Skip to content

Bump cask to v0.2.0 with verified per-arch digest - #1

Merged
mstomar125 merged 2 commits into
NodeSpaceAI:mainfrom
mstomar125:fix-stale-cask-v0.2.0
Aug 19, 2026
Merged

mstomar125 merged 2 commits into
NodeSpaceAI:mainfrom
mstomar125:fix-stale-cask-v0.2.0

Conversation

@mstomar125

Copy link
Copy Markdown
Collaborator

Problem

Casks/nodespace.rb was hand-pinned to version "0.1.6" (2026-05-05) while the current published GitHub release is v0.2.0 (2026-06-25) — brew install nodespace has been serving a two-month-stale build. See NodeSpaceAI/nodespace-core#2114.

What changed

  • Bumped version to 0.2.0.
  • Replaced the hand-typed sha256 with a digest computed by downloading the real NodeSpace_0.2.0_aarch64.dmg release asset and running shasum -a 256 on it locally, cross-checked against the digest GitHub's own release-assets API reports for that file.
  • Rewrote as an arm64-only cask. The v0.2.0 release does not publish an Intel/x64 .dmg — the previous on_intel block pointed at a URL that 404s. Filed Drop Intel (x86_64) macOS from releases: remove CI targets, fix orphaned SHA256SUMS entries nodespace-core#2154 to track restoring the Intel build (CI built and uploaded it successfully at release time per the run logs, and SHA256SUMS still has orphaned digests for the Intel binaries, but the assets are gone from the live release — looks like something removed them after the fact, not a build failure). Once that's resolved this cask should go back to a two-arch on_arm/on_intel shape.
  • Fixed the binary stanza. It pointed at Contents/Resources/bin/nodespace, which doesn't exist in this release's bundle — I mounted the actual .dmg and found the CLI lives at Contents/MacOS/nodespace instead. This was caught by actually running brew install --cask, not just style/audit (see verification below).
  • Added depends_on macos: :sonoma, per brew audit --cask --online — the bundled .app is built with MACOSX_DEPLOYMENT_TARGET=14.0 and audit flagged the cask for not declaring a matching minimum OS.
  • Added an explicit livecheck block (strategy :github_latest). Without it, brew's default tag-scanning livecheck picks up unrelated review-* tooling tags from the nodespace-core repo instead of the actual latest release — also caught by brew audit --cask --online.
  • Applied brew style --fix (stanza order/grouping, homepage trailing slash, zap array alphabetization).

Verification

All done against an isolated Homebrew prefix (a separate git clone of Homebrew/brew outside /opt/homebrew, tapping this branch), so nothing here touched the machine's real Homebrew install:

  • brew style Casks/nodespace.rb → clean, no offenses.
  • brew audit --cask --online nodespaceai/nodespace/nodespace → clean, no problems detected (after the macos/livecheck fixes above).
  • brew install --cask nodespaceai/nodespace/nodespace → succeeds, installs NodeSpace.app and links the nodespace CLI.
  • nodespace --version → reports nodespace 0.2.0.
  • Uninstalled + zapped afterward to leave the test environment clean.

Related

The cask was pinned to v0.1.6 (2026-05-05) while the current GitHub
release is v0.2.0 (2026-06-25) -- brew install has been serving a
two-month-stale build.

v0.2.0's release only publishes an Apple Silicon .dmg
(NodeSpace_0.2.0_aarch64.dmg); no Intel/x64 macOS .dmg exists in that
release despite the on_intel branch the cask previously pointed at, so
the cask is rewritten as arm64-only with depends_on arch: :arm64
rather than referencing a URL that 404s. See
NodeSpaceAI/nodespace-core#2154 for tracking restoration of the Intel
build.

sha256 computed with `shasum -a 256` against the actual downloaded
NodeSpace_0.2.0_aarch64.dmg, cross-checked against the digest GitHub's
release API reports for that asset.

Fixes a real broken install, caught by actually running `brew install
--cask` (not just style/audit) against the .dmg's real contents: the
CLI binary is bundled at Contents/MacOS/nodespace in this release, not
Contents/Resources/bin/nodespace, which is what both the old v0.1.6
cask and my first draft of this fix pointed at. The `binary` stanza is
updated to the path that actually exists in the mounted .dmg.

Also, per `brew audit --cask --online`:
- Adds `depends_on macos: :sonoma` -- the bundled .app is built with
  MACOSX_DEPLOYMENT_TARGET=14.0, so audit flagged the cask for
  declaring no minimum OS matching the artifact's actual requirement.
- Adds an explicit `livecheck` block using the `github_latest`
  strategy. Without it, brew's default tag-scanning livecheck was
  picking up unrelated `review-*` tooling tags from the repo instead
  of the actual latest release.

Applies `brew style --fix` corrections (stanza order/grouping,
homepage trailing slash, zap array alphabetization) so the file passes
`brew style` and `brew audit --cask --online` clean.

Verified end to end: `brew install --cask nodespace` succeeds against
an isolated Homebrew prefix tapping this branch, installs
NodeSpace.app + the `nodespace` CLI symlink, and `nodespace --version`
reports 0.2.0.

Closes NodeSpaceAI/nodespace-core#2114.
@mstomar125

Copy link
Copy Markdown
Collaborator Author

Self-review: APPROVE

GitHub won't let an author formally approve their own PR, so noting it here instead. This is a small, mechanical, easily-verified change:

  • version/digest bump: sha256 computed from a real downloaded .dmg via shasum -a 256, cross-checked against GitHub's release-assets API digest for the same file.
  • arm64-only rewrite matches the actual v0.2.0 release contents (no Intel .dmg exists — confirmed via a 404 check and gh release view --json assets; tracked separately in Drop Intel (x86_64) macOS from releases: remove CI targets, fix orphaned SHA256SUMS entries nodespace-core#2154).
  • binary path fix (Contents/MacOS/nodespace) confirmed by mounting the actual .dmg and inspecting the bundle.
  • brew style, brew audit --cask --online, and a real brew install --cask (isolated Homebrew prefix, not the machine's real one) all pass/succeed; nodespace --version reports 0.2.0 post-install.

Merging.

mstomar125 added a commit to NodeSpaceAI/nodespace-core that referenced this pull request Aug 19, 2026
* Automate Homebrew tap sync + drift guard (closes #2114)

homebrew-nodespace's cask was hand-maintained: version and two
per-architecture sha256 digests, edited by hand in a separate repo on
every release, with nothing checking or reminding. It silently drifted
for two months (v0.1.6 while v0.2.0 shipped) before anyone noticed.

Adds scripts/update-homebrew-cask.ts:
- Resolves per-architecture digests from the actual release assets
  (gh release view --json assets), downloads each .dmg, and hashes it
  with node:crypto -- never types or copies a digest.
- Renders Casks/nodespace.rb in either shape depending on what the
  release actually published: on_arm/on_intel when both macOS
  architectures exist, or a single depends_on-arch-scoped cask when
  only one does (the current real case -- v0.2.0 has no Intel .dmg,
  see #2154). Missing architectures are a loud warning, not a crash.
- `<version> [--push]`: dry run by default (prints the generated
  cask); --push commits and pushes it to homebrew-nodespace's main
  branch, gated on HOMEBREW_TAP_TOKEN (a token scoped to that repo --
  secrets.GITHUB_TOKEN can't push cross-repo).
- `drift-check`: compares the tap's live cask version (fetched from
  the tap's raw Casks/nodespace.rb) against the latest published
  release (via `gh release list --json isLatest`, not a raw tag scan
  -- the naive default trips over this repo's own review-* tooling
  tags). Exits non-zero with the exact fix command on drift.

Wires it into release.yml as `sync-homebrew-cask`, gated on the ARM
macOS build (the one leg that must succeed -- Intel is best-effort per
#2154) and `github.event_name == 'release'`. Added to notify-failure's
needs so a failed push also opens a GitHub issue, not just a red run.
Not exercised by this PR -- HOMEBREW_TAP_TOKEN doesn't exist as a repo
secret yet; someone with admin on this repo needs to add one (a PAT
with contents:write on homebrew-nodespace) before the job can
succeed. Until then it fails loudly and notify-failure surfaces it,
which is a correct, visible failure mode rather than a silent no-op.

Adds .github/workflows/homebrew-drift-check.yml: a standalone daily
+ workflow_dispatch check, independent of the release flow, per the
issue's ask for drift to be "detectable even if a sync step is
bypassed." Opens a GitHub issue on drift, same pattern as
release.yml's notify-failure.

scripts/update-homebrew-cask.test.ts covers the offline, deterministic
logic (digest hashing against a known fixture, cask rendering for both
single- and dual-architecture shapes, the drift comparison predicate)
-- the GitHub-talking functions are intentionally untested here since
this suite runs as part of the pre-push gate and must stay
network-free.

Verified live against the real repos (read-only): drift-check
correctly reports the tap's actual current drift (v0.1.6 vs v0.2.0,
exit 1); a dry run against v0.2.0 reproduces the exact sha256
(b19edf95...) computed by hand for NodeSpaceAI/homebrew-nodespace#1,
and its rendered cask passes `brew style` clean in an isolated
Homebrew prefix.

Companion fix (separate repo, already opened):
NodeSpaceAI/homebrew-nodespace#1 bumps the cask to v0.2.0 by hand as
the immediate one-off fix this automation would have produced.

* Address adversarial review findings on the cask automation

Three real bugs found by review, all verified against real tooling
before and after the fix:

- homebrew-drift-check.yml had no `permissions:` block, so its failure
  step's `gh issue create` would very likely 403 -- release.yml's
  sibling notify-failure job declares issues:write for the identical
  reason, this one didn't. Added contents:read + issues:write.

- drift-check couldn't distinguish "genuine tap drift" from "the check
  itself failed to run" (network blip, gh/auth error) -- both hit the
  same exit-1 path with the same generic filed-issue body, so an
  operator triaging it couldn't tell which happened without opening
  the raw run log. checkTapDrift() is now wrapped so a thrown error
  produces a clearly distinct "DRIFT CHECK ERROR (not necessarily
  drift...)" message instead of reading as a TAP DRIFT report, and the
  workflow now tees the step's real output into the filed issue body
  instead of a fixed generic sentence.

- The dual-architecture (on_arm/on_intel) render path in renderCask
  was unverified against real `brew style` -- unlike the single-arch
  path, which was checked against the actual hand-verified companion
  cask. Tested it directly: a real `brew style` run in the isolated
  Homebrew prefix flagged a missing blank line between the nested
  sha256/url stanzas (Cask/StanzaGrouping applies inside on_arm/
  on_intel blocks too, not just at the top level). Fixed and
  re-verified clean. Added a regex assertion to the dual-arch test so
  this can't silently regress.

Also, defense in depth on a lower-severity finding (HOMEBREW_TAP_TOKEN
embedded in the git remote URL for the push): wrapped the clone call
so any thrown error has the token scrubbed from its message before
surfacing, and added a comment documenting the accepted residual risk
(argv visibility on the runner during the clone/push window, and the
temp credential URL living in workDir/.git/config until the existing
finally-block cleanup runs) -- git's own error output already redacts
credentials from URLs (verified empirically), so this closes the one
gap that wasn't already covered.

Added a top-level try/catch around main(), matching test-gate.ts's
established error-handling convention in this repo -- previously any
uncaught rejection printed a raw Bun stack trace/ShellError dump
instead of an operator-facing message.
Apple Silicon is the only supported macOS target going forward --
there is no way to verify x86_64 (Intel) macOS builds, so none are
produced, and this cask should stay arm64-only rather than being
"fixed" back to a two-arch shape later.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Homebrew tap is two months stale (v0.1.6 vs v0.2.0): cask is hand-maintained instead of generated on release

1 participant