Skip to content

docs(review): rule 37 — a read of a field answers one of three questions - #1894

Merged
lilyshen0722 merged 4 commits into
mainfrom
kai/rule37-field-questions
Sep 25, 2026
Merged

lilyshen0722 merged 4 commits into
mainfrom
kai/rule37-field-questions

Conversation

@lilyshen0722

@lilyshen0722 lilyshen0722 commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

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 401 from 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 writes botToken: '' beside real ids) and backend/services/discordService.ts:216 (ensureClientReady's guard, against the value backend/config/discord.ts:24 sets 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 $exists one line from its own value-shaped write filter; and slackProvider.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 — both botToken refusals are Discord-scoped (routes/integrations.ts:395 create, :706 patch), the server-owned strip runs for every type (:410, :708) and does not list botToken, and the PATCH persists it as config. + 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 with JSON.stringify. The slackProvider read is not a test bug and is tracked as its own row.

Numbering. main ends at rule 36 as of d1688a33 (#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 $exists advice 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 — ABSENT was the botToken read, which feeds no pre-state in rule 36, whose pre-state came from the agentAccessEnabled gate — so the sentence was dropped at the gate's word and rule 36 stands exactly as merged in d1688a33.

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 :708 runs for every type and does not list botToken, and :731 persists each incoming key as config.<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.

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.
@lilyshen0722
lilyshen0722 added this pull request to the merge queue Sep 25, 2026
Merged via the queue into main with commit 51ddd42 Sep 25, 2026
19 of 23 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