Repository navigation
Description
Problem or outcome
Third slice of Milestone 4 per the settled decisions in #32 (decision 4: amendments are made by the finalizing capability set, always carry a required reason, and always require re-acknowledgment), on the finalized-version substrate from #37 and the acknowledgment binding from #39. Delivers corrections without erasure: a finalized version is never edited in place — a correction produces a successor EvaluationVersion linked to its original with an explicit reason and authority, both versions remain readable while retained, the chain hash extends the defined chain (ADR 0011 fixed the rule before the first record existed), and the successor starts unacknowledged by construction (docs/records-integrity.md: "An amendment never inherits acknowledgment silently").
Scope
In scope:
- Migration 0012 — the amendment contract replaces 0010's
evaluation_version_first_versions_onlyplaceholder trigger:- an
amendmentrecord (docs/domain-model.md Amendment): the evaluation record, the version numbers it links, the required non-blank reason (0009's White_Space trim set), the amending actor, and the instant; append-only - successor
evaluation_versionrows are admitted only as the next version of their record (version_number= current max + 1,predecessor_id= the current latest version of the same record) and only with their amendment recorded — the linkage, ordering, and reason-required shape hold under raw writes, in the 0009 snapshot-precedes-decision style - the frozen-state derivation reworked: finalized stays terminal for everyone except an open amendment — amending reopens the one working copy through a modeled, audited act, and the copy refreezes on the amended finalization; the exact frozen/thaw derivation is the slice's main design point and gets stated in the PR (and an ADR if it changes durable behavior beyond ADR 0011's frame)
- an
- Services and API — open an amendment (
review_evaluation, required reason, typed refusals: unfinalized record, amendment already open, blank reason); the reopened copy travels the existing workflow as configured (contribute → submit → review under the pinned version'sfinalization_policy) so amendment content earns the same gates as original content; finalizing an amended record produces version N+1 withpredecessor_id,predecessor_content_hashin the envelope, and the chain hash over the predecessor's raw content hash exactly as ADR 0011 pinned (golden vector already exists);verify()recomputes successor chains; reads present the latest version with the full version history (each version's meta, amendment reason, authority, and its acknowledgment state); audited (amendment_opened, existingdraft_finalized) and noticed (owner, trainee — the successor awaits acknowledgment again) - Acknowledgment interplay — nothing to build, everything to prove: the version binding from records(ack): acknowledgments and the trainee timeline #39 gives re-acknowledgment by construction; tests pin that a successor version answers unacknowledged while the original's acknowledgment remains readable on the original
- Web — the sealed record view gains version history (version pills, amendment reasons, per-version fingerprints) and an "amend" control for
review_evaluationholders; the reopened copy uses the existing draft workspace; the trainee timeline marks amended records and surfaces the awaiting-acknowledgment successor - Tests and e2e — chain-hash proofs against the ADR 0011 golden vectors over real successor bytes; database backstops raw (ordering, linkage, amendment-required, reason shape, immutability of both versions); the acknowledgment re-binding matrix; workflow round trip under review-on and review-off policies; e2e driving finalize → acknowledge → amend with reason → re-review → re-finalize → trainee re-acknowledges
Out of scope: attachment-driven successor versions (attachments are unbuilt), acknowledgment windows, weekly summaries and task signoffs (slice 4), retention/disposition of superseded versions (Milestone 5+), exports (Milestone 5).
Acceptance criteria
- a finalized version is never mutated by an amendment: the successor is a new immutable row, both readable while retained, raw writes refused on both
- amendments carry a required non-blank reason and the amending authority, append-only, bound to exact version numbers
- successor versions arrive only in order, linked to the true predecessor, with the amendment recorded — held at the database
- the successor's chain hash commits to the predecessor's content hash per ADR 0011, and verification recomputes it
- the successor starts unacknowledged; the original's acknowledgment stays with the original
- amendment content passes the pinned version's configured gates before sealing
- all repository gates green
Expected proof
cargo fmt --check,cargo clippy --workspace --all-targets -- -D warnings,cargo test --workspace- database tests raw and through the service for every backstop above
npm run check,npm run build,npm run e2einweb/— the e2e drives the full amend-and-re-acknowledge loop in a real browser
Related roadmap, decisions, or issues
- Refs Milestone 4 design: defensible records (owner decisions needed) #32 (decision 4; slice order), ADR 0011 (chain rule, predecessor treatment, envelope
record.predecessor_content_hash),docs/domain-model.mdAmendment,docs/records-integrity.md(correction, acknowledgment non-inheritance), PRINCIPLES.md - Builds on records(finalize): canonical bytes, completion rules, and the immutable version #37 (the version substrate and lineage slot) and records(ack): acknowledgments and the trainee timeline #39 (version-bound acknowledgments)
Activity
records(amend): amendments reopen the copy; successors extend the chain
records(amend): sealed reads for trainees; retained versions readable
records(amend): ADR 0012; contribution stretches end at the reopening