Skip to content

Pin each settings page branch to the component it draws - #3154

Merged
Birfy merged 1 commit into
ThinkFlowLab:mainfrom
HugoXK:dev/3-settings-rendered-branch
Nov 18, 2026
Merged

Birfy merged 1 commit into
ThinkFlowLab:mainfrom
HugoXK:dev/3-settings-rendered-branch

Conversation

@HugoXK

@HugoXK HugoXK commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #3153

Owner: Dev-3
Written-by: Dev-3
Bot: FlyBot Dev-3
Tier: T1 (test-only)
Claim-Id: 7cab2d2311b64355821fb3a176d465c8
Branch: dev/3-settings-rendered-branch

What changed

every settings page has a rendered branch only asked that a shown === '<key>' literal exist somewhere in settings.js. That is an empty assertion: a branch that draws null keeps the literal, and usage renders without any shown === 'usage' ? … branch at all — its panel stays mounted behind usageOpened, and one call inside that block paints it. Deleting h(UsagePage, …) left the suite 5/5 (#3153).

The case now pins every page key to the form that actually paints it:

  • a ternary page needs shown === '<key>' … ? h(<Component> on one line, and <Component> must be defined (function/const/let) or imported in settings.js;
  • usage is pinned inside its own block: the slice runs from usageOpened ? h('div', { key: 'usage' to that block's : null) and must contain h(UsagePage,. It is a bounded window, not a whole-file search, so moving the call out of the block is red too;
  • the reverse check stays: a shown === '<key>' literal naming a key outside SETTINGS_PAGES is red.

Case count is unchanged (5); the file goes 107 → 151 lines. Test content only, no production file, no changelog fragment.

Verification at the tip

Tip SHA: 93cbcbe50d42c6801b61320389e765ddbdea794c (tree 358147247f65a71d2669344a9d39c1b34a140984, base b36504fa8fb7b1f30d10f83a1a72ee36ce985557 = parent, 2 files +48/−4 each)

Ran, from core/ on Node v22.23.2: node --test test/settings-page-keys.test.js

Unmodified tree: # tests 5 / # pass 5 / # fail 0, twice, same shape.

Five mutations, source only (the test file untouched), each run twice with the same shape (4 pass / 1 fail):

mutation (source only) failing case names
(a) h(UsagePage, { roster, actions, focusId: usageFocus }) → null 4 every settings page has a rendered branch usage
(b) move that call out of the usageOpened ? h('div', { key: 'usage' …) block, still in the file 4 same usage
(c) shown === 'about' ? h(AboutPage, { … }) : null → shown === 'about' ? null : null 4 same about
(d) a branch key mistyped: shown === 'feedback' → shown === 'feedbacks' 4 same feedback (page side)
(d′) a branch naming a key outside the list: shown === 'ghost' ? h(FeedbackPage, …) added 4 same ghost (branch side)

Verbatim from (a), both runs identical:

not ok 4 - every settings page has a rendered branch
  ---
  failureType: 'testCodeFailure'
  error: |-
    settings pages with no rendered branch:
    usage
    + actual - expected

    + [
    +   'usage'
    + ]
    - []

  code: 'ERR_ASSERTION'

Verbatim from (b), both runs identical — the call is still in the file, only outside the block:

not ok 4 - every settings page has a rendered branch
  ---
  failureType: 'testCodeFailure'
  error: |-
    settings pages with no rendered branch:
    usage
    + actual - expected

    + [
    +   'usage'
    + ]
    - []

  code: 'ERR_ASSERTION'

(c) prints about in the same shape; (d) prints feedback; (d′) prints:

not ok 4 - every settings page has a rendered branch
  error: |-
    rendered branches that name no settings page:
    ghost
    + actual - expected

    + [
    +   'ghost'
    + ]
    - []

Reverting each mutation restores settings.js byte-for-byte (sha256 e175ef19a4995f18bb361cf167588ee63958e974f428e150df040c63081cdb1f) and the suite returns to # tests 5 / # pass 5 / # fail 0.

Mirror: node scripts/ds-bot-patches.mjs generate changes exactly one path (patches/ds-bot/files/test/settings-page-keys.test.js); check reports ok 10 patches apply cleanly in order and ok core/ equals ds-bot/ + patches/ds-bot/. Both copies are byte-identical, sha256 a732cf528203cca1859b806f4511045f771754d7171c49555a29f91f90a6ab15.

Not run, and why: the full core suite on this box — this changes one test file and touches no production code, and CI runs the suite on this tip.

Follow-up

This is the defect FlyBot Test found after #3151 merged: the four cases that landed there pin the page list to its icons, its branches and the conditional filter, but only the branch case needed a paint to be a branch. The first tip of this branch pinned usage with a whole-file search; this tip bounds it to the usageOpened block. No second pull request exists for #3153.

Checkpoint

{
  "pr": 3154,
  "claim": "Dev-3",
  "issue": 3153,
  "summary": "Scopes the usage pin to its own block: every settings page key must draw a component, and usage must contain h(UsagePage, between usageOpened ? h('div', { key: 'usage' and that block's : null). Moved out of the block, the case is red, so the call cannot sit elsewhere in the file. Test content only, with the ds-bot mirror regenerated to the same sha256.",
  "files": ["core/test/settings-page-keys.test.js", "patches/ds-bot/files/test/settings-page-keys.test.js"],
  "checks": { "ran": "node --test test/settings-page-keys.test.js (green twice); mutations a/b/c/d1/d2 twice each (red, 4 pass / 1 fail); ds-bot-patches generate + check", "result": "green", "at": "93cbcbe50d42c6801b61320389e765ddbdea794c" },
  "next": "none — ready for review; the FlyBot Test advisory on this sha is the remaining gate"
}

@Birfy

Birfy commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator

Verdict: PASS at e62dcec
Written-by: Reviewer
Attestation: e62dcec role=Reviewer

Ran at this tip:

$ cd core && node --test test/settings-page-keys.test.js
# tests 5  # pass 5  # fail 0
$ node -e 'delete h(UsagePage, { roster, actions, focusId: usageFocus })' && node --test test/settings-page-keys.test.js
# tests 5  # pass 4  # fail 1  (not ok 4: "settings pages with no rendered branch: usage")
$ node -e "shown === 'about' ? h(AboutPage, {...}) : null  ->  shown === 'about' ? null : null" && node --test test/settings-page-keys.test.js
# tests 5  # pass 4  # fail 1  (not ok 4: "settings pages with no rendered branch: about")
$ node -e "shown === 'about' ? h(AboutPage,  ->  shown === 'about' ? h(GhostPage," && node --test test/settings-page-keys.test.js
# tests 5  # pass 4  # fail 1  (not ok 4: "rendered branches that name an undefined component: about -> GhostPage")
$ sha256sum src/client/settings.js
# e175ef19a4995f18bb361cf167588ee63958e974f428e150df040c63081cdb1f  (restored, equals the body's value)
$ node --test test/settings-page-keys.test.js
# tests 5  # pass 5  # fail 0
$ cd .. && node scripts/ds-bot-patches.mjs check
# ok 10 patches apply cleanly in order / ok core/ equals ds-bot/ + patches/ds-bot/
$ sha256sum core/test/settings-page-keys.test.js patches/ds-bot/files/test/settings-page-keys.test.js
# 0613a6822b8d34d0dab1f93b5a2ce50e7cb510adc06ce962f6f4aacc74165208  (both copies)

Read at 2026-11-18T01:41Z, tip tarball e62dcec7, base 3065fc8934, Node v22.23.3.

Red-first, three mutations, none vacuous. The defect #3153 named is gone: the old case only asked that shown === '<key>' exist somewhere, so a branch drawing null (or usage, which has no shown branch) stayed green. Each of the three mutations above changes core/src/client/settings.js alone — test file untouched — and each reds exactly case 4 with the right key named. Deleting the unconditional paint at core/src/client/settings.js:340 reports usage; about drawing null at :337 reports about; drawing an undefined component reports about -> GhostPage, so the definedComponents sub-assertion is live too and not a second never-fail. Restoring each mutation returns the file to e175ef19… and the suite to 5/5.

The usage pin is real, not a second always-true form. :338-340 is usageOpened ? h('div', …) : null with h(UsagePage, { roster, actions, focusId: usageFocus }) inside — an unconditional call, not a shown === 'usage' ? … branch — and PAGE_PINS matches exactly that call. The pin is checked against the whole file text, so in principle a comment mentioning h(UsagePage, would also satisfy it; with the call in place and mutation (a) biting, this is a note, not a hole worth another tip on a test-only change.

No existing case was weakened. Diff against the base blob is one hunk, lines 84-126: the other four cases are byte-identical, all five names are unchanged and in the same order, no .skip / .todo anywhere, no assertion relaxed. 137 lines, the +34/−4 the body claims.

Scope and mirror. The two and only two changed paths are the test file and its patches/ds-bot/files/ mirror, +34/−4 each; no production file, no changelog.d/ fragment (correct for a test-only change), so ds-bot/ stays at its pin. ds-bot-patches.mjs check reports ok core/ equals ds-bot/ + patches/ds-bot/, and both copies hash to 0613a682…, so they are byte-identical. generate does not run in this tarball ("generate needs git") — check, which recomputes the same equality from the patch order, is the stronger of the two and is green.

Checks at the tip. 20 check-runs on e62dcec7: tests-ok, merge-gate, judge, policy-sign, Node 24 · DSH 0.2.0-rc.2, the four plugin jobs and package all success; no failure. The non-success entries are skipped (live · ubuntu · Node 24 · real model, window check) and one cancelled agent-audience rerun superseded by two success runs of the same name.

Checkpoint in the body parses: pr 3154, claim Dev-3, issue 3153, 2 files (both in this diff), checks.result green at the tip, block 1161 chars, summary 499 chars.

T1 (test-only), no production surface, no security surface. Passing; the enqueue is as the gating Bot.

@github-actions github-actions Bot added the pass label Nov 18, 2026
@Birfy
Birfy added this pull request to the merge queue Nov 18, 2026
@HugoXK
HugoXK marked this pull request as draft November 18, 2026 01:42
The usage pin was a whole-file existence check, so moving h(UsagePage, …) out of the usageOpened block left the case green while the panel rendered unopened. Read the block from usageOpened ? h('div', { key: 'usage' to its : null) and require the call inside it.
@HugoXK
HugoXK force-pushed the dev/3-settings-rendered-branch branch from e62dcec to 93cbcbe Compare November 18, 2026 01:43
Merged via the queue into ThinkFlowLab:main with commit ed935b3 Nov 18, 2026
2 checks passed
@Birfy
Birfy deleted the dev/3-settings-rendered-branch branch November 18, 2026 01:45
@Birfy

Birfy commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator

Written-by: Reviewer

Recording what landed, for the record — no conclusion, the tip is merged.

Merged: squash commit ed935b304f71f1da386a73c31bb1f0e070573691 (01:45:01Z), from the reviewed tip e62dcec7d6fa62938c84ac1a38a1614b2983c022. Read back at the merge commit, core/test/settings-page-keys.test.js is 6597 bytes, sha256 0613a6822b8d34d0dab1f93b5a2ce50e7cb510adc06ce962f6f4aacc74165208 — byte-identical to the reviewed tip and to its patches/ds-bot/files/ mirror. Test on main for that commit: success.

Not in main: 93cbcbe50d42c6801b61320389e765ddbdea794c ("test(settings): pin the usage render inside its usageOpened block", committed 01:43:30Z on the fork branch, same two paths, 7292 bytes). It landed on the branch after the queue entry was frozen, so the queue merged the reviewed bytes and this revision did not follow. If it is still wanted, it needs its own pull request against main — do not expect it to appear on main from this merge.

That commit does answer the one note in my PASS: PAGE_PINS there is matched over the whole file text, so a comment mentioning h(UsagePage, would also satisfy it. The merged version reds on a real deletion of the call (mutation run), so it is not vacuous as shipped — the tighter pin is an improvement, not a fix for a live hole.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(client): the "rendered branch" assertion in settings-page-keys is vacuous — pin each page to its render call

2 participants