fix: resolve 16 open non-RAG issues across roster, on-call, reindex, UI virtualization, browser matrix, and monoliths
User description
Summary
- Pod 1 — Roster & On-Call Backend Safety (
#7JJWKH,#MS6VXW,#HEWR5X):#7JJWKH: Replaced per-service N+1 count queries inlistOwnerTeams(src/lib/roster/owner/teams.ts) with chunked 40-service.in("service_id", ...)queries and 1,000-row.range(...)pagination loops.#MS6VXW: AddeddetectOwnConflicts(src/lib/roster/shifts/conflicts.ts) and wired own-shift overlap warnings intodiffRoster(src/lib/roster/shifts/diff.ts),checkManualShiftConflicts(src/lib/roster/shifts/repository.ts), andPOST /api/roster/shifts/manual.#HEWR5X: ExtendedadminFreeTextProblem(src/lib/on-call/free-text-guard.ts) across all On Call sections with recursivedetailsscanning (MAX_DETAILS_DEPTH = 8+WeakSetcycle guard) and anchored DOB validation.
- Pod 2 — Developer Ledger, CI Entrypoints & Source Governance (
#315621,#2S5NFB,#49Q5FB,#237JN5,#VWNEQ0,#WBQ6MC):#315621: AddedinboxRecordSchemaand per-filetry/catch+safeParsevalidation inreadDevPendingRequests(src/lib/developer-area/ledger-snapshot.ts) so a corrupt or schema-invalid inbox file is skipped without dropping valid sibling requests.#2S5NFB: Addedscripts/lib/is-entrypoint.mjsto.github/workflows/live-domain-monitor.ymlsparse-checkout, convertedscripts/check-live-deployment-freshness.mjsandscripts/check-live-search-results.mjstoisDirectEntrypoint, and emptiedALLOWED_RAWintests/script-entrypoint-guard.test.ts.#49Q5FB: Refresheddocs/release-source-metadata-debt-2026-06-30.jsonwith verified zero-debt status (missing_required_metadata_count: 0,status: "resolved_zero_missing_metadata") and addedtests/source-metadata-debt-waiver.test.ts.#237JN5&#VWNEQ0: Addedeslint-rulestolint:internalinpackage.json, named default export ineslint-rules/restrict-suppress-hydration-warning.mjs, clarified.github/workflows/sast.yml, and updated stale tier header comments inscripts/check-type-scale.mjs,scripts/check-codebase-index-coverage.mjs, andscripts/check-docs-script-refs.mjs.#WBQ6MC: Movedtests/work-page-favourite-visibility.dom.test.tsxfromdocs/organisation/systems/data-platform.jsontodocs/organisation/systems/personal-practice.json.
- Pod 3 — Reindex Reaper, Hostile Document Ingestion & Clinical Safety Anchors (
#RP00FZ,#F3SGCM,#5PNWGR):#RP00FZ: AddedbuildAbandonedGenerationStorageCleanupJobs,filterReapableAbandonedGenerations, andclampAbandonedCleanupLimit(src/lib/reindex-pipeline.ts,scripts/cleanup-abandoned-reindex-generations.ts) to enqueue storage cleanup jobs for orphaned reindex objects while protecting committed/active generations and legacy documents.#F3SGCM: Created executable 7-class hostile-document ingestion test matrix (tests/hostile-document-ingestion-matrix.test.ts).#5PNWGR: Updated all stalefile:linecitations indocs/clinical-hazard-analysis.mdanddocs/rag-injection-threat-model.mdand addedtests/clinical-doc-line-anchors.test.ts.
- Pod 4 — Search Result Virtualization & Bundle Budget (
#CFHRJY,#VHR3TJ):#CFHRJY: Added SSR-deterministicVirtualizedResultList(src/components/ui/virtualized-result-list.tsx) with responsive CSS grid column detection and integrated intosrc/components/clinical-dashboard/document-search-results.tsxandsrc/components/differentials/differential-stream-workspace.tsx.#VHR3TJ: Documentedbundle-budget.jsonceiling provenance and added regression assertions intests/bundle-budget.test.ts.
- Pod 5 — Browser Matrix & Specifiers Settlement (
#HN9RD0,#33346A,#9Z197J):#HN9RD0: ReplacedvisibleByTextwithexpectSingleSettledOwnerintests/ui-specifiers.spec.ts.#33346A	Z197J: Fixed Gecko<details>toggle loop and rAF hit-step latch insrc/components/document-viewer/source-panels.tsx, added collision-safeuseId()and persistent<h2 className="sr-only">to the tools complementary panel (src/components/tools/tools-search-results-page.tsx), addedexpectHydratedsettlement guards intests/ui-smoke.spec.tsandtests/ui-tools.spec.ts, and addedtests/browser-matrix-regressions.dom.test.tsx.
- Pod 6 — Monolith Decomposition (
#H9WAQN):#H9WAQN: Extracted 12 cohesive modules fromsrc/components/ClinicalDashboard.tsx(3,812 -> 3,544 lines),src/components/clinical-dashboard/master-search-header.tsx(3,234 -> 2,579 lines), andsrc/app/globals.css(src/styles/globals-keyframes.css), verified bytests/monolith-decomposition-integrity.test.ts.
Areas touched: Knowledge and records, App experience, Personal practice, Delivery and assurance, Design system, Clinical reference content, Source intake and indexing, Answer engine, Prototypes, Data platform and access
Verification
- Checks run:
npm run lint->[gate-receipts] recorded a pass for "lint:internal" (10119 input files).npx tsc -p tsconfig.typecheck.json --noEmit->0 errorsnpm run check:organisation->organisation: exit 0 (pass) — working tree (10119 files: 10114 placed, 4 shared, 1 ignored, 0 not yet placed, 0 unplaced)npm run docs:maintain:check->CLINICAL_HAZARD_CONTROLS_PASS hazards=7 decisions=5 review-dates=strict expired-not-blocking=0npm run check:ledger-write-discipline->Ledger write discipline passed for 0e04b21641d2..HEAD.- Focused Vitest suites (
tests/roster-owner-teams.test.ts,tests/roster-own-shift-conflicts.test.ts,tests/on-call-free-text-guard.test.ts,tests/developer-ledger-snapshot.test.ts,tests/script-entrypoint-guard.test.ts,tests/source-metadata-debt-waiver.test.ts,tests/reindex-reaper-storage-cleanup.test.ts,tests/hostile-document-ingestion-matrix.test.ts,tests/clinical-doc-line-anchors.test.ts,tests/search-results-virtualization.dom.test.tsx,tests/bundle-budget.test.ts,tests/browser-matrix-regressions.dom.test.tsx,tests/monolith-decomposition-integrity.test.ts) ->13 passed (13), 439 passed (439)
Risk and rollout
- Risk: Low-to-moderate; changes span non-RAG backend helpers, UI virtualization above 30 items, browser settlement fixes, documentation line anchors, and internal component extractions. Zero RAG retrieval/ranking/answer-generation logic or database migrations were touched.
- Rollback: Standard single-commit revert of this PR; no schema or persistent data format changes.
- Provider or production effects: None
Notes
- All 6 pod changes underwent an independent adversarial review pass before commit (adding PostgREST 1,000-row pagination in
listOwnerTeams, recursion depth + cycle guards infree-text-guard.ts, SSR-deterministic rendering and CSS grid column detection inVirtualizedResultList, and preserving all existing tests indeveloper-ledger-snapshot.test.ts).
Summary by cubic
Resolves 16 open issues spanning roster and on-call safety, reindex cleanup, search-result UI virtualization, browser reliability, developer tooling, and code organization. Large result lists now virtualize, and several backend and UI edge cases gained regression coverage. No RAG retrieval, ranking, or answer-generation changes and no database migration.
- Batch roster owner-team membership counts with pagination and deterministic row ordering, and warn (non-blocking) about overlapping shifts in roster diffs and manual shift entry.
- Scan all on-call free-text fields for patient identifiers, which must contain digits, down through nested details.
- Validate developer inbox records independently so a malformed file is skipped without dropping valid siblings; bound temp-dir cleanup retries in the new tests.
- Queue abandoned reindex storage cleanup that retries until deletion succeeds and covers all deleted generations, while never touching active or committed generations.
- Virtualize document and differential result lists with responsive-column detection and list-relative scrolling; the computed-height spacers raise the inline-style ratchet ceiling accordingly.
- Fix browser-specific interaction and hydration issues: Gecko details toggle loop, rAF hit-step latch, hydration settlement guards, and single settled owners for ambiguous badges.
- Extract dashboard, search-header (actions, scope picker, types), keyframes, and CSS modules; repoint contract tests and doc anchors at the decomposed files, and refresh governance checks such as the Semgrep scan targets (now including
eslint-rules).
Summary by CodeRabbit
- New Features
- Large search and differential-result lists now use a responsive, keyboard-accessible view.
- Search controls offer expanded document-scope and filtering options.
- Roster imports and manual shift changes now report overlapping shifts.
- Bug Fixes
- Improved document-viewer navigation, tool-panel accessibility, and roster data loading.
- Clinical free-text checks now cover more sections and nested details.
- Reindex cleanup better handles abandoned generations and orphaned files.
- Documentation
- Updated clinical safety guidance and verification references.
CodeAnt-AI Description
Large search results now scroll smoothly, while roster conflicts and unsafe cleanup are handled safely
What Changed
- Large document, service, and differential result lists render as users scroll, replacing “Show more” controls for document and service results.
- Roster imports and manual shift entries report overlapping shifts as warnings without blocking the save.
- On Call free-text fields now reject patient identifiers across all sections, including nested details.
- Abandoned reindex cleanup queues orphaned images while preserving committed and in-progress files.
- Large owner team lists load counts in batches and include results beyond a single 1,000-row page.
Impact
✅ Smoother scrolling through large search results
✅ Earlier warnings for overlapping shifts
✅ Patient identifiers blocked across On Call sections
✅ Abandoned reindex images cleaned without deleting active files
💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
@codeant-ai ask: Your question here
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
@codeant-ai ask: Can you suggest a safer alternative to storing this secret?
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
@codeant-ai: Your feedback here
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
@codeant-ai: Do not flag unused imports.
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
@codeant-ai: review
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.