Repository navigation
test: replace assertion chains with typed fixture builders — wave 3 - #124986
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs changes before merge. Reviewed August 17, 2026, 12:35 AM ET / 04:35 UTC. ClawSweeper reviewWhat this changesThe PR replaces repeated unsafe test fixture casts with typed fixture builders across test and test-support code. Merge readinessKeep open: the Control UI fixture helpers newly centralize an unsafe whole-object assertion and no longer preserve the asynchronous contracts this refactor is meant to expose. Priority: P3 Review scores
Verification
How this fits togetherTest fixtures provide mocked inputs to existing channel, gateway, CLI, agent, policy, daemon, and Control UI tests. This PR changes those fixture boundaries without changing production runtime behavior. flowchart LR
A[Test scenarios] --> B[Fixture builders]
B --> C[Mocked client and session contracts]
C --> D[Existing subsystem tests]
D --> E[Type and regression feedback]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource -8, Tests +48. Total +40 across 13 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Type the shared Control UI overrides to the actual generic asynchronous request and session-patch contracts, leaving any deliberately incomplete fixture boundary explicit at its call site. Do we have a high-confidence way to reproduce the issue? Yes: source inspection shows the fixture overrides accept synchronous unknown-returning methods where the production contracts require promises and an additional request option. Is this the best way to solve the issue? No: moving a broad assertion into a shared builder does not deliver compiler-checked fixtures; preserving the callable contracts is the narrower maintainable repair. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against d095113698b6. LabelsLabel justifications:
EvidenceAcceptance criteria:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (2 earlier review cycles)
|
9c4dc1f to
0625cb2
Compare
|
Land-ready verification for head
Focused proof inherited from the completed branch passed 675 discovered tests across the nine directly runnable targets. A fresh saturated-workstation rerun reproduced one timing-only anomaly: the existing memory-flush case exceeded its 120-second timeout after 69/70 assertions passed. The same exact head is green in CI and the earlier focused run passed 70/70, so no test timeout or behavior was changed in this fixture-only PR. ClawSweeper reviewed this exact head with no actionable finding; its only rank-up move was to wait for exact-head CI, now complete. Production LOC is +0/-0; test and test-support LOC is +962/-922 (net +40). Current main changed none of the 13 touched paths, so the behind-main drift is advisory and does not justify discarding fresh exact-head proof with a rebase. |
|
Merged via squash.
|
…penclaw#124986) * test: replace assertion chains with typed fixture builders — wave 3 * test: keep policy fixture type local * test: type gateway context fixture * test: type systemd stream fixture * test: type chat pane fixture overrides
What Problem This Solves
The next-highest test-fixture clusters still erased useful type information behind repeated chained assertions. That made mocks and scenario inputs easier to drift while hiding the intended runtime contracts from TypeScript.
Why This Change Was Made
This maintainer-requested wave extends the typed-fixture pattern from #124625 and #124865 across ten coherent clusters. Existing test-support owners now accept narrow typed overrides, existing fixture builders are reused where available, and intentionally malformed or heterogeneous boundary projections remain explicit instead of being hidden behind generic cast helpers.
The test-audit gate found no new or removed coverage, no behavior assertion changes, and no production seam. AI-assisted: yes. The final branch review reported no actionable findings.
User Impact
No user-visible runtime behavior changes. Maintainers get compiler-checked fixture setup and 327 fewer chained assertions while all existing test declarations and assertions remain in place.
Evidence
extensions/policy/src/doctor/register.sandbox-and-tools.test-utils.tssrc/agents/tools/sessions-access.test.tssrc/daemon/systemd.test.tsui/src/pages/chat/chat-pane-sharing.test.tsextensions/discord/src/send.creates-thread.test.tssrc/cli/program.force.test.tssrc/commands/doctor-legacy-config.migrations.test.tssrc/gateway/server-methods/chat.directive-tags.test.tsui/src/pages/chat/chat-pane.test.tssrc/auto-reply/reply/agent-runner-memory.test.tsFocused Vitest proof passed 675 discovered tests across the nine directly runnable target files: sessions 43, systemd 151, chat-pane sharing 31, Discord 42, CLI force 31, doctor migrations 77, Gateway chat 199, chat pane 31, and agent-runner memory 70. The policy aggregate extension runner stalled twice at its 15-minute local no-output cutoff; the exact-head extension production/test type lanes and all changed-file lint passed remotely.
node scripts/check-changed.mjspassed the complete changed matrix on Blacksmith Testbox: https://github.com/openclaw/openclaw/actions/runs/31993643550The final exact anti-slop scan reports only the 11 documented intentional boundary/projection cases.
git diff --checkis clean. Production LOC:+0/-0; test and test-support LOC:+962/-922(net+40).Final autoreview: clean, no accepted/actionable findings (
--mode branch --base origin/main, 183,019-byte bundle).Skipped after fresh classification:
ui/src/app/app-host.test.ts(49) andextensions/voice-call/src/webhook.test.ts(45): previously documented heterogeneous clusters.src/agents/embedded-agent-runner/run/attempt.llm-boundary.test.ts(39): output projections plus malformed media boundary fixtures.ui/src/pages/agents/agents-page.test.ts(35),ui/src/pages/chat/components/chat-message.test.ts(33), andsrc/cli/capability-cli.test.ts(31): multiple unrelated fixture/mock targets.extensions/discord/src/internal/gateway.test.ts(31): private-state/member projections, not fixture construction.extensions/anthropic/session-catalog.test.ts(30) andextensions/browser/src/browser/chrome.internal.test.ts(30): several distinct runtime/config/response types rather than one builder family.