Skip to content

Add Storybook stories and e2e tests for mortgage ledger#4

Merged
Connorbelez merged 2 commits intomainfrom
Connorbelez/spec-driven-dev
Mar 13, 2026
Merged

Add Storybook stories and e2e tests for mortgage ledger#4
Connorbelez merged 2 commits intomainfrom
Connorbelez/spec-driven-dev

Conversation

@Connorbelez
Copy link
Copy Markdown
Owner

Summary

Completed comprehensive testing infrastructure for the mortgage ownership ledger feature:

  • Storybook stories (22 stories across 5 components): Entry type badges, mortgage cards, ledger controls, journal tables, and interactive action forms. Stories cover happy paths and edge cases (broken invariants, empty states, loading states).
  • E2E tests (22 tests across 8 suites): Full lifecycle testing from seed → transfer → issue → redeem → cleanup, plus isolated tests for layout, controls, mortgage cards, journal log, and error handling.
  • Component refactoring: Extracted monolithic demo page into 5 reusable presentational components, enabling better isolation and testability.

All quality checks pass: bun check, bun typecheck, bunx convex codegen.

Testing Strategy

Stories enable visual regression testing without backend; e2e tests verify full user workflows with real Convex mutations. Test structure follows existing audit-traceability patterns with 15-second timeouts for Convex data loads.

Changes

  • Added 33 files (5,731 insertions)
  • Core ledger infrastructure: mutations, queries, validation, cursors, tests
  • Spec documents: PRD, design, tasks, gap analysis
  • Frontend components: 5 presentational + 5 story files
  • E2E test suite with serial + parallel test groups

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings March 12, 2026 15:41
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 12, 2026

Warning

Rate limit exceeded

@Connorbelez has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 10 minutes and 33 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: fdd26976-c071-4609-8cb3-aeaf82483eb6

📥 Commits

Reviewing files that changed from the base of the PR and between c8fe340 and e5cd312.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (32)
  • biome.json
  • convex/demo/ledger.ts
  • convex/ledger/__tests__/ledger.test.ts
  • convex/ledger/constants.ts
  • convex/ledger/cursors.ts
  • convex/ledger/internal.ts
  • convex/ledger/mutations.ts
  • convex/ledger/queries.ts
  • convex/ledger/validation.ts
  • convex/ledger/validators.ts
  • convex/schema.ts
  • convex/tsconfig.json
  • e2e/convex-ledger.spec.ts
  • package.json
  • specs/mortgage-ownership-ledger/PRD.md
  • specs/mortgage-ownership-ledger/design.md
  • specs/mortgage-ownership-ledger/gap-analysis.md
  • specs/mortgage-ownership-ledger/tasks.md
  • src/components/document-engine/signatory-colors.ts
  • src/components/header.tsx
  • src/components/ledger/entry-type-badge.stories.tsx
  • src/components/ledger/entry-type-badge.tsx
  • src/components/ledger/journal-log-table.stories.tsx
  • src/components/ledger/journal-log-table.tsx
  • src/components/ledger/ledger-actions.stories.tsx
  • src/components/ledger/ledger-actions.tsx
  • src/components/ledger/ledger-controls.stories.tsx
  • src/components/ledger/ledger-controls.tsx
  • src/components/ledger/mortgage-card.stories.tsx
  • src/components/ledger/mortgage-card.tsx
  • src/routeTree.gen.ts
  • src/routes/demo/convex-ledger.tsx
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch Connorbelez/spec-driven-dev
📝 Coding Plan
  • Generate coding plan for human review comments

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.

Copy link
Copy Markdown

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @Connorbelez, your pull request is larger than the review limit of 150000 diff characters

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a mortgage ownership “double-entry” ledger (Convex tables + mutations/queries + validation) along with a demo route, Storybook coverage for the new presentational components, and Playwright e2e coverage for the demo workflow.

Changes:

  • Introduces Convex ledger backend: schema, validators, Tier 1/2 mutations, read APIs, invariant validation, and consumer cursors, plus convex-test integration tests.
  • Adds /demo/convex-ledger route and decomposes the demo UI into reusable components (with Storybook stories).
  • Adds Playwright e2e suites covering seeding, transfers, issuance, redemption, journal rendering, and cleanup.

Reviewed changes

