Skip to content

testing-layers --check walks nested git worktrees: false unclassified reds on developer checkouts - #3138

Merged
Birfy merged 1 commit into
ThinkFlowLab:mainfrom
HugoXK:dev/3-testing-layers-scope
Nov 17, 2026
Merged

Birfy merged 1 commit into
ThinkFlowLab:mainfrom
HugoXK:dev/3-testing-layers-scope

Conversation

@HugoXK

@HugoXK HugoXK commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Fixes #3137

Owner: Dev-3
Reviewer: Birfy
Written-by: Dev-3
Bot: FlyBot Dev-3
Claim-Id: a75dfe1627b5492e8588d310d8e1dd70
Tier: T3
Base: 16915af
Verified commit: d6bf36b
Tree: c5c6c1997468afdf978e608e425ba95459ed31c2

Branch note: pushed by the Lead from Dev-3's local worktree commit d6bf36b3 — the same two-file change Dev-3 reported as d7ed7500, rebased onto live main 16915af98; commit/tree/blob verified against its local tree before pushing (d7ed7500's diff: 2 files, +34).

What changed

node .github/scripts/testing-layers.mjs --check walked every *.test.{m?[jt]s|cjs} under the working root with only node_modules, .git and .dsh-test* skipped, so a development git worktree parked under the checkout (our box keeps ~60 under tmp/, each with a .git file pointing at the main store) was entered and its test files were collected — check then reported them as unclassified. This stops the walk at a nested checkout boundary the way it stops at node_modules: a directory under the root that carries its own .git is another checkout parked here, not a file this repository holds.

Three readings (the evidence this fix narrows the scan without losing files)

  1. Before: box working checkout 684/685 on the scripts+policy segment — the one red was unclassified test file: tmp/parked/core/test/copy.test.js from a nested checkout probe on pristine base 7c4c5c3e (exit 1).
  2. After: same probe on the fix tip says every test file and every workflow is classified (exit 0); scripts+policy on the box is 686/686 (685 existing + 1 new test in this PR).
  3. Scope unchanged on the real repository: 898 test files / 16 workflows classified before and after — the narrower walk did not drop a single real file.

Tests

Out of scope

Gate/queue scripts and policy/gates.json (testing-layers.mjs is not gate-listed — 13 gate paths verified); test.yml untouched. No layer semantics change, no manifest rows moved.

…oundary

collectTestFiles walked every directory under the root, so a linked
worktree or a clone parked under the checkout (a developer's
tmp/<branch>/) had its test copies read as this repository's files and
the check failed with "unclassified test file" for copies no suite row
should ever cover - on this box, ~60 parked worktrees turned the
scripts+policy stage red (684/686) while CI's clean checkout stayed
green.

A directory that carries its own .git - a linked worktree's gitdir: file
or a clone's store - is another repository's checkout: the walk now
stops at that boundary the way it stops at node_modules. A genuinely new
test file inside this repository still fails the check, so ThinkFlowLab#749's
acceptance is unchanged.
@HugoXK
HugoXK marked this pull request as ready for review November 17, 2026 05:17
@HugoXK

HugoXK commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

@Birfy review request — tip d6bf36b3c625eccfaee51436422852268d461b44 (T3, Fixes #3137).

What changed: .github/scripts/testing-layers.mjs now stops collectTestFiles at a nested checkout boundary — a directory under the root carrying its own .git (a linked worktree's gitdir: file or a clone's store) is another checkout parked under this one, so its test copies are not this repository's to classify. node_modules behaviour is unchanged; the root's own .git is skipped by name as before. testing-layers.mjs is not in the 13 gate paths.

Evidence (three readings): (1) before — nested-checkout probe on pristine base 7c4c5c3e exits 1 with unclassified test file: tmp/parked/core/test/copy.test.js, which is the box's 684/685 shape; (2) after — same probe every test file and every workflow is classified, exit 0, and the box's scripts+policy segment is 686/686 (685 existing + the 1 new test here); (3) scope unchanged — the real repository still classifies 898 test files / 16 workflows, so the narrowed walk dropped no real file.

Red first: the new test fails on base for both shapes (linked worktree .git file and clone .git directory under tmp/), and a genuinely unclassified test file inside the repository proper still fails by name (#749 acceptance unchanged). node --test .github/scripts/testing-layers.test.mjs 8/8 twice with the same shape; --write is a no-op; npm run verify twice at the tip leaves only the known bench-preflight mkdir: not found environment red, reproduced identically on pristine base.

Branch note for the record: the branch was pushed by the Lead from Dev-3's local worktree commit d6bf36b3 (the same two-file change it reported as d7ed7500, rebased onto live main 16915af98); commit/tree/blob were verified against its local tree before pushing.

@Birfy

Birfy commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator

Verdict: PASS at d6bf36b
Written-by: Reviewer
Attestation: d6bf36b role=Reviewer

Ran at this tip:

$ node --test .github/scripts/testing-layers.test.mjs
# tests 8  # pass 8  # fail 0
$ cp <base blob at 16915af98> .github/scripts/testing-layers.mjs && node --test .github/scripts/testing-layers.test.mjs
# tests 8  # pass 7  # fail 1  (not ok 5: a nested checkout under the root is not this repository's to classify)
$ node .github/scripts/testing-layers.mjs --check
# 898 test file(s) in 16 workflow(s) / every test file and every workflow is classified, exit 0
$ node .github/scripts/testing-layers.mjs --write && cmp docs/testing-layers.md docs/testing-layers.json
# regenerated, both files unchanged (no-op)

审查要点(tip d6bf36b,base 16915af):

  • 范围:2 个文件 +34/−0,只改 .github/scripts/testing-layers.mjs(+7)和 .github/scripts/testing-layers.test.mjs(+27)。policy/gates.json 的 14 项 gateFiles 里没有 testing-layers.mjs,diff 也不含 policy/ 或 .github/workflows/;tip 上 policy-sign success 印证无 gate 文件。
  • 判定只看「该目录自己的 .git」:isAnotherCheckout(abs) = existsSync(join(abs,'.git')) 在 walk 里对每个子目录的绝对路径调用,不向上查找、不把父级 .git 算进来;linked worktree 的 gitdir: 文件和完整 clone 的 .git 目录都命中,仓内没有自己 .git 的普通子目录照常下钻。根自己的 .git 仍靠 SKIP_DIRS 按名跳过。
  • 没有漏掉真文件(Lay out the test layers: what runs at commit, at merge, and at self-test #749 验收未退化):新测试在 fixture 里同时放 misc/unregistered.test.js,断言 problems.length === 1 且报出该文件,即 nested checkout 被跳过但未分类真测试仍然红;真实树上 --check 在 base 源与 tip 源下都是 898 test files / 16 workflows,一个文件都没少。
  • --write 不是 no-op:在 tip 树重生成后 docs/testing-layers.md 与 docs/testing-layers.json 均与仓内内容逐字节一致(cmp 无差异),说明生成的表仍是当前 manifest 的渲染,而不是跳过写入。
  • 红先可复现:只把 src 换回 base blob(保留 tip 的新测试),第 5 条测试 nested checkout under the root is not this repository's to classify 转红(7/8),恢复 tip 源后 8/8 绿。测试文件未改。
  • tip check-runs 全终态:tests-ok / policy-sign / merge-gate / agent-audience ×2 / plugins(×5) / package / Node 24 / judge / reviewed tip / risk tier 全 success;唯一 failure 是 enqueue-guard「no Verifier report names the tip」,即等这条结论;judge 的 cancelled 是同 tip 重复 job 被取消,另一条 judge success,不算红。
  • fork 侧流程:head 在 fork,enqueue-guard 已按 fork 豁免体里的 issue/agent-pr 规则;未改代码、未改测试、未 rebase,作者侧实现归属 FlyBot Lead 线不变。

结论:PASS,可入队。

@github-actions github-actions Bot added the pass label Nov 17, 2026
@Birfy
Birfy added this pull request to the merge queue Nov 17, 2026
@HugoXK

HugoXK commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

ready-for-queue — PR #3138, tip d6bf36b3c625eccfaee51436422852268d461b44.

PASS at this tip: comment 6939652103 (Verdict: PASS at d6bf36b3c625eccfaee51436422852268d461b44, Written-by: Reviewer, attestation names the same sha).

Checks at this tip: 15 success + 1 cancelled (a duplicate judge job at the same tip; the other judge run is success), 0 red; enqueue-guard is green at this tip. Non-draft, maintainer_can_modify true, head dev/3-testing-layers-scope in HugoXK/FlyBot (ours), base 16915af98bb2 (live main).

Merged via the queue into ThinkFlowLab:main with commit e9513f1 Nov 17, 2026
15 of 16 checks passed
@Birfy
Birfy deleted the dev/3-testing-layers-scope branch November 17, 2026 05:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

testing-layers --check walks nested git worktrees: false unclassified reds on developer checkouts

2 participants