Repository navigation
revert(cli): stage os skills writes and swap them in by rename, recording last (#35495) - #35616
Conversation
…ding last (#35495) This reverts commit 578d3b1. Why: that commit added a staging directory, mkdtempSync(join(dir, SKILLS_STAGING_PREFIX)) in applySkillsWrite, whose base is the caller's cwd-relative skills directory. The dispatch-gates scratch-dir scan reads one file at a time and treats such a base as unreadable, so the self-test case "no mkdtempSync site in this tree takes a base the scan cannot read" fails on it. That is the one red case keeping main's scheduled full Lint & Type Check run red (#35588). No honest spelling inside the CLI file lets the scan read that base, and the gate is not narrowed. Consequence: the defect #35079 addressed comes back. An os skills update that fails partway can again leave the catalog and its record out of step, and #35079 reopens. Re-landing the staged swap waits on a gate-side ruling about how the scan judges a directory-creating call whose base is a caller's argument. The deleted changeset (.changeset/35079-skills-write-staged-swap.md) was never released, so this revert ships nothing. Claude-Session: https://claude.ai/code/session_01L6bhgTyMahdAdhXSzgy2nt Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift Check6 anchor(s) derived from 1 changed package(s); no hand-written page names any of them, so this run has nothing to list — not a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run. What this run could not see
Coarse fallback — 40 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 91a226e733fa832494fad6e68ea8b83bb6a1ebf4 && git checkout 91a226e733fa832494fad6e68ea8b83bb6a1ebf4
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 08d920a16e977a1c0842f511ef40158ee3bc7c61 dc83a28e0e19b4903ca4570efff4dd896c905aa9 && git checkout -B drift-repro 08d920a16e977a1c0842f511ef40158ee3bc7c61 && git merge --no-ff dc83a28e0e19b4903ca4570efff4dd896c905aa9
node scripts/docs-audit/affected-docs.mjs --json 08d920a16e977a1c0842f511ef40158ee3bc7c61 |
|
repo:objectstack#1 · os-sales · session_01L6bhgTyMahdAdhXSzgy2nt L2 brief · 2026-11-19T18:24Z · handed to the isolated Contract review brief — PR #35616 @
|
|
repo:objectstack#1 · os-sales · session_01L6bhgTyMahdAdhXSzgy2nt Final green head for L1 + L2 (p0):
|
|
repo:objectstack#1 · os-sales · session_01L6bhgTcFanGhTvqS1V2Q4U 维护者速读
席位核对 — ACCEPT (L1-a) · repo:objectstack#1 · head
|
|
repo:objectstack#1 · os-sales · session_01L6bhgTyMahdAdhXSzgy2nt Contract reviewServed-tier: Inputs read: card #35588 with all six comments (triage 7015724643, claim 7015796595, withdrawal 7015822306, re-claim 7015849091, dev reports 7016701837 and 7018103582), the body of PR #35616, the net diff against merge base ① Derived judgments
② Semver levelClause-②: no — right. The diff touches no published schema, spec or protocol; it returns two CLI commands to the behaviour the released package already has. The DELIBERATE CORRECTION: confirmed. The PR deletes the pending note "fix(cli): Judged sentence by sentence against the tree at this head:
Every behavioural sentence of the note would be false once this PR merges, so deleting it is the right correction; there is no true remainder to keep or reword. No new changeset: right. The note is still pending on the merge base, and no commit between ③ Boundary flags
④ Design judgment
No must-fix, no should-fix. Nits, none of which touches correctness or the contract on this head:
Implemented-by: VERDICT: PASS |
|
repo:objectstack#1 · os-sales · session_01L6bhgTyMahdAdhXSzgy2nt Landing (p0) · 2026-11-19T18:28Z · area b1-B. L1-a ACCEPT 7018187876 and contract-review record 7018204348 (PASS,
State: ready and auto-merge now; #35588 closes on merge. In the same round: #35079 is reopened as |
|
repo:objectstack#1 · os-sales · session_01L6bhgUkbQqRUUFSiu2HGob L2 adoption · 2026-11-19T18:31Z · The seat adopts area b1-B's isolated record 7018204348 for head |
…g last Re-lands the staged swap of #35495 (merge 578d3b1), reverted by #35616 because the dispatch-gates mkdtempSync completeness rule could not read the staging base. The gate now reports such a site in shipped package source (#36368), so the diff lands unchanged: applySkillsWrite writes every new skill into a hidden staging directory inside the skills directory, swaps each touched skill in by rename, renames the record over the old one last, and undoes the renames already done on any failure. Claude-Session: https://claude.ai/code/session_01QsR2jTeURPvEm465RcoYEC Co-authored-by: Claude <noreply@anthropic.com>
…g last (re-land) (objectstack-ai#36465) <!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} --> _Requested by **Steedos** · [project thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbCxiFE11rsKwyNffJZKYqJs)_ Fixes objectstack-ai#35079 Clause-②: no Metadata-protocol: none ## 维护者速读 - 用户能看到什么变化:命令行用户运行「安装技能」或「更新技能」时,若中途写盘失败(磁盘满、无权限、被中断),原有技能和安装记录保持原样,下次直接再运行更新即可,不再需要加强制参数。 - 为什么做:这是技能安装可靠性修复的重新合入;上次合入后因车队门禁读不懂暂存目录而被撤回,门禁那一侧已按你「扫描只管仓内运行的代码」的裁决改好。 - 出错会怎样:最坏是安装或更新在失败时留下一个隐藏的暂存目录,它不会被当成技能读取,下次写入时自动删除;可直接撤回本改动。 - 要你做什么:无。 ## What changes This re-lands the staged swap of PR objectstack-ai#35495 (merge commit `578d3b1d66`), byte for byte. PR objectstack-ai#35616 reverted it because the dispatch-gates `mkdtempSync` completeness rule could not read the staging base. That base is computed from the caller's `dir`, and the scan reads one file at a time. PR objectstack-ai#36368 (merged `fb6eb801b2c`) carries out ruling record 7075362923: an unresolved site in shipped package source is now reported, not failed. So the diff lands as written. - `packages/cli/src/utils/skills-install-state.ts`, `applySkillsWrite`: every new skill directory is written into one hidden staging directory inside the skills directory (`.objectstack-skills-staging-*`, from `mkdtempSync`, so it sits on the same filesystem). Each touched skill is renamed aside into it, and its staged copy is renamed into place. The record is written into the staging directory and renamed over the old one, after every swap. Any throw undoes the renames already done, newest first. The next write removes any leftover staging directories. They are hidden, so `status`, the plan and `inspectSkillsDir` never read them as skills. - `packages/cli/test/skills-commands.test.ts`: a new top-level `describe` in the shared harness. It injects `ENOSPC` at three points (a staged file write, moving the second skill into place, the record rename) and has one leftover-staging case. The fault seam is a hoisted pass-through `vi.mock('node:fs')`. The test's own scratch base is `tmpdir()`, which the scan can read. - `.changeset/35079-skills-write-staged-swap.md`: objectstack-ai#35495's patch changeset for `@objectstack/cli`, unchanged. Proof of identity with objectstack-ai#35495: `git diff --cached` after `git cherry-pick -n 578d3b1` equals `git diff 578d3b1~1 578d3b1` (a `diff` of the two outputs printed nothing). Both target files on `origin/main` `ff601499008` are byte-equal to the merge's parent `eb1f85d7f4`: `git diff eb1f85d HEAD` on those two paths was empty before the pick. So nothing on main needed adapting. Files to read first (risk order): 1. `packages/cli/src/utils/skills-install-state.ts`, `applySkillsWrite`'s `try`/`catch` and `undoSwap`. This is the swap and its rollback. 2. `packages/cli/test/skills-commands.test.ts`, the `vi.mock('node:fs')` fault seam at the top of the file. It is a pass-through unless a test arms it. 3. `packages/cli/test/skills-commands.test.ts`, the describe `an interrupted write leaves the installed catalog usable`. Two-minute check: `node scripts/pm/dispatch-gates.mjs --self-test 2>&1 | grep "no mkdtempSync site in a test file"` should print one passing line. It reports `packages/cli/src/utils/skills-install-state.ts:246` under "reported, not failed". ## Tests All readings at head `009ca680a2f` (base `origin/main` `ff601499008`). - `packages/cli/test/skills-commands.test.ts`, run under the verify lock after the `@objectstack/cli^...` closure build: `Test Files 1 passed (1)`, `Tests 34 passed (34)`, `VERDICT command-exit 0`. That is the 30 existing cases plus the 4 new interrupted-write pins. - `pnpm --filter @objectstack/cli build`: exit 0 in the same locked run. - `node scripts/pm/dispatch-gates.mjs --self-test`, both tiers: `fast 2264 case(s) · slow 315 case(s)`, `✓ dispatch-gates self-test: 2579 cases pass.`, exit 0. It includes the slow case this re-land was blocked on, which now passes. - Declared narrowing: the full cli `unit` tier and `pnpm --filter @objectstack/cli typecheck` did not get a lock turn before this PR opened. Two long batteries owned by other seats held the shared lock for more than an hour. Both are declared to CI (`Test Core`, `TypeScript Type Check`). The `integration` tier is declared to CI: the diff touches no integration-tier file and no spawn entry. <details><summary>The live slow case, from the full self-test log</summary> ```text ✓ the sweep really read this tree (3154 directory-creating site(s) across 23442 tracked source(s)) ✓ and it really found in-tree fixture roots (93), so the coverage case below judges something ✓ every in-tree directory this tree's sources create is covered by a tracked ignore rule, or is tracked itself ✓ no mkdtempSync site in a test file or repo tooling takes a base the scan cannot read — reported, not failed (shipped package source, base chosen at run time): packages/cli/src/utils/skills-install-state.ts:246 (dir is not bound in this file) dispatch-gates self-test tiers: fast 2264 case(s) in 576.2s · slow 315 case(s) in 1879.5s. ✓ dispatch-gates self-test: 2579 cases pass. ``` </details> ## Acceptance notes - Gate-side unblock: the slow case's own logic also passed when called through the scan's exports at head `009ca680a2f` (`exposedScratchDirs({})` + `mkdtempCompleteness`): 3154 sites across 23442 tracked sources, 93 in-tree, exposed 0, unresolved 508, failing 0, reported 1 (`packages/cli/src/utils/skills-install-state.ts:246 (dir is not bound in this file)`). No `scripts/pm/**` file is touched. - Residual, unchanged from objectstack-ai#35495: a hard kill (SIGKILL, power loss, an unhandled SIGINT) inside the rename-only swap window can still leave mixed state. The failure path the card names, a throw the process survives, is handled. The hard-kill window is tracked as objectstack-ai#35502. - Ablation not re-run: the source and test are byte-identical to objectstack-ai#35495, whose red-before and ablation runs are on record in its os-dev-report (7008338749): 4 failed / 30 passed on the old source, 34 / 34 on the fix. ## Verification <details><summary>Derived gate families: 64 derived, 61 run, 3 NOT MEASURED, 0 unrun (head 009ca68)</summary> - `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack` derived 64 families. Each one ran with its exit code captured before any pipe. Then `--ran` reconciled them: `✓ dispatch-gates --ran: 64 derived famil(ies) accounted for — 61 run, 3 NOT-MEASURED (3 DERIVED from a recorded exit 3).` - 61 exited 0. Among them: `check:nul-bytes`, `check:cross-package-test-inputs`, `check:test-source-alias`, `check:cli-test-child-env`, `check:published-files`, `check:dts-closure`, `check:i18n`, `check:lean-entry-closure`, `check-changeset-no-major`, `check-empty-changeset`, `check-adr-0087-registration` and `check-closing-keyword-parity` (each with `--self-test` where it is derived). Eight gates first answered exit 3 before the build. They were re-run after the closure build, and five of them went to exit 0. - NOT MEASURED, exit 3 (PREREQUISITE NOT MET), all three left to CI: `pnpm check:dual-build-cjs-loads` (packages outside the cli closure have no `dist/`), `pnpm check:i18n-coverage` (example configs outside the closure are not built), and `pnpm check:type-check-debt` (its re-measure build did not get a turn on the shared lock). - `node scripts/pm/dispatch-gates.mjs --tier`: no path-derived mandate. Changed lines: 253 (+239 / -14), under the 3000 threshold. - `node scripts/pm/overlap-check.mjs --branch=claude/issue-35079-skills-staged-swap-reland`: `VERDICT clean exit 0`, run before the 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> `@objectstack/cli` publishes, so the patch changeset from objectstack-ai#35495 comes along unchanged. No `skip-changeset`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- signed: repo:objectstack#7 · zhuangjianguo · session_01QsR2jTeURPvEm465RcoYEC --> Co-authored-by: Claude <noreply@anthropic.com>
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 (
cmpof the two patches, exit 0).Why. #35495 added a staging directory,
mkdtempSync(join(dir, SKILLS_STAGING_PREFIX))inapplySkillsWrite. Its basediris 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 (atmpdir()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 installoros skills updatethat 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 plainupdaterefuses 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, andscripts/pm/dispatch-gates.mjsis 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 installandos skills updatestage 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/clinever carried the staged swap, so this PR releases nothing and adds no changeset of its own.skip-changesetis not applied (ruling D on #18375).Check Changesetstays 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:applySkillsWritegoes back to the pre-fix(cli): stage os skills writes and swap them in by rename, recording last #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: thean interrupted write leaves the installed catalog usableblock and thenode:fsfault injection that served it are removed with the code they pinned..changeset/35079-skills-write-staged-swap.md: deleted (see above).Read first
packages/cli/src/utils/skills-install-state.ts, theapplySkillsWritehunk: the riskiest change, the non-atomic write coming back.packages/cli/test/skills-commands.test.ts: the deleted interrupted-write block. Every remaining test passes unchanged..changeset/35079-skills-write-staged-swap.md: the deletion the correction above declares.Two-minute verification
From the repo root on this branch:
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
0and exit 0. Onmainthe same command prints1and exits 1.Tests
All readings below are on head
dc83a28e. Exit codes were captured before any pipe.The red case, before and after
e35cf035, wherepackages/cli/src/utils/skills-install-state.tsis byte-identical to the merge basef981dce3(git diff --quietexit 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.exposedScratchDirson this tree read sites=3127, inTree=93, exposed=0, unresolved(mkdtempSync)=0, exit 0. The classifier on the file alone gives 1 unresolvedmkdtempSyncsite at basef981dce3(:246 dir is not bound in this file) and 0 atdc83a28e.dc83a28ewas still running when this PR opened. Its verdict follows in the os-dev-report on 4-hourly full run: red on main (Lint & Type Check) #35588.cli tests and typecheck
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.pnpm --workspace-concurrency=2 --filter '@objectstack/cli^...' build, VERDICT command-exit 0, thenpnpm --filter @objectstack/cli build, VERDICT command-exit 0.Acceptance notes
Lint & Repo Gatesrun (fast tier) does not execute it. The local full self-test under Tests is the evidence, and the next scheduled full run refreshes 4-hourly full run: red on main (Lint & Type Check) #35588.mkdtempSynconly. Asyncmkdtemp(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.gitignoretmp/, 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.
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackgives 64 commands for this change set (3 paths vs merge basef981dce3). They run locally, byte for byte, and are reconciled with--ran.node scripts/check-empty-changeset.mjs --base origin/mainexits 1 on the deleted foreign changeset (the DELIBERATE CORRECTION class above), and so doesCheck Changeseton this PR.check:pm-dispatch-gateson 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