Skip to content

Commit d0106de

Browse files
committed
probe round 3: 定位 Homebrew 6 第三方 tap 信任门,并验证 brew trust 是否真能修好每条用户路径
1 parent 658eb03 commit d0106de

1 file changed

Lines changed: 86 additions & 63 deletions

File tree

.github/workflows/tmp-brew-macos-probe.yml

Lines changed: 86 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -2,94 +2,117 @@ name: tmp-brew-macos-probe
22

33
# TEMPORARY. Delete before merging.
44
#
5-
# Round 1 (macos-14, pre-tapped) passed end to end: install → mcpp new →
6-
# mcpp run → toolchain bootstrap → binary ran. So the reported breakage is not
7-
# "the formula is broken"; it is environment- or path-specific.
5+
# Round 2 found it. Homebrew 6.0.x gates third-party taps behind explicit
6+
# trust:
87
#
9-
# Round 2 widens along the three axes that can differ from that green run:
10-
# OS version the runner was macOS 14; users are on 15 / 26
11-
# arch macos-13 is Intel — the formula REFUSES it by design, and
12-
# this captures the exact message a user would see
13-
# tap path round 1 tapped first; the documented one-liner relies on
14-
# `brew install <user>/<repo>/<formula>` AUTO-tapping, which is
15-
# a different code path
8+
# Refusing to load formula mcpp-community/mcpp/mcpp-m from untrusted tap
9+
# mcpp-community/mcpp.
10+
# Run `brew trust --formula …` or `brew trust mcpp-community/mcpp`.
1611
#
17-
# Every brew invocation records its own exit code. Note the trap round 1 fell
18-
# into: `cmd | tail -20` followed by `$?` reports TAIL's status, so a failing
19-
# command reads as success. Exit codes here are captured before any pipe.
12+
# macos-14 / 15 / 26 all hit it (Homebrew 6.0.5 / 6.0.12 / 6.0.13). The
13+
# documented one-liner still passes because `brew install <user>/<repo>/<f>`
14+
# on an UNTAPPED repo taps and installs in one go, and Homebrew reads that as
15+
# explicit intent. Everything after the tap exists is refused.
16+
#
17+
# Round 3 answers the two questions that decide the fix:
18+
# 1. WHICH user-facing paths are actually broken (short form, re-running the
19+
# documented command, `brew upgrade`, the alias)
20+
# 2. Does `brew trust <tap>` actually repair all of them — i.e. is the fix
21+
# "document one command", or something more
22+
#
23+
# Exit codes are captured before any pipe. Round 1 reported `cmd | tail` and
24+
# read tail's status, which turned a failure into a green line.
2025

2126
on:
2227
pull_request:
2328
workflow_dispatch:
2429

