Skip to content

fix: clean up packed smoke processes - #62

Merged
altaywtf merged 3 commits into
mainfrom
fix/packed-smoke-lifecycle
Aug 15, 2026
Merged

fix: clean up packed smoke processes#62
altaywtf merged 3 commits into
mainfrom
fix/packed-smoke-lifecycle

Conversation

@altaywtf

@altaywtf altaywtf commented Aug 15, 2026

Copy link
Copy Markdown
Member

Summary

Prevent the packed-install smoke from leaving its exact mock API child behind after failure or interruption.

Changed

  • keep lifecycle handling in the existing packed-smoke script
  • stop and await the exact mock API child on every exit
  • abort an in-flight CLI request before teardown
  • preserve the normal result or conventional SIGINT/SIGTERM exit code

Risks

The change is limited to contributor smoke infrastructure and one directly owned child; it does not add a general lifecycle framework.

Verification

  • pnpm exec vp run verify
  • 283 repository tests pass with coverage
  • real SIGINT exits 130 and the exact child is immediately absent
  • real SIGTERM exits 143 and the exact child is immediately absent
  • autoreview clean with Codex gpt-5.6-sol at high effort

Complexity

One existing script, +97/-20 lines.

Copilot AI lite review requested due to automatic review settings August 15, 2026 09:12

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the packed-install smoke infrastructure to ensure subprocesses (mock API + any spawned commands) are reliably cleaned up after cancellation or failure, while preserving conventional signal exit codes and prioritizing primary failures over cleanup failures.

Changes:

  • Refactors smoke-packed-install.mts to run subprocess commands asynchronously under a shared interruption/abort controller, and to perform bounded cleanup on exit.
  • Introduces a reusable process-lifecycle.mts helper (plus Node test coverage) to centralize interruption capture, process-group termination, and outcome precedence.
  • Adjusts the test runner configuration so the new Node-based lifecycle tests run in the packed-smoke gate but are excluded from the existing Vite/Vitest test discovery.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
vite.config.ts Excludes scripts/**/*.test.* from Vite/Vitest discovery so Node test fixtures aren’t picked up inadvertently.
scripts/smoke-packed-install.mts Converts packed-install smoke to async execution with shared abort signal and structured cleanup/exit-code resolution.
scripts/process-lifecycle.test.mts Adds Node node:test coverage for signal handling, process-group termination, and lifecycle outcome precedence.
scripts/process-lifecycle.mts Adds lifecycle utilities for interruption handling and “owned” subprocess termination with TERM→KILL escalation.
package.json Runs the new lifecycle Node tests as part of smoke:pack before executing the packed-install smoke.
Suppressed comments (1)

scripts/process-lifecycle.mts:68

  • On Unix this always signals -child.pid (process group). If the child wasn't spawned detached / as its own process-group leader, this can fail with ESRCH and leave the actual child process running. Consider falling back to signaling the individual PID when the group signal fails.
  try {
    if (process.platform === "win32") {
      if (!hasExited(child)) child.kill(signal);
    } else {
      process.kill(-child.pid, signal);

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread scripts/process-lifecycle.mts Outdated
Comment thread scripts/process-lifecycle.mts Outdated
@altaywtf
altaywtf merged commit d6f496c into main Aug 15, 2026
6 checks passed
@altaywtf
altaywtf deleted the fix/packed-smoke-lifecycle branch August 15, 2026 12:57
putio-releaser Bot added a commit that referenced this pull request Aug 15, 2026
## [1.6.2](v1.6.1...v1.6.2) (2026-08-15)

### Bug Fixes

* clean up packed smoke processes ([#62](#62)) ([d6f496c](d6f496c))
@putio-releaser

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 1.6.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants