Skip to content

test: isolate npm packaging output per invocation - #918

Merged
taras merged 1 commit into
mainfrom
agent/issue-914-packaging-ownership
Oct 15, 2026
Merged

taras merged 1 commit into
mainfrom
agent/issue-914-packaging-ownership

Conversation

@taras

@taras taras commented Oct 15, 2026

Copy link
Copy Markdown
Owner

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 prepared node_modules read-only; copied Deno processes use manual, cached-only and frozen modes. All emitted package installs and output remain private. The production builder and dependency declarations are unchanged.

What must stay true

  • Real current-source builds, skip-install refusal, declared/packed entries, worker relaunch, scripted Plan, named Plugin, contextual Git APIs, stdin, packaged documents, publishable manifests, Syntax and upgrade consumers remain. Existing synthetic closure cases remain unchanged.
  • One built owner remains live while another builds its own leaf. Joined cancellation removes only the first root; a controlled failing owner preserves its error and removes its root; the survivor's complete packed-artifact byte snapshot stays equal and its real Node import succeeds. Successful scope exit removes the survivor too.
  • Verification leaves tracked files, prepared dependencies and deno.lock unchanged. 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.ts

The 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 ensure inside 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, and deno 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, with slice2-handoff.md, slice2-controls/, and slice2-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 as b037f2243733f34ea53fe4c3df5718119eb7b5cc; main...HEAD contains 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

  • Every changed file supports the purpose described above.
  • Unrelated cleanup and formatting changes are excluded.
  • Mechanical path changes and the composition-case rename are identified.
  • The description matches the final diff and test results.

@github-actions

Copy link
Copy Markdown

PR #918: test: isolate npm packaging output per invocation

3 files, +268 / -107

Scope

✅ PR scope looks good.

Structural

✅ No structural bloat detected.

Slop

✅ Slop indicators look low.

Static Analysis

✅ Oxlint found no issues.

Correctness

No extraneous code patterns detected.

@taras
taras merged commit f2007e6 into main Oct 15, 2026
44 checks passed
@taras
taras deleted the agent/issue-914-packaging-ownership branch October 15, 2026 01:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant