Skip to content

homebrew: let guest Homebrew select Kandelo bottles - #944

Closed
brandonpayton wants to merge 1 commit into
mainfrom
fix/homebrew-bootstrap-bottle-tags
Closed

homebrew: let guest Homebrew select Kandelo bottles#944
brandonpayton wants to merge 1 commit into
mainfrom
fix/homebrew-bootstrap-bottle-tags

Conversation

@brandonpayton

@brandonpayton brandonpayton commented Jul 14, 2026

Copy link
Copy Markdown
Member

Why

A Homebrew bottle is a prebuilt package archive. Its platform tag tells Homebrew which operating system and processor the archive supports, so Kandelo guests need tags that Homebrew itself recognizes before they can select compatible bottles.

The guest bootstrap carries real Homebrew, but upstream Homebrew does not know Kandelo's wasm32_kandelo and wasm64_kandelo bottle tags. Supplying a wrapper or a parent-process override would make one demo work without fixing Homebrew's own platform selection.

What changed

  • Fetch one pinned upstream Homebrew commit and apply the reviewed Kandelo bottle-tag patch to a temporary Git index.
  • Verify the patch digest and exact three-file scope before archiving; reject patch drift and non-bare object stores before changing their remotes.
  • Produce deterministic tar/ZIP identities with a fixed timestamp and UTC timezone, and record the upstream commit, patch, tree, archive, architecture, and tag provenance.
  • Generate the root-owned /etc/homebrew/brew.env with the architecture-specific Kandelo tag and HOMEBREW_SYSTEM_ENV_TAKES_PRIORITY=1, so prefix or user files cannot select a bottle for the wrong guest architecture.
  • Keep /usr/bin/brew as a direct symlink to canonical Homebrew. This adds no launcher, wrapper, or install fallback.

Evidence

  • ./scripts/dev-shell.sh scripts/test-homebrew-bootstrap-source.sh passed. It covers wasm32/wasm64 tags, UTC/EST/HST archive identity, hostile prefix/user configuration, exact pinned tap bottle selection, patch drift, and non-bare Git-store rejection.
  • ./scripts/dev-shell.sh bash scripts/check-abi-version.sh passed.
  • The focused TypeScript compile for homebrew_bootstrap_guest_env.ts passed with the repository's host TypeScript toolchain.
  • ./scripts/dev-shell.sh scripts/build-homebrew-bootstrap.sh --skip-package-resolve built an 805,316,862-byte ABI 39 image from existing validated package artifacts.
  • After rm -rf host/dist, the exact guest probe passed by observing Homebrew load the authoritative system environment before the known continuation limit.
  • Fresh independent review accepted commit 3993a5f2c1514121998575bf4e8cceca78f18e45, tree 14098eec658b45ef6ded1e3432387b007ae911f8.

ShellCheck was not available in the declared dev shell, so it is not claimed here. Bash syntax, Node syntax, and git diff --check passed.

Boundaries

This does not change the Kandelo ABI and does not commit a generated VFS image. It proves Homebrew's own bottle-tag selection, not that a GHCR bottle exists, downloads, pours, or runs; the trusted publisher work in #936 owns those claims.

Canonical guest Homebrew currently reaches /etc/homebrew/brew.env and then truthfully fails when its Ruby dispatcher needs 20,012 continuation bytes but ABI 39 reserves 16,384. This PR preserves that platform failure rather than hiding it. It changes no shared Node/browser host path, so browser runtime behavior is unaffected.

Apply the reviewed Kandelo bottle-tag patch to a pinned Homebrew revision and record reproducible source provenance. Generate a root-owned system environment that makes the guest architecture tag authoritative over prefix and user configuration while keeping the canonical Homebrew launcher path.

Test exact tap bottle selection, patch drift and unsafe Git-store rejection, cross-timezone archive identity, hostile environment precedence, and the truthful ABI 39 runtime boundary. This does not change the Kandelo ABI.
@brandonpayton

Copy link
Copy Markdown
Member Author

CI failure audit (external to this PR)

The Staging build test-gate-prepare failure in run 29335107988 is caused by the shared binaries-abi-v39/index.toml, not this branch:

  • exact current main is 9a7a679195ead9bbdef119830437d5a758566607;
  • all 71 enabled package/architecture entries in the live ABI 39 index were replaced by unmerged PR sdk: preserve static linker argument order #913 cache keys in Prepare merge run 29302528145;
  • comparison against current main: 71 mismatched, 0 matched;
  • all 71 current-main-compatible archive assets still exist, are uniquely mapped, and their GitHub digests match independently downloaded bytes;
  • a reconstructed current-main ledger resolved 71/71 through a fresh-cache scripts/fetch-binaries.sh --fetch-only run.

I am not changing this PR or rerunning CI against the same invalid shared ledger. The gate should be rerun after either the canonical ABI 39 ledger is repaired or #913 is approved and merged, making its currently published keys the intended main state.

@brandonpayton

Copy link
Copy Markdown
Member Author

Absorbed by rebase-merged #967. Main is now 6efb411 with the sealed tree b133bfa018f7e2bc84c4845edf2f945b2f844954, and ABI 41 activation completed successfully in run 29550069085. The absorption audit confirmed this PR\x27s behavior and tests are present in that merged tree, so this source PR is closed and its branch is deleted.

@brandonpayton
brandonpayton deleted the fix/homebrew-bootstrap-bottle-tags branch July 17, 2026 02:39
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.

1 participant