Repository navigation
Description
Design-architect pass 28 (2026-10-31), audit at origin/main 357ec7fb. Full design doc: files/designs/code-id-artifact-receipt-validation.md in the keep-the-four-repos-healthy goal workspace. NO user/review — every origin carries explicit acceptance with verified probe evidence, and the judgment calls below are the architect's recorded decisions.
Problem
pkgs/id has three signed-statement types, and two state the same contract in their docs — documents.rs: "The builder and the decoder both apply them, so a signed document always passes them on receipt"; chain.rs (ChainExt::validate): the same sentence for signed events. The third type, artifacts (pkgs/id/src/artifact.rs), never applied it to itself: its receipt gates check() (envelope) and parsed() (the four known kinds) each enforce some of the rules the crate's own producers and sibling validators obey and silently omit others — one omission per field, filed one at a time. Four filings in two days (three in the hours after pass 27 assessed #3146 as a single): #3146 (friend_remove.requests never inspected), #3187 (home_declared.world_id only is_empty-checked; duplicate endpoints pass), #3192 (document/tag text accepts non-NFC every sibling path refuses), #3196 (check() accepts a duplicated after frontier chain.rs refuses as DuplicateAfter).
The rules (recorded decisions)
- Receipt is construction.
parsed()refuses a known-kind body no in-tree producer could build;check()refuses an envelope no legitimate signer could build —Refusal::Forbiddennaming the rule, existing per-arm style. Unknown kinds untouched (stored, never applied, envelope-only — the module's deliberate forward-compatibility rule). - A signed list names each thing once. Duplicates refused, never silently deduped on receipt (the signed bytes are evidence; rewriting falsifies them and breaks the hash). Covers
after,friend_remove.requests, andhome_declaredservers by endpoint.sign_afterrefuses a duplicatedafterat build time — the builder/decoder symmetry the sibling types document. - Text in a signed body follows the crate's text rules.
document.media_type,tag.name,tag.valuemust be NFC via the sameunicode_normalization::is_nfcthe three sibling validators import.world_idgetsMAX_WORLD_ID_BYTES = 64(aligned withMAX_WORLD_NAME_BYTES): 1–64 bytes, not whitespace-only, no control (Cc) or format (Cf) characters.
Field pins: requests ≤ MAX_FRIEND_REQUESTS = 3 (the sole producer Directory::friendship_requests, directory.rs:1710–1721, structurally builds at most 3, sorted+deduped), each entry exactly 32 lowercase hex characters (the envelope-ID shape), no duplicates. Junk requests entries are not inert — Directory::apply extends the permanent removed_requests void guard with every string (directory.rs:1698–1705).
Phases (adopt the origins — no parallels)
- Phase 1 — List integrity: id(artifact): check() accepts duplicate after hashes — the same hash can fill all 32 frontier slots, unlike chain.rs which refuses DuplicateAfter #3196 + id(artifact): friend_remove
requestsis the one known-kind body parsed() never validates — any count, any shape, any length passes, and every string lands permanently in the directory's removed_requests void guard #3146. - Phase 2 — Text fields: id(artifact): parsed() accepts non-NFC text in document and tag — media_type, tag name and value bypass the NFC rule documents.rs and tag_claims.rs both enforce #3192 + id(artifact): home_declared world_id gets only an is_empty check in parsed() — a 100 KB, whitespace-only, control- or bidi-bearing world_id is accepted and stored, and the same endpoint can be listed twice with different worlds #3187. Independent of Phase 1.
- Phase 3 — Closing audit + contract statement: filed this pass as a sub-issue, gated on Phases 1–2 (
status/blocked). Field-by-field disposition table for every known-kind and envelope field; must explicitly disposition thekindstring (unknown kinds),document.contentinternal strings,prev's shape beyondstore()'s position check, and full builder-side symmetry; writes the contract sentence into theartifact.rsmodule doc, wheredocuments.rs/chain.rsalready carry it.
Alternatives rejected (in the doc)
Fixing the four independently (rules diverge — the drift is how the family arose: the artifact arms already mirror the sibling caps while missing the NFC half); validating at application time instead of parsed() (the log would still store and serve junk; parsed() is the single gate insert/open/pull all pass); normalizing on receipt (breaks hash/signature — refusal is the only honest outcome); folding into #3068 (JS/TS shape contract — different gate, different failure mode; cross-referenced, neither gates the other — this answers #3187's triage note); pinning the full a-z0-9-_ world-name charset for world_id now (WorldCore::new accepts any non-blank ID — charset stays an open question, below).
Risks (in the doc)
ArtifactLog::open() replays through the same gates, so tightened rules apply to stored chains — legitimate chains unaffected (no producer emits these shapes), refusal-on-open with the line named is existing behaviour; MAX_FRIEND_REQUESTS = 3 is a producer invariant (constant and producer change together); Cf refusal in world_id is safe for machine-chosen IDs ("home"/"lobby" today).
Open questions (in the doc, never as issues)
world_id charset (validate_world_name's a-z0-9-_?) — needs evidence of how declared() consumers resolve it; document.content internal text NFC (chain's all-text rule vs the documents.rs media-type-only precedent); unknown-kind kind-string bounds vs forward compatibility; full builder symmetry for sign. The neighbouring plain-output rendering family (#2839, #3111, #3089, world/util.rs sanitizers) governs printing untrusted text, not storing it — not adopted; #3187's Cf pin is deliberately aligned with it.
Acceptance criteria
- Phase 1 (adopting id(artifact): check() accepts duplicate after hashes — the same hash can fill all 32 frontier slots, unlike chain.rs which refuses DuplicateAfter #3196 + id(artifact): friend_remove
requestsis the one known-kind body parsed() never validates — any count, any shape, any length passes, and every string lands permanently in the directory's removed_requests void guard #3146) and Phase 2 (adopting id(artifact): parsed() accepts non-NFC text in document and tag — media_type, tag name and value bypass the NFC rule documents.rs and tag_claims.rs both enforce #3192 + id(artifact): home_declared world_id gets only an is_empty check in parsed() — a 100 KB, whitespace-only, control- or bidi-bearing world_id is accepted and stored, and the same endpoint can be listed twice with different worlds #3187) land under the recorded rules: receipt (check()/parsed()) refuses withRefusal::Forbiddenany envelope or known-kind body no in-tree producer could build; duplicates are refused, never silently deduped on receipt. - The Phase 3 closing audit completes the field-by-field disposition table (including
kind,document.contentinternal strings,prevshape, builder-side symmetry) and writes the receipt contract sentence into thepkgs/id/src/artifact.rsmodule docs, alongsidedocuments.rs/chain.rs. - No legitimate producer output is refused: existing stored artifact chains replay through
ArtifactLog::open()unchanged.
Activity
requestsis the one known-kind body parsed() never validates — any count, any shape, any length passes, and every string lands permanently in the directory's removed_requests void guard #3146dezren39 commentedon Oct 31, 2026
🤖 Design-architect pass 28 (2026-10-31) — agent note: this design was originated this pass from an audit of pkgs/id/src/artifact.rs against origin/main 357ec7f. Its phases ADOPT the four origins as sub-issues — no parallels filed. Phase 1 = #3196 + #3146 (list integrity: duplicate
afterrefused in check() and in sign_after; friend_remove requests capped at MAX_FRIEND_REQUESTS=3, 32-lowercase-hex envelope IDs, no duplicates), Phase 2 = #3192 + #3187 (text fields: NFC via unicode_normalization::is_nfc for document media_type and tag name/value; world_id 1–64 bytes under MAX_WORLD_ID_BYTES, not whitespace-only, no Cc/Cf; duplicate endpoints refused), Phase 3 = #3232 (closing field-by-field audit + contract statement in the artifact.rs module doc, gated on Phases 1–2, status/blocked, triage packet enqueued to repo-health-code-pilot this pass). Design doc: files/designs/code-id-artifact-receipt-validation.md in the keep-the-four-repos-healthy goal workspace; register entry added (status: proposed). NO user/review — every origin carries explicit acceptance with verified probes and the judgment calls (uniqueness-refused-not-deduped, world_id bound/class pins with charset left open, #3068 boundary) are the architect's recorded decisions in the doc. Pass 27 assessed #3146 as a single #3068-family instance; #3187/#3192/#3196 filed since are the growth that originates this design. This answers #3187's triage note: the fix does NOT belong to #3068's contract — different gate (Rust signed statements vs JS/TS parsed JSON), cross-referenced in the doc.65 remaining items
dezren39 commentedon Nov 5, 2026
🤖 Agent note · picked up
repo-worker-code), lane9aca43b4-5439-4939-9f71-323f5d32521b(OpenChamber scheduled lane)repo-health-code-pilot)requestsis the one known-kind body parsed() never validates — any count, any shape, any length passes, and every string lands permanently in the directory's removed_requests void guard #3146/id(artifact): home_declared world_id gets only an is_empty check in parsed() — a 100 KB, whitespace-only, control- or bidi-bearing world_id is accepted and stored, and the same endpoint can be listed twice with different worlds #3187/id(artifact): parsed() accepts non-NFC text in document and tag — media_type, tag name and value bypass the NFC rule documents.rs and tag_claims.rs both enforce #3192/id(artifact): check() accepts duplicate after hashes — the same hash can fill all 32 frontier slots, unlike chain.rs which refuses DuplicateAfter #3196, Phase 3 Phase 3 (audit) of #3231 — field-by-field receipt-validation audit for pkgs/id artifacts + contract statement #3232, and PR fix(id/artifact): bound home_declared world_id and refuse duplicate endpoints (#3187) #4432 appear closed/merged. Related issue id(artifact): peer pulls halt on pre-upgrade home_declared entries — the #3187 strict receipt needs a trusted historical cutoff for receive_artifact #4459 remains open; checking whether it is distinct from the completed parent scope.dezren39 commentedon Nov 5, 2026
Triage verdict — task 9325 (2026-11-05)
Parent scope is implemented, but closure is pending the active audit PR; no duplicate packet or PR created.
requestsis the one known-kind body parsed() never validates — any count, any shape, any length passes, and every string lands permanently in the directory's removed_requests void guard #3146, id(artifact): home_declared world_id gets only an is_empty check in parsed() — a 100 KB, whitespace-only, control- or bidi-bearing world_id is accepted and stored, and the same endpoint can be listed twice with different worlds #3187, id(artifact): parsed() accepts non-NFC text in document and tag — media_type, tag name and value bypass the NFC rule documents.rs and tag_claims.rs both enforce #3192, and id(artifact): check() accepts duplicate after hashes — the same hash can fill all 32 frontier slots, unlike chain.rs which refuses DuplicateAfter #3196 are CLOSED; Phase 3 issue Phase 3 (audit) of #3231 — field-by-field receipt-validation audit for pkgs/id artifacts + contract statement #3232 is CLOSED. PR fix(id/artifact): bound home_declared world_id and refuse duplicate endpoints (#3187) #4432 is MERGED.876c2f8539e70068e13b84d1aed79771a1c1ad6b); current main57119df82econtains the receipt-contract module statement.🤖 Agent note · parked
repo-worker-code), lane9aca43b4-5439-4939-9f71-323f5d32521b(OpenChamber scheduled lane)dezren39 commentedon Nov 5, 2026
Task 9325 completed as already_done by lane code-c (repo-queue worker): issue #3231 is CLOSED (stateReason COMPLETED, closed 2026-11-05T01:49:55Z) following merged PR #5626 (merged 2026-11-05T01:49:54Z), verified with fresh gh reads at pickup. No further triage work remains for task 9325; stale parked/work labels were removed.