Repository navigation
test: isolate npm packaging output per invocation - #918
Merged
Merged
Conversation
PR #918: test: isolate npm packaging output per invocation3 files, +268 / -107 Scope✅ PR scope looks good. Structural✅ No structural bloat detected. Slop✅ Slop indicators look low. Static Analysis✅ Oxlint found no issues. CorrectnessNo extraneous code patterns detected. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Packaging verification in #914 needs to run beside other checks without deleting their generated packages. The previous tests built into checkout-owned
packages/*/npm, and shared cleanup removed every member's output.What changes
Before: packaging cases shared source/output roots, and a clean-start refusal test could pass without proving stale artifacts were removed.
After: each invocation copies current source into its own scope-owned root, builds and consumes its real emitted packages there, and removes only that root. The refusal case seeds plausible stale ESM, declarations and package metadata before exercising the actual pre-refusal cleanup branch. Failed leaf builds expose package/command, status, stdout and stderr. The npm Git case names the contextual API composition across copies it already tests.
How it works
useNpmWorkspace()asynchronously copies source/config/assets, excluding generated npm/state and dependency directories. It joins in-flight preparation before root removal. A private symlink borrows the checkout's already preparednode_modulesread-only; copied Deno processes usemanual,cached-onlyandfrozenmodes. All emitted package installs and output remain private. The production builder and dependency declarations are unchanged.What must stay true
deno.lockunchanged. Runtime-owned cache is never inspected by the ownership envelope.How to verify it
deno task test scripts/tests/build-npm.test.ts scripts/tests/cli-npm-bin.test.tsThe final focused run passes 4 groups / 15 steps, 0 failed (3m36s), including the emitted Node consumers. Its external before/after envelope finds 0 differences across 1,714 tracked paths and 157,109 prepared entries, with identical lock SHA-256. Full fingerprints live outside the persistent runtime test, an Architect-approved placement that avoids repeated dependency walks in each shard. The approved prepared-dependency borrowing resolves Node declarations without changing production build behavior.
Three bounded temporary faults fail as intended and restore source bytes exactly: retaining stale output; first-owner cleanup deleting its peer's private npm directory; and leaf child exit 71 with distinct stdout/stderr markers. The corrected envelope registers asynchronous comparison with
ensureinside a scoped owner before child launch and publishes its outcome after joined teardown. A failed-command validation still completes the full comparison with zero differences. The earlier positive comparison/output and its superseded artifact source remain preserved.Delivery verification passes independently:
deno task lint,deno task check,./node_modules/.bin/tsc --noEmit -p tsconfig.node.json, anddeno task check:jsr(Success Dry run complete). These packaging files retain their existing Deno-only eligibility; real emitted Node consumers run within the focused evidence. No full runtime corpus or CI verdict is claimed or monitored.Architect PASS covers exact signed commit
a89dd0cb95eed771bd47fba2a0c7c2966a081b67. Commands, first failures, fault patches/restored hashes, positive and failed ownership results, and cleanup trace are retained under/private/tmp/xmd-test-improvements-20261014, withslice2-handoff.md,slice2-controls/, andslice2-corrected-controls/as the entry points.Scope
Included: three packaging test/helper files and their directly related leaf diagnostic/composition name. No production, public API, dependency, release configuration, runtime exclusion or CI concurrency changes.
This branch has independent base
62d1086703ec72ca6d3b6e90a596ee716c571237. Current main was fetched asb037f2243733f34ea53fe4c3df5718119eb7b5cc;main...HEADcontains exactly the three packaging files. There is no unmerged stack dependency.Selected issue work is accounted for separately: assertion/contracts in merged #915; Core/Workflow classifications and navigation in ready #916; Web settlement, script diagnostics and bounded consolidations in ready #917; and packaging ownership here. This PR references #914 without closing it.
New abstractions
useNpmWorkspace()replaces the shared cleanup helper because both build-npm and CLI packaging cases need current source with invocation-owned output and teardown. It stays local to those tests.Risks and limitations
The private fixture intentionally reads the existing prepared dependency layout. The host envelope verifies that layout remains unchanged on positive and failed paths. Exhaustive runtime execution and required remote checks remain the merge gate.
Scope confirmation