Skip to content

chore(backlog): TODO.md orchestration round 3 — API list-shape convention completion + planned-payment fixes - #136

Draft
EraPartner wants to merge 12 commits into
mainfrom
claude/vision-backlog-orchestration-57km8p
Draft

chore(backlog): TODO.md orchestration round 3 — API list-shape convention completion + planned-payment fixes#136
EraPartner wants to merge 12 commits into
mainfrom
claude/vision-backlog-orchestration-57km8p

Conversation

@EraPartner

Copy link
Copy Markdown
Owner

Summary

Continues working the TODO.md backlog queue (round 3). Landed so far:

  • List-response key drift (⏫) — closed. Every remaining collection endpoint now returns the canonical {items, total(, limit, offset)} data body: market quotes/chart/news, research mappings/provider-keys, ai models, info banks/supported-adapters, planned due-soon/match-suggestions (counts moved from meta into the data body), and the bare-array admin metrics/requests. Frontend api clients unwrap to rows at the boundary; openapi + generated types, MSW handlers, contract tests, and docs/api/ pages aligned. (b60cf41)
  • TODO.md bookkeeping: the finding is ticked and stamped with its fix commit. (bddb115)

Further backlog items (planned-payment sign/amount fixes) land on this branch as they are verified.

Type of change

  • refactor — no behavior change (wire-shape convention; clients updated in lockstep)
  • chore / ci / test — backlog bookkeeping (TODO.md stamps)
  • fix — bug fix (planned-payment findings, as they land)

Checklist

  • Tests pass (backend 3071 passed; frontend 2096 passed, 0 failed) and lint is clean
  • Types check (bun run typecheck clean in both apps)
  • Conventional Commit title (type(scope): subject)
  • No leftover console.log / debug code
  • Affected docs/ pages updated (docs/api/{marketLookup,ai,info,admin,research,plannedTransactions}.md, docs/reference/api-client-methods.md)
  • i18n: no new strings

Architecture & data

  • No architectural change (extends the already-recorded {items,total} wire convention)
  • API change: non-breaking for the app (frontend is the only consumer and is migrated in the same commit); openapi.yaml + generated types updated
  • No schema change

Verification

  • Full backend suite: 3071 passed / 1 skipped (the 10 backup-roundtrip failures were missing sandbox deps; green after bun install in packaging/electron).
  • Full frontend suite: 2096 passed / 35 skipped / 0 failed; MSW contract tests re-pinned to the new shapes.
  • Repo-wide greps for every old key (.quotes/.articles/.points/.mappings/.providers/.models/.banks/.adapters/total_count) confirm no stragglers.

Residual risk & follow-ups

  • GET /api/market/search and GET /api/splits/owed return {items} without total — noted in the backlog, out of this finding's scope.
  • Research data endpoints (/api/research/chart|news|quote) keep domain keys by design under the provenance-meta contract.
  • Phantom MSW-only route GET /api/planned has no backend counterpart — candidate for deletion in a later pass.
  • The updated live-contracts schemas get their first real exercise in CI (LIVE_API_BASE).

🤖 Generated with Claude Code

https://claude.ai/code/session_01Scm4dSE1m9618M1ugk86Cj


Generated by Claude Code

claude added 2 commits July 27, 2026 21:36
…l} everywhere

Closes the LEFT list of the TODO.md ⏫ finding 'List-response key drift':
market quotes/chart/news, research mappings/provider-keys, ai models,
info banks/supported-adapters, planned due-soon/match-suggestions (counts
moved from meta into the data body), and bare-array admin metrics/requests
all now return {items,total(,…)}. Frontend api clients unwrap to rows at
the boundary; openapi + generated types, MSW handlers, contract tests and
docs aligned.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Scm4dSE1m9618M1ugk86Cj
@github-actions

github-actions Bot commented Jul 27, 2026

Copy link
Copy Markdown

Coverage Report for backend

Status Category Percentage Covered / Total
🔵 Lines 82.74% (🎯 80%) 12043 / 14554
🔵 Statements 80.81% (🎯 78%) 13365 / 16538
🔵 Functions 79.33% (🎯 76%) 2203 / 2777
🔵 Branches 70.9% (🎯 68%) 8573 / 12091
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
apps/node-backend/src/repositories/aiChatRepository.js 0% 0% 0% 0% 20-206
apps/node-backend/src/repositories/attachmentRepository.js 4.54% 0% 0% 5% 20-28, 39-136
apps/node-backend/src/repositories/customParserConfigRepository.js 100% 88.23% 100% 100%
apps/node-backend/src/repositories/infoRepositoryAverageVsCurrent.js 97.72% 78.94% 80% 97.36% 106
apps/node-backend/src/repositories/infoRepositoryBanks.js 100% 88.23% 100% 100%
apps/node-backend/src/repositories/infoRepositoryForecast.js 94.44% 86.23% 100% 94.91% 188, 194-196, 249, 430
apps/node-backend/src/repositories/infoRepositoryHelpers.js 91.37% 74.24% 100% 91.74% 255-257, 283, 310, 341, 358-361
apps/node-backend/src/repositories/infoRepositoryMonthly.js 100% 89.36% 100% 100%
apps/node-backend/src/repositories/infoRepositoryNetWorth.js 100% 82% 100% 100%
apps/node-backend/src/repositories/infoRepositoryPlanned.js 89.88% 69.09% 100% 97.18% 31, 34-35, 64, 66, 85, 200, 201, 202
apps/node-backend/src/repositories/infoRepositoryRecipients.js 97.91% 94.91% 100% 100% 100, 298
apps/node-backend/src/repositories/infoRepositoryStatistics.js 95.31% 79.06% 100% 95.08% 168-170
apps/node-backend/src/repositories/instrumentProviderMapRepository.js 11.11% 0% 0% 11.11% 25-103
apps/node-backend/src/repositories/recipientBankAccountRepository.js 9.09% 4.08% 16.66% 9.8% 19-170, 216-227
apps/node-backend/src/repositories/savedChartsRepository.js 0% 0% 0% 0% 27-125
apps/node-backend/src/repositories/settingsRepository.js 95% 100% 85.71% 94.28% 107-108
apps/node-backend/src/repositories/watchlistRepository.js 100% 100% 100% 100%
apps/node-backend/src/routes/admin.js 64.46% 47.82% 68.96% 64.65% 60-61, 71-72, 203-222, 229-263, 269-270, 274-294, 301-303, 316-318, 326-327
apps/node-backend/src/routes/ai.js 75.59% 46.66% 76% 78.26% 119-125, 161-180, 184-196, 204-217, 239, 265-266, 275, 363
apps/node-backend/src/routes/plannedTransactions.js 92.92% 87.31% 85.71% 93.67% 75, 95, 213, 347-353, 366-368, 425, 453, 483-498
apps/node-backend/src/routes/research.js 77.39% 55% 79.31% 76.19% 96, 119-125, 146-149, 171-183, 251, 266-271, 282-283, 289-292
apps/node-backend/src/routes/info/statistics.js 57.5% 0% 62.5% 58.97% 74-98, 106-118
apps/node-backend/src/services/marketLookupService.js 95.23% 87.87% 100% 98.21% 44, 46, 205, 208, 216, 365
apps/node-backend/src/types/rows.js 100% 100% 100% 100%
Generated in workflow #576 for commit d83dba5 by the Vitest Coverage Report Action

@github-actions

github-actions Bot commented Jul 27, 2026

Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 59.31% (🎯 57%) 8444 / 14236
🔵 Statements 57.11% (🎯 54%) 9293 / 16272
🔵 Functions 49.52% (🎯 47%) 2519 / 5086
🔵 Branches 47.23% (🎯 45%) 6341 / 13423
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
apps/frontend/src/components/planned/PlannedPaymentForm.tsx 86.11% 85.52% 57.89% 86.76% 137, 143, 299-350, 379, 415-450
apps/frontend/src/components/planned/RecurringDetectionPanel.tsx 69.79% 56.75% 56% 70.96% 23, 57-63, 76-82, 95-96, 111-113, 134-136, 141-142, 171, 188-197, 203, 238-302, 364, 388-390
apps/frontend/src/components/portfolio/AddToWatchlistDialog.tsx 82.43% 60% 86.66% 89.55% 56, 57, 84, 88, 99, 104, 116-121, 123-125, 139, 185, 255, 310
apps/frontend/src/components/portfolio/PortfolioNewsFeed.tsx 63.63% 55.55% 50% 63.63% 84-135
apps/frontend/src/components/portfolio/PortfolioTicker.tsx 50% 35.82% 56.52% 50% 54, 80-93, 127, 131-152, 160-191, 198, 237-259, 304
apps/frontend/src/components/portfolio/WatchlistChartDialog.tsx 80.88% 80.55% 63.15% 84.12% 60, 64, 75, 80, 89, 107, 174, 242-255
apps/frontend/src/components/research/ResearchMappingDialog.tsx 34.37% 25.31% 16.12% 35.59% 41-46, 61, 69-72, 82, 90-94, 100-105, 109-112, 117-118, 123, 128-138, 159-314
apps/frontend/src/components/settings/ResearchKeysSection.tsx 0% 0% 0% 0% 23-117
apps/frontend/src/components/shared/BankAccountMultiCombobox.tsx 83.33% 75% 50% 100% 12
apps/frontend/src/components/shared/CommandPalette.tsx 0% 0% 0% 0% 53-395
apps/frontend/src/features/imports/useAdapters.ts 85.71% 80% 100% 100% 30
apps/frontend/src/hooks/useMarketQuotesQuery.ts 100% 62.5% 100% 100%
apps/frontend/src/lib/api/admin.ts 100% 100% 100% 100%
apps/frontend/src/lib/api/ai.ts 93.42% 89.18% 90.9% 94.11% 108, 123, 181, 189-190
apps/frontend/src/lib/api/info.ts 100% 100% 100% 100%
apps/frontend/src/lib/api/market.ts 90% 87.5% 80% 88.88% 105-106
apps/frontend/src/lib/api/planned.ts 100% 100% 100% 100%
apps/frontend/src/pages/PlannedPaymentsPage.tsx 63.57% 51.06% 75% 63.86% 46, 52, 61, 66-72, 100-103, 109-110, 148, 151, 173-176, 203, 243-250, 310-318, 339-366, 383-384, 390-391, 423, 481
apps/frontend/src/pages/research/MarketLookupPage.tsx 57% 59.71% 43.58% 59.4% 48-120, 128-129, 135, 140, 164, 211-226, 250, 251-255, 277, 368-379, 440-474
apps/frontend/src/pages/research/MarketOverviewPage.tsx 0% 0% 0% 0% 44-1093
apps/frontend/src/pages/research/ResearchHomePage.tsx 64.91% 42.3% 43.33% 69.38% 58, 72, 77, 83, 88, 116, 168-256
apps/frontend/src/pages/research/WatchlistPage.tsx 76.92% 52.63% 55.55% 78% 53, 64, 68-72, 128, 164-174, 266
Generated in workflow #576 for commit d83dba5 by the Vitest Coverage Report Action

