close-report gates: a declared symbol must be implemented or owed, and mirrored contracts must move together (#1929 retro) #1940

Closed
opened 2026-09-27 22:29:55 +00:00 by matou-build-agent · 1 comment

Why

Two tickets in the #1929 set closed gate-clean while leaving a hole one level out:

  • #1934 declared mintSealingKey() and unlockFromSealedBox() on the steward bundle's interface and built the whole panel state machine against them. Nothing implemented them — the only references on main were the interface, signingSession.ts and three test files, so the phone unlock would have found both verbs undefined in a real browser. Filled in later by #1938.
  • #1933 added the sealed-passcode relay and proved every behaviour in appdoor_seam_test.go, but never extended internal/idp/testdata/app-door-golden.json — the fixture whose own note says "matou-app copies THIS file so neither side guesses the wire". matou-app#663's claiming agent read the golden, searched its repo, found nothing, and stopped. Filled in later by #1939.

Neither run misbehaved. close-report-lib.sh's five gates re-derive claims from git: commits reachable, changed_files ⊆ union diff, success needs a commit or a no_code_change reason, a non-zero tests[] exit refutes success, verdict consistency. That is provenance, and it works. But the criteria map is free text nothing checks, so "proven by " is indistinguishable from "proven end to end". Completeness in general is undecidable and should not be gated — but the two shapes above are mechanically checkable, and both cost a human a catch.

Precedent for the second shape already exists in prose: .sandcastle/prompt-enrichments/rules.md requires a package.json dependency change to ship its pnpm-lock.yaml update in the same commit, after #142 broke every swarm run for six hours. #1933 is the same class of miss, and shows prose does not hold when the consumer is another repo that cannot see this one.

What to build

1. binds: — a declared symbol must be implemented or explicitly owed

New task-manifest field. For every symbol the ticket's interface declares:

interface: |
  mintSealingKey(): { publicKey: string; fingerprint: string }
binds:
  - symbol: mintSealingKey
    defined_in: app/src/keriweb      # a NON-TEST path that must appear in changed_files
  - symbol: unlockFromSealedBox
    owed_by: 1938                    # or an OPEN issue that provides it

Gate: per entry, either the union diff defines symbol under a non-test path, or owed_by names an open issue. Neither → violation. This refuses #1934's exact envelope while still permitting the legitimate interface-first slice (#1930 shipped a verb #1934 consumed) — it only forces "who implements this" to be written down.

2. .sandcastle/mirrors.tsv — files that must change together

A repo-level registry, deliberately not a per-ticket field: the ticket that forgets the mirror is the ticket that forgets to declare it.

# trigger<TAB>mirror
internal/idp/appdoor.go		internal/idp/testdata/app-door-golden.json
internal/idp/appdoorpage.go	internal/idp/testdata/app-door-golden.json
package.json			pnpm-lock.yaml

Gate: a changed_files entry matching a trigger with its mirror absent → violation, waivable only by an explicit mirror_waiver: "<reason>" in the envelope, which then sits in the posted comment for a human to read. Seeding it with the package.json → pnpm-lock.yaml pair promotes today's prose rule to a checked one and proves the mechanism on a case we already know.

3. unproven_by_seam: — name what the seam cannot see

seam: dashboard/tests/unit via the injected steward-bundle loader
unproven_by_seam: the bundle's real sealing crypto — only #1936's live leg exercises it

Prose, not gated. It is the field whose absence let #1929's own breakdown ship #1934 without noticing the bundle half; triage can route on a non-empty value and design-verify can read it as a to-do list.

Where it lands

  1. docs/slices/README.md — the manifest shape gains all three fields, with the worked examples above.
  2. ~/.claude/skills/to-tickets/SKILL.md design-tier section — so future manifests carry them (note: a global skill, outside this repo; if it cannot be edited from the run, say so in the close-report and file the follow-up).
  3. .sandcastle/prompt.md — what a worker must emit, beside the existing envelope schema.
  4. .sandcastle/close-report-lib.sh (gates 6 and 7) + cases in .sandcastle/tests/close-report-lib-test.sh, which drives the library offline over a throwaway repo.

Acceptance criteria

  • Given a canned envelope declaring a symbol with neither defined_in in the diff nor an owed_by, when the gates run, then the close is refused naming that symbol.
  • Given a canned envelope whose binds entry carries owed_by pointing at an open issue, when the gates run, then it passes; and given the issue is closed or does not exist, then it is refused.
  • Given a canned envelope touching a registry trigger without its mirror, when the gates run, then the close is refused naming both paths.
  • Given the same envelope plus a non-empty mirror_waiver, when the gates run, then it passes and the waiver text appears in the posted comment.
  • Given an envelope with no binds and no registry trigger touched, when the gates run, then behaviour is unchanged — every existing passing envelope still passes (the new gates are additive and default-open).
  • Given malformed or non-list binds / a malformed registry line, when the gates run, then it fails closed as a violation, per the library's existing discipline.
  • Given #1933's and #1934's real envelopes replayed as fixtures, when the gates run, then both are refused — the regression test for this ticket's whole reason to exist.
  • docs/slices/README.md and .sandcastle/prompt.md document all three fields; the registry ships seeded with the appdoor/golden and package.json/pnpm-lock pairs.
  • .sandcastle/tests/close-report-lib-test.sh and preflight-swarm.sh's self-test still pass; STATUS.md updated in the same commit.

Out of scope

  • The test-selection hole. Gate 4 refutes success only on a listed failing test, so an agent that omits a suite from tests[] passes clean. Same root — the agent chooses its evidence — but the fix is a per-area required-suite set, which is a different change. File separately if wanted.
  • Retro-fitting manifests on the closed #1929 tickets. The set is nearly done and the two holes are already filled by #1938 and #1939.
  • Judging completeness in general. These two rules catch the two shapes that bit us, not a class.

Why ready-for-session

.sandcastle/** is protected from swarm workers (#445), and this ticket's core is close-report-lib.sh — the machinery that gates every other run. An interactive session makes the change and watches the preflight self-test.

Blocked by

None — can start immediately.

Task manifest

(carrying the fields it introduces, as the worked example)

task: close-report-gates-completeness
implements_flow: n/a — swarm process machinery
interface: |
  manifest fields: binds[], unproven_by_seam
  registry: .sandcastle/mirrors.tsv (trigger<TAB>mirror)
  envelope: mirror_waiver (optional)
  gates: 6 (binds) and 7 (mirrors), additive, fail-closed on malformed input
binds:
  - symbol: gate_binds
    defined_in: .sandcastle/close-report-lib.sh
  - symbol: gate_mirrors
    defined_in: .sandcastle/close-report-lib.sh
mirrors:
  - .sandcastle/close-report-lib.sh -> .sandcastle/tests/close-report-lib-test.sh
seam: .sandcastle/tests/close-report-lib-test.sh (offline, throwaway repo)
unproven_by_seam: >
  that future to-tickets runs actually EMIT the new fields — the skill lives
  outside this repo, so only a later ticket's manifest proves it took
acceptance:
  - given: a canned envelope declaring an unbound symbol with no owed_by
    when: the gates run
    then: the close is refused, naming the symbol
  - given: an envelope touching a registry trigger without its mirror
    when: the gates run
    then: the close is refused, naming both paths
  - given: "#1933's and #1934's real envelopes as fixtures"
    when: the gates run
    then: both are refused
  - given: any existing passing envelope
    when: the gates run
    then: it still passes
depends_on: []
out_of_scope: [test-selection completeness, retro-fitting closed manifests]
needs_human_decision: []

Filed from the #1929 retro (Ben, 2026-09-27): two closed tickets in that set passed their gates with a hole one level out, and both cost a human or a blocked agent the catch.

🤖 Generated with Claude Code

https://claude.ai/code/session_015es4bpK4qRqZhrRYQBWCiY

## Why Two tickets in the #1929 set closed **gate-clean while leaving a hole one level out**: - **#1934** declared `mintSealingKey()` and `unlockFromSealedBox()` on the steward bundle's interface and built the whole panel state machine against them. **Nothing implemented them** — the only references on main were the interface, `signingSession.ts` and three test files, so the phone unlock would have found both verbs undefined in a real browser. Filled in later by #1938. - **#1933** added the sealed-passcode relay and proved every behaviour in `appdoor_seam_test.go`, but never extended `internal/idp/testdata/app-door-golden.json` — the fixture whose own note says *"matou-app copies THIS file so neither side guesses the wire"*. matou-app#663's claiming agent read the golden, searched its repo, found nothing, and stopped. Filled in later by #1939. Neither run misbehaved. `close-report-lib.sh`'s five gates re-derive claims **from git**: commits reachable, `changed_files` ⊆ union diff, success needs a commit or a `no_code_change` reason, a non-zero `tests[]` exit refutes success, verdict consistency. That is provenance, and it works. But the **`criteria` map is free text nothing checks**, so "proven by <unit test over a fake>" is indistinguishable from "proven end to end". Completeness in general is undecidable and should not be gated — but the two shapes above are mechanically checkable, and both cost a human a catch. Precedent for the second shape already exists in prose: `.sandcastle/prompt-enrichments/rules.md` requires a `package.json` dependency change to ship its `pnpm-lock.yaml` update in the same commit, after #142 broke every swarm run for six hours. #1933 is the same class of miss, and shows prose does not hold when the consumer is **another repo that cannot see this one**. ## What to build ### 1. `binds:` — a declared symbol must be implemented or explicitly owed New task-manifest field. For every symbol the ticket's `interface` declares: ```yaml interface: | mintSealingKey(): { publicKey: string; fingerprint: string } binds: - symbol: mintSealingKey defined_in: app/src/keriweb # a NON-TEST path that must appear in changed_files - symbol: unlockFromSealedBox owed_by: 1938 # or an OPEN issue that provides it ``` **Gate:** per entry, either the union diff defines `symbol` under a non-test path, or `owed_by` names an open issue. Neither → violation. This refuses #1934's exact envelope while still permitting the legitimate interface-first slice (#1930 shipped a verb #1934 consumed) — it only forces "who implements this" to be written down. ### 2. `.sandcastle/mirrors.tsv` — files that must change together A **repo-level** registry, deliberately not a per-ticket field: the ticket that forgets the mirror is the ticket that forgets to declare it. ``` # trigger<TAB>mirror internal/idp/appdoor.go internal/idp/testdata/app-door-golden.json internal/idp/appdoorpage.go internal/idp/testdata/app-door-golden.json package.json pnpm-lock.yaml ``` **Gate:** a `changed_files` entry matching a trigger with its mirror absent → violation, waivable **only** by an explicit `mirror_waiver: "<reason>"` in the envelope, which then sits in the posted comment for a human to read. Seeding it with the `package.json` → `pnpm-lock.yaml` pair promotes today's prose rule to a checked one and proves the mechanism on a case we already know. ### 3. `unproven_by_seam:` — name what the seam cannot see ```yaml seam: dashboard/tests/unit via the injected steward-bundle loader unproven_by_seam: the bundle's real sealing crypto — only #1936's live leg exercises it ``` Prose, not gated. It is the field whose absence let #1929's own breakdown ship #1934 without noticing the bundle half; `triage` can route on a non-empty value and `design-verify` can read it as a to-do list. ## Where it lands 1. `docs/slices/README.md` — the manifest shape gains all three fields, with the worked examples above. 2. `~/.claude/skills/to-tickets/SKILL.md` design-tier section — so future manifests carry them (note: a global skill, outside this repo; if it cannot be edited from the run, say so in the close-report and file the follow-up). 3. `.sandcastle/prompt.md` — what a worker must emit, beside the existing envelope schema. 4. `.sandcastle/close-report-lib.sh` (gates 6 and 7) + cases in `.sandcastle/tests/close-report-lib-test.sh`, which drives the library offline over a throwaway repo. ## Acceptance criteria - [ ] **Given** a canned envelope declaring a symbol with neither `defined_in` in the diff nor an `owed_by`, **when** the gates run, **then** the close is refused naming that symbol. - [ ] **Given** a canned envelope whose `binds` entry carries `owed_by` pointing at an **open** issue, **when** the gates run, **then** it passes; **and given** the issue is closed or does not exist, **then** it is refused. - [ ] **Given** a canned envelope touching a registry trigger without its mirror, **when** the gates run, **then** the close is refused naming both paths. - [ ] **Given** the same envelope plus a non-empty `mirror_waiver`, **when** the gates run, **then** it passes and the waiver text appears in the posted comment. - [ ] **Given** an envelope with no `binds` and no registry trigger touched, **when** the gates run, **then** behaviour is unchanged — **every existing passing envelope still passes** (the new gates are additive and default-open). - [ ] **Given** malformed or non-list `binds` / a malformed registry line, **when** the gates run, **then** it fails **closed** as a violation, per the library's existing discipline. - [ ] **Given** `#1933`'s and `#1934`'s real envelopes replayed as fixtures, **when** the gates run, **then** **both are refused** — the regression test for this ticket's whole reason to exist. - [ ] `docs/slices/README.md` and `.sandcastle/prompt.md` document all three fields; the registry ships seeded with the appdoor/golden and package.json/pnpm-lock pairs. - [ ] `.sandcastle/tests/close-report-lib-test.sh` and `preflight-swarm.sh`'s self-test still pass; STATUS.md updated in the same commit. ## Out of scope - **The test-selection hole.** Gate 4 refutes success only on a **listed** failing test, so an agent that omits a suite from `tests[]` passes clean. Same root — the agent chooses its evidence — but the fix is a per-area required-suite set, which is a different change. File separately if wanted. - Retro-fitting manifests on the closed #1929 tickets. The set is nearly done and the two holes are already filled by #1938 and #1939. - Judging completeness in general. These two rules catch the two shapes that bit us, not a class. ## Why `ready-for-session` `.sandcastle/**` is protected from swarm workers (#445), and this ticket's core is `close-report-lib.sh` — the machinery that gates every other run. An interactive session makes the change and watches the preflight self-test. ## Blocked by None — can start immediately. ## Task manifest *(carrying the fields it introduces, as the worked example)* ```yaml task: close-report-gates-completeness implements_flow: n/a — swarm process machinery interface: | manifest fields: binds[], unproven_by_seam registry: .sandcastle/mirrors.tsv (trigger<TAB>mirror) envelope: mirror_waiver (optional) gates: 6 (binds) and 7 (mirrors), additive, fail-closed on malformed input binds: - symbol: gate_binds defined_in: .sandcastle/close-report-lib.sh - symbol: gate_mirrors defined_in: .sandcastle/close-report-lib.sh mirrors: - .sandcastle/close-report-lib.sh -> .sandcastle/tests/close-report-lib-test.sh seam: .sandcastle/tests/close-report-lib-test.sh (offline, throwaway repo) unproven_by_seam: > that future to-tickets runs actually EMIT the new fields — the skill lives outside this repo, so only a later ticket's manifest proves it took acceptance: - given: a canned envelope declaring an unbound symbol with no owed_by when: the gates run then: the close is refused, naming the symbol - given: an envelope touching a registry trigger without its mirror when: the gates run then: the close is refused, naming both paths - given: "#1933's and #1934's real envelopes as fixtures" when: the gates run then: both are refused - given: any existing passing envelope when: the gates run then: it still passes depends_on: [] out_of_scope: [test-selection completeness, retro-fitting closed manifests] needs_human_decision: [] ``` --- *Filed from the #1929 retro (Ben, 2026-09-27): two closed tickets in that set passed their gates with a hole one level out, and both cost a human or a blocked agent the catch.* 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_015es4bpK4qRqZhrRYQBWCiY
Author
Member

close-report — advances #1940 (DONE)

Both close-report holes from the #1929 retro are now mechanically refused. Ruled by agent under ADR 0174 — veto anytime (two-way: every change is a revertible commit/config, proven by an offline test + the live drift check; no one-way door — no spend, no security widening, no member-facing trust accept).

What landed

  • idss 84b58522 (this repo, pushed to main; pre-push drift gate green) — the re-vendor + repo-local files.
  • dev-factory 117a6cfd591f1ce830c55e17bc5f94eea38df163 (Matou/dev-factory main) — the vendored source. close-report-lib.sh, close-report.sh, preflight-swarm.sh, tests/close-report-lib-test.sh are FACTORY-VENDORED (ADR 0180, #932 drift gate), so the gate logic had to land upstream first, then idss bumped FACTORY_REF and re-vendored byte-identical (the factory-vendored-sandcastle-fix-path). The 2 commits idss was behind touched no vendored files, so the re-vendor was surgical.

The two gates (both additive + default-open — every existing passing envelope still passes)

  • Gate 6 (binds) — per declared symbol the union diff must DEFINE it under a non-test defined_in path (in changed_files), or owed_by must name a still-open issue. Neither → refused, naming the symbol; owed_by-closed / owed_by-missing → refused. This refuses #1934's exact envelope (two verbs declared, implemented nowhere) while leaving the legitimate interface-first slice legal. The open-issue check rides a cr_issue_state seam (CR_ISSUE_STATE_CMD in tests, forgejo_get in production — the library stays pure/offline; verified live: 1940→open, 1939→closed, 99999→missing).
  • Gate 7 (mirrors) — a repo-local .sandcastle/mirrors.tsv (trigger<TAB>mirror) registry, seeded with appdoor.go/golden, appdoorpage.go/golden, and package.json/pnpm-lock.yaml (promoting rules.md's #142 prose rule to a checked one). A changed_files entry touching a trigger without its mirror → refused naming both, waivable ONLY by a non-empty mirror_waiver (surfaced in the posted comment by close-report.sh). Kept repo-local (not vendored) so idss-specific pairs never leak to sibling consumers.
  • unproven_by_seam — documented as prose (not gated) for triage/design-verify.
  • Non-list binds, non-object entries, and malformed registry lines all fail closed.

Proof (acceptance criteria)

  • .sandcastle/tests/close-report-lib-test.sh — 30 checks (11 new) green: unbound symbol refused naming it; owed_by-open passes / owed_by-closed / owed_by-missing refused; test-path defined_in refused; non-list & non-object binds fail closed; trigger-without-mirror refused naming both; mirror_waiver passes; malformed registry line fails closed; #1933 and #1934 real envelopes replayed as fixtures → both refused; and the additive check (a no-binds/no-trigger envelope still passes with the registry present).
  • close-report-test.sh 95 green (the post_comment waiver change is safe); preflight-swarm.sh's guard_close_report self-test gains gate-6/7 fixtures and passes.
  • check-harness-drift.sh OK against FACTORY_REF; the stale-render advisory cleared (the prompt change lives in the source enrichment prompt-enrichments/workflow-verify.md, re-rendered into prompt.md).
  • Docs: docs/slices/README.md + .sandcastle/prompt.md document all three fields; STATUS.md updated in the same commit.

Residue (filed, not skipped)

  • #1942 — the GLOBAL to-tickets SKILL.md (in scope per the ticket) could NOT be edited from this run: ~/.claude/skills/ was absent from the session-runner host. The fields are documented in-repo and the gates enforce them; #1942 closes the authoring loop. This is the exact unproven_by_seam this ticket named for itself.
  • #1943 — the test-selection hole (gate 4 refutes only a LISTED failing test), explicitly out of scope here; filed as a per-area required-suite set.

No steering text was involved (this ticket carries no app-report origin marker).

## close-report — advances #1940 (DONE) Both close-report holes from the #1929 retro are now mechanically refused. **Ruled by agent under ADR 0174 — veto anytime** (two-way: every change is a revertible commit/config, proven by an offline test + the live drift check; no one-way door — no spend, no security widening, no member-facing trust accept). ### What landed - **idss `84b58522`** (this repo, pushed to `main`; pre-push drift gate green) — the re-vendor + repo-local files. - **dev-factory `117a6cfd591f1ce830c55e17bc5f94eea38df163`** (`Matou/dev-factory` `main`) — the vendored source. `close-report-lib.sh`, `close-report.sh`, `preflight-swarm.sh`, `tests/close-report-lib-test.sh` are FACTORY-VENDORED (ADR 0180, #932 drift gate), so the gate logic had to land upstream first, then idss bumped `FACTORY_REF` and re-vendored byte-identical (the [[factory-vendored-sandcastle-fix-path]]). The 2 commits idss was behind touched no vendored files, so the re-vendor was surgical. ### The two gates (both additive + default-open — every existing passing envelope still passes) - **Gate 6 (`binds`)** — per declared symbol the union diff must DEFINE it under a non-test `defined_in` path (in `changed_files`), or `owed_by` must name a still-**open** issue. Neither → refused, naming the symbol; owed_by-closed / owed_by-missing → refused. This refuses #1934's exact envelope (two verbs declared, implemented nowhere) while leaving the legitimate interface-first slice legal. The open-issue check rides a `cr_issue_state` seam (`CR_ISSUE_STATE_CMD` in tests, `forgejo_get` in production — the library stays pure/offline; verified live: 1940→open, 1939→closed, 99999→missing). - **Gate 7 (mirrors)** — a repo-local `.sandcastle/mirrors.tsv` (`trigger<TAB>mirror`) registry, seeded with `appdoor.go`/golden, `appdoorpage.go`/golden, and `package.json`/`pnpm-lock.yaml` (promoting rules.md's #142 prose rule to a checked one). A `changed_files` entry touching a trigger without its mirror → refused naming both, waivable ONLY by a non-empty `mirror_waiver` (surfaced in the posted comment by `close-report.sh`). Kept repo-local (not vendored) so idss-specific pairs never leak to sibling consumers. - **`unproven_by_seam`** — documented as prose (not gated) for triage/design-verify. - Non-list `binds`, non-object entries, and malformed registry lines all **fail closed**. ### Proof (acceptance criteria) - `.sandcastle/tests/close-report-lib-test.sh` — **30 checks (11 new)** green: unbound symbol refused naming it; owed_by-open passes / owed_by-closed / owed_by-missing refused; test-path `defined_in` refused; non-list & non-object `binds` fail closed; trigger-without-mirror refused naming both; `mirror_waiver` passes; malformed registry line fails closed; **#1933 and #1934 real envelopes replayed as fixtures → both refused**; and the additive check (a no-binds/no-trigger envelope still passes with the registry present). - `close-report-test.sh` **95** green (the `post_comment` waiver change is safe); `preflight-swarm.sh`'s `guard_close_report` self-test gains gate-6/7 fixtures and passes. - `check-harness-drift.sh` OK against `FACTORY_REF`; the stale-render advisory cleared (the prompt change lives in the source enrichment `prompt-enrichments/workflow-verify.md`, re-rendered into `prompt.md`). - Docs: `docs/slices/README.md` + `.sandcastle/prompt.md` document all three fields; `STATUS.md` updated in the same commit. ### Residue (filed, not skipped) - **#1942** — the GLOBAL `to-tickets` `SKILL.md` (in scope per the ticket) could NOT be edited from this run: `~/.claude/skills/` was **absent from the session-runner host**. The fields are documented in-repo and the gates enforce them; #1942 closes the authoring loop. This is the exact `unproven_by_seam` this ticket named for itself. - **#1943** — the test-selection hole (gate 4 refutes only a LISTED failing test), explicitly out of scope here; filed as a per-area required-suite set. No steering text was involved (this ticket carries no app-report origin marker).
matou-build-agent 2026-09-27 23:04:20 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Matou/idss#1940
No description provided.