Repository navigation
fix(cloud-connection): stage the ledger adoption copy without mkdtempSync, so main's dispatch-gates lane is green again - #30487
Conversation
…Sync, so main's scratch scan reads green again The #30217 adoption step created its staging directory with mkdtempSync under dirname(this.dir), a base resolved at run time. The dispatch-gates self-test holds every mkdtempSync site to a base its source scan can read, so the `Lint · PM dispatch-gates` lane has been red on main since #30351. The staging directory is now an exclusive, non-recursive mkdirSync of a randomly named sibling: still unique, still renamed into place, still removed on failure. Claude-Session: https://claude.ai/code/session_01Utp6CZ9g1bEV7DPMneGKAx Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift Check1 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 — 5 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 8f8013cb0680d8634d3a07ba89dd0886cc32a36a && git checkout 8f8013cb0680d8634d3a07ba89dd0886cc32a36a
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin a1d0b1ee9e428402399f91808923c508c84e0957 c4fb1fe5f1d46dd4ce1ec78a04463700a9117ebb && git checkout -B drift-repro a1d0b1ee9e428402399f91808923c508c84e0957 && git merge --no-ff c4fb1fe5f1d46dd4ce1ec78a04463700a9117ebb
node scripts/docs-audit/affected-docs.mjs --json a1d0b1ee9e428402399f91808923c508c84e0957 |
|
domain:server#3 · os-bill · session_01Utp6CbPxYq1wQmUNWvMZkC 维护者速读(席位终稿)
席位意见:同意立即落地。机械改写,自测不改不收窄;该用例在慢档,PR 与队列只跑快档,合入后由席位看 main 的 push 跑确认转绿。 席位核对ACCEPT · head
|
Requested by Bill · project thread
domain:server#3 · os-bill · session_01Utp6CZ9g1bEV7DPMneGKAx
Fixes #30467
Clause-②: no
Metadata-protocol: none
维护者速读
OS_HOME时用的暂存目录,改用「随机名 + 独占 mkdirSync」创建,不再用mkdtempSync。行为不变:仍是账本目录旁的唯一兄弟目录,复制完重命名到位,失败即删除。os dev --freshrehydrates a previous install #30217)落地后main的Lint · PM dispatch-gates一直红:dispatch-gates 自测要求每个mkdtempSync的基路径都能从源码读出,而这里的基路径是运行时才解析的账本位置。node:crypto导入;名字碰撞时非递归mkdirSync抛 EEXIST,与mkdtempSync同样不复用已有目录。回滚即撤 PR(main 会再次变红)。packages/cloud-connection/src/local-manifest-source.ts的adoptLegacyEntries(第 333 行起那段)。pnpm --filter @objectstack/cloud-connection exec vitest run src/local-manifest-source.test.ts,预期 adoptLegacyEntries 四个用例全过(含「失败不留账本目录」「不留暂存目录」)。What changes
LocalManifestSource.adoptLegacyEntries()(added by #30351, the breaking commitbc254be33e) staged its copy withmkdtempSync(join(dirname(this.dir), ...)).this.diris the ledger location resolved at run time (OS_HOME, or an explicitstorageDir), so the in-tree scratch scan inscripts/pm/dispatch-gates.mjscannot read that base. The scan holdsmkdtempSyncto completeness (an unresolved base is a failure), so the dispatch-gates self-test case "no mkdtempSync site in this tree takes a base the scan cannot read" has been red on everymainrun since.The staging directory is now spelled as an exclusive, non-recursive
mkdirSyncof a randomly named sibling:.LEDGER_BASENAME.adopting-HEX12(12 hex characters fromrandomBytes(6)) underdirname(this.dir). Why this spelling and not one the scan resolves: no spelling of this base can be resolved from source, because the base really is a run-time value (it may even land inside a project checkout whenOS_HOMEpoints there).mkdirSyncis the shape the scan deliberately does not hold to completeness (see the "In-tree scratch directories" block ofdispatch-gates.mjs: runtime bases are named in the report and not failed). The uniqueness guarantee is kept: a non-recursivemkdirSynccreates the directory atomically and throwsEEXISTrather than reuse one that is already there, asmkdtempSyncdoes. The rest is byte-for-byte unchanged: the files are copied into the staging directory, it is renamed into place, and it is removed if the copy fails.scripts/pm/dispatch-gates.mjsand its self-test are not touched.Tests
No test changes. The four existing
adoptLegacyEntriescases inpackages/cloud-connection/src/local-manifest-source.test.tsalready pin the behaviour this keeps: every file copied, no staging directory left beside the ledger, nothing adopted once the ledger exists, and a failed copy leaving neither a ledger nor a staging directory.Acceptance notes
Verification
All readings on head
c4fb1fe5.The failing self-test case, before and after
mainatc58008187(run 42025638313,Lint · PM dispatch-gates):✗ no mkdtempSync site in this tree takes a base the scan cannot read — UNRESOLVED: packages/cloud-connection/src/local-manifest-source.ts:333 (a base this scan cannot read: this.dir), then✗ dispatch-gates self-test: 1 of 2234 case(s) failed.exposedScratchDirsfromscripts/pm/dispatch-gates.mjs), local:origin/main f506b79d: mkdtempSync unresolved = 1 packages/cloud-connection/src/local-manifest-source.ts:333 (a base this scan cannot read: this.dir);head c4fb1fe5: mkdtempSync unresolved = 0 ; exposed = 0.node scripts/pm/check-dispatch-gates.mjs --slow(both tiers, asmain's push and schedule runs do) on head:✓ no mkdtempSync site in this tree takes a base the scan cannot readand✓ every in-tree directory this tree's sources create is covered by a tracked ignore rule, or is tracked itself. The battery's total verdict line is quoted in the os-dev-report on 4-hourly full run: red on main (Lint & Type Check) #30467.pnpm check:pm-dispatch-gates(fast tier, as PR and queue runs do) on head:✓ dispatch-gates self-test (fast tier): 1945 cases pass; 7 slow section(s) deferred., exit 0. The case this PR fixes sits in a slow section, so this PR's own CI does not run it; the first CI run that does ismain's push battery after merge.Package tests and type check
pnpm --filter '@objectstack/cloud-connection^...' build: exit 0.pnpm --filter @objectstack/cloud-connection test:Test Files 70 passed (70),Tests 877 passed (877).pnpm --filter @objectstack/cloud-connection typecheck: exit 0.Derived gates (dispatch-gates --commands, 51 commands)
node scripts/pm/dispatch-gates.mjs --ranon head:✓ dispatch-gates --ran: 51 derived famil(ies) accounted for — 49 run, 2 NOT-MEASURED (2 DERIVED from a recorded exit 3).All 49 run exit 0. NOT MEASURED, left to CI:node scripts/check-plugin-teardown-shape.mjs --self-test(shallow clone cannot reach its pinned control commit) andpnpm check:dual-build-cjs-loads(needs every package built).Generated by Claude Code