Repository navigation
test(ui): split settings node suite by concern - #128788
Conversation
ui/src/app/settings.node.test.ts sat at 999 oxlint-counted lines against the 1000-line max-lines cap, so any added assertion failed the core lint shard — and, as in #128474, could pass locally while only the merge ref tripped the cap. Split the 42-test monolith along the surfaces it actually covers: the base file keeps gateway URL derivation, tab-local token handling, and per-gateway session scoping; preference persistence and layout persistence move to dotted siblings, matching the existing settings.sidebar-prefs.node.test.ts precedent. Test names and count are unchanged (47 across the settings node suites, before and after). The location/base-path/settings-fixture helpers and the storage lifecycle hooks are now shared from ui/src/test-helpers/settings-node.ts instead of being copy-pasted per file; sidebar-prefs drops its duplicate copies too.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
checks-node-compact-large-3 failed twice on this branch in different tests of node-worker-supervisor.container.test.ts, most recently with "SyntaxError: Unexpected end of JSON input" raised from the fake engine's load() while the supervisor ran `docker rm --force`. The shim saved container state with a truncating fs.writeFileSync while sibling shim invocations (rm, inspect, wait, ps) read the same path, so a reader could observe the zero-length window and exit 1. Write to a ".pending" sibling and rename over the target instead; rename is atomic, so readers always see a complete previous or next state. The ps handler filters on the ".container.json" suffix, so pending files are ignored. A concurrent write/read probe over the old pattern produced 2014 partial reads in 212900; the same probe over write-then-rename produced 0 in 203468. Not reproducible end-to-end on macOS, where the truncation window is far narrower than on the loaded Linux shard.
|
Codex review: needs maintainer review before merge. Reviewed August 24, 2026, 12:40 PM ET / 16:40 UTC. ClawSweeper reviewWhat this changesThe PR splits Control UI settings persistence tests into focused suites with shared test setup and replaces truncating fake-container state writes with write-then-rename. Merge readinessKeep open: current main has not absorbed this work, and source review found no actionable defect. The maintainer-authored, maintainer-labeled PR needs the normal human merge decision after exact-head CI finishes. Priority: P3 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherControl UI settings are loaded from browser storage and exercised by node-environment test suites that share module-level state. Separately, node-worker supervisor tests use a fake container engine whose commands read and update per-container state files. flowchart LR
A[Control UI settings] --> B[Node settings test suites]
B --> C[Shared storage lifecycle]
C --> D[Settings persistence module]
E[Worker supervisor tests] --> F[Fake container engine]
F --> G[Container state files]
G --> H[Concurrent shim commands]
Decision needed
Why: The protected maintainer label requires explicit maintainer handling even though the reviewed patch has no actionable finding. Before merge
Agent review detailsSecurityNone. PR surfaceSource +87, Tests -63. Total +24 across 6 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Merge this focused test-only maintenance once exact-head CI is green, retaining the shared lifecycle and fake-engine atomic replacement. Do we have a high-confidence way to reproduce the issue? Unclear for live execution: source establishes the fake-engine reader/writer boundary, but this read-only review did not run the race or test suites. Is this the best way to solve the issue? Yes: behavior-based test splitting with one shared lifecycle is preferable to a lint suppression, and atomic replacement belongs in the fake engine that owns the state file. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 59abf3de62c7. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
* test(ui): split settings node suite by concern ui/src/app/settings.node.test.ts sat at 999 oxlint-counted lines against the 1000-line max-lines cap, so any added assertion failed the core lint shard — and, as in openclaw#128474, could pass locally while only the merge ref tripped the cap. Split the 42-test monolith along the surfaces it actually covers: the base file keeps gateway URL derivation, tab-local token handling, and per-gateway session scoping; preference persistence and layout persistence move to dotted siblings, matching the existing settings.sidebar-prefs.node.test.ts precedent. Test names and count are unchanged (47 across the settings node suites, before and after). The location/base-path/settings-fixture helpers and the storage lifecycle hooks are now shared from ui/src/test-helpers/settings-node.ts instead of being copy-pasted per file; sidebar-prefs drops its duplicate copies too. * test(node-host): write fake container-engine state atomically checks-node-compact-large-3 failed twice on this branch in different tests of node-worker-supervisor.container.test.ts, most recently with "SyntaxError: Unexpected end of JSON input" raised from the fake engine's load() while the supervisor ran `docker rm --force`. The shim saved container state with a truncating fs.writeFileSync while sibling shim invocations (rm, inspect, wait, ps) read the same path, so a reader could observe the zero-length window and exit 1. Write to a ".pending" sibling and rename over the target instead; rename is atomic, so readers always see a complete previous or next state. The ps handler filters on the ".container.json" suffix, so pending files are ignored. A concurrent write/read probe over the old pattern produced 2014 partial reads in 212900; the same probe over write-then-rename produced 0 in 203468. Not reproducible end-to-end on macOS, where the truncation window is far narrower than on the loaded Linux shard.
What Problem This Solves
ui/src/app/settings.node.test.tssat at 999 oxlint-counted lines against its1000-line
max-linescap. Any contributor adding a single counted line to itfailed the
check-lint-core-*CI shard — and because the cap is evaluated onthe merge ref, two branches that each add a few lines can both pass locally and
fail only after merge. #128474 hit exactly that failure mode on
ui/src/app/bootstrap.test.ts; this file was the next one queued up to do it.Why This Change Was Made
The file had one 42-test
describestill titled "loadSettings default gatewayURL derivation" that had long since grown past gateway URLs into every
preference and layout key the settings module persists. Rather than cut it at
an arbitrary line number, it is split along the surfaces under test:
settings.node.test.tskeeps gateway URL derivation, tab-local tokenhandling, and per-gateway/per-base-path session scoping (16 tests).
settings.preferences.node.test.tstakes browser-local preferencepersistence: chat shortcut/follow-up/catalog target, sidebar live activity,
advanced toggle, message width, realtime Talk devices, theme, text scale,
pinned agents, and local user identity (21 tests).
settings.layout.node.test.tstakes chat split, workspace dock, boardsession views, and sidebar session layouts (7 tests).
Keeping the base filename follows the precedent set by the earlier
settings.sidebar-prefs.node.test.tssplit rather than renaming every sibling.The location/base-path/settings-fixture helpers and the storage lifecycle hooks
are genuinely shared by four files now, so they move into
ui/src/test-helpers/settings-node.tsin the style of the existinginstallBrowserHistoryIsolation;settings.sidebar-prefs.node.test.tsdropsits copy-pasted duplicates of the same helpers (-56/+14).
Tests were moved, never duplicated or rewritten, and no
max-linessuppressionor
config/max-lines-baseline.txtentry was added.User Impact
No runtime or user-visible change — test-file organization only. For
contributors, the settings suites now have 557 to 890 counted lines of headroom
instead of 1, so ordinary test additions stop tripping the core lint shard.
Evidence
Test names and counts are identical before and after — verified by diffing the
sorted
it()titles fromHEADagainst the new files (44 titles, byte-identical),plus the 3 in
settings.sidebar-prefs.node.test.ts:Counted lines vs the 1000-line test cap, measured with the rule's own counter
(a throwaway
max-lines: 1oxlint config), not an approximation:settings.node.test.tssettings.preferences.node.test.tssettings.layout.node.test.tssettings.sidebar-prefs.node.test.tsValidation run locally on this branch:
node --import tsx scripts/run-oxlint-shards.mts --only=core --split-core --core-stripe=5/5 --threads=1— cleannode scripts/check-changed.mjs— exit 0 (format, package patch guard, knip, i18n catalog, tsgo core tests + UI, full core lint)node_modules/.bin/oxfmtover all touched filesgpt-5.6-sol, high) — clean, no accepted findingsAlso in this PR: a CI flake fixed rather than waited out
checks-node-compact-large-3failed twice on this branch, in two differenttests of
src/node-host/node-worker-supervisor.container.test.ts— unrelated tothe UI split, which touches no
src/**code. The second failure named the causeoutright:
SyntaxError: Unexpected end of JSON inputfrom the fake engine'sload()while the supervisor randocker rm --force.The test shim saved container state with a truncating
fs.writeFileSyncwhilesibling shim invocations (
rm,inspect,wait,ps) read the same path, so areader could hit the zero-length window and exit 1. It now writes a
.pendingsibling and renames over the target; rename is atomic, so readers always observe
a complete previous or next state. The
pshandler filters on the.container.jsonsuffix, so pending files are ignored.A concurrent write/read probe over the old pattern produced 2014 partial reads
in 212900; the same probe over write-then-rename produced 0 in 203468. The
end-to-end failure does not reproduce on macOS even under 96-way CPU contention
— the truncation window is far narrower there than on the loaded Linux shard —
so the CI stack trace plus the mechanism probe are the evidence, not a local red
test.
Nearby, not touched
These are the next merge-ref landmines of the same kind:
ui/src/components/app-sidebar-session-navigation.tsis at 695/700and
ui/src/app/app-shell-view.tsat 681/700. Both are production files, sosplitting them is an ownership decision rather than a mechanical move; not
touched here.