Repository navigation
fix(test): hermetic zone base + pin #2877 attach-policy flip in pinned-port e2e (#3212) - #3215
ranxianglei wants to merge 4 commits into
Conversation
The live zone tests squatted the machine-global fixed zone base (18787) directly, so any concurrent leg or leaked daemon on the same runner turned them red with EADDRINUSE (#3044 tests on master since 2026-10-14). Each test now reserves its own stable port run through the existing BILI_ZONE_PORT knob (scan above the zone default, below the ephemeral floor), claims the head with a real listener as the arbiter, and releases it (waiting for the socket to free) before the scenario — no new config surface, no ci.yml change.
…3212) #2877 flipped the LANEd-hook default to own-lane, so a lane-less manual daemon on the pinned port is refused (fail fast + remedy) instead of ridden; the pre-existing e2e still asserted the old attach behavior and went deterministically red on every leg. The e2e now pins the documented restore path (native.attachPolicy=global-fallback), and a sibling test pins the new default: fail fast, actionable remedy, exit 0, daemon untouched, no port-hop.
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.3692-pr.3215.1ec382aThis exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr3215.tgz
npm install -g packageInstall instructions are refreshed on each push. |
This head went red on three windows lanes with two pre-existing failure signatures that PR #3197 already fixes on its branch: - auto-restart "survives SIGTERM" stub: POSIX-only scenario — Windows terminates on SIGTERM uncatchably, so the stub can never model a SIGTERM-surviving replacement (w22-2 + w24-2 reds). Skip on win32. - claude-native "occupied stable port": the accepted probe socket's ECONNRESET was unhandled and crashed the test process (w24-3 red). Destroy connections eagerly. Both hunks are verbatim mirrors of #3197's fixes so the branches stay trivially reconcilable when the owner consolidates them.
… review) claim is always bound when release() runs (the bind is the arbiter); net.Server.close() on a listening server does not throw synchronously, so the try/catch swallowed nothing. Review nit per code-cleanliness rules (no empty catch).
[bot] 🏷 查重结论:同家族相关,不关闭——本 PR 的「查重: 无」漏掉了 open 的 PR #3197。 审核动作:两个文件的完整 diff 已逐行读毕,关键断言对照源码验证过(fail-fast 文案 src/launcher.ts:3986-3998 与两套正则全部吻合;own-lane 过滤在 src/launcher.ts:3630,lane-less 发起方保留通配 attach,#2877 前后可完全解释 e2e 翻转)。CI 三条红 lane 全部做了日志取证。已在 PR 分支推了 2 个标注小修 commit(见第 5 问),新 head 八问
协调请求(owner 拍板项)#3197 与 #3215 同为这场红风暴的修复,改同一对文件,不能按现状双双合并。对比:
建议二选一:(a) 先落 #3197(rebase + 剥 pages revert),#3215 的 B 侧双钉作为 follow-up 折入;(b)** 把 #3215 的增量折进 #3197、关掉 #3215(superseded-with-deltas-folded)**。无论哪种,最终只留一个交付载体。 顺带发现(不动手,等 product question 一起定):README quickstart 里「a deliberate 判定:HOLD。 等 (a) owner 对 #3197/#3215 载体的决定,(b) 新 head |
[bot] 🏷 CI 跟进:新 head 判定维持不变:机制成立,待你拍板合并载体(#3197 vs #3215,见上条八问的协调请求)+ 确认后合入。两个分支现在都是绿的,无论选哪个载体,另一侧的增量都合并不冲突(#3215 已逐字镜像 #3197 的两处 flake 修复,收敛成本最小)。 |
Closes #3212
查重: 无(按失败签名检索 open+closed:EADDRINUSE / 18787 / port-zone-live / hook e2e pinned port / lifecycle-less / upgrade-replacement,均无既有条目)
Scope: tests only — no src/, no ci.yml, no config-surface change
Sub-defect A — port-zone-live EADDRINUSE red storm (tests/port-zone-live.test.ts)
Root cause: the live zone tests squatted the machine-global FIXED zone base (18787) directly. Two mechanisms:
Fix: each test reserves its own stable port run through the EXISTING
BILI_ZONE_PORTknob (scan a stable region above the zone default, below the ephemeral floor; claim the head with a real listener as the arbiter; release + wait for the socket to free before the scenario). Verified: full live file 9/9 green while an external dummy holds 18787.Sub-defect B — claude-native pinned-port e2e "lifecycle-less" refusal (tests/claude-native.test.ts)
Root cause: NOT environment — a deterministic regression from #2877 (merged 2026-10-14). The LANEd-hook default attachPolicy flipped to
own-lane, so a lane-less manual daemon on the pinned port is now refused (fail fast + remedy) instead of ridden. The e2e still asserted the pre-#2877 attach behavior → red on every leg. Reproduced locally with the exact CI message.Fix: the e2e now pins the documented restore path (
native.attachPolicy: "global-fallback"), keeping #1660's user-zone attach coverage; a NEW sibling test pins the new default (fail fast, actionable remedy, exit 0, daemon untouched, no port-hop). Both pass locally (full file 59/59).Behavior changes
native.attachPolicy: "global-fallback"/BILI_NATIVE_ATTACH_POLICY). The flip itself shipped in [Bug] attach gate: 手动 bili start 的 user-zone daemon 无视 BILI_NATIVE_ATTACH_EXTERNAL=0(文档称连 user-zone 一起关);并请求按 lane 控制 attach #2877 — this PR only stops the stale e2e from masking it.Config surface
None new. Reuses the existing
BILI_ZONE_PORTenv var (src/config.tsresolveZonePortBase), set inside the test process only.Verification
npm run typecheckclean. Full-suite verdict = remote CI on this head.