Skip to content

fix: keep affected tests for common importer names - #147754

Merged
shakkernerd merged 1 commit into
mainfrom
fix/test-importer-coverage
Sep 14, 2026
Merged

shakkernerd merged 1 commit into
mainfrom
fix/test-importer-coverage

Conversation

@shakkernerd

@shakkernerd shakkernerd commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes focused test selection dropping existing owners when a new importer is added for a source file with a common name. In #147665, a valid root test importing matrix/api.js caused selection for Matrix's channel.ts to omit channel.threading.test.ts. Broad matches can also leave tooling selection with a literal-reference test while dropping its direct-import test.

User Impact

Developers running focused source-file or changed-test commands get existing owner tests alongside newer consumers. Direct tooling selection also retains its imported tests when the same source name appears widely across the checkout.

Why This Change Was Made

The reverse-import scanner already reads candidate files and caches their resolved import edges before applying its 800-candidate limit. That limit now discards acquired facts: a narrow hit can make an incomplete importer list look complete, while tooling has no full-graph recovery for discarded direct imports.

Remove the obsolete limit and consume the existing facts. Keep helper-specific selection, direct-only tooling, traversal stopping at tests, tracked-file and filesystem inventories, live-test exclusions, and explicit full-graph and scan-failure behavior with their existing owners. Planning still reads source text without executing plugin runtimes. This change adds no dependencies, configuration, persistence, or Matrix runtime code.

Evidence

  • On trusted main dbb422c85a5, a tracked fixture containing the Matrix API import reproduces the original omitted-threading-test failure. The extended fixtures fail in three cases against the original implementation, with the no-narrow-import control passing; the candidate passes all six focused cases.
  • On candidate 0e044ec0f041, all 1,105 tests pass with the Matrix importer present: node scripts/run-vitest.mjs test/scripts/test-projects.test.ts test/scripts/test-projects-routing.test.ts test/scripts/ci-changed-node-test-plan.test.ts test/scripts/pr-crabbox-gate-plan.test.ts test/scripts/run-vitest.test.ts --reporter=dot.
  • The complete selected gate passes on the unmodified candidate tree: node scripts/check-changed.mjs -- scripts/test-projects.test-support.mts test/scripts/test-projects.test.ts, including scripts/root-test type checks, semantic lint, and static guards. The local publication preflight took 29 seconds; independent review is clean through P2.

Paired Linux measurements used one retained runner, three fresh Node processes per scenario, five repeated queries in each process, and both resolveChangedTestTargetPlan and buildVitestRunPlans. Times below are median cold changed-target planning; the Matrix scenarios include the same tracked API-import fixture.

Scenario Original Candidate Selected targets
Matrix source 2.871 s 2.889 s 2 → 7; threading restored
Shared temp-directory helper 4.249 s 4.199 s 1,620 → 1,686
Ordinary source with a sibling test 3.79 ms 3.49 ms Same target
Ordinary tooling source 2.26 ms 2.15 ms Same target
Index/full-graph fallback 1.728 s 1.711 s Same 8,421 targets
Explicit full-graph Matrix reference 1.786 s 1.522 s Same 7 targets

Cached Matrix queries measured 2.81 → 4.59 ms for the complete result. Every additional helper target has a verified relative-import path to that helper, and no previous helper consumer was removed. The complete Matrix reference is included because the original partial result's speed alone is not a valid comparison.

The same 1,105 routing tests also pass on the prospective merge with main c863c432c0ec (result tree 97cd85ec00a2). Changed mode selects seven Matrix targets including the parity check; explicit source mode selects the six consumer tests. Both include threading.

CI passed on the exact head. ClawSweeper rated that head Platinum with no findings.

@clawsweeper

clawsweeper Bot commented Sep 14, 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.

@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: S maintainer Maintainer-authored PR labels Sep 14, 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 Sep 14, 2026
@clawsweeper

clawsweeper Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 13, 2026, 11:22 PM ET / September 14, 2026, 03:22 UTC (Revision 3).

ClawSweeper review

What this changes

Removes an importer-count cutoff so focused test runs retain affected tests for common filenames, with regression coverage for cached selection and direct tooling imports.

Merge readiness

✅ Ready for maintainer review

This remains a useful, focused fix: current main still drops import candidates above the cutoff. No blocking correctness or security findings remain, and the supplied measurements support the repair.

Priority: P2
Reviewed head: 0e044ec0f0416408c3210b18f2951c625ab895ae

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A small owner-level repair with meaningful regression coverage and measured before/after planner behavior.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The supplied body records the real test planner running on Linux with a tracked Matrix importer at the candidate head: threading coverage returns, both planner entrypoints are exercised, and paired cold/cached timings quantify the result.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The supplied body records the real test planner running on Linux with a tracked Matrix importer at the candidate head: threading coverage returns, both planner entrypoints are exercised, and paired cold/cached timings quantify the result.
Evidence reviewed 8 items Introduced patch verified: The merge-base-to-head diff removes only the post-acquisition cutoff and extends existing regression fixtures. The verified test merge has the pinned base and head as its ordered parents and changes the same two files.
Current main still needs the fix: Current main skips terms with more than 800 candidates and returns a nonempty narrow result without full-graph recovery. Thus a narrow importer can conceal consumers found only through the common basename.
Released implementation also retains the cutoff: The v2026.9.4 source still contains the 800-candidate condition and skippedBroadTerm fallback. No released fix was established.
Findings None None.
Security None None.

