Conversation
There was a problem hiding this comment.
Sorry @Connorbelez, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
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 |
This stack of pull requests is managed by Graphite. Learn more about stacking. |
|
@copilot please review |
|
@Connorbelez I've opened a new pull request, #98, to work on those changes. Once the pull request is ready, I'll request review from you. |
Greptile SummaryThis PR implements ENG-40: the Consumer Cursor Infrastructure for the mortgage ownership ledger. It refactors Key changes:
Issues found:
Confidence Score: 2/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant C as Consumer (e.g. accrual_engine)
participant R as registerCursor
participant G as getNewEntries
participant A as advanceCursor
participant DB as ledger_journal_entries
C->>R: registerCursor(consumerId)
R-->>C: cursorId (idempotent, lastProcessedSequence=0n)
loop Poll cycle
C->>G: getNewEntries(consumerId, batchSize?)
G->>DB: query by_sequence > lastProcessedSequence, take(batchSize)
DB-->>G: entries[]
G-->>C: { entries, cursorPosition, hasMore }
alt entries.length > 0
C->>C: process entries
C->>A: advanceCursor(consumerId, lastProcessedSequence)
A->>DB: validate sequence exists
A-->>C: cursor patched
else no new entries
C->>C: wait / backoff
end
end
Last reviewed commit: 226b476 |
There was a problem hiding this comment.
Pull request overview
Adds the ENG-40 “consumer cursor” infrastructure to the ledger domain so downstream consumers can register a cursor, poll new journal entries in sequence order, and advance their cursor position, with dedicated test coverage and accompanying spec/task docs.
Changes:
- Refactors
convex/ledger/cursors.tsto use shared helpers, addsregisterCursor+getNewEntries, and tightens cursor mutation validation. - Moves cursor contract tests into a new focused
cursors.test.tsand removes the legacy cursor lifecycle assertions fromledger.test.ts. - Adds ENG-40 planning/status/spec documentation (task lists, chunk contexts/statuses, manifest).
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| specs/ENG-40/tasks.md | Master checklist for ENG-40 work across chunks. |
| specs/ENG-40/chunks/manifest.md | Chunk manifest table and status summary. |
| specs/ENG-40/chunks/chunk-01-cursor-api/tasks.md | Chunk 01 task breakdown (cursor API refactor). |
| specs/ENG-40/chunks/chunk-01-cursor-api/status.md | Chunk 01 implementation + quality gate notes. |
| specs/ENG-40/chunks/chunk-01-cursor-api/context.md | Chunk 01 scope/acceptance criteria/context. |
| specs/ENG-40/chunks/chunk-02-cursor-tests/tasks.md | Chunk 02 task breakdown (cursor tests). |
| specs/ENG-40/chunks/chunk-02-cursor-tests/status.md | Chunk 02 implementation + quality gate notes. |
| specs/ENG-40/chunks/chunk-02-cursor-tests/context.md | Chunk 02 test plan/context. |
| convex/ledger/cursors.ts | Implements consumer cursor API (register, poll, advance/reset) with validation + structured errors. |
| convex/ledger/tests/ledger.test.ts | Removes old cursor lifecycle test block (cursor contract moved to dedicated file). |
| convex/ledger/tests/cursors.test.ts | New dedicated cursor contract tests (SPEC 6.7 flow + edge cases). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…alMutation These three convenience mutations are called by GT effects (Deal Closing, discharge pipeline), not by users directly. Converting them from ledgerMutation.public() to internalMutation enforces this at the Convex level. Also converts mintMortgage/burnMortgage to adminMutation per spec. Key changes: - Extract handler functions (issueSharesHandler, transferSharesHandler, redeemSharesHandler) for reuse across auth boundaries - Add belt-and-suspenders same-mortgage check to transferShares - Update getPositionAccount to throw ConvexError (structured errors) - Add demo wrappers in convex/demo/ledger.ts for the demo UI - Update all test files from api.* to internal.* namespace - Add 21 dedicated unit tests covering happy paths, min fraction violations, sell-all exceptions, insufficient balance, idempotency All 132 ledger tests pass. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…alMutation These three convenience mutations are called by GT effects (Deal Closing, discharge pipeline), not by users directly. Converting them from ledgerMutation.public() to internalMutation enforces this at the Convex level. Also converts mintMortgage/burnMortgage to adminMutation per spec. Key changes: - Extract handler functions (issueSharesHandler, transferSharesHandler, redeemSharesHandler) for reuse across auth boundaries - Add belt-and-suspenders same-mortgage check to transferShares - Update getPositionAccount to throw ConvexError (structured errors) - Add demo wrappers in convex/demo/ledger.ts for the demo UI - Update all test files from api.* to internal.* namespace - Add 21 dedicated unit tests covering happy paths, min fraction violations, sell-all exceptions, insufficient balance, idempotency All 132 ledger tests pass. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
9639a41 to
894e392
Compare

No description provided.