Repository navigation
records(amend): amendments and successor versions - #41
Conversation
A correction never edits a finalized version (docs/domain-model.md Amendment; #32 decision 4). Opening an amendment — review_evaluation, required reason, identity snapshotted — reopens the record's one working copy; the correction travels the ordinary workflow under the pinned version's policy; sealing produces the successor version, numbered next, linked to its true predecessor, its envelope committing to the predecessor's content hash and its chain hash extending ADR 0011's rule. Both versions stay readable; the successor starts unacknowledged because acknowledgments bind to exact versions. The amendment row doubles as the open-state marker: it targets the record's latest version, and the successor's arrival ends it by derivation. Reopened-cycle state is scoped by event and decision high-water marks recorded at opening and held truthful by triggers, so a superseded cycle's approval never leaks into the new one — at the service or raw. Migration 0012 replaces the first-versions-only placeholder with the succession contract and reworks the frozen derivation for the reopened cycle. The web sealed view gains version history with amendment reasons and per-version acknowledgments, the amend control, and an amendment-in-progress banner; the trainee timeline marks amended records, which await acknowledgment again. Refs #40. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01DNP3dkn9c84v2YoNwx7KTg
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4754fb66e3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Codex round one on the amendment slice, all three verified. An
own-record reader now sees the record's sealed self even while an
amendment is in progress: status reads finalized, the working copy and
reopened-cycle events and decisions stay out of the response, and the
amendment internals are absent — a draft in progress about the trainee
was never theirs to see. Opening an amendment advances the record's
revision, so a save or finalization carrying a prior cycle's token is
a typed stale refusal, never a silent overwrite of the new copy. And
every retained version is now readable and verifiable by number —
GET /api/drafts/{id}/versions/{n} and its verify — with the sealed
page rendering a superseded original behind an explicit banner and the
history linking each version.
Refs #40.
Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01DNP3dkn9c84v2YoNwx7KTg
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 30c4345f16
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Codex round two, both verified. ADR 0012 records the amendment state machine as the durable decision it is: the amendment row as permanent record and derived open-state marker, workflow reuse under the pinned policy, high-water-mark scoping with truthfulness triggers, the revision advance at opening, the own-record sealed projection, retained versions readable by number, and no withdrawal in v1 — with the rejected alternatives (event-kind extension, a mutable state column, content resets, a parallel amendment-draft table). And contribution coalescing now ends at the reopening mark: the correction's first save is attributed within its own cycle instead of coalescing into a stretch the sealed version already owns, so draft edits remain attributable (ADR 0008) across cycles. Regression: the same contributor saving before sealing and again in the amendment yields one contributed event per cycle. Refs #40. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01DNP3dkn9c84v2YoNwx7KTg
Primary Issue
Closes #40. Refs #32 (Milestone 4 slice 3; decision 4: amendments by the finalizing capability set, always with a required reason, always re-acknowledged).
Problem And Outcome
Finalized records could not be corrected: the 0010 placeholder trigger admitted first versions only, and any mistake sealed into a record was permanent with no lawful correction path. This slice delivers corrections without erasure, exactly as
docs/records-integrity.mdrequires: an amendment — recorded reason, authority, identity snapshot — reopens the record's one working copy; the correction travels the ordinary workflow under the pinned version's policy; sealing produces the successorEvaluationVersion, numbered next, linked to its true predecessor, chained per ADR 0011 (the envelope commits to the predecessor's content hash; the chain hash covers it). The original stays readable and exportable while retained, and the successor starts unacknowledged — an amendment never inherits acknowledgment silently.Changes
amendmenttable (record, target version, required non-blank reason under the 0009 White_Space trim, authority id plus display-name snapshot, instant, append-only) doubling as the open-state marker: an amendment targeting the record's current latest version is in progress; the successor's arrival ends it by derivation, never by a mutable status column. Succession replacesevaluation_version_first_versions_only: a predecessor-bearing version lands only next-in-order on its own record's latest version, and only under that version's recorded amendment. The reopened cycle is scoped by event/decision high-water marks recorded at opening and held truthful by a trigger (a forged low mark would resurrect the superseded cycle's approval). The frozen derivation gains the reopened cycle, and the approval gate holds raw for successors — with the empty-cycle NULL comparison coalesced closed.amendments::open(review_evaluation, typed refusals: unfinalized, already open, blank reason; auditedamendment_opened; owner noticed),amendments::history(per-version meta, amendment, and acknowledgment — every name from stored snapshots: the envelope's finalizer viajson_extractover the stored bytes, the amendment's and acknowledgment's snapshot columns; no live joins).status_ofand the frozen view derive the reopened cycle from post-mark events, soNotApprovedanswers again under a review-required policy until the correction earns its own approval.finalizeseals version N+1 withpredecessor_id, enveloperecord.predecessor_content_hash, and the chained hash;verifyrecomputes successor chains against the stored predecessor.POST /api/drafts/{id}/amend,GET /api/drafts/{id}/versions; the workspace carriesviewer_may_amend,latest_version_number, andopen_amendment.Amended — vN), which show awaiting acknowledgment again.Scope
No amendment withdrawal (a mistaken opening is closed by re-sealing, which is explicit and audited; withdrawal can be modeled later if the burden proves real). No acknowledgment windows, weekly summaries, or task signoffs (slice 4), no attachments, no retention/disposition of superseded versions, no exports.
Verification
cargo fmt --check,cargo clippy --workspace --all-targets -- -D warnings(pedantic): clean.cargo test --workspace: 101 tests green, including the new 4-testamendmentssuite — the full chained-successor round trip (chain hash recomputed from the stored predecessor against ADR 0011's rule, envelope lineage fields, history with per-version acknowledgments, re-acknowledgment of version 2); raw forgeries refused at the database (successor without amendment, blank reason, forged reopening marks, wrong-record target, out-of-order successor, amendment permanence); the review-required policy proving the superseded cycle's approval never leaks (service and raw); and the HTTP round trip.npm run check,npm run build,npm run e2einweb/: 5/5, the drafts spec now driving finalize → acknowledge → amend with reason → correct → re-review → seal version 2 → verify chained hashes → trainee re-acknowledges.Review And Merge Notes
Two design points worth a look:
🤖 Generated with Claude Code
https://claude.ai/code/session_01DNP3dkn9c84v2YoNwx7KTg
Generated by Claude Code