2530
jobs:
26-
brew-probe:
27-
name: "brew ${{ matrix.os }}"
31+
brew-trust:
32+
name: "trust gate ${{ matrix.os }}"
2833
runs-on: ${{ matrix.os }}
29-
timeout-minutes: 40
34+
timeout-minutes: 30
3035
continue-on-error: true
3136
strategy:
3237
fail-fast: false
3338
matrix:
34-
os: [macos-14, macos-15, macos-26, macos-13]
39+
os: [macos-14, macos-26]
3540
steps:
3641
- name: Environment
3742
run: |
38-
echo "runner: ${{ matrix.os }}"
39-
echo "arch: $(uname -m)"
40-
echo "macOS: $(sw_vers -productVersion)"
41-
echo "brew: $(brew --version | head -1)"
42-
echo "brew prefix: $(brew --prefix)"
43-
echo "tapped? $(brew tap | grep -c mcpp || true)"
43+
echo "runner: ${{ matrix.os }} | macOS $(sw_vers -productVersion) | $(uname -m)"
44+
brew --version | head -1
45+
echo "── does this brew even have \`trust\`? ──"
46+
brew trust --help 2>&1 | head -25 || echo "(no brew trust subcommand)"
4447
45-
# EXACTLY the command README.md line 121 tells users to run — no prior
46-
# `brew tap`. Auto-tapping is part of what is being tested.
47-
- name: "brew install mcpp-community/mcpp/mcpp-m (documented one-liner)"
48-
id: install
48+
# ① the documented one-liner on a machine that has never tapped
49+
- name: "1. documented one-liner (untapped machine)"
4950
run: |
5051
set +e
51-
brew install mcpp-community/mcpp/mcpp-m > install.log 2>&1
52-
rc=$?
53-
echo "install_rc=$rc" >> "$GITHUB_OUTPUT"
54-
echo "=== documented one-liner exit: $rc ==="
55-
tail -40 install.log
56-
exit 0
52+
brew install mcpp-community/mcpp/mcpp-m > s1.log 2>&1
53+
echo "STEP1_rc=$?"
54+
tail -5 s1.log
5755
58-
- name: "Diagnose"
59-
if: ${{ steps.install.outputs.install_rc != '0' }}
56+
# ② the SAME documented command again, now that the tap exists. This is
57+
# what a user hits on their second machine-state, and what CI would
58+
# hit on a warm image.
59+
- name: "2. documented one-liner AGAIN (tap now present)"
6060
run: |
61-
echo "── full log ──"
62-
cat install.log
63-
echo "── error-ish lines ──"
64-
grep -nEi 'error|fail|cannot|no such|denied|unable|invalid|require' install.log | tail -40 || true
65-
for f in ~/Library/Logs/Homebrew/mcpp-m/*; do
66-
echo "===== $f ====="; cat "$f"
67-
done 2>/dev/null || true
61+
set +e
62+
brew uninstall --force mcpp-m > /dev/null 2>&1
63+
brew install mcpp-community/mcpp/mcpp-m > s2.log 2>&1
64+
echo "STEP2_rc=$?"
65+
tail -5 s2.log
6866
69-
- name: "Post-install: launcher + real build"
70-
if: ${{ steps.install.outputs.install_rc == '0' }}
67+
# ③ the short form the tap README advertises once tapped
68+
- name: "3. short form: brew install mcpp-m"
7169
run: |
7270
set +e
73-
which mcpp; ver_rc=0
74-
mcpp --version > ver.log 2>&1 || ver_rc=$?
75-
echo "--version exit=$ver_rc"; cat ver.log
76-
cd "$(mktemp -d)"
77-
mcpp new brewhello > new.log 2>&1; new_rc=$?
78-
echo "new exit=$new_rc"; tail -10 new.log
79-
[ $new_rc -eq 0 ] || exit 0
80-
cd brewhello
81-
mcpp run > run.log 2>&1; run_rc=$?
82-
echo "run exit=$run_rc"; tail -40 run.log
83-
exit 0
71+
brew uninstall --force mcpp-m > /dev/null 2>&1
72+
brew install mcpp-m > s3.log 2>&1
73+
echo "STEP3_rc=$?"
74+
tail -5 s3.log
8475
85-
# The other spelling the tap README advertises (line 30). Installing
86-
# through an alias is not the same code path as installing the formula.
87-
- name: "Alias: brew install …/mcpp"
88-
if: ${{ matrix.os != 'macos-13' }}
76+
# ④ the alias spelling (tap README line 30)
77+
- name: "4. alias: brew install …/mcpp"
8978
run: |
9079
set +e
9180
brew uninstall --force mcpp-m > /dev/null 2>&1
92-
brew install mcpp-community/mcpp/mcpp > alias.log 2>&1
93-
echo "alias install exit=$?"
94-
tail -25 alias.log
95-
exit 0
81+
brew install mcpp-community/mcpp/mcpp > s4.log 2>&1
82+
echo "STEP4_rc=$?"
83+
tail -5 s4.log
84+
85+
# ⑤ THE FIX, if it is one. Everything below must pass after this.
86+
- name: "5. brew trust mcpp-community/mcpp"
87+
run: |
88+
set +e
89+
brew trust mcpp-community/mcpp > s5.log 2>&1
90+
echo "STEP5_rc=$?"
91+
cat s5.log
92+
93+
- name: "6. after trust: short form"
94+
run: |
95+
set +e
96+
brew uninstall --force mcpp-m > /dev/null 2>&1
97+
brew install mcpp-m > s6.log 2>&1
98+
echo "STEP6_rc=$?"
99+
tail -5 s6.log
100+
101+
- name: "7. after trust: alias"
102+
run: |
103+
set +e
104+
brew uninstall --force mcpp-m > /dev/null 2>&1
105+
brew install mcpp-community/mcpp/mcpp > s7.log 2>&1
106+
echo "STEP7_rc=$?"
107+
tail -5 s7.log
108+
109+
- name: "8. after trust: upgrade path + the binary still works"
110+
run: |
111+
set +e
112+
brew upgrade mcpp-m > s8.log 2>&1
113+
echo "STEP8_rc=$?"
114+
tail -5 s8.log
115+
mcpp --version; echo "VERSION_rc=$?"
116+
cd "$(mktemp -d)" && mcpp new t > /dev/null 2>&1; echo "NEW_rc=$?"
117+
cd t && mcpp run > s8run.log 2>&1; echo "RUN_rc=$?"
118+
tail -6 s8run.log

0 commit comments

Comments
 (0)