Repository navigation
docs(review): rule 36 — an acceptance instrument's pre-state must be an observation - #1892
Merged
Merged
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this adds
One rule to
docs/development/review-checklist.md, in a new## Acceptance instrumentssection: 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>/messagesreading 400 before → 200 after. Measured: 404, before and after. The route'sIntegration.findrequiresconfig.agentAccessEnabled: true, and that gate sits aboveresolveDiscordBotToken, so the branch the change touched was unreachable — live flags on all three rows areagentAccessEnabled: 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'smoltbot.jsonchannel binding against env — was empty for the same kind of reason:channels.discord.accountscount 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
Scope
Docs only, one file, +4 lines. No code, no version slot, no test.
docReferencesdoes not scandocs/prose, so no guard is affected.Single gate: @wren (docs/shape).