Skip to content

Commit aec637b

Browse files
test(pm): pin core.quotePath=true in the real-git quoted-path fixtures (#33962)
<!-- claude-projects-attribution: {"github_login":"os-steve"} --> _Requested by **Steve** · [project thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9PaNqu2SSrzw7UtdmjG9BE7)_ Fixes #33846 Clause-②: no Metadata-protocol: none ## 维护者速读 - 改了什么:两个受管合并守卫自测里的真实 git 夹具,在 git 命令行上钉住 `core.quotePath=true`。 - 为什么改:夹具只剥 GIT_* 环境变量,不挡用户或系统 gitconfig;机器上设了 `core.quotePath=false` 时,两条 CONTROL 断言会误红(只会红,不会假绿)。 - 风险与回滚:只动自测夹具,不动守卫判定逻辑,断言数不变(530 / 745);回滚即 revert 本 PR。 - 先看:`scripts/pm/check-governed-queue-guard.mjs` 的夹具 `g`,再看 `scripts/pm/check-governed-merges.mjs` 的夹具 `fg`。 - 两分钟验证:`HOME=$(mktemp -d) sh -c 'git config --global core.quotePath false && node scripts/pm/check-governed-merges.mjs --self-test'`,预期 745 条全绿。 - 需要你做的:无,席位落地。 ## What changes The CONTROL rows of the NUL-path fixtures (from PR #33804) witness that git C-quotes the fixture names when a read runs without `-z`. Both fixture wrappers run real git under `gitFreeEnv()`, which strips every `GIT_` key but leaves `HOME` / `XDG_CONFIG_HOME` and `/etc/gitconfig` in reach, so a box with `core.quotePath=false` in any config file spells the non-ASCII names raw and reds the two CONTROL rows. The fix adds `-c core.quotePath=true` to the command-line pins each wrapper already carries (`user.email`, `user.name`, `init.defaultBranch`, `commit.gpgsign`): - `scripts/pm/check-governed-queue-guard.mjs`: the `g` wrapper of the quoted-path fixture (`guard-quoted-paths-`). - `scripts/pm/check-governed-merges.mjs`: the `fg` wrapper of the quoted-path fixture (`governed-merges-quoted-paths-`). **Why the `-c` pin rather than `GIT_CONFIG_GLOBAL=/dev/null` + `GIT_CONFIG_NOSYSTEM=1`:** command-line `-c` outranks every config file level (system, global, XDG, local), so one pin covers all of them. The env route needs two variables to cover only global and system, and it would have to go through `gitFreeEnv()`, which strips every `GIT_` key by design, so it means changing the shared helper and its callers. The `-c` pin also sits in the same place as the fixture's existing identity pins. `scripts/git-env.mjs` is not changed, so no caller of `gitFreeEnv()` moves. Forced test edits: none. No assertion, expected value or case count changed. Only the two fixture wrappers' git argument lists and their comments changed. ## Tests The acceptance asked for these runs: each self-test with `core.quotePath=false` set in a throwaway global config, before and after the fix. `gitFreeEnv()` strips `GIT_CONFIG_GLOBAL`, so the throwaway config goes in through `HOME`, plus one `XDG_CONFIG_HOME` run. | run | queue-guard `--self-test` | governed-merges `--self-test` | |:---|:---|:---| | base 895783a, default config | exit 0, 530 cases | exit 0, 745 assertions | | base 895783a, `HOME` with `core.quotePath=false` (ablation) | **exit 1**, 1 of 530 failed: the CONTROL row | **exit 1**, 1 failure: the #33620 CONTROL row | | head cd7b9ac, `HOME` with `core.quotePath=false` | exit 0, 530 cases | exit 0, 745 assertions | | head cd7b9ac, `XDG_CONFIG_HOME` with `core.quotePath=false` | exit 0, 530 cases | exit 0, 745 assertions | | head cd7b9ac, default config | exit 0, 530 cases | exit 0, 745 assertions | <details><summary>Ablation output at base (core.quotePath=false)</summary> ```text check-governed-queue-guard: ✗ ⛔ CONTROL the-fixture-names-are-ones-git-C-quotes-without--z: ["\"skills/a/two\\nlines.md\"","skills/a/文档.md"] ✗ check-governed-queue-guard self-test: 1 of 530 case(s) failed. check-governed-merges: ✗ check-governed-merges --self-test — 1 failure(s) • ⛔ #33620 CONTROL the-fixture-names-are-ones-git-C-quotes-without--z: [".github/workflows/café.yml","\"skills/a/two\\nlines.md\"","skills/a/文档.md"] ``` The newline name stays quoted under `core.quotePath=false`. Only the non-ASCII names lose their quotes, which is the `every(startsWith('"'))` limb the CONTROL row reads. </details> ## Acceptance notes - The card's mechanism assumptions held: no `core.quotePath` pin existed in either fixture at 895783a, and `gitFreeEnv()` does not cover config files. One small correction: at base, neither file's comment named `core.quotePath`. The governed-merges comment said only "git would C-quote". Both comments now name it. - The `lowrisk-rename-` real-git fixture in check-governed-queue-guard is in the low-risk arm region (another card is working there) and was left alone. It uses only ASCII names, so it does not depend on `core.quotePath`. - A system-level `/etc/gitconfig` leg was not run, because it would mean writing a file outside the workspace. `-c` outranks the system level by git's documented precedence. ## Verification Gates: `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack` on head cd7b9ac derived 35 commands. All 35 exited 0. `--ran` reconciliation: "35 derived famil(ies) accounted for — 35 run, 0 NOT-MEASURED (a DERIVED zero — all 35 recorded an exit code and none of them is 3)". CI runs every other family on this PR. <details><summary>Derived gate list, each exit 0 at cd7b9ac</summary> ```text node scripts/check-closing-keyword-parity.mjs (+ --self-test) node scripts/check-comment-mask-corpus.mjs node scripts/check-declaration-mirrors.mjs (+ --self-test) node scripts/check-self-test-wired.mjs (+ --self-test) node scripts/check-self-test-workflow-commands.mjs (+ --self-test) node scripts/check-skills-token-ratchet.mjs (+ --self-test) node scripts/check-whole-set-label-write.mjs (+ --self-test) node scripts/ci/plan-test-core-shards.mjs --self-test node scripts/pm/bare-root-worklist.mjs --self-test node scripts/pm/check-governed-queue-guard.mjs --self-test pnpm check:agent-test-spelling · check:bash32-floor · check:ci-filter-parity · check:cli-command-ids pnpm check:closing-target-claim · check:cross-package-test-inputs · check:driver-memory-census · check:entry-guard pnpm check:gitlink-declared · check:nul-bytes · check:parse-guard · check:pm-dispatch-gates pnpm check:pm-governed-merges · check:pnpm-filter-targets · check:pnpm-flag-spellings · check:ratchet-remedy-authority pnpm check:refd-timer-probe · check:scripts-symbol-anchors · check:watch-hint-literal ``` </details> This PR changes only `scripts/pm/**` and publishes nothing, so it takes `skip-changeset`. No governed surface is touched. --- _Generated by [Claude Code](https://claude.ai/code/session_01ADHkmSDNFF5uczb7BL5Bdf)_ Co-authored-by: Claude <noreply@anthropic.com>
1 parent b33365c commit aec637b

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

‎scripts/pm/check-governed-merges.mjs‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8780,11 +8780,13 @@ async function selfTest() {
87808780
// ⛔ #33620: governed paths git would C-quote, read through REAL git with a GIT_*-free environment (gitFreeEnv):
87818781
// a non-ASCII name and a name holding a newline. Without `-z` each path list (--branch, the sweep's
87828782
// commitChanges, the workflow split's ls-tree) spells them `"skills/a/\346\226\207\346\241\243.md"` and
8783-
// `"skills/a/two\nlines.md"`, which match no governed prefix.
8783+
// `"skills/a/two\nlines.md"`, which match no governed prefix. `core.quotePath=true` is pinned on the command line:
8784+
// gitFreeEnv strips GIT_* but not a user or system gitconfig, and `core.quotePath=false` there spells the non-ASCII
8785+
// names raw, which reds the CONTROL witness below.
87848786
const quotedFx = mkdtempSync(join(tmpdir(), 'governed-merges-quoted-paths-'));
87858787
try {
87868788
const fg = (cwd, ...rest) =>
8787-
execFileSync('git', ['-c', 'user.email=t@t.invalid', '-c', 'user.name=t', '-c', 'init.defaultBranch=main', '-c', 'commit.gpgsign=false', ...rest],
8789+
execFileSync('git', ['-c', 'user.email=t@t.invalid', '-c', 'user.name=t', '-c', 'init.defaultBranch=main', '-c', 'commit.gpgsign=false', '-c', 'core.quotePath=true', ...rest],
87888790
{ cwd, encoding: 'utf8', env: gitFreeEnv(), stdio: ['ignore', 'pipe', 'pipe'] });
87898791
const repo = join(quotedFx, 'repo');
87908792
fg(quotedFx, 'init', '-q', repo);

‎scripts/pm/check-governed-queue-guard.mjs‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3700,10 +3700,12 @@ export async function selfTest() {
37003700
// ⛔ A governed path git would C-quote, read through REAL git (gitFreeEnv): a non-ASCII name and a name holding a
37013701
// newline. Without `-z` the first prints as `"skills/a/\346\226\207\346\241\243.md"` and the second as
37023702
// `"skills/a/two\nlines.md"`, quoted spellings that match no governed prefix, so the queue never saw the file.
3703+
// `core.quotePath=true` is pinned on the command line: gitFreeEnv strips GIT_* but not a user or system gitconfig,
3704+
// and a box set to `core.quotePath=false` spells the non-ASCII name raw, which reds the CONTROL witness below.
37033705
const quotedDir = mkdtempSync(join(tmpdir(), 'guard-quoted-paths-'));
37043706
try {
37053707
const g = (args) =>
3706-
execFileSync('git', ['-c', 'user.email=t@t.invalid', '-c', 'user.name=t', '-c', 'init.defaultBranch=main', '-c', 'commit.gpgsign=false', ...args], {
3708+
execFileSync('git', ['-c', 'user.email=t@t.invalid', '-c', 'user.name=t', '-c', 'init.defaultBranch=main', '-c', 'commit.gpgsign=false', '-c', 'core.quotePath=true', ...args], {
37073709
cwd: quotedDir,
37083710
encoding: 'utf8',
37093711
env: gitFreeEnv(),

0 commit comments

Comments
 (0)