Skip to content

Conversation

@antongolub
Copy link
Collaborator

  • Tests pass
  • Appropriate changes to README are included in PR

@antongolub antongolub added the refactoring Internal code improvements label Jul 21, 2025
@antongolub antongolub requested a review from Copilot July 21, 2025 13:32

This comment was marked as outdated.

@antongolub antongolub requested a review from antonmedv July 21, 2025 14:18
@antongolub antongolub requested a review from Copilot July 21, 2025 14:53
Copy link

Copilot AI left a comment

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 refactors the ProcessPromise internal structure by consolidating context management into a unified _snapshot object approach. It simplifies the class by removing multiple individual private properties and centralizing configuration state.

  • Replaces individual properties (_cmd, _from, _stdio, etc.) with a consolidated _snapshot object approach
  • Introduces a Snapshot type and getSnapshot helper function for better type safety
  • Removes redundant property accessors and simplifies the promise resolution logic

Reviewed Changes

Copilot reviewed 8 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/core.ts Major refactoring of ProcessPromise class to use consolidated snapshot approach, introduces Snapshot type and getSnapshot helper
test/core.test.js Updates test setup to use new snapshot structure and adds test for kill() with empty pid
src/cli.ts Minor code reorganization - moves export statement and simplifies conditional logic
package.json Version bump to 8.7.2 and esbuild dependency update
build/ files Generated build artifacts reflecting the core changes
.size-limit.json Updated size limits reflecting bundle size changes

}
const from = getCallerLocation()
if (pieces.some((p) => p == undefined))
if (pieces.some((p) => p == null))
Copy link

Copilot AI Jul 21, 2025

Choose a reason for hiding this comment

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

The change from p == undefined to p == null alters the behavior. The original check with == undefined would catch both undefined and null values, while == null only catches null and undefined. Consider using strict equality === null || === undefined or reverting to the original logic if the intention was to catch both falsy values.

Suggested change
if (pieces.some((p) => p == null))
if (pieces.some((p) => p === null || p === undefined))

Copilot uses AI. Check for mistakes.
@antongolub antongolub merged commit e3f043a into google:main Jul 21, 2025
28 checks passed
@antongolub antongolub deleted the refactor-snapshot branch July 21, 2025 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactoring Internal code improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant