Skip to content

test: derive package-root launcher fixtures from their import closure - #188338

Merged
steipete merged 2 commits into
mainfrom
claude/ecstatic-tereshkova-7d00a6
Nov 5, 2026
Merged

steipete merged 2 commits into
mainfrom
claude/ecstatic-tereshkova-7d00a6

Conversation

@steipete

@steipete steipete commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes: CI integration shards break with ERR_MODULE_NOT_FOUND when a package-root launcher module (cli-invocation.mjs, node-runtime-env.mjs, ...) gains a new sibling import. About ten test fixtures copied these modules from independent, hand-maintained lists. On 2026-10-24 that broke CI twice: #182306 (fixed by #182464) and #182856 (fixed by #182990).

User Impact

User impact: no user-visible change. Contributors who add a sibling import between package-root .mjs modules no longer break unrelated integration shards. A fast unit test names the missing file instead.

Why This Change Was Made

scripts/lib/package-root-modules.mts exports collectPackageRootModules(entries). It closes entry modules over their ./<name>.mjs sibling imports: static, re-export, side-effect, and dynamic. Every fixture now names only its entry modules:

  • the Vitest worker runtime assets and their 6 consumers
  • the launcher fixture and run-node-lifecycle
  • the node-compile-cache, sqlite-capabilities, docker-entrypoint, docker-packaging harness, bun-standalone-support, and node-bootstrap-artifact fixtures

The computed sets equal the previous hand lists (16 launcher files, 5 worker assets). There are no production code changes. vitestWorkerRuntimeAssets moved from vitest-worker-declarations.mts into the new module, so the declarations file stays pure metadata and the trusted PR-wrapper inventory is unchanged.

test/scripts/package-root-modules.test.ts replaces the single-list check from #182464 and checks three things:

  • For every package-root .mjs, the scanner matches an acorn parse.
  • package.json files contains every sibling import of each packaged module, failing as a.mjs -> b.mjs.
  • On a temporary fixture, the closure follows each import form, and a missing sibling names its importer.

Evidence

  • Mutation: adding import("./docker-entrypoint.mjs") to cli-invocation.mjs fails the packaging test with cli-invocation.mjs -> docker-entrypoint.mjs.
  • Converted consumers pass locally:
    • tooling launcher, run-node-lifecycle, and bun-standalone tests
    • 7 gateway node-bootstrap-artifact tests
    • infra compile-cache and sqlite tests
    • 4 cli-process candidate-authority tests through the prepared worker runtime
    • launcher-version e2e
    • the docker packaging harness test
  • After the first CI round, eager-import-closure, test-projects, pr-wrapper-source-closure, and package-root-modules (253 tests) pass locally.
  • Docker packaging harness: scripts/lib/check-limits.mts now imports release-context.mjs (fix: stop line-limit checks from blocking release branches #192806), so the harness also stages release-context.mjs and release-version.mjs. The trusted-harness test passes locally.

Test-line budget

The test-line ceiling is raised manually by exactly 74 lines (6479235 to 6479309, slack 0):

  • +25 net lines in this PR: the new closure, parity, and packaging test, net of the deleted single-list test and the shrunken fixtures.
  • 49 lines of inherited debt already on main at the base.

An allocation file can't cover this, because a combined allocation and scalar change exceeds the per-PR credit cap.

@clawsweeper

clawsweeper Bot commented Oct 30, 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 gateway Gateway runtime scripts Repository scripts size: M labels Oct 30, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-05T05:36:47.130864Z 76f017b New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a29096ee6a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@@ -1,15 +1,14 @@
import { collectPackageRootModules } from "./package-root-modules.mts";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Include the collector and its inputs in the wrapper inventory

The trusted-anchor extraction in scripts/pr copies only scripts/pr, scripts/pr-lib, and wrapper-components.txt entries. That inventory includes vitest-worker-declarations.mts but not the newly imported package-root-modules.mts, so loading the extracted declaration now throws ERR_MODULE_NOT_FOUND, and the existing PR-wrapper inventory test in test/scripts/eager-import-closure.test.ts detects the missing dependency. Adding only the collector is insufficient: its eager filesystem scan then throws missing entry module node-host-launcher.mjs, which is also absent from the inventory. Include both the collector and its required package-root input closure in the extraction inventory.

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 30, 2026
@clawsweeper

clawsweeper Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR derives launcher fixture files from sibling imports instead of maintaining separate copy lists.

Example: cli-invocation.mjs imports node-runtime-env.mjs.

  • Before: A fixture's manual list can omit node-runtime-env.mjs and fail with ERR_MODULE_NOT_FOUND.
  • After: The collector includes node-runtime-env.mjs automatically.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The consolidation has clear value and independent contract coverage, but the current patch breaks two existing tooling boundaries.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored tooling refactor is outside the ordinary contributor proof gate; supplied consumer-test and mutation claims support its intent, while exact-head CI exposes the tooling defects listed above.
Patch quality 🦪 silver shellfish (2/6) 2 actionable review findings remain.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
User problem: Contributors encounter integration failures when launcher imports change without matching updates to copied fixture inventories.
Reason: Prior merged repairs demonstrate recurring maintenance cost, and the maintainer-authored direction reasonably consolidates the inventories without changing product configuration.

Merge readiness

⛔ Needs changes before merge - 3 items remain

Keep this useful maintainer-authored PR open, but repair the wrapper extraction and compiled-runner regressions before merging.

Priority: P2
Reviewed head: a29096ee6aa88e97fe36a342ffa4fdb22efa1583

Before merge

  • Include the collector and its inputs in trusted wrapper extraction (P1) - The new import is reachable from the trusted PR wrapper through vitest-worker-artifacts.mts, but scripts/pr extracts only its own tree and wrapper-components.txt entries. That inventory includes this declaration module and omits package-root-modules.mts, so the extracted wrapper fails with ERR_MODULE_NOT_FOUND. Adding the collector alone still leaves node-host-launcher.mjs absent when the eager closure runs. Update the complete extraction closure or keep collection outside the wrapper's declaration-only dependency path. Exact-head CI confirms the missing collector and unresolved import, matching the existing review comment.
  • Keep closure evaluation out of declaration-only compiled consumers (P2) - Importing declarations now scans package-root files even when the caller only needs declaration metadata. The preserved compiled test-projects entry imports worker-run, then worker-artifacts, then this module. Its collector is emitted beneath dist/legacy-finalizer/scripts/lib, so ../../ resolves to dist/legacy-finalizer; worker assets are instead copied to the generation root, and preservedModuleBuildAssets does not populate that alternate root. The resulting missing-entry exception occurs before --help dispatch. Exact-head CI records this compiled help probe exiting 2 instead of 0. Evaluate the closure at the staging owner rather than requiring package-root files merely to import metadata.
  • Explain or restore the original intent of Shared worker declaration metadata - 7905e68: Separate metadata-only declarations from compilation and share them with artifact verification and tooling, as recorded in refactor(test): separate worker declaration metadata from compilation #144313.

Findings

  • [P1] Include the collector and its inputs in trusted wrapper extraction — scripts/lib/vitest-worker-declarations.mts:1
  • [P2] Keep closure evaluation out of declaration-only compiled consumers — scripts/lib/vitest-worker-declarations.mts:8-11

Provenance

Tests

  • Missing end-to-end proof: The supplied validation does not show passing trusted wrapper extraction and preserved compiled-runner help with the new collector dependency.
Agent review details

How this fits together

Test fixtures and worker compilation consume package-root entry modules and produce isolated runtime trees; the shared declaration registry also enters the trusted PR wrapper and preserved compiled tooling.

flowchart TD
  A[Package root entry modules] --> B[Sibling import collector]
  B --> C[Fixture staging]
  B --> D[Worker declaration registry]
  C --> E[Isolated runtime trees]
  D --> F[Trusted wrapper extraction]
  D --> G[Preserved compiled tooling]
Loading

Technical review

Best possible solution:

Keep automatic closure collection at staging boundaries while preserving metadata-only consumers and complete trusted extraction inventories.

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

Source inspection establishes the missing extraction dependency and incompatible compiled filesystem root, with exact-head CI failures supporting both paths; no target code was executed during this review.

Is this the best way to solve the issue?

Deriving narrow fixture closures is justified, but eager filesystem work in the shared metadata registry crosses existing extraction and compiled-tooling boundaries.

Full review comments:

  • [P1] Include the collector and its inputs in trusted wrapper extraction — scripts/lib/vitest-worker-declarations.mts:1
    The new import is reachable from the trusted PR wrapper through vitest-worker-artifacts.mts, but scripts/pr extracts only its own tree and wrapper-components.txt entries. That inventory includes this declaration module and omits package-root-modules.mts, so the extracted wrapper fails with ERR_MODULE_NOT_FOUND. Adding the collector alone still leaves node-host-launcher.mjs absent when the eager closure runs. Update the complete extraction closure or keep collection outside the wrapper's declaration-only dependency path. Exact-head CI confirms the missing collector and unresolved import, matching the existing review comment.
    Confidence: 0.99
  • [P2] Keep closure evaluation out of declaration-only compiled consumers — scripts/lib/vitest-worker-declarations.mts:8-11
    Importing declarations now scans package-root files even when the caller only needs declaration metadata. The preserved compiled test-projects entry imports worker-run, then worker-artifacts, then this module. Its collector is emitted beneath dist/legacy-finalizer/scripts/lib, so ../../ resolves to dist/legacy-finalizer; worker assets are instead copied to the generation root, and preservedModuleBuildAssets does not populate that alternate root. The resulting missing-entry exception occurs before --help dispatch. Exact-head CI records this compiled help probe exiting 2 instead of 0. Evaluate the closure at the staging owner rather than requiring package-root files merely to import metadata.
    Confidence: 0.96

Overall correctness: patch is incorrect
Overall confidence: 0.97

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Worker runtime asset closure guard keeps the original intent (002518c: Prevent missing sibling imports from breaking integration shards; the new scanner and packaging contracts preserve and broaden that purpose.)
  • Shared launcher fixtures and lifecycle copies keeps the original intent (b8d75ff: Consolidate copied launcher staging while preserving profile-sensitive launcher behavior; the derived closure retains that fixture responsibility.)
  • Compile-cache, SQLite, standalone support, bootstrap artifact, Docker entrypoint, and Docker package fixtures keeps the original intent (fix: retain local helper programs in standalone builds #183120: The supplied provenance and local history show repeated additions needed to keep isolated runtime fixtures self-contained; replacing those lists preserves their staging purpose.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

Acceptance criteria:

  • pnpm test test/scripts/eager-import-closure.test.ts --maxWorkers=1
  • pnpm test test/scripts/test-projects.test.ts -t 'prints wrapper help' --maxWorkers=1
  • pnpm test test/scripts/package-root-modules.test.ts test/scripts/run-node-lifecycle.test.ts test/scripts/bun-standalone-support.test.ts --maxWorkers=1
  • node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.test.root.tooling.json --incremental
  • git diff --check

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 71fac53 adds scripts/lib/vitest-worker-declarations.mts:5 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 71fac5359686; files: scripts/lib/vitest-worker-declarations.mts)
  • Vincent Koc: Raw commit 7905e68 adds scripts/lib/vitest-worker-declarations.mts:1 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 7905e684051c; files: scripts/lib/vitest-worker-declarations.mts)

PR surface

Tests +43, Other +37. Total +80 across 12 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 10 126 83 +43
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 2 42 5 +37
Total 12 168 88 +80

Labels

Label changes:

No label changes.

Label justifications:

  • P2: The consolidation addresses recurring test infrastructure failures, with no demonstrated installed-user runtime defect.
  • merge-risk: 🚨 automation: The introduced declaration dependency breaks trusted PR wrapper extraction and preserved compiled test tooling.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦐 gold shrimp and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 30, 2026, 8:58 AM ET / 12:58 UTC.

@steipete
steipete force-pushed the claude/ecstatic-tereshkova-7d00a6 branch from a29096e to 2c94805 Compare November 5, 2026 04:28
@openclaw-barnacle openclaw-barnacle Bot added the cli CLI command changes label Nov 5, 2026
Fixtures that stage package-root .mjs launcher modules kept hand-maintained copy lists, so a new sibling import (#182306, #182856) broke integration shards instead of a fast test. Fixtures now compute the closure of their entry modules, and a unit test checks the scanner against a module parser and that packaging includes every sibling import.
…est-line budget

check-limits.mts now imports release-context.mjs (#192806); the trusted-harness fixture copies scripts by hand. Raise the test-line scalar by the exact measured gap: +25 lines for package-root closure coverage plus 49 lines of inherited main debt.
@steipete
steipete force-pushed the claude/ecstatic-tereshkova-7d00a6 branch from 2c94805 to 76f017b Compare November 5, 2026 05:34
@steipete
steipete merged commit 94bea34 into main Nov 5, 2026
40 of 41 checks passed
@steipete
steipete deleted the claude/ecstatic-tereshkova-7d00a6 branch November 5, 2026 05:35

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 76f017bb6a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@@ -1 +1 @@
6326566
6326640

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep the shared test-line ceiling unchanged without approval

This raises the shared ceiling by 74 lines, including the 49 lines of inherited debt described in the commit message, rather than allocating only this change’s justified growth. Root AGENTS.md requires the baseline-exception policy, which explicitly preserves inherited debt and requires approval for scalar-only reconciliation; explaining why the allocation cap rejects the increase does not satisfy that requirement. Keep the scalar unchanged and use a per-change allocation for eligible growth, or obtain explicit approval for this broader reconciliation.

AGENTS.md reference: AGENTS.md:L99-L99

Useful? React with 👍 / 👎.

roboclaw-bot added a commit that referenced this pull request Nov 5, 2026
Integrate main 94bea34 to resolve the inherited test-line gate failure through the canonical #188338 reconciliation. Preserve all 20 reviewed renderer, cache, and backup candidate blobs.

Co-authored-by: galiniliev <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 6, 2026
…openclaw#188338)

Fixtures that staged package-root launcher modules kept about ten hand-maintained copy lists, so a new sibling import (openclaw#182306, openclaw#182856) broke integration shards instead of a fast test. Fixtures now name only their entry modules, and collectPackageRootModules computes the closure. vitestWorkerRuntimeAssets moved out of vitest-worker-declarations into the new module, so the trusted PR-wrapper inventory is unchanged. A unit test checks the scanner against an acorn parse and checks that package.json files includes every sibling import of each packaged root module. The docker harness also stages release-context.mjs (openclaw#192806). The test-line ceiling is raised by the exact measured gap: +25 lines for this coverage plus 49 lines of inherited debt.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes gateway Gateway runtime merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. scripts Repository scripts size: M status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant