Skip to content

fix(homebrew): show logo in brew install, guard empty tap token - #22

Merged
elkaix merged 2 commits into
mainfrom
fix/homebrew-tap-token-and-logo
May 30, 2026
Merged

fix(homebrew): show logo in brew install, guard empty tap token#22
elkaix merged 2 commits into
mainfrom
fix/homebrew-tap-token-and-logo

Conversation

@elkaix

@elkaix elkaix commented May 30, 2026

Copy link
Copy Markdown
Member

Problem

Two issues with the Homebrew install path, surfaced from a real brew install:

  1. No logo on brew install. The animated/static "Tetris" robot-head banner exists only in the curl installer (install.sh) and PowerShell installer (install.ps1). Homebrew runs the formula, not those scripts, and the formula had no caveats, so brew printed nothing.

  2. brew install served 0.23.0, not the current 0.25.0. The Update Homebrew tap workflow has failed on every release since the org migration (0.24.0, 0.25.0). The failing step is git push to the tap repo:

    TAP_TOKEN:                       <- empty
    remote: Invalid username or token. Password authentication is not supported for Git operations.
    fatal: Authentication failed for '.../TechMatrix-labs/homebrew-pythinker.git/'
    exit code 128
    

    The HOMEBREW_TAP_TOKEN secret did not survive the mohamed-elkholy95 → TechMatrix-labs org migration (same class of breakage as the pythinker-home site-sync freeze). Formula generation succeeds; only the cross-repo push fails, so the tap stayed frozen at the last good push (0.23.0, with stale old-org asset URLs).

Changes

  • packages/homebrew-tap/pythinker-code.rb.tmpl — add a caveats block rendering the static settled frame of the robot-head logo + tagline (parity with install.sh / install.ps1; brew caveats are plain text, so no animation/colour).
  • .github/workflows/homebrew-tap.yml — fail fast with an actionable message when TAP_TOKEN is empty/unset, instead of the opaque git exit-128.
  • tests/test_homebrew_formula.py — assert the rendered formula carries the logo caveats (tagline + distinctive mouth row).

Out of scope / follow-up

  • The HOMEBREW_TAP_TOKEN secret must be re-added (fine-grained PAT, Contents: Read and write on TechMatrix-labs/homebrew-pythinker). This PR only makes the failure obvious and ships the logo — it does not restore the secret. Until then, every release's tap update will fail the guard with a clear error.
  • The tap repo was hand-republished to 0.25.0 out-of-band (new-org onedir URLs + caveats) so brew install works now; this PR makes future auto-updates correct once the token is restored.

Verification

$ .venv/bin/python -m pytest tests/test_homebrew_formula.py
3 passed

$ python packages/homebrew-tap/generate-formula.py --version 0.25.0 \
    --template packages/homebrew-tap/pythinker-code.rb.tmpl --output /tmp/f.rb
# version 0.25.0, 4 onedir URLs (TechMatrix-labs), 4 sha256, caveats present, 0 unresolved placeholders

Summary by CodeRabbit

  • New Features

    • Homebrew installation now shows an ASCII-art logo and a branded welcome/caveat message after install.
  • Chores

    • Deployment workflow now validates the Homebrew tap authentication token before attempting to publish, preventing failed pushes.
  • Tests

    • Added tests to verify the formula displays the caveats/logo and to improve Homebrew formula asset handling.

Review Change Stack

Two Homebrew install problems, both rooted in the tap pipeline:

1. `brew install` showed no logo. The Tetris/robot-head banner lived only
   in the curl (install.sh) and PowerShell (install.ps1) installers, which
   Homebrew never runs. Add a `caveats` block to the formula template so
   `brew install` prints the static settled frame of that same logo (brew
   caveats are plain text, so this is the uncoloured robot head).

2. The tap auto-update workflow has failed on every release since the org
   migration: the `HOMEBREW_TAP_TOKEN` secret did not carry over, so
   `git push` to the tap repo fails with a cryptic exit-128 auth error and
   the tap stays frozen at the last good push (0.23.0). Add a fail-fast
   guard that detects an empty TAP_TOKEN and prints an actionable error
   instead of the opaque git failure.

Also add a test asserting the rendered formula carries the logo caveats.

The token secret itself must be re-added out-of-band (a fine-grained PAT
with Contents: Read and write on the tap repo); this change only makes the
failure obvious and ships the logo.
@coderabbitai

coderabbitai Bot commented May 30, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: bb5f5546-236a-4924-912d-16ddd52f4283

📥 Commits

Reviewing files that changed from the base of the PR and between 3776cda and 4cfeb7c.

📒 Files selected for processing (1)
  • tests/test_homebrew_formula.py

📝 Walkthrough

Walkthrough

