Skip to content

[PR] release: v3 gate-branch publish model (ship PR lane→bugfix fires; auto-cut next lane) - #4653

Merged
ranxianglei merged 3 commits into
masterfrom
lane-publish-v2
Oct 25, 2026
Merged

ranxianglei merged 3 commits into
masterfrom
lane-publish-v2

Conversation

@ranxianglei

@ranxianglei ranxianglei commented Oct 25, 2026 •

Copy link
Copy Markdown
Owner

What changed vs the earlier draft on this PR

Model revision after owner decision (2026-10-25): publishing must be one exact explicit act — a reviewed ship PR bugfix-vX.Y.Z → bugfix being merged into the standalone protected gate branch bugfix (same status as master). Merging carries INTO a tag lane publishes NOTHING (the v2 "any lane merge fires" behavior is gone); every other PR shape is a millisecond no-op. Three files:

  1. .github/workflows/release-bugfix.yml — dual-path rewrite (pull_request_target closed, base ∈ {bugfix, master}):
    • Path A (PUBLISH): base=bugfix ∧ head matches bugfix-vX.Y.Z ∧ same-repo ∧ merged → publish the POST-MERGE lane head (= merge_commit_sha, drift-checked against the live lane ref) through the unchanged guard chain (monotonic vs npm latest / not-already-live / no sub-0.1.0 / manifest fail-open notice / release-notes opt-in / full-CI dispatch+wait at the publish sha / npm ci + typecheck + full test + build) → tag → npm publish → GH Release → audit comment on the ship PR → auto-open alignment PR (head=bugfix → master, title contract below).
    • Path B (AUTO-CUT, stage P4): merged alignment PR (head=bugfix, base=master, same-repo, title starts with align master with vX.Y.Z (shipped from) → auto-cut lane bugfix-vX.Y.Z from tag vX.Y.Z, pre-bump package.json +1 patch, push (idempotent; failure posts manual recovery commands AND fails loudly). One remaining manual click per cycle: applying branch protection (GITHUB_TOKEN cannot; announcement comment carries it).
    • Legacy pull_request closed carve-out path kept dormant verbatim; workflow_dispatch fast=true emergency escape hatch unchanged; concurrency group unchanged.
  2. .github/workflows/ci.yml — bugfix added to push+pull_request branch lists; the plan job forces FULL matrix scope for base=bugfix (born full-scope like Release PRs should default to running the full matrix: the ci:full label has a merge-timing race condition (v0.1.200's | 发版 PR 应默认跑全量矩阵:ci:full 标签存在合并时序竞态(v0.1.200 全量被取消后白付两遍) #3688 release PRs, no label needed). E2E lanes stay label-gated: the ship PR carries the standard ci:full label at open time, so they ride green.
  3. reference/release.md — gate-branch model v3: roles of bugfix (THE GATE) / tag lanes / master; cycle stages P1–P4; alignment title contract (load-bearing for P4); protection PUT payload + the "required context roster comes from the PR's own check-runs" rule (a required context landing skipped deadlocks merges); dual-lane section aligned (auto-cut replaces manual cut-after-first; ship PR = lane→bugfix; CI wiring v3).

After this merges (owner steps)

  1. Merge this PR (mechanism on master).
  2. I push the new protected-intent branch bugfix off the post-merge master (it carries this exact workflow file — base-side copy executes, so there is no arming window).
  3. Apply protection to bugfix (Settings → Branches; payload in reference/release.md § Lane/gate-branch protection; start with contexts:["gate"]).
  4. I open the ship PR bugfix-v0.1.206 → bugfix with ci:full → its FULL runs double as the probe → I harvest the exact context roster → you widen protection to the full roster.
  5. You merge the ship PR = v0.1.207 ships (guards verify 0.1.207 > npm latest 0.1.206 first) → alignment PR auto-opens → you merge it → bugfix-v0.1.207 auto-cuts itself. Cycle closed.

Note: the advisory-note PR (#4655, into the lane) is a plain carry now — merge it into the lane BEFORE the ship PR is opened so the banner rides the release tree. backport-ship stays decommissioned; the only labels the flow uses are backport (carry routing) and ci:full (e2e gate).

…backport-ship label)

Owner decision 2026-10-25: a publish action must be a human MERGE into a protected
patch lane — the single-label 'backport-ship' auto-publish path is dangerous and
is decommissioned (the label itself was already removed from the repo).

release-bugfix.yml (v2):
- drop the 'labeled' trigger entirely
- new 'pull_request_target' closed trigger on bugfix-v* / bugfix-release/** bases:
  resolving the POST-MERGE lane head (merge_commit_sha, same-repo guard,
  non-merged closes no-op within milliseconds), cross-checked against the live
  lane ref with a drift warning
- audit comment on the merged lane PR
- NEW post-publish step: auto-open the alignment PR (lane -> master, deduped,
  failure flagged non-fatal) so master picks up shipped content; merging it
  completes the cycle
- legacy one-off carve-out path (pull_request closed, bugfix-release/* heads)
  kept DORMANT byte-for-byte; all version/guard steps (monotonic guard,
  manifest check fail-open, full-CI dispatch+wait, pre-flight, fast mode)
  unchanged

release-manual.yml: 'Release (one-click)' train mode RETIRED — it refuses at its
first step; its direct-push mechanics predate protected lanes. Master-lane flow
unaffected.

reference/release.md: patch-lane channel rewritten around the governing rules
(protected lane = same status as master, content only via reviewed PRs, merge IS
the release, alignment PR closes the cycle), label path marked DECOMMISSIONED,
CI wiring = the required-checks story (core matrix on lane PRs; FULL matrix at
the exact publish sha inside the pipeline).

Arming order note: GitHub executes the BASE (lane-side) workflow copy for
pull_request_target events, so this file must land ON a lane through an ordinary
carry PR before its first merge-trigger can fire (follow-up PR to
bugfix-v0.1.206).
@ranxianglei ranxianglei changed the title release: merge-gated patch-lane publish (protected lanes; supersedes backport-ship label) [PR] release: merge-gated patch-lane publish (protected lanes; supersedes backport-ship label) Oct 25, 2026
@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: lane-publish-v2 (c88399c)

Latest build — install this exact version

npm install -g billion-context@0.0.5699-pr.4653.9383716

This exact version is immutable and reproducible. The rolling pr tag tracks the newest test build across all PRs.

Recent builds (commit → version)

commit version build
c88399c billion-context@0.0.5699-pr.4653.9383716 build
f009043 billion-context@0.0.5697-pr.4653.c45f7ac build

Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf billion-context-pr4653.tgz
npm install -g package

Install instructions are refreshed on each push.

@ranxianglei

Copy link
Copy Markdown
Owner Author

Lane branch-protection payload (step 2 of the sequence)

Empirical basis (verified against the only PR ever merged into a lane, #4577): a lane PR produces exactly one green check context — gate (the CORE matrix aggregate; 16 check-runs all success) plus the 9 full-E2E contexts which come back as skipped (their triggers scope to master/agent-relay; lanes get the core matrix per ci.yml's plan job). A required check that lands skipped blocks merges, so copying master's 14-shard list would deadlock every lane PR forever. The FULL suite is not skipped over — it runs inside release-bugfix.yml at the exact publish sha (dispatch + wait, hard failure before npm publish), which is where those contexts can actually go green.

Master today (for parity reference): PR-only (0 approvals), strict checks [test shards ubuntu/windows × 22/24], force+delete disallowed, enforce_admins=false.

Recommended rule for bugfix-v0.1.206 (Settings → Branches → Add branch rule, or the API call below — my local gh-guard blocks me from writing it):

PUT /repos/ranxianglei/billion-context/branches/bugfix-v0.1.206/protection
{
  "required_status_checks": {
    "strict": true,
    "contexts": ["gate"],
    "context_options": []
  },
  "enforce_admins": false,
  "required_pull_request_reviews": { "required_approving_review_count": 0 },
  "allow_force_pushes": { "enabled": false },
  "allow_deletions": { "enabled": false }
}

i.e. same posture as master, with the one context that lane PRs provably produce. If you later want stricter entry gating (e.g. more static gates), add only contexts that lane PR events demonstrably run — re-query the lane PR's commits/check-runs first.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

查重: 不重复 — open/closed issue+PR 全检索:这是独立的发布流程变更 PR(前身是它取代的 #4596 label 路径,非重复);companion arm-PR #4654 是同一设计的配套动作,不是重复条目。

标签: scope/ci + p3(发布流水线流程收紧,无用户侧缺陷;不打 bug——这不是缺陷修复)。

结构化八问

  1. 是什么问题:发布流程缺陷——旧路径([PR] fix(release): label-gated head-tree publish for conflicted carve-out ship PRs #4596)的触发面是 backport-ship 标签而非 merge:任何能给 PR 打标的人都能发版,中间没有人工合并决策。本 PR 把触发面换成「人工 merge 进受保护 lane」。
  2. 什么原因导致的:不是代码 bug,是权限模型缺口——label 事件对仓库内所有有 label 权限的身份开放,而 publish 是不可逆动作;两者之间缺一道决策门。修法 = 删掉 label 触发器,让 publish 只挂在 merged same-repo PR on lane base 上。
  3. 影响范围与严重程度:仅 patch-lane 发布通道(bugfix-v* / bugfix-release/**)。master 正常发布、one-click lane、fast 紧急输入全部未动。armed-not-fired 设计保证:lane 未 arm 前新触发器不可能开火 → 对外部用户零影响,纯内部流程收紧。
  4. 怎么修复的:labeled → pull_request_target closed(base ∈ lane 模式;closed+merged+same-repo 三重 guard,fork 在触碰任何 head 内容前拒绝)。发布对象 = POST-MERGE lane head(merge_commit_sha,对 live lane ref 做 drift 警告),完整 guard 链不变(版本单调/manifest 同步/publish sha 处 full-CI dispatch+wait/pre-flight);发布后自动开 alignment PR(lane→master,dedupe,失败非致命→手动开)。release-manual.yml train mode 退役(首步直接拒)。
  5. 是否有回归问题:逐项审过既有行为——legacy pull_request closed carve-out 路径 byte-for-byte 保留(in-flight carves 不受影响),且其中 bugfix-v* case 被移除:已验证这是对的,否则自动开的 alignment PR(head=lane, base=master)合入 master 会二次触发 publish;concurrency group、版本 guard、manifest check、full-CI wait、fast input 均未变。发现一个真缺陷并已修(见下 a)。
  6. 是否破坏缓存:不涉及(纯 CI workflow + 文档,无运行时行为)。
  7. 是否改了设计方向:是,这正是本 PR 的目的——v2 patch-lane 模型(lane = 与 master 同级的受保护分支;内容全走 reviewed carry PR;merge 即发布;发布后自动 alignment)。与 2026-10-25 owner 决定一致,无额外转向。
  8. 是否引入了新的配置:无新 env/config/默认值。分支保护规则按你给的 payload 设置完成(见下 c)。

Review findings 与已执行动作

a) 缺陷:release-bugfix.yml release-notes 步骤里 echo "" 被编辑成裸 ""(Create GitHub Release 步骤,{ ... } > "$NOTES" 分组内)。bash 会把裸 "" 当空命令名执行 → ": command not found" exit 127。该步骤没有 set -e,所以今天只是 stderr 噪音、不阻断发布,但显然是编辑事故。已在 PR 分支就地修复:5c198901b fix: restore blank-line echo clobbered by edit in release-notes step (#4653 review)。

b) 文档与观测不符并已修正:reference/release.md 原 "CI wiring" 段称 lane PR 跑 CORE matrix 且「这就是 lane 保护强制的 required-checks」。实测(活证据 #4654,lane PR):其 head sha 上只有 gate success ×N + 各 e2e suite skipped,没有任何 ci.yml context(no plan/test/static-gates)——尽管 ci.yml 的 pull_request filter 列了 bugfix-v*。后果:(i) 你选 ["gate"] 作 required check 不会死锁(gate 在 lane PR 上实证恒绿),这个选择本身正确;(ii) 真正兜底的是结构性覆盖——publish sha 处 release-bugfix.yml dispatch+wait FULL matrix(publish 前硬失败)。已改文档为观测事实:c88399c68 docs: align CI-wiring paragraph with observed lane-PR check contexts (#4653 review)。连带发现(未动,超本 PR 文件范围,留你处置):ci.yml 自身注释(master 侧)也写着「carry PRs INTO the current patch lane run the CORE matrix」,与实测矛盾;为什么 filter 匹配却不触发值得单独查一眼。

c) gate 归属更正:它不是 core-matrix 聚合,而是每个 ci-e2e-* workflow 的 gate: scope-decision job(non-ci:full PR 上 gate 绿、suite skipped)。不影响你的 payload 结论,仅更正表述。

d) 分支保护已代设并验证(你的 gh-guard 写不了,我走 API 落了):bugfix-v0.1.206 现为 required checks strict=["gate"]、approvals=0、enforce_admins=false、force-push/delete 双禁。与你 payload 的唯一差异:PUT API 要求 boolean 形式(allow_force_pushes:false)+ protected:true + restrictions:null,语义与你的 JSON 完全一致,HTTP 200 响应体逐项核对过。你的 After-merge 三步现在只剩 2、3。

e) 版本状态核验(你的第 3 步可行性):npm latest = 0.1.206,最新 tag = v0.1.206;lane 上已带着旧 train flow 留下的未发布 bump commit 9068ca5a2 "release v0.1.207"(2026-10-24,从未 publish)。⇒ advisory note PR 合入 lane 后直接从 post-merge head 发 v0.1.207,advisory PR 本身不需要再带任何 version bump,guard(严格大于 npm latest)通过。

f) CI 状态:原 head f009043 上 diff 相关检查(static-gates/guards/docs-sync 等)全绿;红的 6 个 test shard 与 master head 52567f1 完全同签名(继承性红,与本 diff 无关——diff 只碰 .github/workflows/* + reference/release.md)。已在 #4599 留一行记录,未另开 issue(政策)。我的两个 review commit 已推上 lane-publish-v2,CI 重跑中,预期仍是同样的继承红直到 master 侧恢复。

判定

可合。两个 review commit(a 的缺陷修复 + b 的文档对齐)请一并收进 PR;合入后按你的顺序执行 arm-PR(#4654)→ advisory note PR(首发 v0.1.207)。继承性的 6-shard 红不构成本 PR 特有阻塞,#4599 跟踪。

@ranxianglei
ranxianglei merged commit 8b24d1f into master Oct 25, 2026
85 of 128 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.831-master.8b24d1f (rolling master tag).

npm install -g billion-context@0.0.831-master.8b24d1f  # this exact build
npm install -g billion-context@master  # always the newest merged build

npm view billion-context@master prints the current version at any time.

@ranxianglei ranxianglei changed the title [PR] release: merge-gated patch-lane publish (protected lanes; supersedes backport-ship label) release: v3 gate-branch publish model (ship PR lane→bugfix fires; auto-cut next lane) Oct 25, 2026
@ranxianglei ranxianglei changed the title release: v3 gate-branch publish model (ship PR lane→bugfix fires; auto-cut next lane) [PR] release: v3 gate-branch publish model (ship PR lane→bugfix fires; auto-cut next lane) Oct 25, 2026
@github-actions github-actions Bot mentioned this pull request Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant