Repository navigation
Description
Problem or outcome
First slice of Milestone 4 per the settled decisions in #32, on the reviewed-draft substrate from #31. Delivers the transition the whole milestone rests on: an approved daily draft whose completion rules pass becomes an immutable EvaluationVersion — canonical bytes, content hash, integrity-chain hash — that the database refuses to mutate and the interface renders from the stored snapshot, never from live joins. This also closes Milestone 0's one open deliverable: the canonical-record-bytes specification (docs/roadmap.md current position).
Scope
In scope:
- ADR 0011 — the canonical record format and finalization model: RFC 8785 JCS semantics over a closed integer-safe subset (UTF-8, sorted members, integers only with magnitude below 2^53, no floats); the versioned envelope (canonicalization version, record-schema version) and its exact v1 field set per
docs/domain-model.mdEvaluationVersion — attribution stream, trainee identity as presented (including the profile fields Milestone 3 design: sessions, drafts, and attribution (owner decisions needed) #22 reserved for these snapshots), program/phase/form/competency/rating definitions with labels and anchor text, observations/ratings/modifiers/narratives, covered sessions with their local-time representation, review decisions, empty-but-present attachments, finalization actor and instant; the SHA-256 content hash; the chain construction fromdocs/records-integrity.mdwith the missing-predecessor treatment fixed (32 zero bytes) and byte lengths pinned; the honest-limits language (ADR 0010 — local hashes prove internal consistency, not provenance); who finalizes (proposed:review_evaluationholders); andFinalizedas a derived status (anevaluation_versionrow exists), extending the frozen derivation without reopening the closed contributor-event kind set - Migration 0010 —
evaluation_version(record, version number, canonical bytes, content hash, chain hash, predecessor slot for slice 3, finalized instant and actor) with immutability triggers in the 0009 backstop style; the frozen view extended so a finalized record stays frozen;finalization_policyper program version (the Milestone 4 design: defensible records (owner decisions needed) #32 decision-2 closed rule set: review approved, required narratives, ratings complete — all backfilled on for existing versions);draft_rating.not_observedas a typed marker (value and marker mutually exclusive at the schema) — the completion rule must never key on modifier codes or other heuristics - Services and API — the canonicalization module with golden vectors; hashing; completion-rule evaluation against the pinned version's policy with per-rule typed refusals; the finalize service (capability-gated, state and rules rechecked inside the write transaction, audited, owner notified); a verification read that recomputes and compares hashes; endpoints for finalize, finalized-version read, and verification
- Web — finalize action on approved drafts with completion-rule refusals displayed honestly; authoring support for the three policy toggles on new program versions (default on); the finalized record view rendered from the stored envelope; hash and verification presentation with the honest-limits wording
- Tests and e2e — canonicalization golden vectors, fixed hash and chain vectors, raw-database immutability tests (every mutation of a finalized version fails closed), the completion-rule matrix including not-observed markings, service and API round trips, and e2e driving approve → finalize → sealed record view
Out of scope: acknowledgments and the trainee timeline (slice 2), amendments and successor versions (slice 3 — the predecessor slot and chain rule ship now so slice 3 cannot redefine a record), weekly summaries and task signoffs (slice 4), signatures (held), exports and PDFs (Milestone 5).
Acceptance criteria
- the canonical byte format is specified in ADR 0011 and pinned by golden vectors, including the chain construction and missing-predecessor rule
- finalizing an approved, rules-passing draft produces an
evaluation_versionwhose stored canonical bytes reproduce exactly and whose content and chain hashes verify - finalization is refused typed for: unapproved drafts, each failing completion rule, and actors without the finalizing capability
- every raw mutation attempt against a finalized version and its bytes fails closed at the database, and the finalized record stays frozen end to end
- the finalized view renders from the stored envelope — a later rename or config edit changes nothing it presents
- verification reports honestly: reproducible and consistent, never "tamper-proof"
- all repository gates green
Expected proof
cargo fmt --check,cargo clippy --workspace --all-targets -- -D warnings,cargo test --workspace- golden vectors for canonicalization, content hash, and chain hash (fixed hex, invented record)
- database tests: immutability, frozen-after-finalization, policy backfill
npm run check,npm run build,npm run e2einweb/— the e2e drives approve → finalize → sealed view in a real browser
Related roadmap, decisions, or issues
- Refs Milestone 4 design: defensible records (owner decisions needed) #32 (decisions 1, 2, and the slice order; closes with the milestone, not this slice);
docs/records-integrity.md;docs/domain-model.mdEvaluationVersion; PRINCIPLES.md 1, 2, 6; ADR 0008, 0010 - Builds on review(workflow): single-step review for daily drafts #31; closes the Milestone 0 canonical-bytes deliverable noted in
docs/roadmap.md
Activity
records(finalize): canonical bytes, hashes, and the sealing service
records(web): finalize action, sealed record view, not-observed marking
records(rules): completion gates at submission; vectors and proofs
records(finalize): sealing carries the viewed revision; sealed header
records(web): sealed identities for attribution and the finalizer
records(policy): no retroactive content rules; sealed view fails closed