ReportingShell AAA Testing Contract¶
Scope¶
This guide owns the unit-test inventory for the first-party caller and callee
graph of frontend/src/views/reporting/ReportingShell.vue. The readiness state
and acceptance evidence remain in
feature-tracking/ReportingShellAAATestCoverage.yml.
A test in this matrix follows Arrange-Act-Assert (AAA):
Arrange typed inputs, isolated stores, deterministic clocks or promises, and the exact dependency behavior required by the case.
Act once through the public component, store, service, route, contract, or persistence boundary under test.
Assert returned or rendered output, state and durable mutations, exact collaborator arguments, and forbidden side effects for failure or stale contexts.
Large snapshots, line execution without behavioral assertions, and an end-to-end happy path alone do not establish unit coverage. Async tests must control completion order and must not use real network access. Each test owns a fresh Pinia where applicable and resets mocks, fake timers, and pending promises.
Frontend Caller And Component Matrix¶
Production boundary |
Direction |
Owning suites |
Covered behavior |
|---|---|---|---|
|
caller |
|
Auth-subject binding and isolation exercised through the public store action invoked at bootstrap. |
|
caller |
|
Shell registration, direct and legacy routes, deep links, context-preserving navigation, guarded draft flush, and failure cancellation. |
|
component |
|
Context creation and restore, immutable resolution, templates, draft hydration, media preload, imports, lifecycle events, stale work, and guarded navigation. |
|
nested caller |
|
Worklist rendering and reporting entry. |
|
nested caller |
|
Exact-version builder loading, lifecycle mutations, delayed responses, and errors. |
|
nested caller |
|
Case resolution and reporting-flow handoff. |
|
nested caller |
|
Patient/examination setup, typed context, and invalid resolution. |
|
nested caller |
|
Catalog loading, findings mutation, draft persistence, and missing context. |
|
nested caller |
|
Template validation, editor state, report submission, identity guards, and persisted artifacts. |
|
nested caller |
|
Frame-selection context and persistence calls. |
|
nested caller |
|
Verified-draft gate, exact make-report payload, text export, and artifact links. |
|
nested caller |
|
Latest-final read, technical details, PDF links, and timeline filtering. |
|
direct child |
|
Import request/result and shell completion handoff. |
Frontend Store, Service, And Helper Matrix¶
Production boundary |
Direction |
Owning suites |
Covered behavior |
|---|---|---|---|
|
callee/shared state |
|
Subject isolation, template identity, dirty state, coalesced autosave, flush, conflict, failure, and final-save navigation. |
|
callee |
|
Exact bundle identity, revisions, stale load/select handling, import failures, and error state. |
|
callee |
|
Typed patient list, selector projection, malformed response, lookup, and Pinia isolation. |
|
callee |
|
Canonical dropdown normalization and fail-closed error state. |
|
callee |
|
Creation handoff, detail validation, selection, removal, and malformed response rejection. |
|
callee |
|
Exact case requests, response validation, and malformed nested data. |
|
callee |
|
Catalog context, request identity, normalization, and invalid payloads. |
|
callee |
|
Exact-version reads, graph identity/hash/edge validation, and examination projection. |
|
callee |
|
GET/PUT paths, stable identity serialization, revision payload, normalization, and malformed responses. |
|
callee |
|
Exact make-report request/response and failure propagation. |
|
callee |
|
Supported languages, canonical labels, and unusable contracts. |
|
callee |
|
Latest history selection and stream preference. |
|
callee |
|
Template normalization, runtime payload, exact identity, and fail-closed malformed responses. |
|
transport callee |
|
API ownership, prefix and casing conversion, binary behavior, exact endpoint paths, and HTTP methods. |
|
callee |
|
Credentialed HLS, artifact changes, native mode, cleanup, and fail-closed stream errors. |
|
callee |
|
Structure validation, immutable deterministic waves, barriers, rejection, supersession, and atomic commit. |
|
callee |
|
Identity casing/precedence, active/pinned matching, absent context, and mismatch rejection. |
Reporting presentation, indication, examination, list, text, error, lifecycle, and coverage helpers |
callee |
Corresponding |
Table-driven normalization, labels, errors, resolution, export, and negative boundaries. |
Backend Graph And Persistence Matrix¶
Production boundary |
Repository |
Owning suites |
Covered behavior |
|---|---|---|---|
|
lx-data-models |
|
Exact module/version loader calls, serialized graph/context, 404 unknown examination, and 409 incoherent graph. |
|
lx-data-models |
|
Deterministic hashes, closed projections, published-template filtering, identity and edge validation. |
|
lx-data-models |
|
Registry absence, exact versions, provider digests, unknown providers, and explicit sources. |
|
lx-data-models |
|
Canonical JSON, strict nested types, identity aliases, revisions, non-finite values, and empty sentinel. |
|
lx-data-models |
|
Submission/make-report identities, versions, frame bounds, JSON safety, and persisted artifact payloads. |
Patient-examination draft route, serializer, and model |
endoreg-db |
|
GET/PUT round trip, 404, strict shape, unknown fields, optimistic conflict, legacy revision, direct model validation, and final-draft clearing. |
PatientExaminationReport API routes |
endoreg-db |
|
List scope, save validation/status mapping, make-report identity, frames, empty selections, artifacts, and finalization rollback. |
|
endoreg-db |
|
Draft/final create/update, template validation, draft retention/clearing, artifact IDs, and transaction rollback. |
Runtime validation, finding sync, patient context, and history services |
endoreg-db |
|
Typed validation snapshots, clinical ledger mutations, patient snapshots, history limits, negative relationships, and rollback. |
PatientExaminationReport model and persisted JSON schemas |
endoreg-db |
|
Canonical JSON/language provenance, lifecycle values, versions, and complete knowledge-base identity. |
PDF and full-report artifacts |
endoreg-db |
|
Strict renderer success/failure, durable IDs and links, rollback, zero-frame output, and no false final status. |
Explicit Exclusions¶
Vue, Vue Router, Pinia, Axios, Django, Django REST Framework, Django Ninja, Pydantic, and database-driver internals are third-party framework boundaries.
Generated OpenAPI TypeScript declarations are checked for freshness by
npm run type-check; their generators and consuming services are tested, so generated declarations do not receive handwritten unit suites.Type-only modules have no runtime behavior. They are verified by the strict TypeScript and Pyright lanes and by the runtime boundary that constructs the type.
Shared infrastructure consumers unrelated to reporting are outside this graph. The shared helper itself remains in scope when ReportingShell invokes it, as shown in the matrix above.
Verification Commands¶
Run from /home/admin/dev/lx-annotate/frontend:
npm run test:unit -- --run src/router/__tests__/reportingFlow.test.ts \
src/api/__tests__ src/stores/__tests__ src/views/reporting/__tests__ \
src/components/Reporting/__tests__ \
src/composables/__tests__/useAuthenticatedVideoStream.test.ts
npm run type-check
npm run type-check:component-tests
Run from /home/admin/lx-data-models:
uv run pyright
uv run pytest \
tests/unit/lx_dtypes/django/api/test_knowledge_base_graph_api.py \
tests/unit/lx_dtypes/django/api/test_reporting_shell_graph_aaa.py \
tests/unit/lx_dtypes/models/contracts/test_report_draft.py \
tests/unit/lx_dtypes/models/contracts/test_patient_examination_report.py \
tests/unit/lx_dtypes/models/contracts/test_reporting_shell_persistence_aaa.py \
tests/unit/lx_dtypes/models/interface/test_knowledge_base_resolver.py -q
Run from /home/admin/endoreg-db after confirming no unrelated pytest process
is active:
.devenv/state/venv/bin/pyright
devenv shell -- .devenv/state/venv/bin/pytest \
tests/views/report/test_reporting_shell_finalization_aaa.py \
tests/views/report/test_patient_examination_report_ninja_api.py \
tests/views/patient_examination/test_patient_examination_draft_viewset.py \
tests/services/test_report_persistence_service.py \
tests/services/test_report_runtime_validation.py \
tests/services/test_report_history.py \
tests/services/test_report_finding_sync.py \
tests/services/test_report_patient_context.py \
tests/models/test_patient_examination_report_validation.py -q