Repository navigation
feat(bindings): publish the Bundle Pin scripts as the npm package zingolib-bundle-pin - #2941
Merged
Merged
Conversation
…ngolabs/bundle-pin zingolib#2930 rules that the scripts a consumer runs to hold its Bundle Pin and fetch the Prebuilt Bundles are defined in one place. That place is bindings/pin, beside the Android and Swift packaging, so the scripts and the bundle layout they read change in one pull request. The package carries the modules kitchen-sync proved, with two commands, pin-binding-layer and fetch-binding-layer, that take the consumer root from the working directory. It depends on nothing, and its tests run on the runner Node ships. The Binding Layer publish workflow publishes the package by npm trusted publishing when npm lacks the version the package names, and a new check fails a pull request that changes the package without raising that version. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The registry-url setting of setup-node writes an npmrc entry that reads an auth token from an environment variable the job never sets. The empty entry can stand in the way of the OIDC exchange that trusted publishing performs, and the default registry is already npmjs.org, so the setting goes. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The npm scope zingolabs is held by an account that has published nothing, and whose holder is unknown. An unscoped name needs no organization, and trusted publishing serves it the same way, so the package is zingolib-bundle-pin. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
… scripts The npm publish of bindings/pin leaves the /publish job and becomes a publish job of the "Bundle Pin package" workflow that runs on a push to dev. The /publish job checked out the pull request's branch head, so the package shipped unmerged content, and its provenance named the default branch's head, a commit that did not hold the published files. A publish from dev names the merged commit, removes the race in which a later push to the pull request found its own version already on npm, and lets a failed publish retry on the next push instead of being refused with the recorded Binding Layer entry. Only the publish job holds id-token: write, and it installs a pinned npm rather than npm@latest. The scripts gain four fixes. The digest directory counts as held by its one visible entry, so a stray dotfile no longer forces a download whose rename then fails on the existing directory, and a directory that holds no bundle is replaced. parsePin returns a malformed-pin outcome for text that is not JSON and for null. fetch-binding-layer without --platform reports a message that names the platforms. The registry obtains one token per repository and passes it to the manifest and blob requests. Every failure message names pin-binding-layer, the published command, in place of the kitchen-sync alias yarn pin, and the header comments leave the lib and bin files. The tests cover each fixed behavior, and the README describes the publish. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Contributor
|
Tests pass 25/25 on Node 22,
|
…e by name The ENOENT fallback that readPin, held, text, and exists each wrote now lives once in lib/disk.mjs as text and exists. The atomic replacement of a directory, which fetchBundle and placeSwiftPackage each spelled out, is replaceDirectory there: it fills a partial directory, discards the partial directory when the fill reports anything but success, and otherwise removes the old directory and renames the partial one into its place. Both bins take the default pin path from pinPath. The android bundle's directory gains a marker file, bundle, that names the bundle's file, as the iOS placement's marker names its digest. held reads the marker and checks that the named file exists, so a directory that holds one stray file no longer counts as the bundle. The marker is written after the download verifies, inside the partial directory, so its presence proves a complete bundle. A directory written before this commit holds no marker and is downloaded once more. The tests cover the marker, the replacement of an unmarked directory, and the removal of the partial directory after a corrupt download or a package without a manifest. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Member
Author
|
Commits d5a8b08 and 0fd6850 answer the ten findings of the recall review and the three points above.
On the three points above:
The suite is 26 tests. A live |
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.
zingolib#2930 rules that the scripts a consumer runs to hold its Bundle Pin and fetch the Prebuilt Bundles are defined in one place. This pull request adds that place. Nothing is deleted.
What changes
bindings/pinis the npm packagezingolib-bundle-pin. It carries the modules kitchen-sync proved in kitchen-sync#1 and kitchen-sync#2 underlib/. Two commands underbin/replace the entry scripts:pin-binding-layer <commit>moves the pin, andfetch-binding-layer --platform <platform>prints the path of the pinned bundle. Both take the consumer's root from the working directory, with--rootand--pinoverrides, because a file undernode_modulescannot find that root by its own path.The modules differ from the kitchen-sync copies in four ways. The registry obtains one token per repository and passes it to the manifest and blob requests.
parsePinreturns a malformed-pin outcome for text that is not JSON. The android bundle's directory holds a marker file that names the bundle's file, as the iOS placement's marker names its digest, so a held bundle is matched by name. The disk helpers for an absent file and for the atomic replacement of a directory live once, inlib/disk.mjs.The package depends on nothing. Its 26 tests run on the test runner that Node ships, so zingolib gains no Node dependency and no lock file.
bundle-pin.yamlis a new workflow with two jobs. The check job runs the tests, lists the filesnpm packwould publish, and fails a pull request that changes the package without raising its version. The publish job runs on a push todevand publishes the package when npm lacks the versionpackage.jsonnames. The published content is therefore always a merged commit, and the provenance names that commit. The publish uses npm trusted publishing, so only that job holdsid-token: write, and no npm token is stored.binding-layer-publish.yamlis unchanged.Set up by hand, once
The npm scope
zingolabsis held by an account that has published nothing, so the package is unscoped and needs no organization.bindings/pinwithnpm publish --access public. npm configures a trusted publisher on a package that exists, so the first version cannot come from the workflow.bundle-pin.yaml. The workflow publishes every later version.Bundle Pin packageto the required checks ofdev.Open
AGENTS.md's scripting rule names Rust in the workbench crate for committed tooling. The consumers of this package hold no Rust, so the package is Node. The rule needs an exception for
bindings/pin, which this pull request does not write.bindings/published.tomlcould record the package version beside each entry's digests. That is deferred.Follow-ups
After the first publish, kitchen-sync installs the package and deletes its
scripts/. Step 4 of zingolib#2930 installs it in zingo-mobile.🤖 Generated with Claude Code