Repository navigation
Commit fb6eb80
fix(pm): mkdtempSync completeness fails tests and tooling, reports shipped package source (#36368)
<!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} -->
_Requested by **Steedos** · [project
thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbCxiFE11rsKwyNffJZKYqJs)_
Fixes #35611
Clause-②: no
Metadata-protocol: none
Ruling-ref: 7075362923
## 维护者速读
- 用户能看到什么变化:用户无感;车队门禁的「临时目录扫描」不再因为发布代码里由用户运行时决定位置的暂存目录而判红,测试和仓库脚本照旧判红。
- 为什么做:执行你选的「扫描只管仓内运行的代码」裁决,解开技能安装「失败可回滚」修复被撤回的卡点。
- 出错会怎样:最坏是发布代码里一个真会落进仓库的暂存目录只被报告、不被拦下;今天这一类为零,撤回本改动即可恢复原判法。
- 要你做什么:本改动碰到门禁本身,需要你批准后才能合入。
## What changes
The `mkdtempSync` completeness rule of the directory-creating sweep in
`scripts/pm/dispatch-gates.mjs` now judges an UNRESOLVED site by its
**file population**, as ruling record 7075362923 orders. The
maintainer's choice, verbatim: 「扫描只管仓内运行的代码」; the option's stated
consequence, verbatim:
「完整性规则只管测试与仓库脚本,发布代码同类调用只报告不判红;门禁小幅收窄,技能安装修复原样重新合入。」
- **Test files and repo tooling: still FAIL** on an unresolved
`mkdtempSync` base, exactly as before.
- **Shipped package source: REPORTED, not failed.** The live case names
each such site on its own line and stays green.
- **The boundary is one predicate, `isShippedPackageSource(rel,
members)`:** a non-test source under the own `src/` of a workspace
member whose manifest is not `private: true` (members come from
`workspacePackages`' `{dir, manifest}` pairs; a private member, or one
whose manifest does not parse, stays on the failing side). "Non-test"
reuses the runner-env gate's `isProductSource` (a test by file name or
by directory, `.d.ts` excluded). That is the stricter of the tree's test
predicates, so a helper under `src/__tests__/` is still held. "Workspace
package" means a workspace-enumerator member that holds a published
(non-`private`) manifest. The predicate keeps no list of its own. The
filter is the file, never "in-tree", because an unresolved site is
exactly the one whose location is unknown. It is also not
`isTestFilePath` alone, which would drop the 344 tooling sites.
- `mkdtempCompleteness(unresolved, { members })` (default:
`workspacePackages(ROOT)`) returns `{ failing, reported }`. The live
slow case and the new fast pins call the same function.
- The in-tree/uncovered rule (`exposedScratchDirs`) is unchanged for
every population. No new gate, derivation row, ratchet or constant
(`instrument-discipline.md`).
- Header: the stale "359 sites, 4 in the tree" is replaced with a dated
reading taken through the scan's own exports, plus the boundary in one
sentence.
- Riders, per the ruling record's seat reading: the #30467 site stays as
landed. Spellings 7 and 8 stay as they are for test fixtures, and this
diff does not touch either.
After this merges, #35079's lane re-lands the #35495 staged swap as
written. This PR does not re-land it.
Files to read first (risk order):
1. `scripts/pm/dispatch-gates.mjs`, `isShippedPackageSource` /
`mkdtempCompleteness` (just above `isTrackedIgnoreSource`). This is the
narrowing hunk: the predicate decides which unresolved sites stop
failing.
2. `scripts/pm/dispatch-gates.self-test.mjs`, the live case "no
mkdtempSync site in a test file or repo tooling takes a base the scan
cannot read" (slow section).
3. `scripts/pm/dispatch-gates.self-test.mjs`, the new fast-tier block
"Which UNRESOLVED mkdtempSync site fails completeness".
Two-minute check: `node scripts/pm/dispatch-gates.mjs --self-test --fast
2>&1 | grep -A11 "REPORTED, not failed"` should print twelve `✓` lines:
the shipped arm reported, plus the private-member, non-own-`src/`, test,
`__tests__` and tooling arms failing, each next to its control.
## Tests
New fast-tier pins (the tier a pull request's lane runs), on the exact
spelling that turned main red (`mkdtempSync(join(dir,
SKILLS_STAGING_PREFIX))`):
| Arm | Verdict | Control one step away |
|:--|:--|:--|
| `packages/cli/src/utils/skills-install-state.ts` | reported, not
failed | same file, `packages/cli` not a workspace package: FAILS; same
package, outside `src/`: FAILS |
| the same site in a `private: true` member's `src/` | FAILS | the
published member: reported |
| `packages/cli/scripts/src/staging.ts` (a `src/` that is not the
member's own) | FAILS | the member's own `src/`: reported |
| `…/skills-install-state.test.ts` (by name), `src/__tests__/…` (by
directory) | FAILS | the test file on a `tmpdir()` base: in neither list
|
| `scripts/pm/stage-skills.mjs` (repo tooling) | FAILS | the tooling
file on a `tmpdir()` base: in neither list |
| unresolved `mkdirSync` | in neither list | (that half was never held
to completeness) |
| this tree's own workspace (default `members`) | shipped arm reported,
tooling arm FAILS | n/a |
Runs at `f7e942e8` (before the rework; this branch merged with
`origin/main` `d8599c2c`). At the rework head `3ec2a452` the dev reran
both tiers, exit 0: fast 2264 case(s) · slow 315 case(s), 2579 cases
pass, including the 12 boundary pins (os-dev-report 7077315476).
<details><summary>Both tiers, the slow section that holds the live case
included: <code>node scripts/pm/dispatch-gates.mjs --self-test</code>,
exit 0</summary>
```text
✓ a caller's-directory mkdtempSync base in shipped package source is REPORTED, not failed
✓ CONTROL: the same file in a directory that holds no workspace package still FAILS
✓ CONTROL: and in the package but outside its own src/ (one directory up), it still FAILS
✓ the same site in a test file FAILS — beside the shipped file, by name
✓ and in a test helper under src/__tests__/, by directory — the stricter test predicate holds it
✓ CONTROL: the test file with a base the scan CAN read (the system temp directory) is in neither list
✓ the same site in repo tooling FAILS — the tooling population is not dropped with the test predicate
✓ CONTROL: the tooling file with a base the scan CAN read is in neither list
✓ and an unresolved mkdirSync site is in neither list — that half was never held to completeness
✓ on this tree's own workspace, the shipped arm is REPORTED and the tooling arm FAILS
...
✓ the sweep really read this tree (3145 directory-creating site(s) across 23403 tracked source(s))
✓ and it really found in-tree fixture roots (93), so the coverage case below judges something
✓ no mkdtempSync site in a test file or repo tooling takes a base the scan cannot read
...
dispatch-gates self-test tiers: fast 2262 case(s) in 1009.1s · slow 315 case(s) in 1825.0s.
✓ dispatch-gates self-test: 2577 cases pass.
```
</details>
<details><summary>Fast tier as CI runs it: <code>pnpm
check:pm-dispatch-gates</code>, exit 0</summary>
```text
✓ dispatch-gates self-test (fast tier): 2262 cases pass; 9 slow section(s) deferred.
check:pm-dispatch-gates: the battery (the fast tier) took 562.7s on this box.
```
</details>
## Acceptance notes
- **The #35495 spelling passes the slow case now (scratch copy, not
re-landed here).** I checked out a scratch worktree at this branch's
head and applied #35495's merge diff (`578d3b1d66`: the
skills-install-state source, its test, its changeset). I then ran the
slow case's own logic on that tree through the scan's exports
(`exposedScratchDirs` + `mkdtempCompleteness`). Result: origin/main's
rule FAILS, `UNRESOLVED:
packages/cli/src/utils/skills-install-state.ts:246 (dir is not bound in
this file)`; this branch's rule has failing 0 and reported 1 (the same
site), so the case passes. Exposed: 0.
- **Boundary reading, resolved by the seat (reading B, rework
3ec2a45).** The maintainer's words 「扫描只管仓内运行的代码」 and 「发布代码同类调用只报告不判红」:
a `private: true` member (`examples/*`, `apps/docs`, QA harnesses, the
eslint plugin…) is not published code, so its `src/` keeps failing. L2
7076625985 graded the literal-rider reading M1; L1-d had preferred the
literal reading (7076590966) and accepted the seat's ruling. Pins: a
private member's `src/` site FAILS with the published arm as control,
and `packages/cli/scripts/src/staging.ts` FAILS as the control for "the
member's own `src/`" (L2 S1). The header's measurement is dated by base
tree `d8599c2c`: 1823 sites, 1465 test (47 in-tree), 344 other, 14
shipped (tmpdir), 0 unresolved.
- **Ablation not run.** The diff is a repo script, and the dispatch
contract does not ablate scripts. The fast pins carry their own
controls, and each control flips the verdict.
- The live case's title changed from "no mkdtempSync site in this tree…"
to "no mkdtempSync site in a test file or repo tooling…". No other file
names the old text (`git grep` 0 hits).
## Verification
<details><summary>Derived gate families: 63 derived, 62 run, 1 NOT
MEASURED, 0 unrun (at f7e942e)</summary>
- `node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack` derived 63 families. Each was run with its
exit code captured before any pipe, then reconciled: `node
scripts/pm/dispatch-gates.mjs --ran ran.list --repo
objectstack-ai/objectstack` → `✓ dispatch-gates --ran: 63 derived
famil(ies) accounted for — 62 run, 1 NOT-MEASURED (1 DERIVED from a
recorded exit 3).`
- 62 exit 0, including `pnpm check:pm-dispatch-gates`, `pnpm
check:nul-bytes`, `pnpm check:pm-governed-prose`, `pnpm
check:pm-governed-merges`, `node
scripts/pm/check-governed-queue-guard.mjs --self-test`, `node
scripts/check-closing-keyword-parity.mjs` (+ `--self-test`) and `node
scripts/check-self-test-wired.mjs` (+ `--self-test`).
- NOT MEASURED: `pnpm check:i18n-coverage`, exit 3 (PREREQUISITE NOT
MET: the package `dist/` builds it lints against are not built in this
worktree, and this diff touches no package). CI runs it.
- `node scripts/check-self-test-workflow-commands.mjs` first refused
with `spawnSync node ETIMEDOUT` (load average 11 on a shared box, so no
verdict). It was rerun at load 7.4 on the same head: exit 0.
- `node scripts/pm/overlap-check.mjs
--branch=claude/issue-35611-mkdtemp-shipped-report` → `VERDICT clean
exit 0` before each push.
- Body gate: `node scripts/check-closing-keyword-parity.mjs --body`
binds exactly one declaration, this card's, on the line under the
header.
</details>
Tier H: `scripts/pm/dispatch-gates.mjs` is a governed guard instrument,
so this lands only on the maintainer's approval. `skip-changeset`:
`scripts/pm/**` publishes nothing.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- signed: repo:objectstack#7 · zhuangjianguo ·
session_01QsR2jTeURPvEm465RcoYEC -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent dcc9b07 commit fb6eb80
2 files changed
Lines changed: 174 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
468 | 468 | | |
469 | 469 | | |
470 | 470 | | |
471 | | - | |
| 471 | + | |
472 | 472 | | |
473 | 473 | | |
474 | 474 | | |
| |||
8713 | 8713 | | |
8714 | 8714 | | |
8715 | 8715 | | |
8716 | | - | |
8717 | | - | |
8718 | | - | |
| 8716 | + | |
| 8717 | + | |
| 8718 | + | |
| 8719 | + | |
8719 | 8720 | | |
8720 | | - | |
8721 | | - | |
8722 | | - | |
| 8721 | + | |
| 8722 | + | |
| 8723 | + | |
| 8724 | + | |
| 8725 | + | |
| 8726 | + | |
| 8727 | + | |
| 8728 | + | |
| 8729 | + | |
| 8730 | + | |
| 8731 | + | |
| 8732 | + | |
| 8733 | + | |
8723 | 8734 | | |
8724 | 8735 | | |
8725 | 8736 | | |
| |||
9992 | 10003 | | |
9993 | 10004 | | |
9994 | 10005 | | |
| 10006 | + | |
| 10007 | + | |
| 10008 | + | |
| 10009 | + | |
| 10010 | + | |
| 10011 | + | |
| 10012 | + | |
| 10013 | + | |
| 10014 | + | |
| 10015 | + | |
| 10016 | + | |
| 10017 | + | |
| 10018 | + | |
| 10019 | + | |
| 10020 | + | |
| 10021 | + | |
| 10022 | + | |
| 10023 | + | |
| 10024 | + | |
| 10025 | + | |
| 10026 | + | |
| 10027 | + | |
| 10028 | + | |
| 10029 | + | |
| 10030 | + | |
| 10031 | + | |
| 10032 | + | |
| 10033 | + | |
| 10034 | + | |
| 10035 | + | |
| 10036 | + | |
| 10037 | + | |
| 10038 | + | |
| 10039 | + | |
| 10040 | + | |
| 10041 | + | |
| 10042 | + | |
| 10043 | + | |
| 10044 | + | |
| 10045 | + | |
| 10046 | + | |
| 10047 | + | |
| 10048 | + | |
| 10049 | + | |
| 10050 | + | |
| 10051 | + | |
| 10052 | + | |
| 10053 | + | |
| 10054 | + | |
| 10055 | + | |
9995 | 10056 | | |
9996 | 10057 | | |
9997 | 10058 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
185 | 185 | | |
186 | 186 | | |
187 | 187 | | |
| 188 | + | |
188 | 189 | | |
189 | 190 | | |
190 | 191 | | |
| |||
210 | 211 | | |
211 | 212 | | |
212 | 213 | | |
| 214 | + | |
213 | 215 | | |
214 | 216 | | |
215 | 217 | | |
| |||
11452 | 11454 | | |
11453 | 11455 | | |
11454 | 11456 | | |
| 11457 | + | |
| 11458 | + | |
| 11459 | + | |
| 11460 | + | |
| 11461 | + | |
| 11462 | + | |
| 11463 | + | |
| 11464 | + | |
| 11465 | + | |
| 11466 | + | |
| 11467 | + | |
| 11468 | + | |
| 11469 | + | |
| 11470 | + | |
| 11471 | + | |
| 11472 | + | |
| 11473 | + | |
| 11474 | + | |
| 11475 | + | |
| 11476 | + | |
| 11477 | + | |
| 11478 | + | |
| 11479 | + | |
| 11480 | + | |
| 11481 | + | |
| 11482 | + | |
| 11483 | + | |
| 11484 | + | |
| 11485 | + | |
| 11486 | + | |
| 11487 | + | |
| 11488 | + | |
| 11489 | + | |
| 11490 | + | |
| 11491 | + | |
| 11492 | + | |
| 11493 | + | |
| 11494 | + | |
| 11495 | + | |
| 11496 | + | |
| 11497 | + | |
| 11498 | + | |
| 11499 | + | |
| 11500 | + | |
| 11501 | + | |
| 11502 | + | |
| 11503 | + | |
| 11504 | + | |
| 11505 | + | |
| 11506 | + | |
| 11507 | + | |
| 11508 | + | |
| 11509 | + | |
| 11510 | + | |
| 11511 | + | |
| 11512 | + | |
| 11513 | + | |
| 11514 | + | |
| 11515 | + | |
| 11516 | + | |
| 11517 | + | |
| 11518 | + | |
| 11519 | + | |
| 11520 | + | |
| 11521 | + | |
| 11522 | + | |
| 11523 | + | |
| 11524 | + | |
| 11525 | + | |
| 11526 | + | |
| 11527 | + | |
| 11528 | + | |
| 11529 | + | |
| 11530 | + | |
| 11531 | + | |
| 11532 | + | |
| 11533 | + | |
| 11534 | + | |
| 11535 | + | |
| 11536 | + | |
| 11537 | + | |
| 11538 | + | |
| 11539 | + | |
| 11540 | + | |
| 11541 | + | |
| 11542 | + | |
| 11543 | + | |
| 11544 | + | |
| 11545 | + | |
| 11546 | + | |
| 11547 | + | |
11455 | 11548 | | |
11456 | 11549 | | |
11457 | 11550 | | |
| |||
11851 | 11944 | | |
11852 | 11945 | | |
11853 | 11946 | | |
11854 | | - | |
11855 | | - | |
11856 | | - | |
11857 | | - | |
11858 | | - | |
| 11947 | + | |
| 11948 | + | |
| 11949 | + | |
| 11950 | + | |
| 11951 | + | |
| 11952 | + | |
| 11953 | + | |
| 11954 | + | |
| 11955 | + | |
| 11956 | + | |
| 11957 | + | |
| 11958 | + | |
11859 | 11959 | | |
11860 | 11960 | | |
11861 | | - | |
| 11961 | + | |
11862 | 11962 | | |
11863 | 11963 | | |
11864 | 11964 | | |
| |||
0 commit comments