Repository navigation
Commit ae2a67d
Fixes #35588
Clause-②: no
Metadata-protocol: none
## 维护者速读
-
用户能看到什么变化:用命令行安装或更新技能包的开发者,回到上一个发布版的写入方式:更新中途失败(磁盘满、权限不足)时,技能目录可能新旧混杂,要再强制更新一次才能恢复。
- 为什么做:为主干每四小时一次的全量检查解决变红,它被技能写入新加的暂存目录卡住;按席位指令先撤回那次改动,让主干恢复全绿。
- 出错会怎样:本次只删不增,和原改动逐字节相反,影响只在技能安装与更新两条命令;万一有问题,可以直接撤回本次撤回。
- 要你做什么:无
## This is a revert
This PR reverts #35495 (578d3b1) and nothing else. The diff is
byte-identical to the inverse of that commit (`cmp` of the two patches,
exit 0).
**Why.** #35495 added a staging directory, `mkdtempSync(join(dir,
SKILLS_STAGING_PREFIX))` in `applySkillsWrite`. Its base `dir` is the
caller's skills directory, which is cwd-relative
(`resolveSkillsDir(args.dir, cwd)`). The dispatch-gates scratch-dir scan
reads one file at a time and treats a cwd-relative base as unreadable on
purpose, so the self-test case "no mkdtempSync site in this tree takes a
base the scan cannot read" fails on that line. That one case of 2564 is
what keeps main's scheduled full Lint & Type Check run red (#35588). No
honest spelling inside the CLI file lets the scan read that base. Every
spelling that turns the case green does so by a lie (a `tmpdir()`
marker, a fabricated binding) or an evasion (`mkdirSync`, an aliased
import), and the gate is not narrowed. The measurements are on #35588
(comment 7016701837). The seat ordered this revert as the named
fallback.
**What returns.** The defect #35079 addressed comes back: an `os skills
install` or `os skills update` that fails partway (disk full,
permission, a locked file) can again leave the skill directories gone or
half-written under the old record, and the next plain `update` refuses
them as changed locally until `--force`. #35079 reopens.
**Re-landing.** The staged swap re-lands only after a gate-side ruling
on how the scan judges a directory-creating call whose base is a
caller's argument. Even a cross-file hop ends at `process.cwd()`, and a
killed run at this repo's root would leave
`.claude/skills/.objectstack-skills-staging-*`, which no tracked ignore
rule covers. So the rule needs a policy, not a reading. That decision is
outside this PR, and `scripts/pm/dispatch-gates.mjs` is untouched.
## DELIBERATE CORRECTION
This PR deletes one pending release note it did not add:
`.changeset/35079-skills-write-staged-swap.md`. It was never released.
The behaviour it describes is the code this PR reverts, so the note
would now be false. Its headline sentence, quoted as it stood on the
merge base: "`os skills install` and `os skills update` stage the new
catalog and swap it in by rename, so a write that fails partway leaves
the previous skills and their record as they were". Corrected to: no
note. With the note gone, the published `@objectstack/cli` never carried
the staged swap, so this PR releases nothing and adds no changeset of
its own. `skip-changeset` is not applied (ruling D on #18375). `Check
Changeset` stays red by design (route 0 of its refusal text), and the
dispatching seat confirms this correction by its own record.
## What changes
- `packages/cli/src/utils/skills-install-state.ts`: `applySkillsWrite`
goes back to the pre-#35495 write (remove the dropped and replaced skill
directories, write the new ones, write the record last).
`SKILLS_STAGING_PREFIX`, the staging directory, the rename swap and its
undo are removed.
- `packages/cli/test/skills-commands.test.ts`: the `an interrupted write
leaves the installed catalog usable` block and the `node:fs` fault
injection that served it are removed with the code they pinned.
- `.changeset/35079-skills-write-staged-swap.md`: deleted (see above).
## Read first
1. `packages/cli/src/utils/skills-install-state.ts`, the
`applySkillsWrite` hunk: the riskiest change, the non-atomic write
coming back.
2. `packages/cli/test/skills-commands.test.ts`: the deleted
interrupted-write block. Every remaining test passes unchanged.
3. `.changeset/35079-skills-write-staged-swap.md`: the deletion the
correction above declares.
## Two-minute verification
From the repo root on this branch:
```sh
node --input-type=module -e "const m = await import('./scripts/pm/dispatch-gates.mjs'); const u = m.exposedScratchDirs({}).unresolved.filter(function (s) { return s.call === 'mkdtempSync'; }); console.log(u.length); process.exit(u.length ? 1 : 0);"
```
Expect `0` and exit 0. On `main` the same command prints `1` and exits
1.
## Tests
All readings below are on head `dc83a28e`. Exit codes were captured
before any pipe.
<details>
<summary>The red case, before and after</summary>
- Before, at `e35cf035`, where
`packages/cli/src/utils/skills-install-state.ts` is byte-identical to
the merge base `f981dce3` (`git diff --quiet` exit 0). `node
scripts/pm/dispatch-gates.mjs --self-test` (both tiers) printed `✗ no
mkdtempSync site in this tree takes a base the scan cannot read —
UNRESOLVED: packages/cli/src/utils/skills-install-state.ts:246 (dir is
not bound in this file)` and `✗ dispatch-gates self-test: 1 of 2564
case(s) failed.`, exit 1.
- After: the one-case replay through the module's own
`exposedScratchDirs` on this tree read sites=3127, inTree=93, exposed=0,
unresolved(mkdtempSync)=0, exit 0. The classifier on the file alone
gives 1 unresolved `mkdtempSync` site at base `f981dce3` (`:246 dir is
not bound in this file`) and 0 at `dc83a28e`.
- The full self-test on `dc83a28e` was still running when this PR
opened. Its verdict follows in the os-dev-report on #35588.
</details>
<details>
<summary>cli tests and typecheck</summary>
- `pnpm --filter @objectstack/cli exec vitest run --maxWorkers=2
test/skills-commands.test.ts`: `Test Files 1 passed (1)`, `Tests 30
passed (30)`, lock VERDICT command-exit 0.
- `pnpm --filter @objectstack/cli exec vitest run --project unit
--maxWorkers=2`: `Test Files 431 passed (431)`, `Tests 6158 passed
(6158)`, lock VERDICT command-exit 0. The integration layer is left to
CI: the diff touches no integration file and no spawn entry.
- `pnpm --filter @objectstack/cli typecheck` (`tsc --noEmit &&
check:test-typecheck`): lock VERDICT command-exit 0,
`check:test-typecheck: OK`.
- Dependency closure first: `pnpm --workspace-concurrency=2 --filter
'@objectstack/cli^...' build`, VERDICT command-exit 0, then `pnpm
--filter @objectstack/cli build`, VERDICT command-exit 0.
</details>
## Acceptance notes
- The case runs in the slow tier, so a pull request's own `Lint & Repo
Gates` run (fast tier) does not execute it. The local full self-test
under Tests is the evidence, and the next scheduled full run refreshes
#35588.
- Observation, not filed: the scan holds the completeness rule to the
spelling `mkdtempSync` only. Async `mkdtemp(join(PKG, 'tmp', ...))`
builds in-tree fixture roots it does not see
(`packages/cli/src/utils/graft-runtime-hooks.test.ts:236`,
`packages/cli/test/next-steps.test.ts:83`). Both are covered by
`.gitignore` `tmp/`, so nothing is exposed.
## Verification
The PR opened while the local gate runs were still finishing, so the
local readings follow in the os-dev-report on #35588. CI on this PR is
the gate.
- Derived set: `node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack` gives 64 commands for this change set (3
paths vs merge base `f981dce3`). They run locally, byte for byte, and
are reconciled with `--ran`.
- Expected red, by design: `node scripts/check-empty-changeset.mjs
--base origin/main` exits 1 on the deleted foreign changeset (the
DELIBERATE CORRECTION class above), and so does `Check Changeset` on
this PR.
- `check:pm-dispatch-gates` on a pull request runs its fast tier only,
so the red case is not in this PR's check-runs. The full self-test above
is the reading for it.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01L6bhgTyMahdAdhXSzgy2nt)_
Co-authored-by: Claude <noreply@anthropic.com>
1 parent 2e19f36 commit ae2a67d
3 files changed
Lines changed: 14 additions & 239 deletions
File tree
- .changeset
- packages/cli
- src/utils
- test
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | 22 | | |
43 | 23 | | |
44 | 24 | | |
45 | | - | |
| 25 | + | |
46 | 26 | | |
47 | 27 | | |
48 | 28 | | |
49 | 29 | | |
50 | 30 | | |
51 | 31 | | |
52 | 32 | | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | 33 | | |
61 | 34 | | |
62 | 35 | | |
| |||
219 | 192 | | |
220 | 193 | | |
221 | 194 | | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | 195 | | |
229 | 196 | | |
230 | 197 | | |
231 | 198 | | |
232 | | - | |
233 | | - | |
| 199 | + | |
234 | 200 | | |
235 | 201 | | |
236 | 202 | | |
237 | | - | |
| 203 | + | |
238 | 204 | | |
239 | 205 | | |
240 | | - | |
| 206 | + | |
241 | 207 | | |
242 | | - | |
243 | | - | |
244 | 208 | | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
279 | 215 | | |
280 | | - | |
281 | 216 | | |
282 | | - | |
| 217 | + | |
| 218 | + | |
283 | 219 | | |
284 | 220 | | |
285 | 221 | | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | | - | |
302 | | - | |
303 | | - | |
304 | | - | |
305 | | - | |
306 | | - | |
307 | | - | |
308 | | - | |
309 | | - | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
317 | | - | |
318 | | - | |
319 | 222 | | |
320 | 223 | | |
321 | 224 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | 22 | | |
45 | 23 | | |
46 | 24 | | |
47 | 25 | | |
48 | | - | |
| 26 | + | |
49 | 27 | | |
50 | 28 | | |
51 | 29 | | |
| |||
480 | 458 | | |
481 | 459 | | |
482 | 460 | | |
483 | | - | |
484 | | - | |
485 | | - | |
486 | | - | |
487 | | - | |
488 | | - | |
489 | | - | |
490 | | - | |
491 | | - | |
492 | | - | |
493 | | - | |
494 | | - | |
495 | | - | |
496 | | - | |
497 | | - | |
498 | | - | |
499 | | - | |
500 | | - | |
501 | | - | |
502 | | - | |
503 | | - | |
504 | | - | |
505 | | - | |
506 | | - | |
507 | | - | |
508 | | - | |
509 | | - | |
510 | | - | |
511 | | - | |
512 | | - | |
513 | | - | |
514 | | - | |
515 | | - | |
516 | | - | |
517 | | - | |
518 | | - | |
519 | | - | |
520 | | - | |
521 | | - | |
522 | | - | |
523 | | - | |
524 | | - | |
525 | | - | |
526 | | - | |
527 | | - | |
528 | | - | |
529 | | - | |
530 | | - | |
531 | | - | |
532 | | - | |
533 | | - | |
534 | | - | |
535 | | - | |
536 | | - | |
537 | | - | |
538 | | - | |
539 | | - | |
540 | | - | |
541 | | - | |
542 | | - | |
543 | | - | |
544 | | - | |
545 | | - | |
546 | | - | |
547 | | - | |
548 | | - | |
549 | | - | |
550 | | - | |
551 | | - | |
552 | | - | |
553 | | - | |
554 | | - | |
555 | | - | |
556 | | - | |
557 | | - | |
558 | | - | |
559 | | - | |
560 | | - | |
561 | | - | |
562 | | - | |
563 | | - | |
564 | | - | |
565 | | - | |
566 | | - | |
567 | | - | |
568 | | - | |
569 | | - | |
570 | | - | |
571 | | - | |
572 | | - | |
573 | | - | |
574 | | - | |
575 | | - | |
576 | | - | |
577 | | - | |
578 | | - | |
0 commit comments