Skip to content

fix(ci): select mock consumers when module exports change - #164666

Merged
steipete merged 3 commits into
mainfrom
fix/mock-export-selection-spd10
Oct 4, 2026
Merged

steipete merged 3 commits into
mainfrom
fix/mock-export-selection-spd10

Conversation

@steipete

@steipete steipete commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes PR test-selection gaps when a first-party module gains exports that a test's closed vi.mock factory does not provide; eight hourly failures on 2026-10-03 exposed this class.

User Impact

No product behavior changes. PR CI retains affected mock consumers so missing mock exports are caught before the hourly run, preserving existing test cases and assertions.

Why This Change Was Made

The existing selection owner compares runtime export sets syntactically against preflight's comparison revision and selects every vi.mock/vi.doMock consumer of a changed module, including tests using shared mock installers. It reuses relative, workspace-package, and TypeScript-path resolution. Newly consumed bindings also retain tests shared by the caller and mock consumer, covering the observed case where the export already existed.

Missing history or unknown syntax retains coverage; unreadable current source fails preflight. No compiler program, parallel planner, new CI job, tier change, or worker increase is introduced. Main/hourly coverage is unchanged. Handwritten object fakes remain outside this module-export mechanism.

Evidence

  • Historical replay covers 7/8 observed failing jobs across four producer families: all nine workspace suites from 0c96fd043ab3, both SQLite suites from e6ec522a023d, and the recovery case from 3a8abe6955cc. The handwritten terminal fake from aff22764a883 remains out of scope by design.
  • 24 recent PRs: median +0 files / 0 predicted test seconds; maximum +344 files / 1,752 predicted test seconds. Median planner wall 12.65 → 13.93 seconds, maximum 26.50 seconds. Test seconds use existing timing hints; they are not measured CI wall time.
  • Linux full test-types, scripts types, source-contracts, architecture, check-changed (377 seconds), and boundary lint (108 seconds) passed. Full planner file passed 285 cases on the earlier candidate; the final 45 focused cases passed. P2 review is clean.
  • Real manifest entrypoint passed PR and scheduled-main inputs in both indexed same-SHA and sparse-fetched different-SHA harness shapes. Cold shallow-checkout proof materialized missing base blobs and retained the changed-export consumer.
  • Whole unit-fast passed 16,459 tests; tooling-isolated passed 371. Tooling shards 1/4 and 2/4 passed 6,748 and 5,900 tests. Shard 3/4 passed 6,497 with one unrelated bench-sqlite-reliability.test.ts failure: the unchanged SQLite worker argv owner drops --no-concurrent-sparkplug, failing an inherited compiler-policy probe. Shard 4/4 never executed due admission timeouts; the fallback fleet was at capacity. This is an explicitly accepted proof gap, not a whole-tooling pass.
  • Earlier unrelated install-smoke failures were fixed on main by fix(release): preserve publication and source provenance contracts #164595 (65fe6d98da24); its full 16-case file passed on Linux after incorporation. The final rebase preserved all six reviewed source/test/doc files byte-for-byte. Natural PR CI supplies the remaining CI-shape evidence; no dispatches or reruns.

Retain module-mock consumers when changed runtime exports or newly consumed
imports/re-exports can outgrow a closed factory. Reuse the pre-install source
scanner, import resolver, and bounded Node planner, including shared mock
installers and package aliases.

Strip TypeScript syntax with the existing native parser before comparing
runtime signatures. Unknown syntax and missing historical source retain mock
coverage; current checkout read failures reject preflight. Existing runtime
tiers and matrix bounds remain owned by the planner.
@clawsweeper

clawsweeper Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@steipete
steipete enabled auto-merge (squash) October 4, 2026 01:23
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation scripts Repository scripts size: L labels Oct 4, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 4, 2026
@clawsweeper

clawsweeper Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 3, 2026, 9:27 PM ET / October 4, 2026, 01:27 UTC.

ClawSweeper review

What this changes

The PR updates CI test selection to retain tests whose module mocks may become incomplete when exports or consumed bindings change, with regression coverage and documentation.

Merge readiness

✅ Ready for maintainer review

The repair remains useful: current main lacks the added mock-consumer protection, and no blocking patch defect was found.

Likely related people: @steipete (routing candidate; high confidence).

Priority: P2
Reviewed head: d62f86d1bdd5a57987f28568ea6c4e668c03cbf2

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-level repair with meaningful regression coverage and disclosed validation limits; no blocking defect was found.
Proof confidence 🌊 off-meta tidepool Not applicable: The verified repository-admin author is exempt from ordinary contributor proof. The captured body nevertheless reports the actual manifest entrypoint retaining changed-export consumers across CI checkout shapes; these claims were not independently rerun. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The verified repository-admin author is exempt from ordinary contributor proof. The captured body nevertheless reports the actual manifest entrypoint retaining changed-export consumers across CI checkout shapes; these claims were not independently rerun. No stored-data contract changes.
Evidence reviewed 9 items Pinned introduction and merge composition: Reviewed the merge-base-to-head introduction. The raw test-merge parents are exactly the pinned main followed by the pinned PR head; its delta contains the same six introduced paths and does not remove the base-only node-host test change.
Existing owner receives comparison revision: The manifest already supplies OPENCLAW_CI_CHANGED_BASE. The patch carries that revision into the existing bounded selector rather than adding a competing planner.
Mock-consumer selection: Export changes retain mock consumers and their transitive test users without ordinary depth limits. Newly consumed bindings retain the intersection of caller tests and mock-consumer tests; missing history conservatively retains coverage.
Findings None None.
Security None None.

