Skip to content

Refactor bridge.ts into domain-specific route modules#11

Merged
chitcommit merged 7 commits intofeat/ui-design-enhancementfrom
main
Mar 4, 2026
Merged

Refactor bridge.ts into domain-specific route modules#11
chitcommit merged 7 commits intofeat/ui-design-enhancementfrom
main

Conversation

@chitcommit
Copy link
Contributor

This pull request introduces a comprehensive token management API for both legacy and ChittyAuth tokens, along with corresponding frontend API types and methods. The main goal is to provide secure, admin-scoped endpoints for viewing, rotating, provisioning, validating, and revoking tokens, while ensuring backward compatibility with legacy authentication. The changes also update the authentication middleware to use ChittyAuth for token validation when available.

Backend: Token Management API

  • Added a new src/routes/token-management.ts route module, providing endpoints for token overview, legacy token rotation, ChittyAuth token provisioning, validation, and revocation, all gated by admin scope.
  • Enhanced the authentication middleware in src/middleware/auth.ts to validate tokens via ChittyAuth when configured, falling back to legacy token checks for compatibility.

Frontend: API Types and Methods

  • Defined new TypeScript interfaces in ui/src/lib/api.ts for token overview and token action responses, supporting the new backend endpoints.
  • Added frontend API methods to ui/src/lib/api.ts for interacting with the new token management endpoints: overview, rotate, provision, validate, and revoke.

chitcommit and others added 4 commits February 28, 2026 05:26
Break the 880-line monolith into src/routes/bridge/ with 9 domain
files (ledger, credentials, finance, plaid, mercury, books, assets,
scrape, status) and a barrel index. No behavior changes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
refactor: split bridge.ts into domain-specific route modules
feat: enhance UI with Dark Precision design system
@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@coderabbitai
Copy link

coderabbitai bot commented Mar 4, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5f449f90-2473-4186-903f-674ffebac026

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch main

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

* fix: complete 4-lane remediation — tests, governance, security, CORS

Lane 1 (Testing): Add vitest infrastructure with MCP test cases
  covering JSON-RPC protocol, tool success/error paths, and defensive
  parsing.

Lane 2 (Governance): Add GitHub Actions CI/CD (ci.yml, deploy-worker,
  governance gates), org governance scripts (audit, enforce, remediate),
  ISSUE_TEMPLATE, release.yml, and governance-baseline templates.

Lane 3 (Security): Add .gitleaks.toml for secret scanning, security
  docs (access broker runbook, secret rotation checklist, scan report),
  .gitignore hardening.

Lane 4 (Code + UI): CORS OPTIONS + credentials support, MCP server
  expanded from 6 to 28 tools across 8 domains, integrations and
  validators updates, UI disputes widget and API client fixes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: address PR review feedback across 10 files

- package.json: remove trailing space on kv:seed script line
- ci.yml: add npm test step, fix secret allowlist to catch bracket
  notation (secrets['NAME']) in addition to dot notation
- reusable-governance-gates.yml: same bracket notation fix
- chittycompliance-dispatch.sh: replace string interpolation with
  jq -nc for all JSON payloads to prevent injection
- org-governance-adversarial-review.sh: add defensive // [] for
  missingFiles and missingTriggers jq expressions
- connect.ts: proper AuthVariables typing instead of @ts-expect-error
- integrations.ts: normalize KV cache key with encodeURIComponent
- wrangler.toml: default PLAID_ENV to sandbox, production override
  in [env.production.vars]
- org-governance-pr-integration-loop.sh: add author verification
  against governance automation allowlist before auto-approve
- .gitignore: exclude timestamped governance report artifacts

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(backend): add missing beacon, context, and ledger modules

These three files were present locally but missed during the initial
push, causing TypeScript compilation errors in CI.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(ci): allow vitest to pass with no test files

Add passWithNoTests to vitest config so CI doesn't fail when the tests
directory hasn't been populated yet.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(scripts): use grep -F for literal bot author matching

The [bot] suffix in author names was being interpreted as a regex
character class. Use -F flag for fixed-string matching.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* ci: add CodeQL code scanning workflow