Copilot reviewed 31 out of 33 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
src/routes/demo/convex-ledger.tsx New demo page wiring Convex queries/mutations to the ledger UI components
src/routeTree.gen.ts Registers the new /demo/convex-ledger route
src/components/ledger/mortgage-card.tsx Presentational card for per-mortgage balances/positions
src/components/ledger/mortgage-card.stories.tsx Storybook coverage for MortgageCard states
src/components/ledger/ledger-controls.tsx Seed/cleanup controls card for the demo
src/components/ledger/ledger-controls.stories.tsx Storybook coverage for LedgerControls states
src/components/ledger/ledger-actions.tsx Interactive Transfer/Issue/Redeem form UI
src/components/ledger/ledger-actions.stories.tsx Storybook coverage for LedgerActions states
src/components/ledger/journal-log-table.tsx Journal table rendering for ledger entries
src/components/ledger/journal-log-table.stories.tsx Storybook coverage for JournalLogTable states
src/components/ledger/entry-type-badge.tsx Badge component for displaying entry types
src/components/ledger/entry-type-badge.stories.tsx Storybook coverage for EntryTypeBadge variants
specs/mortgage-ownership-ledger/tasks.md Task checklist for ledger implementation/testing
specs/mortgage-ownership-ledger/gap-analysis.md Coverage matrix + divergences vs spec
specs/mortgage-ownership-ledger/design.md Design spec snapshot (schema, API, invariants, conventions)
specs/mortgage-ownership-ledger/PRD.md PRD snapshot for the ledger feature
scripts/code-review.sh Tweaks coderabbit invocation options
package.json Adds Storybook testing utilities + convex-test dev dependency
e2e/convex-ledger.spec.ts Playwright e2e suite for the ledger demo page
convex/tsconfig.json Excludes Convex __tests__ from Convex TS compilation/codegen inputs
convex/schema.ts Adds ledger_accounts, ledger_journal_entries, ledger_cursors tables + indexes
convex/ledger/validators.ts Shared Convex validators for ledger entry types and mutation args
convex/ledger/validation.ts Supply invariant validation query
convex/ledger/queries.ts Ledger query APIs (balances, histories, point-in-time reconstruction)
convex/ledger/mutations.ts Ledger Tier 1/2 mutations + posting validation pipeline
convex/ledger/internal.ts Internal helpers (WORLD/TREASURY/POSITION accessors, sequence numbers, balances)
convex/ledger/cursors.ts Cursor query/mutations for downstream consumers
convex/ledger/constants.ts Ledger constants (units per mortgage, min position)
convex/ledger/tests/ledger.test.ts convex-test + vitest integration tests for ledger behavior
convex/demo/ledger.ts Demo seed/cleanup + demo-facing queries for the UI
convex/_generated/api.d.ts Codegen updates to include demo + ledger modules
bun.lock Lockfile updates for new dependencies
biome.json Excludes Convex ledger tests from Biome; updates lint/assist config

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/routes/demo/convex-ledger.tsx
Comment thread package.json Outdated
Comment thread convex/ledger/queries.ts Outdated
Comment thread convex/ledger/mutations.ts
Comment thread src/components/ledger/ledger-actions.tsx
Comment thread convex/demo/ledger.ts Outdated
Comment thread convex/ledger/queries.ts Outdated
Comment thread src/components/ledger/entry-type-badge.tsx Outdated
Comment thread convex/demo/ledger.ts
Comment thread convex/ledger/mutations.ts
@Connorbelez Connorbelez changed the base branch from 03-11-documenso to graphite-base/4 March 12, 2026 15:49
@Connorbelez Connorbelez changed the base branch from graphite-base/4 to 03-11-fluent March 12, 2026 15:49
This was referenced Mar 12, 2026
Merged
Copy link
Copy Markdown
Owner Author

Connorbelez commented Mar 12, 2026

This stack of pull requests is managed by Graphite. Learn more about stacking.

@Connorbelez Connorbelez changed the base branch from 03-11-fluent to graphite-base/4 March 12, 2026 16:41
@Connorbelez Connorbelez force-pushed the Connorbelez/spec-driven-dev branch from e40f36b to e5cd312 Compare March 12, 2026 17:00
@Connorbelez Connorbelez changed the base branch from graphite-base/4 to main March 12, 2026 17:00
@Connorbelez Connorbelez merged commit 02314eb into main Mar 13, 2026
1 check passed
@Connorbelez Connorbelez mentioned this pull request Mar 13, 2026
Merged
Connorbelez added a commit that referenced this pull request Mar 28, 2026
- Wrap handlePipelineLegConfirmed in try/catch to protect cash postings (#1, #11)
- Make initiateTransferInternal retry-safe with early return (#2, #5, #10)
- Fix misleading comment in startDealClosingPipeline (#4)
- Add validatePipelineFields guard to public createTransferRequest (#7, #12)
- Document supported provider codes for deal-closing (#8)
- Filter pipeline legs by specific pipelineId in getPipelineStatus (#6)
- Return null for unknown pipeline IDs in getTransfersByPipeline (#15)
- Validate leg2Amount early in createDealClosingPipeline (#13)
- computePipelineStatus prefers active legs over terminal after retry (#14)
- Updated tests for retry scenarios (37 passing)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Connorbelez added a commit that referenced this pull request Apr 20, 2026
## Summary

Completed comprehensive testing infrastructure for the mortgage ownership ledger feature:

- **Storybook stories (22 stories across 5 components)**: Entry type badges, mortgage cards, ledger controls, journal tables, and interactive action forms. Stories cover happy paths and edge cases (broken invariants, empty states, loading states).
- **E2E tests (22 tests across 8 suites)**: Full lifecycle testing from seed → transfer → issue → redeem → cleanup, plus isolated tests for layout, controls, mortgage cards, journal log, and error handling.
- **Component refactoring**: Extracted monolithic demo page into 5 reusable presentational components, enabling better isolation and testability.

All quality checks pass: `bun check`, `bun typecheck`, `bunx convex codegen`.

## Testing Strategy

Stories enable visual regression testing without backend; e2e tests verify full user workflows with real Convex mutations. Test structure follows existing audit-traceability patterns with 15-second timeouts for Convex data loads.

## Changes

- Added 33 files (5,731 insertions)
- Core ledger infrastructure: mutations, queries, validation, cursors, tests
- Spec documents: PRD, design, tasks, gap analysis
- Frontend components: 5 presentational + 5 story files
- E2E test suite with serial + parallel test groups

🤖 Generated with [Claude Code](https://claude.com/claude-code)
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