How this fits together

CI preflight turns changed repository paths into a bounded test plan before dependencies are installed. The source scanner and import graph identify affected tests, which the existing planner assigns to CI jobs.

flowchart TD
 A[Changed files and comparison revision] --> B[Source scanner]
 B --> C[Runtime export and import comparison]
 B --> D[Import and mock consumers]
 C --> E[Affected test selection]
 D --> E
 E --> F[Existing CI job planner]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +557, Docs +1, Other +299. Total +857 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 3 561 4 +557
Docs 1 1 0 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 2 305 6 +299
Total 6 867 10 +857

Review metrics

Metric Value Why it matters
Production versus test growth production/tooling +423 net lines; tests +433 net lines The production growth implements dependency-free contract comparison and mock reachability in the existing planner, with its purpose stated in the PR.

Technical review

Best possible solution:

Keep mock-contract protection in the existing source scanner and bounded selector while preserving established CI scheduling limits.

Do we have a high-confidence way to reproduce the issue?

Yes, from source: a changed module can outgrow a closed mock beyond the ordinary importer-depth limit. The added planner fixtures exercise that selection boundary, but this review did not run them.

Is this the best way to solve the issue?

Yes. The patch extends the existing scanner, resolver, and selector with conservative fallbacks instead of restoring full-suite PR selection or adding another planning owner.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against fd69a4eedd30.

Labels

Label changes:

  • add P2: This repairs a concrete CI coverage gap without changing product behavior or reporting an urgent user-facing outage.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The verified repository-admin author is exempt from ordinary contributor proof. The captured body nevertheless reports the actual manifest entrypoint retaining changed-export consumers across CI checkout shapes; these claims were not independently rerun. No stored-data contract changes.

Label justifications:

  • P2: This repairs a concrete CI coverage gap without changing product behavior or reporting an urgent user-facing outage.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The verified repository-admin author is exempt from ordinary contributor proof. The captured body nevertheless reports the actual manifest entrypoint retaining changed-export consumers across CI checkout shapes; these claims were not independently rerun. No stored-data contract changes.

Evidence

What I checked:

  • Pinned introduction and merge composition: Reviewed the merge-base-to-head introduction. The raw test-merge parents are exactly the pinned main followed by the pinned PR head; its delta contains the same six introduced paths and does not remove the base-only node-host test change. (01cd3d6cb8cf)
  • Existing owner receives comparison revision: The manifest already supplies OPENCLAW_CI_CHANGED_BASE. The patch carries that revision into the existing bounded selector rather than adding a competing planner. (scripts/lib/ci-changed-node-test-plan.mts:468, d62f86d1bdd5)
  • Mock-consumer selection: Export changes retain mock consumers and their transitive test users without ordinary depth limits. Newly consumed bindings retain the intersection of caller tests and mock-consumer tests; missing history conservatively retains coverage. (scripts/test-projects.test-support.mts:4509, d62f86d1bdd5)
  • Current-main necessity: The pinned main selector uses ordinary import reachability and depth limits without the introduced mock-export selection. Its scanner returns imports and type-only imports without mock edges, so the central repair is not already present. (scripts/lib/test-selector-source-facts.mts:277, fd69a4eedd30)
  • Behavioral regression coverage: The introduced tests exercise selected targets through the planner boundary using relative, TypeScript-path, and package aliases, shared installers, newly consumed existing exports, missing history, and unchanged-export negative controls. They were inspected, not executed during this read-only review. (test/scripts/test-projects.test.ts:2826, d62f86d1bdd5)
  • Recorded validation and scope: The captured PR body reports historical replay retaining seven of eight observed failing jobs and real manifest-entrypoint validation across indexed, sparse-fetched, and cold shallow-checkout shapes. It explicitly excludes handwritten object fakes and discloses an unexecuted tooling shard and an unrelated tooling failure; no whole-tooling pass is inferred. (d62f86d1bdd5)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete merged commit 2ed30d4 into main Oct 4, 2026
127 of 128 checks passed
@steipete
steipete deleted the fix/mock-export-selection-spd10 branch October 4, 2026 01:31
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 4, 2026
…64666)

* fix(ci): select consumers of changed mocked module contracts

Retain module-mock consumers when changed runtime exports or newly consumed
imports/re-exports can outgrow a closed factory. Reuse the pre-install source
scanner, import resolver, and bounded Node planner, including shared mock
installers and package aliases.

Strip TypeScript syntax with the existing native parser before comparing
runtime signatures. Unknown syntax and missing historical source retain mock
coverage; current checkout read failures reject preflight. Existing runtime
tiers and matrix bounds remain owned by the planner.

* style(ci): format mock selection regression guard

* test(ci): require cross-area mock consumer coverage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant