pin @machine0/cli@1.0.164, drop the npm builder - #3
Merged
Merged
Conversation
The pin was stuck at 1.0.155 even though the daily cron reported success.
`./update.sh` was aborting halfway: it printed the new tarball hash, then
exited non-zero before rewriting flake.nix, leaving the pins stale.
Cause: 1.0.164 has no runtime dependencies, and `buildNpmPackage` cannot
express that. Regenerating the lockfile now produces a single empty root
package, and `prefetch-npm-deps` refuses it:
Error: No cacheable dependencies were found.
So `npmDepsHash` came back empty and the script's own guard exited 1. The
GitHub workflow retried five times and would have failed the same way on
every future release.
The dependencies existed because fdmtl/machine0#626 externalised `open`
and `update-notifier` out of the CLI bundle to fix a Windows crash.
fdmtl/machine0#733 re-bundled them and returned them to devDependencies,
keeping the `--format=esm` flag that was the part of #626 actually
responsible for the Windows fix. From 1.0.164 the tarball is
self-contained again.
Rather than set `forceEmptyCache` to keep an npm builder that installs
nothing, drop the builder: unpack the tarball and wrap bin/entry.cjs with
node. That removes the vendored package-lock.json, the npmDepsHash pin,
and the postPatch that stripped bun `workspace:*` devDependencies npm
could not parse.
The risk this trades into is that a future release reintroducing runtime
dependencies would build fine and fail on the user's first invocation
with ERR_MODULE_NOT_FOUND. Guarded twice:
- `./update.sh` inspects the tarball's package.json and refuses to pin a
release with a non-empty dependency tree, naming the offenders.
- The derivation runs the same assertion as an installCheckPhase, so a
hand-edited pin fails at build time rather than at runtime.
Verified: `./update.sh 1.0.163` (the known-bad release) is rejected with
both package names and leaves flake.nix untouched; `nix build` succeeds
on 1.0.164 and `--version` reports 1.0.164; re-running `./update.sh` is
idempotent.
Greptile SummaryPins
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains; the previously reported optional-dependency gap is addressed consistently in both the updater and build-time validation.
|
| Filename | Overview |
|---|---|
| update.sh | Replaces lockfile and npm dependency-hash generation with a dependency-free package assertion that now covers both regular and optional dependencies. |
| flake.nix | Pins CLI 1.0.164, installs the bundled package directly, wraps its entry point, and verifies that the package declares no runtime dependencies. |
| .github/workflows/update-pin.yml | Removes deleted lockfile references from change detection and automated commits. |
Reviews (2): Last reviewed commit: "guard optionalDependencies too" | Re-trigger Greptile
Greptile flagged that both the updater check and the installCheckPhase only inspected `.dependencies`. npm installs `optionalDependencies` on a normal `npm i -g` as well, so a release moving a package there would slip past the guard and reintroduce exactly the ERR_MODULE_NOT_FOUND failure this packaging is trying to prevent. Both checks now inspect the union. `peerDependencies` is deliberately excluded — supplying those is the consumer's job, not the tarball's. Verified: 1.0.163 is still rejected (open, update-notifier), a synthetic package.json with only optionalDependencies is now counted, and `nix build` + `--version` still pass on 1.0.164.
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.
What
Pins
@machine0/cli1.0.155 → 1.0.164 and replacesbuildNpmPackagewith a plain unpack-and-wrap, removing the vendoredpackage-lock.json, thenpmDepsHashpin, and thepostPatch.Why the pin was stuck
The daily cron has been reporting success while changing nothing —
mainstill said 1.0.155 seventeen hours after the last green run../update.shwas aborting halfway. It printed the new tarball hash, then exited non-zero before rewritingflake.nix:1.0.164 has no runtime dependencies, and
buildNpmPackagecannot express that. Regenerating the lockfile now yields a single empty root package, andprefetch-npm-depsrejects it outright:npmDepsHashcame back empty, the script's own guard exited 1, and the workflow's 5× retry loop would have failed identically on every future release.Why the dependencies disappeared
fdmtl/machine0#626 externalised
openandupdate-notifierout of the CLI bundle to fix a Windows crash, which made the tarball non-self-contained from 1.0.147. fdmtl/machine0#733 re-bundled both and returned them todevDependencies, keeping the--format=esmflag that is the part of #626 actually responsible for the Windows fix. (CJS output erasesimport.meta.url, whichopenuses to locate its vendoredxdg-openhelper; ESM preserves it. The externalisation was not load-bearing.) machine0'sCLI Package (Windows, Node 20.12)job passes on #733.The trade, and how it's guarded
Rather than set
forceEmptyCacheto keep an npm builder that installs nothing, this drops the builder. The risk that introduces: a future release reintroducing runtime dependencies would build fine and then die on the user's first invocation withERR_MODULE_NOT_FOUND— invisible at build time. That exact failure shipped to every consumer packaging the tarball directly (fdmtl/machine0-nixos#31).Guarded in two places:
./update.shinspects the tarball'spackage.jsonand refuses to pin a release with a non-empty dependency tree, naming the offenders.installCheckPhase, so a hand-edited pin fails at build time.Verification
./update.sh 1.0.163(known-bad release)open+update-notifier,flake.nixuntouchednix build .#defaultnix run .#default -- --version1.0.164./update.shre-runAlso
update-pin.ymlreferencedpackage-lock.jsonin its diff check and itsgit add. Left as-is,git add flake.nix package-lock.jsonwould fail on a deleted path and break the workflow — both references removed. README updated to describe the packaging accurately.