Repository navigation
Build a package that ships a binding.gyp and names no install script - #1206
Draft
tolgaergin wants to merge 6 commits into
Draft
tolgaergin wants to merge 6 commits into
tolgaergin wants to merge 6 commits into
Conversation
tolgaergin
force-pushed
the
feat/implied-native-build
branch
2 times, most recently
from
November 16, 2026 13:40
d8976ec to
9d9f121
Compare
tolgaergin
force-pushed
the
feat/implied-native-build
branch
from
November 16, 2026 16:10
9d9f121 to
6925b14
Compare
A package with a `binding.gyp` at its root and no `install` or `preinstall` script is built with `node-gyp rebuild` by npm, pnpm, yarn and bun, and the registry reports it as having an install script. LPM read only the scripts the manifest names, so such a package was installed unbuilt, with nothing to approve and nothing to say it needed a build. The implied build is now the package's `install` script wherever its scripts are read: it is hashed, classified and listed for approval like a named one, and `lpm rebuild` runs it. A manifest with `"gypfile": false` opts out, as it does for npm. A package that names only a `postinstall` script and ships a `binding.gyp` gets the build too, so its script hash changes and an earlier approval of it is asked for again. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
`lpm query ":scripts"` and its `--assert-none` read a manifest's named scripts only, so a package built from its `binding.gyp` wasn't matched. `lpm audit` reported lifecycle scripts only from the list the registry gives, which has no entry for the implied build; it now also honors the registry's own flag for a version that has an install script. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
… again - The scan of a `binding.gyp` read `<!(…)` and `<!@(…)` up to the first closing bracket. It now reads the `>` and `^` forms too, to the bracket that closes them, and leaves the scan incomplete for what it can't judge: a `pymod_do_main` expansion, which imports a Python module of the package, an included `.gypi`, an expansion that never closes, and a `binding.gyp` it can't read. More packages reach this scan now that one with only a `binding.gyp` has a build. - An install records the revision of the rules that say which scripts a package has. A project installed under another revision is installed again once, so a package that had nothing to approve is listed, and an approval that no longer covers what would run is asked for again. - The quality check for install scripts honors `"gypfile": false`. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A command in a `binding.gyp` sits inside a quoted string, so its own quotes are escaped there. It was reported, and classified, with the escapes left in. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…leaves unread The scan looked for `<!(…)` in the text of a binding.gyp. gyp evaluates the file as Python first, so a command could be spelled so the scan didn't see it: with an escape, as two strings side by side, behind a variable, as a list, or under a name. A condition is itself Python that gyp evaluates, and actions, rules and build events hold commands that run during the build. The file is now read as the plain literal such files are written as, strings decoded as Python decodes them. A command is reported as before when it is a plain shell command. Everything else that can run something leaves the scan incomplete, so the package is reviewed on its own: a file that isn't a plain literal, a named or list expansion, a command built from a variable, a condition that does more than compare, a key the reader doesn't know to be inert, a setting that names a program or a command line, and a dependency on another build file. The config.gypi and common.gypi that node-gyp adds from the package's directory are read the same way. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ummarized The audit already counted a version the registry flags as having an install script without listing one. The install summary, the warning `lpm add` prints and the check for anything worth warning about read only the list, and so missed a package whose build its binding.gyp implies. They now share one reader, which names the install phases the manifest declares and `install` when it declares none. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
tolgaergin
force-pushed
the
feat/implied-native-build
branch
from
November 16, 2026 18:13
6925b14 to
c15cb62
Compare
This branch has not been deployed
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.
Summary
A package with a
binding.gypat its root and noinstallorpreinstallscript is built withnode-gyp rebuildby npm, pnpm, yarn and bun, and the registry reports it as having an install script. LPM read only the scripts a manifest names, so such a package (segfault-handler,iconv,node-expatand others) was installed unbuilt: nothing to approve, nothing to say a build was missing, and a failure only when the project loaded it.Change
The implied build is the package's
installscript wherever its install-time scripts are read. It is hashed, classified (node-gyp rebuildis a green command) and listed bylpm approve-scriptslike a named script, andlpm rebuildruns it. The rule is npm's: abinding.gypfile at the package root, noinstalland nopreinstallscript, and no"gypfile": falsein the manifest.A package that names only a
postinstallscript and ships abinding.gypgets the build too. Its script hash changes, so an approval given before this change is asked for again.An install records the revision of the rules that say which scripts a package has. A project installed under an earlier revision is installed again once, so such packages are listed without waiting for an unrelated change.
lpm query ":scripts",lpm audit, the install summary and the warninglpm addprints count the implied build as well.The scan of what a
binding.gypruns is stricter, because more packages now reach it. gyp evaluates the file as Python before it expands anything, so the scan reads it as the plain literal such files are written as, with strings decoded as Python decodes them. A<!(…),>!(…)or^!(…)command is reported as before when it is a plain shell command. The scan is left incomplete, which sends the package to review, for anything else that can run something:The
config.gypiandcommon.gypithat node-gyp adds from the package's directory are read the same way. Of 66 command-freebinding.gypfiles from packages on the test machine, three are now sent to review: one for actions, one for a second build file, one for a key since added to the inert list.Not changed: only a command the static gate marks Red is reported. One it marks Amber, such as
node -p "require('node-addon-api').include", is not.Tests
install_native_build(workflow): a package with abinding.gypand no scripts waits for review with aninstallphase on the green tier, which fails before the change; one with"gypfile": falsehas nothing to review.🤖 Generated with Claude Code