Review domain files
Command contracts, business rules and save coordination. The UI calls these functions rather than writing review JSON directly.
System explanation · Choosing checks
Source files
| File | Responsibility / entry points |
|---|---|
src/features/reviews/command-draft.ts
|
Coalesces compatible repeated edits into one pending command and preview
revision. CommandDraft |
src/features/reviews/command-schema.ts
|
Zod input contract for commands and the browser's id/command envelopes; rejects
invalid shapes before execution. commandSchema, pendingCommandSchema |
src/features/reviews/commands.ts
|
Entry point for review changes. execute checks access, copies the
review, runs the handler for the command type and appends its activity entry.execute, ReviewCommand; re-exports permissions |
src/features/reviews/permissions.ts
|
Role and state rules that the UI and the handlers share. canEdit, canAddNote, canUpdateNote, canRefuseFinding, canSubmitPolicyDecision, openFindingsBlockApproval |
src/features/reviews/handlers/
|
One handler per command. facts.ts changes examiner facts,
evidence.ts handles notes, refusals, appointments and documents, and
workflow.ts handles routing, PEC, the memo cycle and release.CommandContext, CommandHandlers, factHandlers, evidenceHandlers, workflowHandlers |
src/features/reviews/downstream.ts
|
Release gates, memo eligibility, FNS field rows, EPP handoff and downstream
summaries. CURRENT_TEMPLATE_FNS_DISCLAIMER, EPP_ADAPTER_DISCLAIMER, deriveFfyFromSampleMonth, DownstreamGateResult, downstreamGateStatus, transmittalEligible … |
src/features/reviews/intake-command.ts
|
Parses supplied files, matches business identity, checks version/role and creates
or refreshes a review. IntakeFiles, promoteSnapNegative |
src/features/reviews/persistence.ts
|
Coordinates idempotent request lookup, expected versions, command execution and
append-race recovery. PendingCommand, StaleReviewError, saveCommands, appendReview |
src/features/reviews/preferences.ts
|
Reads account autosave and computation-difference preferences, both opt-in. useReviewPreferences |
src/features/reviews/provider.tsx
|
Review state, computation drafts, command queue, save retry/conflict handling,
undo and save-before-navigation. ReviewProvider, useReview, useReviewNavigation |
src/features/reviews/received-snapshot.ts
|
Copies facts and identifying fields for handoff/reset; excludes documents, notes
and activity. captureReceivedSnapshot |
src/features/reviews/return-path.ts
|
Remembers usable in-app return locations and provides a safe fallback. RETURN_FALLBACK, rememberPath, returnPath |
src/features/reviews/review-error-message.ts
|
Normalizes review errors into user-facing messages. reviewErrorMessage |
src/features/reviews/review-error-toast.tsx
|
Presents persistent review error feedback through the shared toast control. ReviewErrorToast |
src/features/reviews/review-key.ts
|
UUID identity helpers and separate business identity/FFY matching. Never derive
year from a UUID. reviewKey, newReviewKey, isReviewKey, fiscalYear, ReviewIdentity, reviewIdentity … |
src/features/reviews/review-store.ts
|
Store interface, StoredReview envelope, legacy binding and storage-error
wrapper. StoredReview, ReviewStore, bindStoredRules, bindReviewRules, ReviewStoreUnavailableError, protectReviewStore |
src/features/reviews/section-state.ts
|
Builds section clear/restore commands from the current review and role-specific
received copy. receivedSnapshot, sectionCommand |
src/features/reviews/types.ts
|
Shared actor, workflow, note, document, approval and base review types. documentCategories, workflowLabels, WorkflowState, ReviewOutcome, DemoRole, roleLabels … |
src/features/reviews/workflow.ts
|
Submit, return, route and approve transitions; includes the unresolved non-drop
PEC routing gate. PEC_ROUTING_PENDING, WorkflowAction, WorkflowContext, transition |
Tests
| File | Responsibility / entry points |
|---|---|
src/features/reviews/command-draft.test.ts
|
Checks command draft. Example: “typing a narrative previews and commits one revision and activity event”. |
src/features/reviews/command-schema.test.ts
|
Checks command schema. Example: “commandSchema”. |
src/features/reviews/commands.test.ts
|
Checks commands. Example: “SNAP Negative review commands”. |
src/features/reviews/downstream.test.ts
|
Checks downstream. Example: “PEC approval creates an editable manager memo and received snapshot without release”. |
src/features/reviews/intake-command.test.ts
|
Checks intake command. Example: “intake persists matched facts and complete batch lineage, supports guarded refresh”. |
src/features/reviews/persistence.test.ts
|
Checks persistence. Example: “saveCommands”. |
src/features/reviews/return-path.test.ts
|
Checks return path. Example: “Return uses the previous in-app path”. |
src/features/reviews/review-error-message.test.ts
|
Checks review error message. Example: “serialized validation issues become a single readable message without duplicates”. |
src/features/reviews/review-key.test.ts
|
Checks review key. Example: “UUID identity contains no business-field dependency”. |
src/features/reviews/section-state.test.ts
|
Checks section state. Example: “Clear all keeps routing context and undo restores the preceding facts”. |
src/features/reviews/storage-errors.test.ts
|
Checks storage errors. Example: “storage boundary classifies network and database failures without exposing details”. |