Required by org-level ruleset for branch protection on main.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link

github-actions bot commented Mar 4, 2026

  1. @coderabbitai review
  2. @copilot review
  3. @codex review
  4. @claude review
    Adversarial review request: evaluate security, policy bypass paths, regression risk, and merge-gating bypass attempts.

* Initial plan

* feat: add .github/copilot-instructions.md with repository-specific Copilot guidance

Co-authored-by: chitcommit <208086304+chitcommit@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: chitcommit <208086304+chitcommit@users.noreply.github.com>
@github-actions
Copy link

github-actions bot commented Mar 4, 2026

  1. @coderabbitai review
  2. @copilot review
  3. @codex review
  4. @claude review
    Adversarial review request: evaluate security, policy bypass paths, regression risk, and merge-gating bypass attempts.

* fix: complete 4-lane remediation — tests, governance, security, CORS

Lane 1 (Testing): Add vitest infrastructure with MCP test cases
  covering JSON-RPC protocol, tool success/error paths, and defensive
  parsing.

Lane 2 (Governance): Add GitHub Actions CI/CD (ci.yml, deploy-worker,
  governance gates), org governance scripts (audit, enforce, remediate),
  ISSUE_TEMPLATE, release.yml, and governance-baseline templates.

Lane 3 (Security): Add .gitleaks.toml for secret scanning, security
  docs (access broker runbook, secret rotation checklist, scan report),
  .gitignore hardening.

Lane 4 (Code + UI): CORS OPTIONS + credentials support, MCP server
  expanded from 6 to 28 tools across 8 domains, integrations and
  validators updates, UI disputes widget and API client fixes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: address PR review feedback across 10 files

- package.json: remove trailing space on kv:seed script line
- ci.yml: add npm test step, fix secret allowlist to catch bracket
  notation (secrets['NAME']) in addition to dot notation
- reusable-governance-gates.yml: same bracket notation fix
- chittycompliance-dispatch.sh: replace string interpolation with
  jq -nc for all JSON payloads to prevent injection
- org-governance-adversarial-review.sh: add defensive // [] for
  missingFiles and missingTriggers jq expressions
- connect.ts: proper AuthVariables typing instead of @ts-expect-error
- integrations.ts: normalize KV cache key with encodeURIComponent
- wrangler.toml: default PLAID_ENV to sandbox, production override
  in [env.production.vars]
- org-governance-pr-integration-loop.sh: add author verification
  against governance automation allowlist before auto-approve
- .gitignore: exclude timestamped governance report artifacts

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Initial plan

* fix: address unresolved review comments — error info leakage, type safety, and MCP tests

Co-authored-by: chitcommit <208086304+chitcommit@users.noreply.github.com>

* fix: wire mcpAuthMiddleware in tests, fix empty-body parse error, rename GET test

Co-authored-by: chitcommit <208086304+chitcommit@users.noreply.github.com>

---------

Co-authored-by: @chitcommit <208086304+chitcommit@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
@github-actions
Copy link

github-actions bot commented Mar 4, 2026

  1. @coderabbitai review
  2. @copilot review
  3. @codex review
  4. @claude review
    Adversarial review request: evaluate security, policy bypass paths, regression risk, and merge-gating bypass attempts.

@chitcommit chitcommit merged commit 668d1fc into feat/ui-design-enhancement Mar 4, 2026
20 of 21 checks passed
chitcommit added a commit that referenced this pull request Mar 4, 2026
* refactor: split bridge.ts into domain-specific route modules

Break the 880-line monolith into src/routes/bridge/ with 9 domain
files (ledger, credentials, finance, plaid, mercury, books, assets,
scrape, status) and a barrel index. No behavior changes.



* feat(auth): add in-app token management and chittyauth-first mcp auth (#6)

* fix: complete 4-lane remediation (#10)

* fix: complete 4-lane remediation — tests, governance, security, CORS

Lane 1 (Testing): Add vitest infrastructure with MCP test cases
  covering JSON-RPC protocol, tool success/error paths, and defensive
  parsing.

Lane 2 (Governance): Add GitHub Actions CI/CD (ci.yml, deploy-worker,
  governance gates), org governance scripts (audit, enforce, remediate),
  ISSUE_TEMPLATE, release.yml, and governance-baseline templates.

Lane 3 (Security): Add .gitleaks.toml for secret scanning, security
  docs (access broker runbook, secret rotation checklist, scan report),
  .gitignore hardening.

Lane 4 (Code + UI): CORS OPTIONS + credentials support, MCP server
  expanded from 6 to 28 tools across 8 domains, integrations and
  validators updates, UI disputes widget and API client fixes.



* fix: address PR review feedback across 10 files

- package.json: remove trailing space on kv:seed script line
- ci.yml: add npm test step, fix secret allowlist to catch bracket
  notation (secrets['NAME']) in addition to dot notation
- reusable-governance-gates.yml: same bracket notation fix
- chittycompliance-dispatch.sh: replace string interpolation with
  jq -nc for all JSON payloads to prevent injection
- org-governance-adversarial-review.sh: add defensive // [] for
  missingFiles and missingTriggers jq expressions
- connect.ts: proper AuthVariables typing instead of @ts-expect-error
- integrations.ts: normalize KV cache key with encodeURIComponent
- wrangler.toml: default PLAID_ENV to sandbox, production override
  in [env.production.vars]
- org-governance-pr-integration-loop.sh: add author verification
  against governance automation allowlist before auto-approve
- .gitignore: exclude timestamped governance report artifacts



* fix(backend): add missing beacon, context, and ledger modules

These three files were present locally but missed during the initial
push, causing TypeScript compilation errors in CI.



* fix(ci): allow vitest to pass with no test files

Add passWithNoTests to vitest config so CI doesn't fail when the tests
directory hasn't been populated yet.



* fix(scripts): use grep -F for literal bot author matching

The [bot] suffix in author names was being interpreted as a regex
character class. Use -F flag for fixed-string matching.



* ci: add CodeQL code scanning workflow

Required by org-level ruleset for branch protection on main.



---------



* Set up GitHub Copilot coding agent instructions (#14)

* Initial plan

* feat: add .github/copilot-instructions.md with repository-specific Copilot guidance



---------




* Addressing PR comments (#12)

* fix: complete 4-lane remediation — tests, governance, security, CORS

Lane 1 (Testing): Add vitest infrastructure with MCP test cases
  covering JSON-RPC protocol, tool success/error paths, and defensive
  parsing.

Lane 2 (Governance): Add GitHub Actions CI/CD (ci.yml, deploy-worker,
  governance gates), org governance scripts (audit, enforce, remediate),
  ISSUE_TEMPLATE, release.yml, and governance-baseline templates.

Lane 3 (Security): Add .gitleaks.toml for secret scanning, security
  docs (access broker runbook, secret rotation checklist, scan report),
  .gitignore hardening.

Lane 4 (Code + UI): CORS OPTIONS + credentials support, MCP server
  expanded from 6 to 28 tools across 8 domains, integrations and
  validators updates, UI disputes widget and API client fixes.



* fix: address PR review feedback across 10 files

- package.json: remove trailing space on kv:seed script line
- ci.yml: add npm test step, fix secret allowlist to catch bracket
  notation (secrets['NAME']) in addition to dot notation
- reusable-governance-gates.yml: same bracket notation fix
- chittycompliance-dispatch.sh: replace string interpolation with
  jq -nc for all JSON payloads to prevent injection
- org-governance-adversarial-review.sh: add defensive // [] for
  missingFiles and missingTriggers jq expressions
- connect.ts: proper AuthVariables typing instead of @ts-expect-error
- integrations.ts: normalize KV cache key with encodeURIComponent
- wrangler.toml: default PLAID_ENV to sandbox, production override
  in [env.production.vars]
- org-governance-pr-integration-loop.sh: add author verification
  against governance automation allowlist before auto-approve
- .gitignore: exclude timestamped governance report artifacts



* Initial plan

* fix: address unresolved review comments — error info leakage, type safety, and MCP tests



* fix: wire mcpAuthMiddleware in tests, fix empty-body parse error, rename GET test



---------





---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants