feat: add stable and beta Homebrew channels#613
Conversation
sczheng189
left a comment
There was a problem hiding this comment.
Gate decision
REQUEST CHANGES — 当前 stable/beta Formula 的真实安装与隔离行为通过,但新加入的六渠道 verifier 会把错误或陈旧版本误报为 PASS,并且没有验证 stable/beta 共存;PR 正文中的若干验证命令也无法按原样复现。
Review provenance
- [PASS] PR head 隔离检出:
76e9df331780f512f3ac4e450ffae636c0422b93 - [PASS] 本地 HEAD 与远端 PR head 一致
- [PASS] diff merge-base:
43798de08891c83049b95a596150ae8d0cb69c71 - [PASS] 审查环境:Darwin arm64,Go 1.26.4,Homebrew 6.0.6(执行 verifier 时自动更新至 6.0.10),npm 10.9.8
- [PASS] 使用隔离 checkout;原工作区未切分支或写入
- [PASS] 临时 Homebrew Formula 与 tap 已清理;调用者原有
/Users/zhengyubai/.local/bin/dws未被替换
PR description completeness
- [PASS] D1 Requirement and problem — 说明了此前只有 host-specific local Formula、没有公共 Homebrew channel
- [PASS] D2 Goal and expected behavior — stable、keg-only beta、Formula PR automation 和不直写 main 的目标清楚
- [FAIL] D3 Acceptance criteria and requirement-to-test mapping — “version check”没有映射到期望版本断言;“beta 不覆盖 stable”没有共存验证步骤
- [PASS] D4 Implementation summary — Formula 生成、发布 PR、验证器和文档变更有概述
- [FAIL] D5 Configuration and environment — 未记录作者验证的 OS/arch/Go/Homebrew 版本,也未记录
make package必需的DWS_PACKAGE_VERSION和合并前验证 PR Formula 所需的 tap override - [FAIL] D6 Exact test steps and author results — Homebrew 实机步骤不是可复制命令;原样
make package和默认 verifier 在 PR checkout 上均失败,正文却只写 passed - [PASS] D7 Limitations and known failures — 已明确首次 tag-triggered Formula PR 才是发布自动化 live E2E
Author validation reproduction
| ID | Acceptance criterion | Author step | Independent result | Match | Evidence |
|---|---|---|---|---|---|
| V1 | 全量回归 | go test ./... |
FAIL | No | exit 1;subprocess 超时重跑通过,权限失败在 base 同样复现,属于环境/基线问题 |
| V2 | script tests | go test ./test/scripts -count=1 |
FAIL | No | 既有并行测试共享 repo-root dws,并受 root-owned ~/.agents/skills/dws 影响;相关新增测试单独运行通过 |
| V3 | 生成发布包 | make package |
FAIL | No | exit 2:could not resolve package version |
| V4 | 带必要版本生成发布包 | DWS_PACKAGE_VERSION=v1.0.52-beta.4 make package |
PASS | Diagnostic | 六平台包、skills、npm 和 beta Formula 成功生成 |
| V5 | 包管理器验证 | ./scripts/release/verify-package-managers.sh |
PASS | Yes | npm 与 Homebrew local Formula 安装成功 |
| V6 | policy | make policy |
PASS | Yes | open-source audit / command surface 均 OK |
| V7 | whitespace | git diff --check |
PASS | Yes | exit 0 |
| V8 | 六渠道默认命令 | ./verify/verify-all-channels.sh |
FAIL | No | Homebrew 从尚未包含本 PR Formula 的远端 main tap 安装,步骤失败;其余本机可运行渠道通过 |
| V9 | PR-head 六渠道诊断 | 设置 DWS_VERIFY_HOMEBREW_TAP 与 DWS_VERIFY_HOMEBREW_REPO_URL 后运行同一脚本 |
PASS | Diagnostic | curl、npm stable/beta、Homebrew、upgrade 均 PASS;PowerShell 在非 Windows 为 SKIP |
Behavioral and regression checks
- [PASS] beta 实装版本 —
$(brew --prefix dingtalk-workspace-cli-beta)/bin/dws version --format json返回v1.0.52-beta.4 - [PASS] stable/beta 共存 — stable 保持
v1.0.51,安装 beta 前后 stable 二进制 SHA 均为98b9b2b143f01e85676ceb974ee74afcadeac9dd45244e7ecc5b78422bf611e2 - [PASS] stable link 不变 —
/opt/homebrew/bin/dws安装 beta 前后均解析到 stable Cellar 路径 - [PASS]
brew test— stable 与 beta 均通过 - [PASS] pkgshare Skills — stable 与 beta 的
skills/dws均存在 - [PASS] 发布资产完整性 — 两个 Formula 的 macOS amd64/arm64、Linux amd64/arm64 与 skills 共 10 个 SHA 全部匹配 GitHub Release 资产
- [PASS] beta channel isolation — beta Formula 是独立类、独立文件并声明
keg_only - [PASS] Secret presence — repository Actions secret 列表中存在
HOMEBREW_PR_TOKEN,更新时间为 2026-07-14T07:33:42Z - [NOT VERIFIED] Secret value properties — GitHub 不公开 secret 的 PAT scope、owner 或过期策略,无法独立验证
public_repo/ non-expiring 声明 - [NOT VERIFIED] Windows PowerShell channel — 当前主机不是 Windows
- [NOT VERIFIED] 第一次 tag-triggered Formula PR — PR 正文已正确声明为合并后的 live E2E
Conventional code review
- [PASS] Formula 平台选择、URL、SHA 与 release assets
- [PASS] stable/beta 命名、keg-only 和链接隔离
- [PASS] 发布 workflow 只推 automation branch 并开 PR,不直接写 main
- [PASS] token 通过 askpass/GH_TOKEN 使用,未发现日志泄漏
- [PASS] shell / Ruby syntax、
make policy、git diff --check - [PASS] 本 PR 相关 focused Go tests
- [FAIL] verifier version semantics — 只执行
dws version,不比较期望值 - [FAIL] verifier coexistence semantics — 安装 beta 前先卸载 stable,无法证明 beta 不覆盖 stable
- [FAIL]
brew style— 两个 Formula 共 3 个 offense:desc 以 Formula 名开头,以及两处不必要的FileUtils.qualifier
CI and baseline comparison
- [PASS] Required CI — Lint、Multi Profile E2E、Test、macOS、Windows、Coverage、Policy、Edition Contract 全绿;Notify 按预期 SKIP
- [PASS] Base comparison —
internal/upgrade与test/scripts的权限失败在43798de同环境复现,归类为 baseline/environment failure,不是本 PR 回归 - [PASS] Transient subprocess failures —
internal/helpers与internal/transport单包重跑通过
Findings and blockers
- Blocking code findings:
- verifier 必须解析并断言 stable/beta 的期望版本;错误版本必须使 channel FAIL,并补回归测试。
- Homebrew 验证必须在 stable 仍安装时安装 keg-only beta,并验证 stable 版本、二进制/链接不变;cleanup 同时清理两条由脚本安装的 Formula,仍需保护用户预装版本。
- PR description blockers: D3、D5、D6。请补作者环境、完整可复制命令、
DWS_PACKAGE_VERSION、PR-head tap override,以及真实 observed results/cleanup。 - Validation mismatches: V1、V2、V3、V8;请不要保留无条件的 “passed” 描述。
- Not-verified items: Windows PowerShell、首次 tag-triggered Formula PR、secret 实际 scope/expiry。
- Formatting: 请一并运行并修复
brew style Formula/dingtalk-workspace-cli.rb Formula/dingtalk-workspace-cli-beta.rb。
Review action
REQUEST_CHANGES。修复 verifier 的版本断言与共存检查、补相应行为测试并更新 PR 正文后,请重新 request review;Formula 当前实装行为本身已验证通过。
| smoke() { | ||
| binary="$1" | ||
| test -x "$binary" || return 1 | ||
| "$binary" version |
There was a problem hiding this comment.
[P1] 这里仅执行 dws version,没有解析或比较期望版本,所以 npm beta/Homebrew beta 即使错误地安装了 stable 或旧 beta 也会被标记为 PASS。请为 stable/beta 提供可复现的期望版本来源并做严格断言,同时补一条 wrong-version 必须失败的行为测试。
| brew install -y "$TAP/$PACKAGE" | ||
| installed_formula="$PACKAGE" | ||
| smoke "$(brew --prefix "$PACKAGE")/bin/dws" | ||
| brew uninstall "$installed_formula" >/dev/null |
There was a problem hiding this comment.
[P1] 在安装 beta 之前卸载 stable,使这个步骤无法证明 keg-only beta 不会覆盖 stable。请保留脚本刚安装的 stable,再安装 beta,并比较 stable 的版本、二进制或 Homebrew link 在前后不变;cleanup 可记录并清理两条由本次运行安装的 Formula。
|
已按评审意见修复并推送( Blocking code findings
brew style: PR 正文:重写 D3(验收标准→测试映射)、D5(作者环境 + 本轮本机复核:focused |
sczheng189
left a comment
There was a problem hiding this comment.
复验通过。上次阻塞项已全部修复:版本校验现在对错误版本、空期望值和同前缀 beta fail-closed;Homebrew 验证会在 stable 保持安装时安装 keg-only beta,并校验 stable 的版本、二进制 SHA 与 PATH 链接不变;仓库内及发布模板生成的 stable/beta Formula 均通过 brew style。Focused tests、双版本打包复验及当前 head b1e3f10 的 GitHub CI 均通过。
The six-channel verifier previously ran `dws version` without comparing it to the version each channel advertises, so a stale or wrong binary still reported PASS. It also uninstalled stable before installing beta, which could not prove the keg-only beta coexists with stable. - smoke() now takes an expected version and fails the channel on mismatch - npm/homebrew derive the expected version from the package manager; curl/upgrade derive it from the latest GitHub release tag - homebrew installs keg-only beta while stable stays installed, then asserts stable's version, binary SHA and PATH link are unchanged - cleanup uninstalls both script-installed formulae, still refusing to touch a pre-existing user install - add regression tests for version assertion and coexistence semantics
- reword desc so it no longer starts with the formula name - drop the unnecessary `require "fileutils"` and use the mixed-in cp_r instead of the FileUtils. qualifier
b1e3f10 to
b47d538
Compare
Summary
Why
The repository generated only a host-specific local Formula and never delivered a public Homebrew channel. The public command also cannot use the implicit tap convention because all implementation must remain in this repository.
Acceptance criteria → tests
smoke()+ executableTestVerifyAssertsExpectedVersioncasesbrew list --versions, npmnpm view @tag version, curl/upgrade GitHubreleases/latestTestVerifyHomebrewCoexistenceinstalled_formulaecleanupcp_rtemplates + package-generation regression assertions + Homebrew style auditautomation/homebrew-*branches and opens PRs; never writesmainEnvironment
go1.25.9 darwin/arm646.0.1011.6.2, Node:v24.13.0make packagerequiresDWS_PACKAGE_VERSION(for examplev1.0.52-beta.5).DWS_VERIFY_HOMEBREW_TAPandDWS_VERIFY_HOMEBREW_REPO_URL.v1.0.52andv1.0.52-beta.5already exist on the canonical repository.Verification
go test ./test/scripts -count=1ok ... test/scripts 43.597sDWS_PACKAGE_VERSION=v1.0.52-beta.5 make package./scripts/release/verify-package-managers.shPackage-manager verification complete.brew style Formula/dingtalk-workspace-cli.rb Formula/dingtalk-workspace-cli-beta.rbbrew style --only-cops=FormulaAudit/Miscellaneous dist/homebrew/dingtalk-workspace-cli-beta.rband--only-cops=FormulaAudit/Descmake policy./scripts/policy/check-generated-drift.shandgit diff --checkDWS_VERIFY_HOMEBREW_TAP=<owner/repo> DWS_VERIFY_HOMEBREW_REPO_URL=<git-url> bash verify/verify-all-channels.shLimitations:
Risk and rollback
The built-in
GITHUB_TOKENkeeps minimal permissions. Formula automation uses a dedicated repository secret only to pushautomation/homebrew-*branches and open Formula PRs; it never writesmain. Stable and beta Formulae are isolated. Rollback is reverting this PR; existing release assets are unchanged.Required repository configuration
Configured on 2026-07-14: the repository Actions secret
HOMEBREW_PR_TOKENcontains a dedicated, non-expiring classic PAT with only thepublic_reposcope. A classic token is necessary because the organization does not allow a fine-grained token to target this repository, and the built-inGITHUB_TOKENcannot create pull requests under the current organization Actions policy.No maintainer environment variable is required when creating a tag. Replace the token immediately if it is exposed, its owner loses repository access, or release-bot ownership changes. The first tag-triggered Formula PR will provide the live end-to-end automation check after merge.