This PR adds a static ASCII-art caveats method to the Homebrew formula, introduces a test helper and a test verifying the caveats output, and updates the CI workflow to verify the HOMEBREW_TAP_TOKEN before attempting to push to the tap repo.

Changes

Homebrew Installation Caveats

Layer / File(s) Summary
Caveats method in formula template
packages/homebrew-tap/pythinker-code.rb.tmpl
caveats instance method added to the Homebrew formula that returns a heredoc-rendered ASCII-art robot logo and a one-line tagline displayed after installation.
Tests and helper for formula rendering
tests/test_homebrew_formula.py
Adds a _fake_assets(generator, version) helper and updates tests: the existing native tarball-rendering test now uses the helper, and a new test asserts the generated native Homebrew formula contains a def caveats block including the expected ASCII-art mouth-row glyph.
Workflow token validation before deployment
.github/workflows/homebrew-tap.yml
CI sync step now checks that HOMEBREW_TAP_TOKEN/TAP_TOKEN is set and non-empty and emits a detailed error and exits if missing before any git operations.

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

bug, enhancement

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 70.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed Title follows conventional commits format with type(scope): description and clearly describes the two main fixes in the changeset.
Description check ✅ Passed Description covers all required template sections: related issue context, detailed changes, verification steps, and follow-up notes on out-of-scope work.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/homebrew-tap-token-and-logo

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
.github/workflows/homebrew-tap.yml (2)

28-28: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Pin third-party action to commit SHA.

The action uses a tag reference (v4) instead of a full commit SHA. As per coding guidelines, actions in .github/workflows/** should be pinned to immutable commit SHAs for supply-chain security.

🔒 Proposed fix
-      - name: Checkout source repo
-        uses: actions/checkout@v4
+      - name: Checkout source repo
+        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683  # v4.2.2
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/homebrew-tap.yml at line 28, The workflow is using the tag
reference "actions/checkout@v4" which is mutable; replace that tag with the
repository's immutable commit SHA (e.g., "actions/checkout@<full-commit-sha>")
so the action is pinned; locate the line containing uses: actions/checkout@v4 in
the workflow and update it to the corresponding full commit SHA for the
actions/checkout repo (and apply the same pinning approach to any other
third-party actions in this file).

48-48: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Pin third-party action to commit SHA.

The action uses a tag reference (v5) instead of a full commit SHA. As per coding guidelines, actions in .github/workflows/** should be pinned to immutable commit SHAs for supply-chain security.

🔒 Proposed fix
-      - name: Set up Python
-        uses: actions/setup-python@v5
+      - name: Set up Python
+        uses: actions/setup-python@0b93645e9e7c3e5d7b1ae4f84c82ca0e90d6c29a  # v5.3.0
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/homebrew-tap.yml at line 48, Replace the tag reference
"uses: actions/setup-python@v5" with a pinned commit SHA: locate the uses line
(actions/setup-python@v5) and change it to the full commit SHA for the desired
v5 release (e.g., actions/setup-python@<full-commit-sha>), obtaining the SHA
from the official actions/setup-python GitHub repo and updating the workflow to
use that immutable SHA.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/test_homebrew_formula.py`:
- Around line 66-73: Extract the duplicated asset setup into a helper function
(e.g., create_assets_for_version) that takes a version string and an iterable of
targets and returns the assets dict; replace the inline logic that builds assets
using version, assets, generator.NATIVE_TARGETS and target.asset_name(...) in
tests/test_homebrew_formula.py with a call to this helper, and apply the same
change to the new test so both use the shared helper.

---

Outside diff comments:
In @.github/workflows/homebrew-tap.yml:
- Line 28: The workflow is using the tag reference "actions/checkout@v4" which
is mutable; replace that tag with the repository's immutable commit SHA (e.g.,
"actions/checkout@<full-commit-sha>") so the action is pinned; locate the line
containing uses: actions/checkout@v4 in the workflow and update it to the
corresponding full commit SHA for the actions/checkout repo (and apply the same
pinning approach to any other third-party actions in this file).
- Line 48: Replace the tag reference "uses: actions/setup-python@v5" with a
pinned commit SHA: locate the uses line (actions/setup-python@v5) and change it
to the full commit SHA for the desired v5 release (e.g.,
actions/setup-python@<full-commit-sha>), obtaining the SHA from the official
actions/setup-python GitHub repo and updating the workflow to use that immutable
SHA.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 77bf84f9-7372-4577-a0a0-bde23ddc8068

📥 Commits

Reviewing files that changed from the base of the PR and between 3e85740 and 3776cda.

📒 Files selected for processing (3)
  • .github/workflows/homebrew-tap.yml
  • packages/homebrew-tap/pythinker-code.rb.tmpl
  • tests/test_homebrew_formula.py

Comment thread tests/test_homebrew_formula.py Outdated
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