Repository navigation
Wire the nodespace-cli Homebrew formula into release-sync and drift-check - #2175
Merged
Merged
Conversation
…heck Formula/nodespace-cli.rb (added in #2146) hardcoded its own version and 6 asset digests, completely independent of the automation that keeps the sibling nodespace cask in sync -- the same "hand-maintained artifact silently drifts" failure mode #2114 fixed for the cask, reintroduced for the formula in the very PR that added it. - Add scripts/update-homebrew-formula.ts: resolves all 6 digests (cli + daemon, for each of the 3 required build-headless targets) from real release assets, fully re-renders Formula/nodespace-cli.rb (verified byte-for-byte against the live published file), and pushes to the tap. Every required target is hard-required -- a missing asset is a loud error, matching #2171's "missing arm64 is a hard error" precedent for the cask, since the formula has no optional architecture to omit. - Add scripts/homebrew-tap-push.ts: the shared "clone tap, write file, commit, push" mechanics, extracted out of update-homebrew-cask.ts so the credential-scrubbing safety net can't drift out of sync between the cask and formula sync scripts. - Export REQUIRED_HEADLESS_TARGETS from publish-install-script.ts so the formula's required-target set shares one source of truth with install.sh's own pin instead of maintaining a second copy. - Add the sync-homebrew-formula job to release.yml, gated on build-headless the same way sync-install-script already is. - Extend homebrew-drift-check.yml with an independent formula-drift-check job so formula staleness is caught the same day, with its own distinctly-titled issue. The on_intel odie block for macOS stays hardcoded rather than becoming conditional on asset presence: unlike the cask's now-removed Intel .dmg leg, build-headless has never had a macOS x86_64 leg at all, so there is no CI signal this script could ever observe flip from absent to present. Co-Authored-By: Claude <[email protected]>
…d digests Three real findings from an independent adversarial review of PR #2175: - release.yml: sync-homebrew-formula and sync-homebrew-cask are two independent jobs that both push to homebrew-nodespace's main branch in the same release run. Before this PR there was only ever one writer; running them concurrently lets either git push lose a non-fast-forward race with no retry. Add sync-homebrew-cask to sync-homebrew-formula's `needs` purely for sequencing (matching the existing needs-for-ordering- without-gating-on-result pattern already used elsewhere in this file), so the formula sync's fresh clone always sees whatever the cask sync already pushed. - update-homebrew-formula.ts: renderFormula()'s six url stanzas had the asset filename hand-typed as a separate literal, decoupled from the digest.fileName that was actually downloaded and hashed. Today they happened to agree, but nothing would catch a future edit to the target constants leaving them silently out of sync (sha256 for one asset, url for another). Build the filename segment from digests.*.fileName instead, tying it to the same verified value the sha256 came from. - homebrew-tap-push.ts: the credential-scrubbing catch only wrapped the git clone call, not the subsequent add/commit/push steps. Widen it to cover the whole operation for defense in depth, matching the file's own stated purpose. Co-Authored-By: Claude <[email protected]>
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.
Closes #2162.
Problem
Formula/nodespace-cli.rb(added in #2146) hardcoded its ownversionand 6 asset URLs/sha256 digests, entirely independent of the automation #2114 built for the siblingnodespacecask.scripts/update-homebrew-cask.tsonly knew aboutCasks/nodespace.rb, andhomebrew-drift-check.ymlonly compared the cask's version — it would report "Tap in sync" while the formula silently drifted indefinitely behind it. Same failure mode #2114 fixed for the cask, reintroduced for the formula in the very PR that added it.What changed
scripts/update-homebrew-formula.ts(new): resolves all 6 digests (nodespace+nodespaced, for each of the 3 requiredbuild-headlesstargets — macOS arm64, Linux arm64, Linux x86_64, sharingREQUIRED_HEADLESS_TARGETSwithpublish-install-script.tsso there's one source of truth instead of a second copy) from the actual published release assets, fully re-rendersFormula/nodespace-cli.rb, and pushes it to the tap. Every target is required — a missing asset is a loud hard error (matching Make the Homebrew cask generator arm64-only to match the Intel-macOS drop #2171's "missing arm64 is a hard error, not a warning" precedent for the cask), since this formula has no optional architecture to gracefully omit. Supports<version>(dry run),<version> --push, anddrift-check, mirroringupdate-homebrew-cask.ts's CLI shape.scripts/homebrew-tap-push.ts(new): the shared "clone the tap, write the file, commit, push" mechanics, extracted out ofupdate-homebrew-cask.tsso the credential-scrubbing safety net on a failed clone can't drift out of sync between the cask and formula sync scripts.update-homebrew-cask.tsnow uses it too — behavior unchanged, ~35 lines de-duplicated.scripts/publish-install-script.ts: exportsREQUIRED_HEADLESS_TARGETS(was a private const) soupdate-homebrew-formula.tscan share it instead of maintaining an independent copy of "which build-headless targets are required.".github/workflows/release.yml: adds async-homebrew-formulajob, gated onbuild-headlessthe same waysync-install-scriptalready is (that job's own required-target set is only 3 ofbuild-headless's 4 matrix legs, andneedsonly exposes the aggregate result, not individual legs — so it runs wheneverbuild-headlessfinishes (not cancelled) and letsresolveFormulaDigests()'s own asset check be the real gate). Added tonotify-failure'sneedslist..github/workflows/homebrew-drift-check.yml: adds an independentformula-drift-checkjob so formula staleness is caught by the same daily watchdog, with its own distinctly-titled issue (... (nodespace-cli formula)vs... (cask)) so an operator doesn't have to open the raw run log to know which artifact drifted.package.json: addshomebrew:sync-formulaandhomebrew:formula-drift-checkscripts, mirroring the existing cask ones.The
on_intel do odie(...) endquestion (issue point 3)Deliberately left hardcoded, not made conditional on asset presence. Reasoning: unlike the cask's now-removed Intel
.dmgleg (whichbuild-tauriused to produce until #2169),release.yml'sbuild-headlessmatrix has never had a macOS x86_64 leg at all — there is no CI job this script could ever observe flip from absent to present. Making this conditional now would be speculative generality for a scenario with no live path to occur under the current pipeline, and it lines up with #2171's own "Apple Silicon is the only supported target, reversible but requires restoring code" decision for the cask. If a macOS x86_64 build ever gets added tobuild-headless, that's the point to revisit this.Verification
renderFormula()verified byte-for-byte against a live fetch ofNodeSpaceAI/homebrew-nodespace'sFormula/nodespace-cli.rb(own test + confirmed independently against the real published file, not just the fixture).bun run scripts/update-homebrew-formula.ts 0.2.0,bun run scripts/update-homebrew-formula.ts drift-check) — dry-run output matches the live formula; drift-check correctly reports "Tap formula in sync: v0.2.0".bun run test:scripts: 115 pass, 0 fail (was 110 before this PR).bun run quality:fixclean.bun run test:allclean (222 frontend test files, 115 script tests, 2 skill test files, full Rust workspace).scripts/test-gate.ts) passed, includingcargo test -p nodespace-app(ADR-048 Tauri-seam suite).Test plan
update-homebrew-formula.tsresolves all 6 digests from real release assets and fails loudly if any is missingrenderFormula()output verified byte-identical to the publishedFormula/nodespace-cli.rbfor v0.2.0drift-checkcommand correctly reports sync/drift for the formulahomebrew-tap-push.tsextraction is behavior-preserving for the cask (existing cask tests still pass unchanged)release.yml'ssync-homebrew-formulajob gated the same waysync-install-scriptis, wired intonotify-failurehomebrew-drift-check.ymlchecks both cask and formula independently, with distinctly-titled failure issuesbun run test:scripts/test:all/quality:fixall clean🤖 Generated with Claude Code