Skip to content

Commit 1f13eb3

Browse files
fix(repo): ignore the conversions-registry codemod's in-tree scratch dir (#30100)
<!-- claude-projects-attribution: {"github_login":"os-support-ai"} --> _Requested by **Yibo Wang** · [project thread](https://claude.ai/code/project/chan_01BVUyyPie8gHwoPM18iABwB?thread=cmsg_01BVUyyPie8gHwoPM18iABwBPMzGRiRL8auFeiVJGtznMw)_ Refs #30078 ## 维护者速读 - **改了什么:** 根 `.gitignore` 加一条跟踪规则 `packages/spec/.codemod-arrays-*/`(含三行注释),放在 `packages/spec/src/migrations/registry.ts.*.tmp` 旁边。只有这 5 行。 - **为什么改:** #29993(`d79eecfe`)给 `scripts/codemod-split-conversions-registry.mjs` 加了 `arraysProof()`,它在 `packages/spec/` 里 `mkdtempSync('.codemod-arrays-')`。PM dispatch-gates self-test 的 `exposedScratchDirs` 用例要求树内每个临时目录都被跟踪的 ignore 规则覆盖,于是 main 的 `Lint · PM dispatch-gates` 红了(1 of 2234)。 - **风险与回滚:** 只加一条 ignore 规则,不碰门禁、self-test、用例列表和 codemod。没有选「搬到 `os.tmpdir()`」:探针把 spec 的 `src` 复制进临时目录再用 tsx 加载,复制出来的源码有 391 处 `from 'zod'`,靠从 `packages/spec/` 往上找 `node_modules` 解析,搬出树外就解析不到。回滚 = revert。 - **先看:** `.gitignore` 第 71–74 行。 - **两分钟验证:** `node -e "import('./scripts/pm/dispatch-gates.mjs').then(m=>console.log(m.exposedScratchDirs({}).exposed))"`:main 上列出两个 `.codemod-arrays-0osprobe` 目录,本分支为 `[]`。 - **需要你做的:** 无,席位审阅落地(仅根配置,`skip-changeset`)。 Clause-②: no Metadata-protocol: none ## What changes - **`.gitignore`.** Adds `packages/spec/.codemod-arrays-*/` with a three-line comment, next to the existing `registry.ts.*.tmp` staging rule. `git check-ignore -v --no-index` now answers `.gitignore:74:packages/spec/.codemod-arrays-*/` for both probe paths the gate asks about (`packages/spec/.codemod-arrays-0osprobe/leftover-probe` and `…/unpack/leftover-probe`). ## Why this fix and not moving the scratch dir The order offered two remedies: (a) a tracked ignore rule, or (b) moving `arraysProof()`'s `mkdtempSync` to `os.tmpdir()`. (b) does not work. The probe copies `packages/spec/src` into the scratch dir and loads it with `tsx` (cwd `packages/spec`). The copied sources import `zod` at 391 sites, plus `typescript` and `@objectstack/spec/*` self-references, and Node resolves those bare specifiers by walking up from the importing file to `packages/spec/node_modules`. Under `os.tmpdir()` that walk finds nothing. So the scratch dir has to stay inside `packages/spec/`, and (a) is the smaller sufficient fix. The codemod already removes the dir in a `finally`; the rule covers a leftover from a killed run. The gate (`exposedScratchDirs` in `scripts/pm/dispatch-gates.mjs`), its self-test and its case list are untouched. ## Readings | Reading | `origin/main` `d79eecfe` | this branch | | :--- | :--- | :--- | | `exposedScratchDirs({}).exposed` | `packages/spec/.codemod-arrays-0osprobe (scripts/codemod-split-conversions-registry.mjs:843)`, `packages/spec/.codemod-arrays-0osprobe/unpack (…:858)` | `[]`; both now `covered` by `.gitignore:74` | | `node scripts/pm/dispatch-gates.mjs --self-test` (both tiers, as the push run) | exit 1, `✗ dispatch-gates self-test: 1 of 2234 case(s) failed.`, the one ✗ being the EXPOSED line above (33 min) | exit 0, `✓ dispatch-gates self-test: 2234 cases pass.` (fast 1945 in 509 s, slow 289 in 1465 s), the case reads ✓ | ## Gates `node scripts/pm/dispatch-gates.mjs --commands` derives 8 commands for this change set; each ran on the branch: ``` 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 pnpm check:driver-memory-census :: exit 0 pnpm check:gitlink-declared :: exit 0 pnpm check:nul-bytes :: exit 0 pnpm check:refd-timer-probe :: exit 0 pnpm check:watch-hint-literal :: exit 0 ``` `dispatch-gates --ran`: 8 derived, 8 run, 0 NOT-MEASURED, 0 UNRUN. ## Changeset Root config only, no published package moves: `skip-changeset`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01WGufziUhP2qtBGrqtbPFTj Co-authored-by: Claude <noreply@anthropic.com>
1 parent f4db5f3 commit 1f13eb3

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎.gitignore‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ packages/spec/json-schema/
6868
packages/spec/src/migrations/registry.ts
6969
packages/spec/src/migrations/registry.ts.*.tmp
7070

71+
# Scratch dir of `codemod-split-conversions-registry.mjs --arrays`: its mkdtemp
72+
# sits inside packages/spec so the copied src resolves the package's own
73+
# node_modules; removed in a finally, ignored here in case a run is killed.
74+
packages/spec/.codemod-arrays-*/
75+
7176
# Generated bundle size reports
7277
packages/spec/bundle-size-report.json
7378

0 commit comments

Comments
 (0)