Repository navigation
test: complete current-plugin-metadata-snapshot mock factories - #129791
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 25, 2026, 11:36 PM ET / August 26, 2026, 03:36 UTC. ClawSweeper reviewWhat this changesThis PR completes Vitest mock factories for plugin metadata, removes a local leak workaround, splits an oversized agent test file, and refreshes the Control UI startup-size baseline. Merge readinessKeep open for maintainer merge handling: the factory sweep repairs the producer-side mock invariant and removes the consumer workaround, but the branch is behind current main, checks are incomplete, and its CI baseline update needs exact-head confirmation. Priority: P3 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherAgent and command tests mock the plugin metadata snapshot used by model and plugin discovery. Vitest factories must retain exports that sibling tests may import under shared-process test composition, while the Control UI baseline controls a CI performance gate. flowchart LR
A[Test suites] --> B[Vitest mock factory]
B --> C[Plugin metadata module]
C --> D[Scoped metadata reader]
D --> E[Agent and model tests]
F[Control UI build] --> G[Startup-size baseline]
G --> H[CI performance gate]
Before merge
Agent review detailsSecurityNone. PR surfaceTests +47, Other 0. Total +47 across 30 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the producer-side mock repair and test split, then rebase and validate the composed agent suites and Control UI performance gate against current main before merging. Do we have a high-confidence way to reproduce the issue? Yes, at source level: current main has a partial metadata-module factory while the consumer test imports the omitted module surface; the shared-process leak path is clear, though it was not executed in this dependency-less read-only checkout. Is this the best way to solve the issue? Yes for the test flake: repairing factories at their producers is preferable to retaining a consumer-side identity mock; the accompanying CI baseline still needs current-main validation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 9ab6df9f1983. LabelsLabel changes:
Label justifications:
EvidenceWhat 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 (1 earlier review cycle)
|
76bb857 to
9791abf
Compare
Explicit vi.mock factories for src/plugins/current-plugin-metadata-snapshot.ts exported only getCurrentPluginMetadataSnapshot; under isolate:false shard composition the incomplete mocks leaked into sibling files (CI incident: model-resolution-consistency.test.ts lost withPluginMetadataSnapshotScope, stopgapped in #129526). Convert all 27 incomplete factories to the importOriginal-spread form, overriding only the stubbed binding, and remove the now-unneeded self-defense identity mock. model.static-catalog.test.ts sat at the 1000-counted-line max-lines cap, so its canonicalizeManifestModelCatalogProviderAlias block moved to a new model.static-catalog.provider-alias.test.ts sibling (picked up by the agents-embedded lane glob) instead of adding a suppression.
9791abf to
b2472cd
Compare
|
Merged via squash.
|
…law#129791) Explicit vi.mock factories for src/plugins/current-plugin-metadata-snapshot.ts exported only getCurrentPluginMetadataSnapshot; under isolate:false shard composition the incomplete mocks leaked into sibling files (CI incident: model-resolution-consistency.test.ts lost withPluginMetadataSnapshotScope, stopgapped in openclaw#129526). Convert all 27 incomplete factories to the importOriginal-spread form, overriding only the stubbed binding, and remove the now-unneeded self-defense identity mock. model.static-catalog.test.ts sat at the 1000-counted-line max-lines cap, so its canonicalizeManifestModelCatalogProviderAlias block moved to a new model.static-catalog.provider-alias.test.ts sibling (picked up by the agents-embedded lane glob) instead of adding a suppression.
* origin/main: (24 commits) fix(gateway): reject rootless session permission modes (#128149) docs(memory): document shipped turn-taint propagation for network tool output (#129837) fix(ui): pool reply-less wake activity into one chat rollup (#128442) fix(package): prevent installs from deleting validated runtime assets (#129724) fix(nodes): approve silent initial node surfaces and name the pending surface approval (#129795) fix(backup): preserve configured agent state roots (#129773) fix(ui): own chat history issuance with a closed state machine (#129776) fix(cron): preserve cancellation reason after late finalization (#129331) fix(cron): prevent run waits from failing after clock changes (#129805) fix(telegram): route commentary through one frozen progress owner (#128259) fix(release): start approved VCR mirror recovery jobs (#129829) test: complete current-plugin-metadata-snapshot mock factories (#129791) test(telegram): remove duplicate reaction case (#129848) fix(channels): honor supported account reply-threading policies (#129679) refactor(cli): deduplicate lazy subcommand registration (#129351) fix(ai): report interrupted local-model streams instead of empty success (#129794) refactor(cli): consolidate Gateway fallback and hook ownership (#129802) fix(qa): reject token confidence lanes without executed evidence (#129830) fix(tui): fence session state and delayed actions (#129810) fix(control-ui): keep task progress full width on hover (#129832) ...
What Problem This Solves
~27 test files mocked
src/plugins/current-plugin-metadata-snapshot.tswith explicitvi.mockfactories exporting onlygetCurrentPluginMetadataSnapshot, violating the AGENTS.md rule that explicit factories must export every binding prod touches. Underisolate: falseshard composition these incomplete mocks can leak into sibling test files. Live incident:src/agents/embedded-agent-runner/model-resolution-consistency.test.tsfailed on CI withNo withPluginMetadataSnapshotScope export is defined on the mock; PR #129526 added a file-local self-defense identity mock as a stopgap.Why This Change Was Made
Repair the invariant at the producers instead of defending at one consumer: every incomplete factory now uses the importOriginal-spread form, overriding only the binding the test actually stubs, so leaked mocks still carry the full real module surface. With the sweep exhaustive, the stopgap identity mock in
model-resolution-consistency.test.tsis removed.src/agents/embedded-agent-runner/model.static-catalog.test.tssat at exactly the 1000-counted-linemax-linescap; completing its factory added a line, so per repo file-split guidance (never suppressmax-lines) itscanonicalizeManifestModelCatalogProviderAliasdescribe block moved to a new siblingmodel.static-catalog.provider-alias.test.ts(632 + 390 counted lines afterwards). The new file is picked up by the agents-embedded lane glob (src/agents/embedded-agent-runner/*.test.ts) — no vitest config change.User Impact
None at runtime — test-only change. Production LOC delta: 0. Removes a whole class of cross-file mock-leak flakes from the agents shards.
Evidence
rg -ln 'vi\.mock\([^)]*current-plugin-metadata-snapshot' src extensions test→ all 36 mocking factories now spreadimportOriginal; none export a partial surface.node scripts/run-vitest.mjs src/agents/embedded-agent-runner/model.static-catalog.test.ts src/agents/embedded-agent-runner/model.static-catalog.provider-alias.test.ts src/agents/embedded-agent-runner/model-resolution-consistency.test.ts→ 3 files, 36 tests passed (stopgap removed).node scripts/run-vitest.mjs src/agents/embedded-agent-runner→ 249 files, 3,376 tests passed.node scripts/check-changed.mjs→ formatting, policy guards, max-lines ratchet, core-test typecheck, oxlint batches all green.CI heal note
checks-node-compact-small-18failed on an earlier rebased head withstartup JS gzip: 340903 B vs 340900 B— main-side Control UI growth had consumed the 512 B rolling tolerance; this PR's diff is test-only and adds no UI bytes. A baseline refresh was briefly carried here, then dropped: main independently landed its own refresh in #129824 (22d3c550fca, baseline 340901 B), which covers the current bundle. This PR is now purely test-only again.ClawSweeper before-merge items applied: rebased onto current main and re-validated with exact-head CI; its live-verification "FAIL" was the harness's own 30 s timeout — the visible test lines all passed, and the same composition passes locally (36/36).