refactor(server): split routes into books vs accounting concerns#120
Conversation
Introduce a structural books/accounting boundary with no behavior change. Books writes facts (ingest, categorize, journal); accounting derives meaning (chart of accounts, reporting, tax, allocations). - move transactions/import/webhooks -> server/books/ - move accounts/reports/tax/allocations -> server/accounting/ - add concern-boundary READMEs for each tree - classification.ts stays in routes/ (straddles both); note added - fix import paths in app.ts and __tests__ Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
@coderabbitai review Please evaluate:
|
|
Caution Review failedPull request was closed or merged during review No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (19)
📝 WalkthroughWalkthroughRoutes are reorganized from a single ChangesRoute Module Organization
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add 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. Comment |
Code Review — PR #120:
|
| Rule | Status |
|---|---|
All DB access through SystemStorage |
Not touched — N/A |
| No raw Drizzle in routes | Not touched — N/A |
| No mocks/fake data in commits | Move-only — N/A |
npm run check passes |
✅ confirmed in PR description |
| No DoorLoop reintroduction | N/A |
Security / Performance
No concerns. This is purely a build-time module path change with no runtime surface area.
Verdict
Approve with minor suggestions. The refactor is correct, disciplined, and well-scoped. The two suggestions above (barrel exports, tracking issue for classification.ts) are improvements worth making but not blockers. The CI note is a sanity check worth ticking before merge.
|
Actionable comments posted: 0 |
* refactor(server): split routes into books vs accounting concerns Introduce a structural books/accounting boundary with no behavior change. Books writes facts (ingest, categorize, journal); accounting derives meaning (chart of accounts, reporting, tax, allocations). - move transactions/import/webhooks -> server/books/ - move accounts/reports/tax/allocations -> server/accounting/ - add concern-boundary READMEs for each tree - classification.ts stays in routes/ (straddles both); note added - fix import paths in app.ts and __tests__ Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(deps): resolve @chittyos/schema lockfile drift Revert PR #103's refactor that introduced an unresolvable file: dependency. Root cause: PR #103 swapped the self-contained local scope-projector for a thin adapter over `@chittyos/schema`, declared as `file:../../CHITTYFOUNDATION/chittyschema`. That sibling-repo path only exists on the dev VM. In CI it cannot resolve, and worse, pnpm 10 refuses to record file: directory links in the lockfile importer block at all — so `pnpm install --frozen-lockfile` always sees a specifier mismatch ("1 dependencies were added: @chittyos/schema@file:..."), failing the Dependency Audit (High+) gate on every PR (#119, #120). No clean dependency form resolves in CI: the package is unpublished (npm 404), its dist/ is gitignored in the sibling repo (so a github: dep ships no build), and it has no prepare script. Fix: restore the pre-#103 self-contained implementation of server/lib/central-workflows.ts (175 lines, uses @neondatabase/serverless which is already a dependency) and drop the @chittyos/schema dependency. Public API (scopeLog, SCOPE_TYPES, ScopeStatus, etc.) is unchanged, so callers in workflows.ts and reports.ts are unaffected. Regenerated lockfile. Verified in a clean checkout (sibling repo absent, pnpm 10): pnpm install --frozen-lockfile -> exit 0 pnpm audit --prod --audit-level high ... -> exit 0 npm run check (tsc) -> exit 0 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
Folds the retired ChittyBooks concern into ChittyFinance as a structural books vs accounting split (no behavior change). Boundary: Books writes facts, Accounting derives meaning.
server/books/←transactions.ts,import.ts,webhooks.ts(ingest / categorize / journal)server/accounting/←accounts.ts,reports.ts,tax.ts,allocations.ts(COA / reporting / tax / allocations)classification.tsleft inroutes/(straddles both) with a boundary commentMove-only: all 7 modules are 100% git renames, imports rewired in
app.ts+ 8 tests.npm run checkpasses.Context
Standalone ChittyBooks (Flask, non-persistent demo) is retired; its capability is a strict subset of ChittyFinance. This lands the concern boundary as code. Agent registration into the orchestrator follows once the fractal tree is built+deployed — not registered as phantoms.
Test plan
npm run check(tsc) cleanSummary by CodeRabbit
Chores
Documentation