Files
user-system/docs/evidence/ops/2026-03-28/quality/COVERAGE_REMEDIATION_20260328-121611.md

2.8 KiB

2026-03-28 Q-004 Coverage Remediation Pass 16

Scope

  • Continue strict Q-004 closure work after Pass 15.
  • Fully close the remaining router hotspot in:
    • frontend/admin/src/app/router.tsx
  • Re-verify closure through targeted router tests and full frontend validation.

Changes

Frontend

  • Replaced the shallow route-table assertions in:
    • frontend/admin/src/app/router.test.tsx
  • New coverage now verifies:
    • exact public route registration
    • exact protected route registration
    • RequireAuth shell wrapping and nested AdminLayout
    • RequireAdmin wrapping for admin-only routes
    • default Navigate redirect to /dashboard with replace
    • lazy route resolution for every page entry
    • lazyPage() error handling when the requested export is not a React component
  • Test isolation hardening:
    • cleaned up dynamic vi.doMock() registrations with explicit vi.doUnmock() in afterEach
    • this removed cross-file mock leakage that briefly caused full-suite hangs

Backend

  • No backend code changes were required in this pass.

Verified Commands

cd D:\project\frontend\admin
npm.cmd run test:run -- src/app/router.test.tsx
npm.cmd run test:run
npm.cmd run lint
npm.cmd run build
npm.cmd run test:coverage

Results

Frontend coverage

  • Overall:
    • statements 90.74%
    • branches 77.74%
    • functions 87.40%
    • lines 90.87%
  • Target area:
    • src/app/router.tsx: statements 100%, branches 100%, functions 100%, lines 100%

Validation outcomes

  • Full frontend test run now completes with:
    • 47 passing test files
    • 215 passing tests
  • Full frontend coverage run now completes with:
    • 47 passing test files
    • 215 passing tests
  • The required sequential frontend validation path passed:
    • test:run -- src/app/router.test.tsx
    • test:run
    • lint
    • build
    • test:coverage

Validation Notes

  • During this pass, a real test-hygiene regression was found and fixed:
    • dynamic route test mocks leaked into later test files
    • symptom: full test:run and test:coverage stalled until the command timeout
    • fix: explicit vi.doUnmock() cleanup for every mocked router dependency
  • The successful frontend coverage run still emits one post-summary jsdom AggregateError network-noise line.
    • It does not fail the command.
    • It remains a real validation-hygiene issue and cannot be hidden.

Real Conclusion

  • src/app/router.tsx is no longer an open Q-004 gap.
  • Q-004 still cannot be honestly declared closed.
  • After this pass, the main remaining frontend gaps narrow further to:
    • src/pages/admin/DashboardPage/DashboardPage.tsx
    • src/components/feedback/PageState/PageState.tsx
    • additional lower-coverage shared/admin surfaces outside this pass
    • the post-summary jsdom AggregateError coverage-noise hygiene issue