Repository navigation
fix(cli): migrate meta --write keeps the edits that stand on their own, and leaves a pair whole - #39123
Conversation
…r; wording Claude-Session: https://claude.ai/code/session_01QSeKYoSKoNUygbCoMBTbGc Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QSeKYoSKoNUygbCoMBTbGc Co-authored-by: Claude <noreply@anthropic.com>
… top; changeset Claude-Session: https://claude.ai/code/session_01QSeKYoSKoNUygbCoMBTbGc Co-authored-by: Claude <noreply@anthropic.com>
…grate-write-exportsof
Claude-Session: https://claude.ai/code/session_01QSeKYoSKoNUygbCoMBTbGc Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QSeKYoSKoNUygbCoMBTbGc Co-authored-by: Claude <noreply@anthropic.com>
…nly what its re-check disagrees with Claude-Session: https://claude.ai/code/session_01QSeKYoSKoNUygbCoMBTbGc Co-authored-by: Claude <noreply@anthropic.com>
…grate-write-partial # Conflicts: # packages/cli/src/commands/migrate/meta.write-exportsof.test.ts # packages/cli/src/utils/authored-source-codemod.ts
…klist verify text Claude-Session: https://claude.ai/code/session_01QSeKYoSKoNUygbCoMBTbGc Co-authored-by: Claude <noreply@anthropic.com>
… edited write suites Claude-Session: https://claude.ai/code/session_01QSeKYoSKoNUygbCoMBTbGc Co-authored-by: Claude <noreply@anthropic.com>
…grate-write-partial # Conflicts: # docs/qa/platform-checklist/areas/cli.json
📓 Docs Drift Check36 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 — 41 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 16dff1740e79b0bd2022cdbc30faa8ddf381855e && git checkout 16dff1740e79b0bd2022cdbc30faa8ddf381855e
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin cef9a803ae9d3e01a8f77a338a37426a5f7dd1b6 18764e5eb7057605b1ed5280e87a45f9fd96ed25 && git checkout -B drift-repro cef9a803ae9d3e01a8f77a338a37426a5f7dd1b6 && git merge --no-ff 18764e5eb7057605b1ed5280e87a45f9fd96ed25
node scripts/docs-audit/affected-docs.mjs --json cef9a803ae9d3e01a8f77a338a37426a5f7dd1b6 |
|
repo:objectstack@os-justin · os-justin · session_01QSeKYoSKoNUygbCoMBTbGc Final green head for review · 2026-12-02T11:01Z
|
|
repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2 L1 ACCEPT · PR #39123 (#38922) · head 席位核对 · ACCEPTACCEPT · repo:objectstack@os-justin · head
|
|
repo:objectstack@os-justin · os-justin · session_01QSeKYoSKoNUygbCoMBTbGc Landing · 2026-12-02T11:04Z · head
|
Fixes #38922
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
os migrate meta --from 18 --writeon a showcase-shaped stack wrote, re-checked, disagreed with itself and restored every file: one view whosebulkActionsnamed a helper-built action took the action-location renames and theengines.protocolmove down with it.bulkActionsremoval, andselectionadded to the actions it names). The planner now re-runs the chain in memory over the stack the written sources would load (the stack the chain started from plus the written units' changes), per unit, and joins the units that cannot be written without each other. A pair one of whose sites is refused is left whole, asentangled, naming the site that holds it. Nothing names a conversion: the pairing is read from the chain's answers (packages/cli/src/utils/authored-source-write-units.ts, a new sibling module; the codemod is over 1,000 lines). One in-memory re-run when the plan is consistent; one per unit of the conversions in the disagreement otherwise.not written [unverified]) and the rest is written again; a disagreement no written unit can be tied to still restores every file, as before.Wrote N of M mechanical change(s) into F file(s); K left because of CAUSES, listed below:(each cause with its count), followed by a pair group naming each pair's sites (path, item names,file:lineor why it cannot be written) and its files.--writethat leaves any mechanical change (or the declared range) by hand exits 1; what it wrote stays written. A write that left nothing exits 0 as before.--json.writegainspairs(siteswithconversionId/path/file/lineorkind/reason, andfiles) when a pair was left. No field renamed or removed;manual[]entries keep exactly their four keys.CodemodRefusalKindgainsunverified(the put-back units);entanglednow also covers a held pair.docs/qa/platform-checklist/areas/cli.json: the WRITE MODE verify text's exit-0 and "every file restored" claims rewritten to the per-unit behaviour (only that line; the "Applied" wording elsewhere in the file is the companion PR's).#38879's wording is kept: "Would apply N" on a dry run, "N … to apply" with
--write, never "Applied".Tests
New
packages/cli/src/commands/migrate/meta.write-partial.test.ts(4 cases, in-process over the real command):^18): the renames, the second view's whole pair and the range are written, the first view's pair is left whole and named, exit 1, a second run finds only that pair;pairs, exit 0;Pins whose asserted behaviour this card changes, updated:
test/migrate-meta-write.test.ts(partial write exits 1; first-line prefix),src/commands/migrate/meta.write-exportsof.test.ts(0-of-N write exits 1),test/migrate-meta-protocol-range.test.ts(a range that does not land is put back alone, the chain's edit stays).Targeted run and ablations
All readings on head
18764e5eb7unless named.vitest run --project unitoversrc/commands/migrate/meta.*,test/migrate-meta*(unit tier),doctor-deprecation-hint-commands,invocation.test.ts,vitest-tiers-partition:Test Files 20 passed (20),Tests 217 passed (217). All eight--writesuites are in the unit tier (vitest list).pnpm --filter @objectstack/cli typecheck: exit 0.ec0a60d42e(before any edit), the same fixture shape in one file:--write wrote 1 file(s), but re-running the chain over them did not match this report, so every one was restored to its previous bytes: no longer converted: actions[1].locations,engines.protocolleft at'^18'.scripts/ablation-replace.mjs, each restored (blob == HEAD,git diff HEADempty), over the four write suites (62 cases):heldPairsanswer replaced by an empty list): 3 failed / 59 passed (both showcase-shape cases and the put-back case; the control stays green).disagreeingUnitsanswer empty, so every disagreement restores all): 2 failed / 60 passed (the put-back case and the range put-back pin).leftByHandalways false): 5 failed / 54 passed / 3 skipped (every exit-1 pin). A first C attempt was refused by the tool as a no-op (anchor inside the replacement) and re-run with a disjoint anchor.dispatch-gates.mjs --commands, 77):--ranreports 75 run, 2 NOT-MEASURED (check:dual-build-cjs-loads,check:i18n-coverage: PREREQUISITE NOT MET, they need a full workspace build; left to CI).check:test-source-aliaswas red on74f3c5d2da(the two edited suites reached the command's dynamic imports without module-top loads); fixed in0666c92821with the same imports the sibling suites carry, re-run exit 0. After mergingorigin/main(#39112among it):check:platform-checklistexit 0 and the targeted subset above re-run.Acceptance notes
--write467 ms end to end, 175 written, 5 pairs held, re-check ok (shared box; ratio-wise negligible against the 7 s first load).Verification
Two-minute check: in a v18 project whose list view names an action built by a helper, run
npx os migrate meta --from 18 --write. Expect the first line of the write group to readWrote N of M …; K left because of 1 pair(s) …, a1 pair(s) left wholegroup naming the view, the actions and the files,engines.protocolnow'^19', and exit code 1.Files to read first:
packages/cli/src/utils/authored-source-write-units.ts(heldPairs: the isolation run and the union),authored-source-codemod.tsPhase 5 inplanAuthoredSourceWrite,meta.tswriteSources(the put-back loop anddisagreeingUnits).Generated by Claude Code