Repository navigation
docs(review): rule 37 — a read of a field answers one of three questions - #1894
Merged
Merged
Conversation
Adds `## Questions about a field` (rule 37): whether a stored field's KEY exists, whether its VALUE is usable, and whether the value can be used to AUTHENTICATE are three different questions with three different correct tests, and the same expression is right for one and wrong for another. Carries the corollary earned the same session: a well-formed test over a field with no writer answers its question about nothing, because the read is constant. Also appends one sentence to rule 36's earned note, recording that the read which produced its pre-state was itself a falsy-collapsed print. Droppable on the gate's word if rule 36 is better left as merged. Docs only; no source, no version slot.
vera asked for it from a live near-miss in her own count. Rule 37 gains the namespace form of the same failure: a query against a collection that does not exist answers exactly as a query against an empty one, so a count is evidence only after the thing counted is shown to exist. Her instance is recorded -- ConnectorSecret overrides Mongoose's pluralised name (models/ConnectorSecret.ts:35), so the pluralised one resolves to nothing and returned 0 indistinguishably from the real 0 -- with the one-query positive control. Pre-gate: #1894 has not been ruled on, so no clearance is invalidated.
- The middle rung is NON-EMPTY, not "usable": a non-empty stored token got 401, so non-emptiness cannot confirm usability. The three questions are a ladder; both correct instances are the value rung, stated plainly rather than papered over with "each answering a different question". - discordService.ts:214 -> :216 (the ensureClientReady guard). - The Slack sentence was false as written: a Slack POST body can persist config.botToken, since the server-owned-key stripping and both client-botToken refusals are Discord-scoped. What is accurate is that the live BIND never writes the field the provider reads, and that is what the text now says. - The shared predicate fixed the COUNT, not the print; the print was fixed in another seat's change with JSON.stringify. "The first two" claimed too much. - Drops the sentence I had added to rule 36: ABSENT was the botToken read, which feeds no pre-state in rule 36 -- the pre-state there came from the agentAccessEnabled gate, so the sentence named the wrong instrument for that rule.
The clause said the field's only writer is a caller-supplied POST body. PATCH writes it as well: the `botToken` refusal is Discord-scoped on both routes (`routes/integrations.ts:395`, `:706`), `stripServerOwnedConfig` runs for every type (`:410`, `:708`) and does not list `botToken`, and the patch persists each incoming key as `config.<key>` (`:731`). Now says POST or PATCH, with the strip's type-scope named rather than implied. TASK-139's write surface is therefore two routes, not one, and its row carries a correction note saying so.
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.
Docs-only: adds rule 37 (
## Questions about a field).The rule. A read of a stored field answers one of three questions — does the KEY exist, is the VALUE non-empty, can the value AUTHENTICATE — and a test is only correct relative to which rung it is on. It is a ladder rather than three synonyms, because a non-empty value can still fail to authenticate (a stored token that read cleanly got
401from the live API).value !== ''is a defect in a presence report and the accurate answer to the non-emptiness one; answering a later rung with an earlier rung's test is the family. The corollary is the part worth the entry: a test whose field has no writer answers its question about nothing — the read is constant, and a constant discriminates nothing, however well-formed the test is. The final clause is the namespace form of the same failure: a query against a collection that does not exist answers exactly as a query against an empty one, so a count is evidence only once the thing counted is shown to exist.Coverage, stated honestly. Both correct instances in this entry are the value rung —
backend/utils/discordBinding.ts:39(isSupplied, deliberately non-emptiness, because the consent callback writesbotToken: ''beside real ids) andbackend/services/discordService.ts:216(ensureClientReady's guard, against the valuebackend/config/discord.ts:24sets from the environment). The instances are rarer than the distinction, and the entry says so rather than implying it illustrates all three.Why now. Three reads of the same field family went wrong three ways in one session (2026-09-25, TASK-124/TASK-137): a falsy-collapsed print reported two rows holding
''as missing the key; the clear script counted the field's other store with$existsone line from its own value-shaped write filter; andslackProvider.ts:128's read answers a usability question about a field the live Slack bind never writes — its only writer is a caller-supplied body on POST or PATCH — bothbotTokenrefusals are Discord-scoped (routes/integrations.ts:395create,:706patch), the server-owned strip runs for every type (:410,:708) and does not listbotToken, and the PATCH persists it asconfig.+ key (:731). The count and the write are now pinned by one shared predicate (one edit reddens six of seven witnesses); the print was fixed in another seat's change withJSON.stringify. TheslackProviderread is not a test bug and is tracked as its own row.Numbering.
mainends at rule 36 as ofd1688a33(#1892), so 37 is free — this PR was held until that merged rather than cut alongside it.Scope note on neighbours, because the section sits adjacent to two existing rules and neither covers it: rule 34's
$existsadvice answers a presence question and needed this scope line, not a retraction; rule 36 checks the instrument's path, while this checks its subject.Not carried. An earlier revision of this branch appended one sentence inside rule 36's earned note, claiming the read that produced rule 36's pre-state was the falsy print. That was wrong —
ABSENTwas thebotTokenread, which feeds no pre-state in rule 36, whose pre-state came from theagentAccessEnabledgate — so the sentence was dropped at the gate's word and rule 36 stands exactly as merged ind1688a33.Correction at the gate (wren 74134/74135). An earlier head of this branch said the field's only writer is a POST body. That was false: PATCH writes it too — the refusal is Discord-scoped at
:706, the strip at:708runs for every type and does not listbotToken, and:731persists each incoming key asconfig.<key>. The sentence now says POST or PATCH and names the strip's type-scope, which also means TASK-139's write surface is two routes, not one.Gate: @wren.