Conversation
|
Caution Review failedAn error occurred during the review process. Please try again later. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. |
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
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
There was a problem hiding this comment.
Pull request overview
Implements ENG-277’s production admin “view engine” surface (table + read-only kanban) and migrates admin routes and Convex test helpers to align with the new CRM-backed view contracts.
Changes:
- Added shared admin view-engine context resolution + shared
AdminEntityViewPagethat renders table/kanban from CRM view state and persists layout via saved views / viewDefs. - Migrated admin entity routes (dedicated +
/admin/$entitytype) from scaffolded/fake tables to the shared view-engine surface. - Moved Convex test helper modules out of
convex/**/__tests__helper paths intosrc/test/convex/**to reduce Convex codegen/module-analysis surface area.
Reviewed changes
Copilot reviewed 83 out of 84 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/test/convex/registerAuditLogComponent.ts | New test helper wrapper for registering the audit log component outside convex/test. |
| src/test/convex/payments/cashLedger/testUtils.ts | Centralized cash-ledger Convex test harness/utils in src/test for reuse by many convex/** tests. |
| src/test/convex/payments/cashLedger/e2eHelpers.ts | Updated cash-ledger e2e helper imports to match moved test utilities. |
| src/test/convex/listings/create.test.ts | Updated audit log component registration import path. |
| src/test/convex/crm/helpers.ts | Updated CRM Convex test harness helper imports/paths after relocating helpers. |
| src/test/admin/admin-view-context.test.ts | Added unit tests for admin view-context resolution logic. |
| src/test/admin/admin-shell.test.ts | Refactored test fixture helpers (removed duplicates / formatting changes). |
| src/routes/admin/properties/route.tsx | Migrated properties list route to AdminEntityViewPage. |
| src/routes/admin/obligations/route.tsx | Migrated obligations list route to AdminEntityViewPage (removed fake data). |
| src/routes/admin/mortgages/route.tsx | Migrated mortgages list route to AdminEntityViewPage. |
| src/routes/admin/listings/route.tsx | Migrated listings list route to AdminEntityViewPage. |
| src/routes/admin/deals/route.tsx | Migrated deals route to AdminEntityViewPage (replacing prior dedicated kanban board). |
| src/routes/admin/borrowers/route.tsx | Migrated borrowers list route to AdminEntityViewPage (removed fake data). |
| src/routes/admin/$entitytype.tsx | Migrated dynamic entity route to AdminEntityViewPage and removed legacy react-query loader. |
| src/lib/admin-view-context.ts | New canonical resolver for entityType → objectDef/views/savedViews + active view selection. |
| src/lib/admin-entity-queries.ts | Narrowed legacy listEntityRows query helper typing (now explicitly “legacy” scoped). |
| src/lib/admin-entities.ts | Expanded the canonical admin entity type set + labels. |
| src/components/demo/crm/RecordTableSurface.tsx | Tightened demo kanban field selection to single-select only (aligning with new kanban contract). |
| src/components/admin/shell/admin-view-types.ts | Added shared admin view-engine result/column/group types for table + kanban surfaces. |
| src/components/admin/shell/admin-view-rendering.tsx | Added shared field rendering + kanban option derivation helpers for admin view engine UI. |
| src/components/admin/shell/AdminEntityViewToolbar.tsx | Added reusable toolbar supporting table/kanban toggles + board-field selector. |
| src/components/admin/shell/AdminEntityViewToolbar.stories.tsx | Added Storybook coverage for the new toolbar component. |
| src/components/admin/shell/AdminEntityViewPage.tsx | Added shared orchestration page: loads context + schema, queries records, persists layout selection, renders table/kanban. |
| src/components/admin/shell/AdminEntityTableView.tsx | Added admin table renderer for view-engine record results. |
| src/components/admin/shell/AdminEntityKanbanView.tsx | Added read-only admin kanban renderer for grouped view-engine results. |
| specs/ENG-277/tasks.md | Added ENG-277 task tracking document. |
| specs/ENG-277/summary.md | Added ENG-277 implementation summary + scope/constraints. |
| specs/ENG-277/execution-checklist.md | Added execution checklist + validation state for ENG-277. |
| specs/ENG-277/chunks/manifest.md | Added chunk manifest for ENG-277 work breakdown. |
| specs/ENG-277/chunks/chunk-03-route-rollout/tasks.md | Added per-chunk task list (route rollout). |
| specs/ENG-277/chunks/chunk-03-route-rollout/status.md | Added per-chunk status (route rollout). |
| specs/ENG-277/chunks/chunk-03-route-rollout/context.md | Added per-chunk context (route rollout). |
| specs/ENG-277/chunks/chunk-02-kanban-surface/tasks.md | Added per-chunk task list (kanban surface). |
| specs/ENG-277/chunks/chunk-02-kanban-surface/status.md | Added per-chunk status (kanban surface). |
| specs/ENG-277/chunks/chunk-02-kanban-surface/context.md | Added per-chunk context (kanban surface). |
| specs/ENG-277/chunks/chunk-01-view-context/tasks.md | Added per-chunk task list (view context). |
| specs/ENG-277/chunks/chunk-01-view-context/status.md | Added per-chunk status (view context). |
| specs/ENG-277/chunks/chunk-01-view-context/context.md | Added per-chunk context (view context). |
| e2e/demo-listings.spec.ts | Strengthened demo listing fixture assertion (fails fast if fixture missing). |
| convex/test/registerAuditLogComponent.ts | Deleted old Convex-side test helper (replaced by src/test/convex/registerAuditLogComponent.ts). |
| convex/payments/cashLedger/tests/writeOff.test.ts | Updated to import moved cash-ledger test utils from src/test/convex. |
| convex/payments/cashLedger/tests/waiver.test.ts | Updated to import moved cash-ledger test utils from src/test/convex. |
| convex/payments/cashLedger/tests/transferReconciliation.test.ts | Updated to import moved cash-ledger test utils from src/test/convex. |
| convex/payments/cashLedger/tests/suspenseResolution.test.ts | Updated to import moved cash-ledger test utils from src/test/convex. |
| convex/payments/cashLedger/tests/servicingFeeRecognition.test.ts | Updated to import moved cash-ledger test utils from src/test/convex. |
| convex/payments/cashLedger/tests/sequenceCounter.test.ts | Updated audit log registration import to use src/test/convex helper. |
| convex/payments/cashLedger/tests/reversalReconciliation.test.ts | Updated to import moved cash-ledger test utils from src/test/convex. |
| convex/payments/cashLedger/tests/reversalIntegration.test.ts | Updated to import moved cash-ledger test utils from src/test/convex. |
| convex/payments/cashLedger/tests/reversalCascade.test.ts | Updated to import moved cash-ledger test utils from src/test/convex. |
| convex/payments/cashLedger/tests/replayIntegrity.test.ts | Updated to import moved cash-ledger test utils from src/test/convex. |
| convex/payments/cashLedger/tests/reconciliationSuite.test.ts | Updated to import moved cash-ledger test utils from src/test/convex. |
| convex/payments/cashLedger/tests/postingGroups.test.ts | Updated to import moved cash-ledger test utils from src/test/convex. |
| convex/payments/cashLedger/tests/postingGroupIntegration.test.ts | Updated to import moved cash-ledger test utils from src/test/convex. |
| convex/payments/cashLedger/tests/postEntry.test.ts | Updated to import moved cash-ledger test utils from src/test/convex. |
| convex/payments/cashLedger/tests/paymentReversalIntegration.test.ts | Updated to import moved cash-ledger test utils from src/test/convex. |
| convex/payments/cashLedger/tests/lenderPayoutPosting.test.ts | Updated to import moved cash-ledger test utils from src/test/convex. |
| convex/payments/cashLedger/tests/lenderPayableIntegration.test.ts | Updated to import moved cash-ledger test utils from src/test/convex. |
| convex/payments/cashLedger/tests/lenderPayableBalance.test.ts | Updated to import moved cash-ledger test utils from src/test/convex. |
| convex/payments/cashLedger/tests/integration.test.ts | Updated to import moved cash-ledger test utils from src/test/convex. |
| convex/payments/cashLedger/tests/financialInvariants.test.ts | Updated to import moved cash-ledger test utils from src/test/convex. |
| convex/payments/cashLedger/tests/financialInvariantStress.test.ts | Updated to import moved cash-ledger test utils from src/test/convex. |
| convex/payments/cashLedger/tests/entryTypes.test.ts | Updated to import moved cash-ledger test utils from src/test/convex. |
| convex/payments/cashLedger/tests/e2eLifecycle.test.ts | Updated to import moved cash-ledger e2e helpers + test utils from src/test/convex. |
| convex/payments/cashLedger/tests/disbursementGate.test.ts | Updated to import moved cash-ledger test utils from src/test/convex. |
| convex/payments/cashLedger/tests/dealCashEvents.test.ts | Updated to import moved cash-ledger test utils from src/test/convex. |
| convex/payments/cashLedger/tests/corrections.test.ts | Updated to import moved cash-ledger test utils from src/test/convex. |
| convex/payments/cashLedger/tests/constraintsAndBalanceExemption.test.ts | Updated to import moved cash-ledger test utils from src/test/convex. |
| convex/payments/cashLedger/tests/chaosTests.test.ts | Updated to import moved cash-ledger e2e helpers + test utils from src/test/convex. |
| convex/payments/cashLedger/tests/cashReceiptIntegration.test.ts | Updated to import moved cash-ledger test utils from src/test/convex. |
| convex/payments/cashLedger/tests/cashReceipt.test.ts | Updated to import moved cash-ledger test utils from src/test/convex. |
| convex/payments/cashLedger/tests/cashApplication.test.ts | Updated to import moved cash-ledger test utils from src/test/convex. |
| convex/payments/cashLedger/tests/auditTrail.test.ts | Updated to import moved cash-ledger constants from src/test/convex. |
| convex/ledger/tests/testUtils.test.ts | Updated audit log registration import to use new src/test/convex helper. |
| convex/crm/viewState.ts | Updated kanban disabled-layout message to “single-select” wording. |
| convex/crm/viewQueries.ts | Updated kanban query doc comment (removed multi-select grouping narrative). |
| convex/crm/viewDefs.ts | Updated kanban validation error message to “single-select” wording. |
| convex/crm/metadataCompiler.ts | Enforced kanban eligibility strictly for select (single-select) fields. |
| convex/crm/tests/walkthrough.test.ts | Updated test harness imports to new src/test/convex/crm/helpers. |
| convex/crm/tests/viewEngine.test.ts | Updated harness imports and expected kanban messaging to “single-select”. |
| convex/crm/tests/userSavedViews.test.ts | Updated harness imports to new src/test/convex/crm/helpers. |
| convex/crm/tests/systemAdapters.test.ts | Updated harness imports to new src/test/convex/crm/helpers. |
| convex/crm/tests/records.test.ts | Updated harness imports to new src/test/convex/crm/helpers. |
| convex/crm/tests/metadataCompiler.test.ts | Updated harness imports + adjusted expectations for multi_select capability. |
| convex/_generated/api.d.ts | Codegen output updated to drop references to removed/moved convex/**/__tests__ helper modules. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/components/admin/shell/admin-view-rendering.tsx`:
- Around line 169-175: The "boolean" case currently treats any non-true value as
False and can misrepresent bad data; update the "boolean" switch branch to first
check typeof value === "boolean" and only render the Badge/CheckCheck and
"True"/"False" when that strict type check passes, otherwise render a neutral
placeholder (e.g., an empty span or "—") to indicate invalid/non-boolean data;
target the "boolean" case in admin-view-rendering.tsx and the Badge/CheckCheck
rendering logic to add the typeof guard.
In `@src/components/admin/shell/AdminEntityTableView.tsx`:
- Around line 65-71: The TableRow currently only supports mouse clicks for
selection; when onSelectRecord is provided make the row focusable and
keyboard-activatable by adding tabIndex={0}, a semantic role (e.g.,
role="button"), and an onKeyDown handler that calls onSelectRecord(record._id)
on Enter or Space key presses; update the TableRow JSX where onSelectRecord is
used (the TableRow element that references record._id and onClick) to include
these attributes and ensure the cursor/hover styling remains conditional on
onSelectRecord.
In `@src/components/admin/shell/AdminEntityViewPage.tsx`:
- Around line 371-381: handleNextTablePage currently reads tablePageIndex from
render scope causing stale-state races on rapid clicks; change both updates to
use functional updaters so they use the same previous state. Specifically,
inside handleNextTablePage keep the early return on !tableResult?.cursor, then
call setTablePageIndex(prevIndex => { const nextIndex = prevIndex + 1;
setTableCursorHistory(prevHistory => prevHistory[nextIndex] ===
tableResult.cursor ? prevHistory : [...prevHistory, tableResult.cursor]); return
nextIndex; }); so setTablePageIndex and setTableCursorHistory both derive from
the same prevIndex/prevHistory and avoid index drift (references:
handleNextTablePage, tableResult.cursor, setTableCursorHistory, tablePageIndex,
setTablePageIndex).
In `@src/lib/admin-view-context.ts`:
- Around line 94-98: The current viewMode computation can mismatch because it
checks activeSavedView independently from activeSourceView; change it to derive
viewMode from the resolved source view (e.g., compute a single resolvedSource =
activeSourceView ?? activeSavedView or similar) and then set viewMode =
resolvedSource?.viewType === "kanban" ? "kanban" : "table" so the mode always
follows the actual source view (referencing activeSourceView, activeSavedView,
and viewMode to locate the logic).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 6204693d-30f5-42f4-bc3e-9101de26c47d
⛔ Files ignored due to path filters (1)
convex/_generated/api.d.tsis excluded by!**/_generated/**
📒 Files selected for processing (83)
convex/crm/__tests__/metadataCompiler.test.tsconvex/crm/__tests__/records.test.tsconvex/crm/__tests__/systemAdapters.test.tsconvex/crm/__tests__/userSavedViews.test.tsconvex/crm/__tests__/viewEngine.test.tsconvex/crm/__tests__/walkthrough.test.tsconvex/crm/metadataCompiler.tsconvex/crm/viewDefs.tsconvex/crm/viewQueries.tsconvex/crm/viewState.tsconvex/ledger/__tests__/testUtils.test.tsconvex/payments/cashLedger/__tests__/auditTrail.test.tsconvex/payments/cashLedger/__tests__/cashApplication.test.tsconvex/payments/cashLedger/__tests__/cashReceipt.test.tsconvex/payments/cashLedger/__tests__/cashReceiptIntegration.test.tsconvex/payments/cashLedger/__tests__/chaosTests.test.tsconvex/payments/cashLedger/__tests__/constraintsAndBalanceExemption.test.tsconvex/payments/cashLedger/__tests__/corrections.test.tsconvex/payments/cashLedger/__tests__/dealCashEvents.test.tsconvex/payments/cashLedger/__tests__/disbursementGate.test.tsconvex/payments/cashLedger/__tests__/e2eLifecycle.test.tsconvex/payments/cashLedger/__tests__/entryTypes.test.tsconvex/payments/cashLedger/__tests__/financialInvariantStress.test.tsconvex/payments/cashLedger/__tests__/financialInvariants.test.tsconvex/payments/cashLedger/__tests__/integration.test.tsconvex/payments/cashLedger/__tests__/lenderPayableBalance.test.tsconvex/payments/cashLedger/__tests__/lenderPayableIntegration.test.tsconvex/payments/cashLedger/__tests__/lenderPayoutPosting.test.tsconvex/payments/cashLedger/__tests__/paymentReversalIntegration.test.tsconvex/payments/cashLedger/__tests__/postEntry.test.tsconvex/payments/cashLedger/__tests__/postingGroupIntegration.test.tsconvex/payments/cashLedger/__tests__/postingGroups.test.tsconvex/payments/cashLedger/__tests__/reconciliationSuite.test.tsconvex/payments/cashLedger/__tests__/replayIntegrity.test.tsconvex/payments/cashLedger/__tests__/reversalCascade.test.tsconvex/payments/cashLedger/__tests__/reversalIntegration.test.tsconvex/payments/cashLedger/__tests__/reversalReconciliation.test.tsconvex/payments/cashLedger/__tests__/sequenceCounter.test.tsconvex/payments/cashLedger/__tests__/servicingFeeRecognition.test.tsconvex/payments/cashLedger/__tests__/suspenseResolution.test.tsconvex/payments/cashLedger/__tests__/transferReconciliation.test.tsconvex/payments/cashLedger/__tests__/waiver.test.tsconvex/payments/cashLedger/__tests__/writeOff.test.tsconvex/test/registerAuditLogComponent.tse2e/demo-listings.spec.tsspecs/ENG-277/chunks/chunk-01-view-context/context.mdspecs/ENG-277/chunks/chunk-01-view-context/status.mdspecs/ENG-277/chunks/chunk-01-view-context/tasks.mdspecs/ENG-277/chunks/chunk-02-kanban-surface/context.mdspecs/ENG-277/chunks/chunk-02-kanban-surface/status.mdspecs/ENG-277/chunks/chunk-02-kanban-surface/tasks.mdspecs/ENG-277/chunks/chunk-03-route-rollout/context.mdspecs/ENG-277/chunks/chunk-03-route-rollout/status.mdspecs/ENG-277/chunks/chunk-03-route-rollout/tasks.mdspecs/ENG-277/chunks/manifest.mdspecs/ENG-277/execution-checklist.mdspecs/ENG-277/summary.mdspecs/ENG-277/tasks.mdsrc/components/admin/shell/AdminEntityKanbanView.tsxsrc/components/admin/shell/AdminEntityTableView.tsxsrc/components/admin/shell/AdminEntityViewPage.tsxsrc/components/admin/shell/AdminEntityViewToolbar.stories.tsxsrc/components/admin/shell/AdminEntityViewToolbar.tsxsrc/components/admin/shell/admin-view-rendering.tsxsrc/components/admin/shell/admin-view-types.tssrc/components/demo/crm/RecordTableSurface.tsxsrc/lib/admin-entities.tssrc/lib/admin-entity-queries.tssrc/lib/admin-view-context.tssrc/routes/admin/$entitytype.tsxsrc/routes/admin/borrowers/route.tsxsrc/routes/admin/deals/route.tsxsrc/routes/admin/listings/route.tsxsrc/routes/admin/mortgages/route.tsxsrc/routes/admin/obligations/route.tsxsrc/routes/admin/properties/route.tsxsrc/test/admin/admin-shell.test.tssrc/test/admin/admin-view-context.test.tssrc/test/convex/crm/helpers.tssrc/test/convex/listings/create.test.tssrc/test/convex/payments/cashLedger/e2eHelpers.tssrc/test/convex/payments/cashLedger/testUtils.tssrc/test/convex/registerAuditLogComponent.ts
💤 Files with no reviewable changes (1)
- convex/test/registerAuditLogComponent.ts
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
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
3a5ca5e to
7667859
Compare
Merge activity
|
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added read-only kanban board layout for admin entity views with single-select field grouping. * Introduced shared admin view interface enabling table and kanban mode switching with persistent layout selection. * Added toolbar controls for viewing mode and board field selection. * **Bug Fixes** * Restricted kanban layout eligibility to single-select fields only. * **Documentation** * Added project specifications and implementation tracking for kanban view engine integration. <!-- end of auto-generated comment: release notes by coderabbit.ai -->

Summary by CodeRabbit
New Features
Bug Fixes
Documentation