Skip to content

Homebrew CI fails on two SimpleInterpolation offenses in the vp formula #3548

Closed

Description

@fengmk2

The Linux x64 Homebrew installation workflow fails at brew style viteplus/e2e/vp. On #3544 the published package passed its installation and runtime checks, then both the published and source-build jobs failed the same style check. The formula matches main at abdad5156. Published job · Source-build job

Homebrew/SimpleInterpolation flags two expressions in HomebrewFormula/vp.rb.

  • Line 61 interpolates Digest::SHA512.file(archive).base64digest when constructing the checksum. Source
  • Line 106 interpolates the conditional "-gnu" if OS.linux? when constructing the platform name. Source

To reproduce in CI, apply the test: install-e2e label to a PR that uses this formula. The expected result is that the style check passes and the job proceeds to brew audit --strict --formula. The same two diagnostics also appear on unrelated PRs. #3532 job · #3537 job

Activity

  1. added theissue type on Nov 23, 2026
  2. voidzero-bot commented on Nov 23, 2026

    @voidzero-bot
    Contributor
    • Reproduced: Yes — exact CI failure reproduced locally: brew style viteplus/e2e/vp against a clone of Homebrew master fails with the same two Homebrew/SimpleInterpolation offenses at HomebrewFormula/vp.rb:61 and :106.
    • Exploration: Yes — View branch
    • Unit Test: No — per repo policy, no new unit tests were added for CI-automation changes; instead, the exact failing command was re-run (exit 1 → exit 0) along with the existing formula harnesses (homebrew-preview.rb fixture, homebrew-formula.mjs tests, brew audit --strict).
    • Priority: Priority P1: chore. This is a CI release-gate regression only: it blocks the test: install-e2e Homebrew workflow on all labeled PRs, but does not change any user-facing behavior — installed vp binaries and the published tap keep working exactly as before.

    Upstream Homebrew added the Homebrew/SimpleInterpolation RuboCop cop on 2026-11-21 (Homebrew/brew commit 67c5ff289e), and the E2E script clones Homebrew master by design (.github/scripts/test-homebrew.mjs), so the gate started failing on both published and source-build jobs — and on unrelated PRs — without any Vite+ change. The cop requires interpolation bodies to be "simple values" with no branching and no multi-step call chains, which two long-standing expressions in HomebrewFormula/vp.rb violate: the inline Digest::SHA512.file(archive).base64digest checksum comparison (line 61) and the conditional "-gnu" if OS.linux? platform suffix (line 106). A control run against a pre-cop Homebrew 7.0.14 confirmed the formula itself was clean until the upstream cop landed.

    I found a potential fix for this issue. The branch hoists each flagged expression into a local variable (digest = Digest::SHA512.file(archive).base64digest and gnu_suffix = "-gnu" if OS.linux?), leaving plain variable references inside the interpolations, which the cop allows while preserving evaluation order and values. With the fix, the failing command passes (1 file inspected, no offenses detected), the job proceeds to and passes brew audit --strict --formula, and the preview-resolution fixture passes on both Homebrew master and stable.

    Full Triage Report

    Triage Report: GH-3548 — Homebrew CI fails on two SimpleInterpolation offenses in the vp formula

    Reproduce

    Result: ✅ Reproduced on current main (abdad51563297a59266bb27c3f2a91e8ce0696cc — the exact commit cited in the issue). Issue type: Bug (CI style-gate failure caused by a new upstream Homebrew RuboCop cop).

    Summary

    Homebrew/SimpleInterpolation — a new RuboCop cop added to Homebrew/brew on 2026-11-21 (commit 67c5ff289e, "Add simple ternary and interpolation cops") — flags two interpolations in HomebrewFormula/vp.rb:

    • Line 61: "sha512-#{Digest::SHA512.file(archive).base64digest}" (checksum construction in the preview path)
    • Line 106: platform = "#{os}-#{arch}#{"-gnu" if OS.linux?}" (platform name construction)

    The Vite+ Homebrew E2E script (.github/scripts/test-homebrew.mjs) clones https://github.com/Homebrew/brew master (--brew-source default) into a disposable prefix, so CI always runs latest Homebrew master. Since the cop landed upstream, every test: install-e2e labeled run fails brew style viteplus/e2e/vp on the Linux x64 job before reaching brew audit --strict --formula, on any PR touching (or not touching) the formula — matching the reports on #3544, #3532, and #3537.

    Environment

    • Vite+ checkout: abdad51563297a59266bb27c3f2a91e8ce0696cc, branch triagebot/fix-3548
    • OS: Ubuntu 26.04.1 LTS, x86_64
    • Runner Homebrew (stable): 7.0.14, HEAD c3286d37 (predates the cop)
    • RuboCop used by brew style: 1.92.2
    • Node.js: v24.22.3; vp --version: v1.7.0

    Why the runner's own brew first passed

    brew style viteplus/e2e/vp against the preinstalled stable Homebrew 7.0.14 reported 1 file inspected, no offenses detected — the cop does not exist in that tree. CI fails because its brew comes from a fresh clone of Homebrew master, which includes the new cop.

    Commands attempted and results

    1. Mirrored the CI setup: built a local git tap viteplus/e2e containing HomebrewFormula/vp.rb (unmodified copy from the checkout).

    2. Control on stable brew: brew style viteplus/e2e/vp (Homebrew 7.0.14) → 1 file inspected, no offenses detected, exit 0.

    3. Reproduction with CI's brew source: git clone --depth 1 https://github.com/Homebrew/brew, tapped the same formula, then brew style viteplus/e2e/vp → exit 1, output:

      HomebrewFormula/vp.rb:61:18: C: Homebrew/SimpleInterpolation: Move this expression outside the interpolation.
            if "sha512-#{Digest::SHA512.file(archive).base64digest}" != integrity
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      HomebrewFormula/vp.rb:106:30: C: Homebrew/SimpleInterpolation: Move this expression outside the interpolation.
          platform = "#{os}-#{arch}#{"-gnu" if OS.linux?}"
                                       ^^^^^^^^^^^^^^^^^^^^^^
      
      1 file inspected, 2 offenses detected
      

      This matches the issue's two diagnostics exactly (same lines, same cop).

    4. Control case: hoisted the flagged expressions out of the interpolations in a copy of the formula and reran the same brew style with the same brew clone → 1 file inspected, no offenses detected, exit 0. Confirms the two interpolations are the only trigger; the rest of the formula is clean.

    Diagnosis

    Confidence: high — proven by code inspection of the new upstream cop plus observed behavior (exact offense reproduction and a passing hoisted control).

    Affected files and lines

    Location Role
    HomebrewFormula/vp.rb:61 "sha512-#{Digest::SHA512.file(archive).base64digest}" in Preview.resolve — SHA-512 integrity check for preview archives
    HomebrewFormula/vp.rb:106 platform = "#{os}-#{arch}#{"-gnu" if OS.linux?}" — platform selector for preview resolution
    .github/scripts/test-homebrew.mjs:255 CI clones Homebrew master into a disposable prefix, so the style gate always runs latest upstream Homebrew
    .github/scripts/test-homebrew.mjs:474-491 the gate: swaps the production formula into the tap, runs brew style viteplus/e2e/vp then brew audit --strict --formula — Linux x64 only

    Root cause

    This is not a Vite+ regression. Upstream Homebrew added the RuboCop cop Homebrew/SimpleInterpolation on 2026-11-21. The E2E script clones Homebrew master, so the gate started failing without any Vite+ change — which is exactly why the two diagnostics also appear on unrelated PRs (#3532, #3537), and why the timing (failures first reported 2026-11-22/23) matches the upstream commit date.

    The cop requires every interpolation body to be a "simple value": no branching and no multi-step call chains (value parts — calls plus argument values — limited to 3, with calls-with-arguments disallowed as nested receivers). Both formula sites violate it:

    • Line 61: Digest::SHA512.file(archive).base64digest is a nested call chain — the receiver Digest::SHA512.file(archive) is itself a call with an argument, so the interpolation is not a simple value.
    • Line 106: "-gnu" if OS.linux? puts a conditional branch inside the interpolation.

    Corroborating evidence:

    • Stable Homebrew 7.0.14 (predating the cop) reports no offenses; a fresh clone of Homebrew master reports the two exact offenses; the same clone reports no offenses once the two expressions are hoisted. This isolates the cause to the new upstream cop.
    • git log -S shows both interpolations were introduced in feat: add official Homebrew tap #2740 (8ea2f843d, "feat: add official Homebrew tap") — old code newly policed, not a recent formula regression.
    • The sibling cop added in the same upstream commit (Homebrew/SimpleTernary) flags nothing else in the formula: the full style run reports exactly these 2 offenses.

    Edge cases and constraints for the fix

    • The Preview module must stay in the formula ("Keep this helper in the formula: Homebrew also loads the copy saved in the keg"); the hoist stays inside the formula.
    • .github/scripts/__tests__/homebrew-preview.rb loads the formula via Formulary and exercises Preview.resolve on all four platforms, the SHA-512 integrity path, corrupted-archive rejection, and cache behavior — the nearby regression harness a fix must keep green.
    • Release automation only rewrites the BEGIN/END RELEASE ASSETS block (update-homebrew-formula.mjs:73-101); lines 61/106 are outside it, so the fix persists across release updates.
    • The source-build job's generated local formula variant is not style-checked (the gate swaps in the production formula), so no parallel change is needed.
    • Future formula edits must avoid ternaries/conditionals and multi-step calls inside interpolations.

    Verification

    • Observed: brew style viteplus/e2e/vp in the Homebrew install E2E (Linux x64 job) fails with two Homebrew/SimpleInterpolation offenses at vp.rb:61/:106, blocking brew audit --strict --formula — on both published and source-build flows, and on unrelated PRs.
    • Expected (per the reporter and the gate's design): the style check passes and the job proceeds to brew audit --strict --formula.

    Verdict: bug (confidence: high).

    Evidence: the gate is intentional Vite+ behavior added with the formula in #2740, with the explicit comment "Audit the production URLs and release gate, not the local archive override" (test-homebrew.mjs:485-488); the official Homebrew tap is documented product surface (docs/guide/homebrew.md, docs/guide/global-cli.md:465-483); the gate was green through releases 1.5.0–1.7.0 and broke only after the upstream cop landed, with no intentional Vite+ change; the offending code is Vite+'s own HomebrewFormula/vp.rb, so the fix belongs in this repository rather than upstream; gh search for "SimpleInterpolation" / "brew style" finds only this issue.

    Fix

    Result: fixed — HomebrewFormula/vp.rb only; no other files touched.

    Rationale

    Hoisting each flagged expression into a local variable keeps the interpolation a plain variable reference, which the cop allows, while preserving the exact evaluation order and values.

    Full diff

    --- a/HomebrewFormula/vp.rb
    +++ b/HomebrewFormula/vp.rb
    @@ -58,7 +58,8 @@ class Vp < Formula
           # the normal formula fetch reuses this archive from Homebrew's download cache.
           archive = resource.cached_download
           resource.fetch(verify_download_integrity: false, quiet: true) unless archive.file?
    -      if "sha512-#{Digest::SHA512.file(archive).base64digest}" != integrity
    +      digest = Digest::SHA512.file(archive).base64digest
    +      if "sha512-#{digest}" != integrity
             resource.clear_cache
             raise "Vite+ preview checksum mismatch"
           end
    @@ -103,7 +104,8 @@ class Vp < Formula
       if preview_ref
         os = OS.mac? ? "darwin" : "linux"
         arch = Hardware::CPU.arm? ? "arm64" : "x64"
    -    platform = "#{os}-#{arch}#{"-gnu" if OS.linux?}"
    +    gnu_suffix = "-gnu" if OS.linux?
    +    platform = "#{os}-#{arch}#{gnu_suffix}"
         preview = Preview.resolve(preview_ref, platform)

    Regression test

    No new test file. Per AGENTS.md, repo automation (.github/scripts/) takes no new unit tests, and no .github/ files were modified; the existing regression harnesses were re-run instead. The bug's failing command — brew style viteplus/e2e/vp under a clone of Homebrew master — failed with exit 1 and the two exact offenses before the fix and passes after it.

    Validation commands and results

    Check Result
    ruby -c HomebrewFormula/vp.rb Syntax OK
    brew style viteplus/e2e/vp — Homebrew master clone (the exact failing CI command), production formula written into the disposable tap as CI does 1 file inspected, no offenses detected, exit 0 (was exit 1, 2 offenses)
    brew audit --strict --formula viteplus/e2e/vp — the gate the job proceeds to exit 0, no output
    brew ruby .github/scripts/__tests__/homebrew-preview.rb — exercises Preview.resolve on all four platforms (incl. linux-*-gnu), SHA-512 integrity verification, corrupted-archive rejection, preview/stable selection; run with Homebrew master clone and stable 7.0.14 exit 0, all assertions pass on both
    node --test .github/scripts/__tests__/homebrew-formula.mjs — the check-formula job's test of publication rules against the formula source 6/6 pass
    git diff --check clean

    Skipped checks: vp check, pnpm test:unit, just check/test/lint, snapshot suites — the change is a Ruby formula consumed only by the Homebrew E2E; no TypeScript, Rust, or CLI-snapshot surface changed.

    Alternatives considered:

    • Pinning the E2E's --brew-source to a pre-2026-11-21 Homebrew commit — would hide the problem and rot; the gate intentionally tracks master to keep the official tap compliant.
    • Suppression comments (# rubocop:disable Homebrew/SimpleInterpolation) — the hoists are trivial and clearer than suppressions, and brew audit --strict favors real fixes.

    This report was made by an LLM. The analysis may be wrong, and the potential fix might not work, but is intended as a starting point for exploring the issue.

    I've opened a pull request with this fix: #3550

  3. added
    - P1: chore
    on Nov 23, 2026
  4. self-assigned this
    on Nov 23, 2026
  5. added a commit that references this issue on Nov 23, 2026
    8aba5f3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

- P1: choretriage: fix verified

Type

Fields

Priority

None yet

Effort

None yet

Target date

None yet

Start date

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions