Skip to content

records(ack): acknowledgments and the trainee timeline - #39

Merged
TusanHomichi merged 4 commits into
mainfrom
claude/milestone-2-org-rename-q8b2q8
Aug 31, 2026
Merged

TusanHomichi merged 4 commits into
mainfrom
claude/milestone-2-org-rename-q8b2q8

Conversation

@TusanHomichi

Copy link
Copy Markdown
Member

Primary Issue

Closes #38. Refs #32 (Milestone 4 slice 2; decision 3's four acknowledgment verbs and the trainee capability set).

Problem And Outcome

Finalized records existed (#36) but the person they are about could neither see nor answer them: the Trainee bundle was empty, and every read path led through assignment or review authority. This slice delivers the domain model's Acknowledgment — a permanent row binding the trainee to one finalized EvaluationVersion, recording receipt, not agreement — and the trainee's own-records timeline, so the acknowledgment loop closes: finalize → the trainee is told → they read the sealed record → they acknowledge, respond, or refuse → a refusal escalates to review authority, which can attest what the trainee cannot or will not record.

Changes

  • Migration 0011 — the acknowledgment table: closed five-kind set (acknowledged, acknowledged_with_response, refused, supervisor_attested_refusal, unavailable), FK to evaluation_version (invariant 2), UNIQUE (evaluation_version_id, user_id), append-only triggers, and shape held raw: a plain acknowledgment carries no text while every other kind requires non-blank text past the full Unicode White_Space trim (the 0009 set); trainee kinds satisfy recorded_by = user_id, attested kinds never; the bound person is always the version's trainee (trigger). Grants view_own_records and acknowledge_own_record to existing enrolled users — enrollment is what makes someone a trainee.
  • Capabilities — ViewOwnRecords / AcknowledgeOwnRecord; the Trainee bundle now grants both.
  • Services (acknowledgments.rs) — acknowledge (trainee-only, typed refusals for wrong-person, unfinalized, duplicate, and text-shape cases; refusal escalates to every review_evaluation holder in the same transaction), attest (review authority, never self, reason required, trainee noticed), acknowledgment_of (readers the draft rules admit), own_records (the timeline, finalized records only). All acts audited (acknowledgment_recorded) inside write_tx with storage::refuse on every refusal path.
  • Read gate — evaluation_drafts::may_read admits the trainee to their own record once finalized; working drafts about them stay out of reach. finalize() now also notifies the trainee (record_awaits_acknowledgment).
  • API — POST /api/drafts/{id}/acknowledge, POST /api/drafts/{id}/attest, GET /api/drafts/{id}/acknowledgment, GET /api/my/records, with stable refusal codes.
  • Web — the My Records timeline page and nav entry (capability-gated), the acknowledgment panel on the sealed record view (trainee controls or coordinator attest controls, exactly one act per version), and the trainee role option no longer labeled capability-less.

Scope

No amendment or re-acknowledgment mechanics (slice 3 replaces the first-versions-only trigger and defines succession; a successor version takes a new acknowledgment because it is a new version row). No acknowledgment windows or reminders, no weekly summaries, no exports.

Verification

  • cargo fmt --check, cargo clippy --workspace --all-targets -- -D warnings (pedantic): clean.
  • cargo test --workspace: 18 suites green, including the new acknowledgments suite — trainee read/acknowledge round trip with raw forgery refusals at the database (text shape, recorded-by, wrong subject, permanence), refusal escalation to exactly the review_evaluation holders, attestation gates (authority, self-attestation, blank reason, unfinalized), and the HTTP round trip. The lifecycle role-bundle test now asserts the trainee's two capabilities.
  • npm run check, npm run build, npm run e2e in web/: 5/5, with the drafts spec extended through the full trainee flow (timeline → sealed record → acknowledge with response → controls leave with the act).

Review And Merge Notes

The one deliberate judgment call: attested kinds (supervisor_attested_refusal, unavailable) are gated on review_evaluation — the same authority set that finalizes (#32 decision 4's pattern) — and require a non-blank reason, since an attestation is someone else's statement about the trainee and should explain itself. Escalation notices name the trainee but never record content (AGENTS.md logging rule applies to notices' spirit; messages are content-free).

🤖 Generated with Claude Code

https://claude.ai/code/session_01DNP3dkn9c84v2YoNwx7KTg


Generated by Claude Code

An Acknowledgment binds the trainee to one finalized EvaluationVersion
and records receipt, not agreement (docs/domain-model.md; #32
decision 3). Migration 0011 holds the shape at the database: the
closed five-kind set, append-only permanence, one per version per
person, the trainee as the only bindable subject, trainee kinds
recorded by the trainee and attested kinds never, and non-blank text
for every kind that explains itself.

Trainees gain view_own_records and acknowledge_own_record: the Trainee
bundle grants both to new users, migration 0011 grants them to
existing users identified by their enrollments, and the drafts read
gate admits a trainee to their own record once finalized — sealed
presentation only, never a working draft. The service records the
trainee's acknowledgment, response, or refusal (escalated to every
review_evaluation holder), and review authority attests a refusal or
unavailability about the trainee, audited and noticed throughout;
finalization now tells the trainee their record awaits them.

The web interface adds the My Records timeline, the acknowledgment
panel on the sealed record, and the coordinator's attest controls.

Refs #38.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01DNP3dkn9c84v2YoNwx7KTg

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a001312ef8

ℹ️ 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".

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 31, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-08-31T06:32:32.432674Z 147b14a New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Two Codex findings, both verified real. acknowledgment_of now starts
from the latest finalized version and left-joins its acknowledgment,
so an unacknowledged successor (slice 3) answers None instead of
presenting a predecessor's act as current — matching the function's
own contract. And a trainee response is a persisted notice to the
record's owner, as docs/architecture.md's Notifications contract
requires; refusal escalation is unchanged.

Refs #38.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01DNP3dkn9c84v2YoNwx7KTg

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cf19785f46

ℹ️ 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".

… caps

Two more Codex findings, both verified against AGENTS.md. Slice 2 added
read-gate behavior to evaluation_drafts.rs past the 1,000-line
threshold, so the draft authorization gates move to their new owner:
draft_access now holds contributor identity, authoring scope, the read
rule, and who may start a session's draft; evaluation_drafts keeps the
workflow and drops to 918 lines. No behavior change; the focused proof
is the existing gate coverage across the draft, review, finalization,
and acknowledgment suites.

And enrollment now grants view_own_records and acknowledge_own_record
idempotently in its own transaction: the 0011 backfill ran once, so an
account created under another bundle and enrolled later was left unable
to read or acknowledge its own finalized records. Enrollment is what
makes someone a trainee.

Refs #38.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01DNP3dkn9c84v2YoNwx7KTg

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 782b674a6b

ℹ️ 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 three, both verified. The acknowledgment row now stores
presentation-name snapshots for the bound person and the recorder,
taken in the recording transaction: a permanent act displays who spoke
as they were named at the act, and a later profile rename never
rewrites it — ids preserve identity, snapshots preserve what the
record said (the slice-1 sealed-identity precedent). Reads come from
the stored snapshots, never a live user join.

And the draft read gate now answers with its basis: workflow readers
(contributors, open enrollment history, reviewers of a submitted
record) see the whole workspace, while the trainee's own-record basis
is authorization for the finalized record only — the workspace redacts
the transfer roster and snapshot bookkeeping, which name staff and
workflow internals that are not an own-record reader's to see.

Refs #38.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01DNP3dkn9c84v2YoNwx7KTg
@TusanHomichi
TusanHomichi merged commit 35496fc into main Aug 31, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Milestone 4 slice 2: trainee timeline and the acknowledgment workflow

2 participants