Skip to content

fix(pm): dispatch-gates derives the change set with -z, so a non-ASCII governed path keeps its tier - #33998

Merged
objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/project-thread-xes6db
Nov 15, 2026
Merged

objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/project-thread-xes6db

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Steve · project thread

Fixes #33847

Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:派发工具 dispatch-gates.mjs 的 changedPathsFromGit 读变更路径(已提交、未提交、未跟踪三份清单)时改成加 -z、按 NUL 切分,三份清单走同一个读取函数,-z 由该函数统一插入。
  • 为什么改:不加 -z 时 git 会把含中文等非 ASCII 字符或换行的路径打印成带引号的转义串,它对不上任何 glob,于是 skills/** 下这样命名的受管文件在派发时算不出复审档位,派生的门禁清单也漏掉它;未跟踪的这种文件还被记成「读不到、0 行」。
  • 风险与回滚:只改 scripts/pm/** 一个工具脚本和它的自测,不发布任何包;所有 ASCII 路径的读数逐字节不变。回滚即还原本 PR。
  • 先看:scripts/pm/dispatch-gates.mjs 的 gitPathList(新读取函数)与 changedPathsFromGit 的三处调用;自测文件里 quoted-names 场景。
  • 两分钟验证:在一个分支上提交 skills/objectstack-data/文档.md 后跑 node scripts/pm/dispatch-gates.mjs --tier,预期 stderr 列出原样的中文路径,stdout 给出契约复审档位(修复前是带引号的转义串、无档位)。
  • 需要你做的:无,席位落地(非受管面)。

What changes

changedPathsFromGit (it feeds --tier, --commands and the changed-line size) read its three path lists line by line, with no -z:

Read Was Now
committed diff --name-only --no-renames MERGE_BASE HEAD, split on newline, trimmed diff -z --name-only --no-renames MERGE_BASE HEAD, split on NUL, not trimmed
working tree diff --name-only --no-renames HEAD, same diff -z …, same
untracked ls-files --others --exclude-standard, same ls-files -z …, same
changedLinesFromGit fallback (no untracked passed) the untracked read above the same -z read

Git C-quotes a path holding a non-ASCII byte, a double quote or a control character (a file named in Chinese prints as a quoted octal string), and that spelling starts with a quote mark, so it matched no glob. Measured on a real repo before the fix: a committed skills/x/ file named in Chinese plus an untracked one derived tier: null, and the untracked one was counted as 1 unreadable file of 0 lines. After: both raw, tier CONTRACT_REVIEW_TIER, 0 unreadable.

All four reads now go through one reader, gitPathList, which splices -z in after the subcommand itself, so no caller in this file can list paths the other way. The old gitLines had no other caller and is gone. Not done, per the card: core.quotePath=false alone, which would still split a newline name in two.

Not changed: the size read diff --numstat -M (summed by parseNumstat in check-governed-merges.mjs) only adds the two counts, which quoting never touches; the same call was left as is in #33804 for the same reason.

Tests

node scripts/pm/dispatch-gates.mjs --self-test on acb82a3: 2520 cases pass, exit 0 (lock VERDICT command-exit 0). Five new cases, in the slow tier's real-git section, on a fixture repo that sets core.quotePath true itself so it quotes on any machine. Each of the three reads carries one name git quotes: a committed file named in Chinese, an uncommitted edit to another, and an untracked file whose name holds a newline.

  • CONTROL: the plain read (no -z) of the same branch quotes all three, and they derive no tier and name no gate family.
  • The derived change set lists each name raw (committed 1, worktree 1, untracked 1).
  • Those raw names derive CONTRACT_REVIEW_TIER through skills/** (3 hits).
  • They name check:skill-* gate families, the ones the derived --commands list is built from.
  • The untracked newline-named file is counted from disk: 0 unreadable, +3 lines.

No existing test was edited.

Ablation: the old reader restored on disk, exactly the four new rows red, restored (head acb82a3)

Each mutation through node scripts/ablation-replace.mjs (anchor hits 1 then 0 on disk, blob changed), the self-test under os-verify-lock.sh; restore: blob == HEAD (6343de57fbce) and git diff HEAD empty, both legs.

leg 2 (the card's ablation): gitPathList body back to the old gitLines body
  (no -z, split on newline, trimmed)                 -> VERDICT command-exit 1, 4 of 2520 failed:
  the derived change set spells each C-quoted name as it is on disk: committed, uncommitted and untracked (newline included)
  and those raw names derive the contract-review tier through the skills/** glob
  and they name the skill gate families the derived --commands list is built from
  and the untracked newline-named file is counted from disk, not as an unreadable file of 0 lines
  (the CONTROL row stays green, as it must)
leg 1: only the spliced -z dropped, NUL split kept   -> VERDICT command-exit 1, 12 of 2520 failed:
  the four rows above, plus 8 older real-git derivation rows: without -z
  the whole newline-joined listing comes back as ONE name, so -z and the
  NUL split are bound in one reader and cannot drift apart

Acceptance notes

Verification

Local subset on acb82a3 (final head): node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack derived 30 commands; all 30 exit 0 (each exit captured before any pipe). --ran with every line annotated :: exit N: 30 derived, 30 run, 0 NOT-MEASURED, 0 UNRUN (a derived zero, all 30 recorded an exit code). pnpm check:pm-dispatch-gates is in that 30 (its fast tier, 2205 cases); the full both-tier battery is the 2520 above. The script's other callers of changedPathsFromGit are only check-dispatch-gates.mjs, covered there. No package touched, so no build closure and no package test is owed; CI runs the rest.

The 30 commands and their exit codes
node scripts/check-closing-keyword-parity.mjs :: exit 0
node scripts/check-closing-keyword-parity.mjs --self-test :: exit 0
node scripts/check-comment-mask-corpus.mjs :: exit 0
node scripts/check-declaration-mirrors.mjs :: exit 0
node scripts/check-declaration-mirrors.mjs --self-test :: exit 0
node scripts/check-self-test-wired.mjs :: exit 0
node scripts/check-self-test-wired.mjs --self-test :: exit 0
node scripts/check-self-test-workflow-commands.mjs :: exit 0
node scripts/check-self-test-workflow-commands.mjs --self-test :: exit 0
node scripts/check-whole-set-label-write.mjs :: exit 0
node scripts/check-whole-set-label-write.mjs --self-test :: exit 0
node scripts/ci/plan-test-core-shards.mjs --self-test :: exit 0
pnpm check:agent-test-spelling :: exit 0
pnpm check:bash32-floor :: exit 0
pnpm check:ci-filter-parity :: exit 0
pnpm check:cli-command-ids :: exit 0
pnpm check:cross-package-test-inputs :: exit 0
pnpm check:declared-population-live :: exit 0
pnpm check:driver-memory-census :: exit 0
pnpm check:entry-guard :: exit 0
pnpm check:gitlink-declared :: exit 0
pnpm check:nul-bytes :: exit 0
pnpm check:parse-guard :: exit 0
pnpm check:pm-dispatch-gates :: exit 0
pnpm check:pnpm-filter-targets :: exit 0
pnpm check:pnpm-flag-spellings :: exit 0
pnpm check:ratchet-remedy-authority :: exit 0
pnpm check:refd-timer-probe :: exit 0
pnpm check:scripts-symbol-anchors :: exit 0
pnpm check:watch-hint-literal :: exit 0

Generated by Claude Code

…I governed path keeps its tier

changedPathsFromGit read its three path lists (committed, uncommitted,
untracked) line by line without -z. Git C-quotes a path holding a
non-ASCII byte or a control character, the quoted spelling matches no
glob, and a skills/** file derived no tier and no gate family; an
untracked one was counted as unreadable. The lists now go through one
reader that splices -z in and splits on NUL, untrimmed.

A real-git self-test scenario carries one such name per read (two
Chinese names, one newline name), with a control that reads the same
branch the old way and comes back quoted, tierless and gateless.

Claude-Session: https://claude.ai/code/session_01ADHkmPfzYmYaFdzt3TJ9w2
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:skills#1 · os-steve · session_01ADHkmPd7uRqHauEehGPr19

席位核对 · ACCEPT · head acb82a3e2d384412d64b3479350cdfde4d391b7c · 2026-11-15T16:00Z

  • 形态: 2 files, scripts/pm/dispatch-gates.mjs + its self-test, +91 / −6, exactly the claimed surface. check-governed-merges --pr 33998: NOT governed.
  • 前提实测: the dev measured the defect before the fix: a Chinese-named skills/** file read tier null, an untracked one counted unreadable; the self-test CONTROL row keeps that reading pinned.
  • 复核: round 0 PASS 6897152012 on this head, Served-tier: CONTRACT_REVIEW_TIER, no must-fix, no should-fix; nits N1–N6 not blocking.
  • 门禁 check-runs: 49 on this head, all completed, 26 success, 23 skipped, none red. The five new real-git rows sit in the slow tier, which PR CI does not run; their measurement is the dev's local both-tier run (2520/2520) plus the ablation, accepted as recorded.
  • 接受的偏差: process-only (an overlapping gate run re-run on the clean tree).
  • 范围外去向: the triggerPatternRegex dotAll residue the record escalated → pm(dispatch-gates): triggerPatternRegex's ** does not span a path segment that holds a newline (no dotAll), so a pattern-judged gate is silently not derived #34002 (filed by this seat). The newline-in-display note (N1) stays a nit.
  • 落地: K = 10 (PRBASE b8ac0e24, Test Core's affected-set diff base). Not governed → ready + auto-merge by this seat.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 15, 2026 16:00
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 15, 2026
Merged via the queue into main with commit a3aa1d2 Nov 15, 2026
50 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-xes6db branch November 15, 2026 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/s skip-changeset PR has no user-facing published change; bypasses the changeset gate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pm(dispatch-gates): changedPathsFromGit reads paths without -z, so a non-ASCII governed path is missed at dispatch

2 participants