Repository navigation
fix(cli): stage os skills writes and swap them in by rename, recording last (re-land) - #36465
Conversation
…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>
📓 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 4fe40eec7624ff0f2610fec36da508a0d2b52224 && git checkout 4fe40eec7624ff0f2610fec36da508a0d2b52224
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin e9da8987afd23fa2b66e8a141c0585174819f521 009ca680a2f59e1a28a705897d37b3540effbd01 && git checkout -B drift-repro e9da8987afd23fa2b66e8a141c0585174819f521 && git merge --no-ff 009ca680a2f59e1a28a705897d37b3540effbd01
node scripts/docs-audit/affected-docs.mjs --json e9da8987afd23fa2b66e8a141c0585174819f521 |
|
repo:objectstack#7 · zhuangjianguo · session_01QsR2jS7jCv5PH4ytECQWqf L1 ACCEPT · head 维护者速读
席位核对
|
|
repo:objectstack#7 · zhuangjianguo · session_01QsR2jTeURPvEm465RcoYEC Landing (seat 7, 2026-11-22T13:15Z): head |
Requested by Steedos · project thread
Fixes #35079
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
This re-lands the staged swap of PR #35495 (merge commit
578d3b1d66), byte for byte. PR #35616 reverted it because the dispatch-gatesmkdtempSynccompleteness rule could not read the staging base. That base is computed from the caller'sdir, and the scan reads one file at a time. PR #36368 (mergedfb6eb801b2c) 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-*, frommkdtempSync, 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, sostatus, the plan andinspectSkillsDirnever read them as skills.packages/cli/test/skills-commands.test.ts: a new top-leveldescribein the shared harness. It injectsENOSPCat 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-throughvi.mock('node:fs'). The test's own scratch base istmpdir(), which the scan can read..changeset/35079-skills-write-staged-swap.md: fix(cli): stage os skills writes and swap them in by rename, recording last #35495's patch changeset for@objectstack/cli, unchanged.Proof of identity with #35495:
git diff --cachedaftergit cherry-pick -n 578d3b1d66equalsgit diff 578d3b1d66~1 578d3b1d66(adiffof the two outputs printed nothing). Both target files onorigin/mainff601499008are byte-equal to the merge's parenteb1f85d7f4:git diff eb1f85d7f4 HEADon those two paths was empty before the pick. So nothing on main needed adapting.Files to read first (risk order):
packages/cli/src/utils/skills-install-state.ts,applySkillsWrite'stry/catchandundoSwap. This is the swap and its rollback.packages/cli/test/skills-commands.test.ts, thevi.mock('node:fs')fault seam at the top of the file. It is a pass-through unless a test arms it.packages/cli/test/skills-commands.test.ts, the describean 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 reportspackages/cli/src/utils/skills-install-state.ts:246under "reported, not failed".Tests
All readings at head
009ca680a2f(baseorigin/mainff601499008).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.unittier andpnpm --filter @objectstack/cli typecheckdid 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). Theintegrationtier is declared to CI: the diff touches no integration-tier file and no spawn entry.The live slow case, from the full self-test log
Acceptance notes
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)). Noscripts/pm/**file is touched.os skillsswap phase can leave mixed skill directories that only--forcerepairs, and the next write deletes the stranded old copies #35502.Verification
Derived gate families: 64 derived, 61 run, 3 NOT MEASURED, 0 unrun (head 009ca68)
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackderived 64 families. Each one ran with its exit code captured before any pipe. Then--ranreconciled them:✓ dispatch-gates --ran: 64 derived famil(ies) accounted for — 61 run, 3 NOT-MEASURED (3 DERIVED from a recorded exit 3).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-registrationandcheck-closing-keyword-parity(each with--self-testwhere 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.pnpm check:dual-build-cjs-loads(packages outside the cli closure have nodist/),pnpm check:i18n-coverage(example configs outside the closure are not built), andpnpm 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.node scripts/check-closing-keyword-parity.mjs --bodybinds exactly one declaration, this card's, on the line under the header.@objectstack/clipublishes, so the patch changeset from #35495 comes along unchanged. Noskip-changeset.🤖 Generated with Claude Code