Repository navigation
refactor(test): compress repetitive fixtures in mega-tests, batch 3 - #120294
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 7, 2026, 2:41 PM ET / 18:41 UTC. ClawSweeper reviewWhat this changesThe branch replaces repeated test setup objects with file-local default-and-override builders across agent, channel, memory, and gateway test suites. Merge readinessKeep open: this is an active protected maintainer PR with a clean, test-only fixture refactor and no concrete semantic regression found. Priority: P3 Review scores
Verification
How this fits togetherThe changed fixtures construct inputs for tests covering agents, channels, memory, and gateway behavior. The builders feed existing runtime paths and assertions without changing production code. flowchart LR
A[Test scenarios] --> B[Local fixture builders]
B --> C[Agent and channel tests]
B --> D[Gateway and memory tests]
C --> E[Existing runtime behavior]
D --> E
E --> F[Assertions]
Before merge
Agent review detailsSecurityNone. PR surfaceTests -2353. Total -2353 across 8 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain file-local builders with explicit edge-case overrides and merge after normal maintainer review of the exact head. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR refactors test setup rather than repairing a reported production failure. Is this the best way to solve the issue? Yes: file-local builders preserve ownership and avoid a new shared fixture API; inspection found their defaults and override order equivalent to the replaced literals. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against c25671cf275a. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
The forward-compat fixture contract's expected values are unchanged by this PR. Value preservation is proven by the unchanged test assertions; the refactor only moves repeated fixture literals into builder defaults, satisfying the dependency-inspection concern. |
|
Merged via squash.
|
…penclaw#120294) * refactor(test): compress subagent lifecycle fixtures * refactor(test): compress model resolution fixtures * refactor(test): compress Telegram bot fixtures * refactor(test): compress reply-agent e2e fixtures * refactor(test): compress Matrix SDK fixtures * refactor(test): compress QMD manager fixtures * refactor(test): compress gateway chat fixtures * refactor(test): compress gateway reload fixtures * fix(test): preserve raw Telegram secret fixture * fix(test): retain session fixture key type * fix(test): preserve raw reload secrets fixture * fix(test): retain gateway fixture parameter types
Related: #120124
AI-assisted: yes
What Problem This Solves
An audit of every
*.test.tsfile at least 1,500 LOC found eight eligible files with 1,537–1,650 exact repeated eligible lines each after the campaign, directory-ownership, and worker-priority exclusions were applied. Their repeated arrange objects obscured scenario-specific inputs and made fixture-wide changes unnecessarily risky.Why This Change Was Made
This batch adds local, domain-named
make*builders with dominant defaults and explicit overrides at each owning test boundary. Nested values are merged where required, and capability-absent negative fixtures remain explicit. No production code, shared helper surface, baseline, snapshot, test title, assertion contract, or test order changed.The eight selected files were committed independently, with four tiny file-scoped type-contract follow-ups from the changed gate. The final test-only diff removes 2,353 net LOC.
User Impact
None. This is a behavior-neutral test-maintenance refactor. Future cases can express only their meaningful differences while retaining the same runtime coverage.
Evidence
The batch-2-compatible census used exact trimmed physical lines at least 15 characters long, excluded complete import declarations and comment-only lines, retained strings occurring at least three times, and ranked
sum(frequency - 1). The selected files contained 12,780 repeated lines in aggregate; every file exceeded Worker A's 30% self-repetition threshold.Mechanical Vitest
list --jsontitle multisets were identical before and after:Focused Vitest proof, serialized in this worktree:
Static proof:
The initial delegated
node scripts/check-changed.mjsattempt recorded Crabbox runrun_e5d4bd79dc48; Blacksmith doctor failed, Daytona timed out, and Azure rejected its brokered image selector withadmin_required. The trusted-source local fallback above is the final green changed gate.Production-vs-test numstat against the requested base
5e477aff2adc0: