Skip to content

test(bundle): opt the node --check spawn out of NODE_V8_COVERAGE so the suite survives coverage.autoAttachSubprocess - #236

Open
hivecommons-hive[bot] wants to merge 1 commit into
mainfrom
quality/test-bundle-check-v8-coverage
Open

hivecommons-hive[bot] wants to merge 1 commit into
mainfrom
quality/test-bundle-check-v8-coverage

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

__tests__/bundle/bundle.test.ts only — the one pushable piece of #235 that is not blocked by another open PR.

is a syntactically valid bundle with no unresolved modules runs node --check dist/index.js via spawnSync with the inherited env. Node re-injects the parent's NODE_V8_COVERAGE into any child whose env object lacks that key, and on Node 26.10 node --check aborts under it:

TypeError: WeakRef: invalid target
    at SourceMapCacheMap.set (node:internal/source_map/source_map_cache_map:68:21)
    at maybeCacheSourceMap (node:internal/source_map/source_map_cache:198:29)
    at checkSyntax (node:internal/main/check_syntax:88:3)

Today nothing sets the variable on the vitest worker, so the test passes. The moment coverage.autoAttachSubprocess: true is enabled (the vitest 5 option that makes the bundle e2e child's V8 coverage reach the report — see #235) the worker carries NODE_V8_COVERAGE and this test is the only one in the suite that fails. Destructuring the key out of process.env does not work, because Node re-adds it; an explicit empty string is the documented opt-out.

Change: spawnSync(..., { encoding: 'utf8', env: { ...process.env, NODE_V8_COVERAGE: '' } }) plus a two-line comment.

Verified on main @ c48bd6d, Node v26.10.0:

  • npx vitest run --coverage → 69 files / 1447 tests pass, All files 99.83 | 98.35 | 100 | 99.82 (unchanged)
  • npx vitest run --coverage --coverage.autoAttachSubprocess → 69 files / 1447 tests pass (without this change: 1 failed, the --check test)
  • npx eslint __tests__/bundle/bundle.test.ts clean

Disjoint from every open hold-gated PR (#217, #219, #221, #223, #225, #227, #229, #230, #232, #234): none touch __tests__/bundle/.

Related Issue

Refs #235 (needs-human: the remaining deliverables — coverage.autoAttachSubprocess: true in vitest.config.mjs, which is occupied by #230 until it lands, and a tsc --sourceMap → ncc -s chain so dist/index.js hits remap to src/, which is a build-script change outside the quality lane — are laid out in the issue comment posted with this PR)


Filed by quality agent (hold-gated mode). Human review required.

— hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88

Node re-injects the parent's NODE_V8_COVERAGE into any child whose env
lacks the key, and `node --check dist/index.js` aborts under it on
Node 26 (WeakRef: invalid target in the source-map cache). Once vitest
runs with coverage.autoAttachSubprocess the worker carries that variable
and the bundle validity test fails. Pass an explicit empty value so the
syntax check runs without coverage.

Signed-off-by: quality <quality@hive.kubestellar.io>
@hivecommons-hive hivecommons-hive Bot added the hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 30, 2026
@hivecommons-hive
hivecommons-hive Bot requested a review from jpmcb as a code owner September 30, 2026 02:36
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

Important

Held for human review by the hive's ACMM level gate.

This PR was opened by the "quality" agent while Hive policy required a human checkpoint for that agent. Non-outreach agents are held at ACMM L3–L5; the outreach agent is always held because it publishes project-facing communication.

Hive will automatically remove the hold label once current policy no longer requires a level hold for "quality". If this is an outreach PR, a human must review it and remove the label.

@hivecommons-hive hivecommons-hive Bot added the hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 30, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

/kind cleanup


🐝 Hive Agent: quality | Instance: hosted-available-lke648397-260827-5q9t | SHA: unknown

— hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88

@github-actions github-actions Bot added kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. and removed needs-kind labels Sep 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hold Indicates that a PR should not merge because someone has issued a /hold command. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants