Skip to content

docs(review-checklist): two rules earned by #1734 — a fixture that skips the schema, and a guard set enumerated by its refusal code - #1735

Merged
lilyshen0722 merged 1 commit into
mainfrom
kai/task044-review-checklist-fixture-rule
Sep 18, 2026
Merged

lilyshen0722 merged 1 commit into
mainfrom
kai/task044-review-checklist-fixture-rule

Conversation

@lilyshen0722

Copy link
Copy Markdown
Contributor

Two incident-derived rules for docs/development/review-checklist.md, both earned by TASK-043 / #1734. Docs only.

Rule 24 — Tests and assertions: a fixture that builds its own document proves the reader can read a field, never that the field can be there

A test that constructs its own object exercises the read and skips the write, and the write is where a strict schema drops what the reader expects. In #1734 the route derived a runtime type from manifest.runtime.runtimeType, ManifestRuntimeSchema had no such path and was strict, so the field was dropped on every write:

new AgentRegistry({manifest:{runtime:{type:'native',runtimeType:'native'}}}).toObject().manifest.runtime
  → { type: 'native', connection: 'mcp' }
AgentRegistry.schema.path('manifest.runtime.runtimeType')  →  undefined

The route's own suite stayed green because its fixture was a plain object; the seeder's enum-invalid type:'native' persisted precisely because findOneAndUpdate skips validators; and the fallback had been dead on every row ever written. Check: for each cross-layer read, confirm the writing schema declares the path, and confirm one test round-trips a document through the real model. A path whose every test builds its own object is unproven, and mutating the schema will not redden it.

Rule 25 — Guards and predicates: enumerate a guard set by its refusal code, not by its predicate

Guards refusing the same operation for the same stated reason can be implemented by different mechanisms, so a predicate grep returns a closed-looking set that is not closed. On #1734 I grepped isCloudRuntime, found exactly two call sites, and told a reviewer "the gate lives only in routes/registry/install.ts". cloud_agents_not_entitled has three sites: registry/install.ts and registry/provision.ts gate via isCloudRuntime; personas.ts gates runtime-agnostically on role + entitlements.cloudAgents before calling hirePersona. The hire path was gated all along, and the incomplete map had already been used to argue which paths a ruling had to cover. Check: grep the refusal code the client branches on, read every hit, then say whether a path reaches a gate.

Placement

Each rule sits at the end of its thematic section rather than in numeric position, because the sections group by kind and the file already carries out-of-order numbers (23 sits after 17). If you would rather have the numbers re-sorted, say so and I will do it separately.

Evidence

  • Diff: 4 insertions, one file, no code, no behavior.
  • git diff origin/main --stat → docs/development/review-checklist.md | 4 ++++
  • The quoted measurements above were taken at fix(registry): make a manifest's declared driver identity persist #1734's head and are reproduced in that PR's task row.
  • Deliberately not touched here: the file contains duplicated rules — 18 appears three times (one copy a strict prefix of the other) and 19 four times, the earlier copies carrying a count claim ("the only reader … admin-only surface") that the latest copy corrects. Removing the superseded copies is a judgement call about someone else's prose, so it is a separate row rather than a rider on this one.

…ips the schema, and a guard set enumerated by its refusal code

Rule 24 (Tests and assertions): a test whose fixture builds its own document
proves the reader can read a field, never that the field can be there. The
write is where a strict schema drops what the reader expects, and
findOneAndUpdate does not run validators — so both failure halves can coexist
with a green suite. Check: for each cross-layer read, confirm the writing
schema declares the path and that one test round-trips through the real model.

Rule 25 (Guards and predicates): enumerate a guard set by the refusal code the
client branches on, not by the predicate. Two guards refusing the same thing
for the same stated reason can be implemented by different mechanisms, so a
predicate grep returns a closed-looking set that is not closed.

Both earned by TASK-043 / PR #1734.
@lilyshen0722
lilyshen0722 merged commit a204e72 into main Sep 18, 2026
13 checks passed
samxu01 pushed a commit that referenced this pull request Sep 18, 2026
… and 7

My own #1735 (merged as a204e72) appended these two rules to the tail of the
'Tests and assertions' and 'Guards and predicates' lists. Markdown numbers
ordered-list items by position, so rule 24 rendered as 5 and rule 25 as 7, and
neither 24 nor 25 appeared anywhere in the rendered document — measured with
marked@12: [1,2,3,4,24] renders 1..5 and [5,6,25] renders 5,6,7.

Relocating both after rule 23 makes document order ascend 1..25, so every rule
renders under its literal number. Text is byte-identical to what #1735 merged.
This supersedes that PR's placement paragraph.
lilyshen0722 added a commit that referenced this pull request Sep 18, 2026
…ric order so rendered numbers match their literals (#1736)

* docs(review-checklist): keep one copy of rules 18 and 19, and move rule 23 last so rendered numbers match their literals

Rules 18 and 19 had accumulated duplicate copies from successive appends.

18 (3 copies): the first is a strict prefix of the third; the second and third
are word-identical. Keep one.
19 (4 copies): copies 1, 3 and 4 are strict subsets of copy 4 — every word of
each still appears in order in copy 4 — so dropping them loses nothing. Copy 2
is the exception and is dropped deliberately: it carries the stale count claim
('the only reader in any route or controller ... an admin-only surface') that
copy 4 corrects to three readers in the whole tree, one of them
scripts/seat-output.ts. Copy 4 also records that earlier wording and why the
count is load-bearing, so the correction survives the deletion.

Rule 23 moves to the end (text byte-identical) because markdown numbers list
items by position, not by their literal number. With 23 sitting between 17 and
18 in one list, the rendered document showed rule 23 as '18' and rule 18 as '19'
(verified by rendering both revisions with marked@12). Document order 18..23
makes every one of the 23 rules render as its literal number. No rule is
renumbered: numbers are cited externally (ADR-028 rule 23, ADR-019 rule 9,
REVIEW.md §7).

* docs(review-checklist): relocate rules 24 and 25 — they rendered as 5 and 7

My own #1735 (merged as a204e72) appended these two rules to the tail of the
'Tests and assertions' and 'Guards and predicates' lists. Markdown numbers
ordered-list items by position, so rule 24 rendered as 5 and rule 25 as 7, and
neither 24 nor 25 appeared anywhere in the rendered document — measured with
marked@12: [1,2,3,4,24] renders 1..5 and [5,6,25] renders 5,6,7.

Relocating both after rule 23 makes document order ascend 1..25, so every rule
renders under its literal number. Text is byte-identical to what #1735 merged.
This supersedes that PR's placement paragraph.
lilyshen0722 added a commit that referenced this pull request Sep 18, 2026
…er (#1737)

Adding a rule to the tail of its thematic section is the intuitive move, and it
silently breaks the numbering: markdown numbers ordered-list items by position,
so the new rule renders under the section's next number and its own number
appears nowhere. #1735 did exactly that — rules 24 and 25 rendered as 5 and 7 —
and #1736 (d720685) fixed the instances by putting every rule in ascending
document order.

Rule numbers are cited by number elsewhere (ADR-028 rule 23, ADR-019 rule 9,
REVIEW.md §7), so a rendered number that disagrees with the citation is the
failure that reaches a reader. This states the convention where the next
contributor will see it, in the file's existing header style.

Docs only, one line. Rendered numbers are unchanged at 1..25 (marked@12), and
the note adds no list item.
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