claude added 10 commits July 27, 2026 21:59
…rection

The panel hardcoded 'amount: latestAmount * -1' while the detection service
abs()'s every amount, so a detected recurring income (salary, rent received)
became a negative planned payment that plannedMatchService could never
auto-match. The detection payload already carries direction per pattern
(grouped recipient+sign server-side); the panel now recombines
magnitude + direction. MSW end-to-end tests pin the POST body sign for both
directions.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Scm4dSE1m9618M1ugk86Cj
…egenerates

applyLoanPatchDefaults only re-derived amount when the client omitted it, so
editing loan_principal/rate/term (or converting to a loan via PATCH) with a
defined client amount desynced amount from loan_regular_payment_amount. The
regeneration branch now sets amount = -|regular_payment_amount|
unconditionally, matching POST; a loan PATCH touching no schedule input still
honors the client amount. Three new route tests pin all three cases against
the real amortization math; the now-false comment in PlannedPaymentForm
documenting the stale-amount behavior is updated.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Scm4dSE1m9618M1ugk86Cj
The form was keyed editing?.id ?? 'new', so back-to-back creates never
remounted and all useState initializers survived — name, amount, and most
visibly the direction toggle. A counter bumped on each New open now keys
fresh creates. Integration test pins the reset (direction back to Expense,
name empty on reopen).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Scm4dSE1m9618M1ugk86Cj
…dexes concurrently

The account_id backfill UPDATE now runs in 50k id-range batches inside an
autocommit block (short locks, spread WAL, resumable via the account_id IS
NULL guard), and the two transactions indexes are built AFTER the backfill
with CREATE INDEX CONCURRENTLY, with an invalid-leftover drop-then-recreate
guard for interrupted builds. Semantics of the backfill are unchanged (same
WHERE, same join). env.py already runs transaction_per_migration, so the
change is scoped entirely inside 0050.

Verified on a fresh DB (bun run test:db: migrate to head + 3112 tests pass)
and by the implementing agent on a populated pre-0050 DB (120k rows, sparse
ids: upgrade, idempotent re-run, downgrade, invalid-index recovery).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Scm4dSE1m9618M1ugk86Cj
…lur half needs look sign-off)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Scm4dSE1m9618M1ugk86Cj
…files clean

Annotates the remaining 17 repository files (335 errors → 0) with pg-accurate
JSDoc, adds 8 row typedefs to src/types/rows.js (verified against the Alembic
migrations; NUMERIC/BIGINT stay strings, DATE stays Date, CHECK-constraint
literal unions), and collapses the ratchet list to the directory prefixes
src/types/ + src/repositories/ so new repository files are ratcheted from
birth. Annotation-only: the diff contains no runtime changes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Scm4dSE1m9618M1ugk86Cj
…le two bugs noticed en route

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Scm4dSE1m9618M1ugk86Cj
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