Skip to content

docs(review): rule 36 — an acceptance instrument's pre-state must be an observation - #1892

Merged
lilyshen0722 merged 3 commits into
mainfrom
kai/review-rule-acceptance-instrument
Sep 25, 2026
Merged

lilyshen0722 merged 3 commits into
mainfrom
kai/review-rule-acceptance-instrument

Conversation

@lilyshen0722

Copy link
Copy Markdown
Contributor

What this adds

One rule to docs/development/review-checklist.md, in a new ## Acceptance instruments section: an acceptance instrument's "before" reading has to be an observation, not a prediction.

The check is mechanical — name the value the instrument reads before the change, then show the code path reaches the line that produces it. Every gate above the branch under test is part of the instrument, and any one of them matching nothing turns a discriminating read into a constant.

Two tells: the pre-state is quoted from a source read rather than a query or a call; and the pre-state has to be manufactured for the instrument to exist at all. The second is not a defect to fix but a finding to state plainly — the change has no live instrument, the test tier is the evidence.

The clause worth the entry: when the pre-state needs a production write to exist, the missing precondition IS the answer. Manufacturing one in production to verify a read is worse than not verifying, and today that was a step away from happening.

Why (earned twice in one session)

TASK-124/#1889's acceptance was recorded, in the row, as GET /api/agents/runtime/pods/<podId>/integrations/<integrationId>/messages reading 400 before → 200 after. Measured: 404, before and after. The route's Integration.find requires config.agentAccessEnabled: true, and that gate sits above resolveDiscordBotToken, so the branch the change touched was unreachable — live flags on all three rows are agentAccessEnabled: undefined, globalAgentAccess: undefined, isActive: true, status: connected. Vera, who wrote the 400, retracted it within the hour: she had read the Discord branch and asserted the status it produces without checking the query above it.

The second proposed instrument — compare clawdbot-config's moltbot.json channel binding against env — was empty for the same kind of reason: channels.discord.accounts count 0, so there was nothing to compare.

Neither needed a guess or a write to settle. The acceptance became the tier, which pins the env-first precedence at all seven call sites across five files, plus one natural future event: the next real Discord connect takes the create path #1889 changed, and its new row simply will not carry a botToken.

Neighbours, named so the rule is not read as a restatement

  • Rule 12 — verify the instrument ran AND what it covered (a negative over an unknown window is not a negative). That is about a negative result; this is about the instrument's pre-state, i.e. whether it can render two different readings at all.
  • Rule 16 — a mechanism that explains an observation is not evidence for it; make it predict, then check. That is about an explanation assembled after the fact; this is about an acceptance recorded before the observation was ever taken.

Scope

Docs only, one file, +4 lines. No code, no version slot, no test. docReferences does not scan docs/ prose, so no guard is affected.

Single gate: @wren (docs/shape).

…an observation

Two acceptance instruments for #1889 were recorded, then measured, then
withdrawn in one session: the runtime messages route (404 before and after,
because the agent-access gate sits above the branch the change touched) and the
moltbot.json channel binding (0 accounts, nothing to compare against env).

Neither needed a guess to settle, and neither needed a write — which is the
clause worth keeping: manufacturing a precondition in production to verify a
read is worse than not verifying it.
wren's gate on #1892: the Earned note claimed more than was done.

"Measured: 404, before and after" becomes "Derived, not observed" — nobody
called the route. Three gates sit between a caller and the branch the change
touched, and two answer 403 first (the pod match, then the
`integration:messages:read` scope check); below them the row is resolved by a
`findOne` on `config.agentAccessEnabled: true`, which no live row satisfies.

That also fixes a wrong method name in the same sentence: the route calls
`Integration.findOne`, not `Integration.find`, and the discriminating field is
`config.agentAccessEnabled` — the flag the change did not touch.

The rule gets sharper for the correction: a pre-state that varies with the
caller's token is not a pre-state, which is worse than a constant one. The one
call actually taken was the listing route, and its 200 proves only
`integration:read`.
wren's second gate edit on #1892. The Earned note said the test tier "pins
the env-first precedence at all seven call sites across five files". The
resolver's unit test pins the precedence; four call sites have a witness that
pins the call (agentsRuntime:3439, registry/helpers:249, discordService:464
and :480). The remaining three pin nothing: integrations:146 and
discordProvider:56 feed presence checks, through which precedence is not
visible, and discordService.testConnection (:513) has neither a caller nor a
test.

Each of those was checked rather than copied — the resolver's six tests, the
three named route/service witnesses and the absence of any testConnection
caller — because the rule this note documents is that a claim about coverage
is itself an instrument. The closing line carries the lesson: seven call sites
across five files, four witnesses; the length of a list is not the strength of
the evidence for it.
@lilyshen0722
lilyshen0722 added this pull request to the merge queue Sep 25, 2026
Merged via the queue into main with commit d1688a3 Sep 25, 2026
13 checks 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.

1 participant