How this fits together

OpenClaw’s test planner turns changed source paths into focused Vitest targets. Its reverse-import scanner connects those paths to consuming tests before the test runner selects its execution lanes.

flowchart LR
  A[Changed source paths] --> B[Test planner]
  C[Tracked source inventory] --> D[Import scanner]
  B --> D
  D --> E[Resolved importer edges]
  E --> F[Source traversal or direct tooling selection]
  F --> G[Focused Vitest targets]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +7. Total +7 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 2 67 60 +7
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 67 60 +7

Review metrics

Metric Value Why it matters
Recorded Matrix planning comparison 2 → 7 targets; cold planning 2.871 → 2.889 seconds The paired measurements show restored coverage with nearly unchanged cold-planning time.

Technical review

Best possible solution:

Keep complete resolved importer facts in the existing planner while preserving helper rules, direct-only tooling selection, and explicit full-graph fallback.

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

Yes: current-main source proves that a narrow importer plus more than 800 basename matches can suppress other consumers. The PR supplies matching before/after observations; this review did not execute tests.

Is this the best way to solve the issue?

Yes: removing the cutoff uses facts already acquired by the existing owner and fixes both source and tooling selection without introducing another routing mechanism.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The supplied body records the real test planner running on Linux with a tracked Matrix importer at the candidate head: threading coverage returns, both planner entrypoints are exercised, and paired cold/cached timings quantify the result.

Label justifications:

  • P2: Repairs silent omissions in focused developer test selection with a bounded tooling change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The supplied body records the real test planner running on Linux with a tracked Matrix importer at the candidate head: threading coverage returns, both planner entrypoints are exercised, and paired cold/cached timings quantify the result.
  • proof: sufficient: Contributor real behavior proof is sufficient. The supplied body records the real test planner running on Linux with a tracked Matrix importer at the candidate head: threading coverage returns, both planner entrypoints are exercised, and paired cold/cached timings quantify the result.

Evidence

What I checked:

  • Introduced patch verified: The merge-base-to-head diff removes only the post-acquisition cutoff and extends existing regression fixtures. The verified test merge has the pinned base and head as its ordered parents and changes the same two files. (scripts/test-projects.test-support.mts:1787, 0e044ec0f041)
  • Current main still needs the fix: Current main skips terms with more than 800 candidates and returns a nonempty narrow result without full-graph recovery. Thus a narrow importer can conceal consumers found only through the common basename. (scripts/test-projects.test-support.mts:1795, c2f7bfbc2401)
  • Released implementation also retains the cutoff: The v2026.9.4 source still contains the 800-candidate condition and skippedBroadTerm fallback. No released fix was established. (scripts/test-projects.test-support.mts:1762, 3a9d69db306c)
  • Regression coverage matches the failure: The existing fixture now covers both presence and absence of a narrow importer, checks initial and cached selection, and retains deleted/untracked/live-test exclusions. Tooling fixtures cover Git and filesystem inventories while excluding transitive imports and substring-only references. (test/scripts/test-projects.test.ts:2025, 0e044ec0f041)
  • Recorded production-planner observations: The complete supplied PR body reports paired Linux runs through resolveChangedTestTargetPlan and buildVitestRunPlans at the pinned candidate: Matrix selection grows from 2 to 7 targets and restores threading, with cold planning changing from 2.871 to 2.889 seconds. It also reports 1,105 passing routing tests and successful selected checks. These are contributor-recorded observations; this read-only review did not rerun code. (0e044ec0f041)
  • Existing acquisition and security boundary preserved: The scanner parses source through a Node-only reader with bounded concurrent reads and propagates scan failures. The patch consumes already acquired edges without changing subprocess commands, permissions, dependencies, persistent state, or plugin runtime execution. (scripts/lib/test-selector-source-facts.mts:35, 0e044ec0f041)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; 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.

History

Review history (2 earlier review cycles)
  • reviewed 2026-09-14T02:56:48.138Z sha 0e044ec :: needs maintainer review before merge. :: none
  • reviewed 2026-09-14T03:09:23.665Z sha 0e044ec :: needs maintainer review before merge. :: none

@shakkernerd shakkernerd self-assigned this Sep 14, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Sep 14, 2026
@shakkernerd
shakkernerd merged commit afd20f8 into main Sep 14, 2026
91 checks passed
@shakkernerd
shakkernerd deleted the fix/test-importer-coverage branch September 14, 2026 03:28
@shakkernerd

Copy link
Copy Markdown
Contributor Author

Fixed: focused test selection retains affected source and tooling tests for common importer names.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 14, 2026
Preserve complete affected-test selection for common source names while retaining existing helper and tooling routing.

Refs openclaw#147665.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: S 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