Repository navigation
fix(scripts,objectql): codemod-split-engine --members reads hand-written facet headers and inverts its import edits; move registerApp, registerDriver and registerHook - #30716
Conversation
…der tail and inverts the import edits a move made The fourth pass refused engine-registration.ts, whose header a hand edit wrote on after (isExternalWriteForbidden), and failed the undo proof of registerHook, whose import of HookEntry resolves a docblock link the base module left unresolved, so the prune could not take it back. headerNamesOf now reads the hand's words after the header sentence and accepts the header when the names and those words rewrap to it byte for byte; the pass carries them over. The undo inverts the import edits it reads off the base and head import blocks (bindings added or widened, each read by a moved member; none dropped or narrowed) instead of relying on the prune alone. The comparison stays byte for byte. Co-authored-by: Claude <[email protected]> Claude-Session: https://claude.ai/code/session_016WV4cwSsWgu5WEWLNtFrf3
… onto their facets Written by scripts/codemod-split-engine.mjs --members (the undo proof passes byte for byte); their three facade-delegation-registry exceptions are dropped, so check-facade-delegation-only holds them as delegations. Co-authored-by: Claude <[email protected]> Claude-Session: https://claude.ai/code/session_016WV4cwSsWgu5WEWLNtFrf3
Co-authored-by: Claude <[email protected]> Claude-Session: https://claude.ai/code/session_016WV4cwSsWgu5WEWLNtFrf3
…-wuvbn6 # Conflicts: # packages/objectql/src/engine.ts
📓 Docs Drift CheckThis PR changes 1 package(s): 3 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 2 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 21 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 1502beaaf68dca87d0b40cc81de406b059e9c538 && git checkout 1502beaaf68dca87d0b40cc81de406b059e9c538
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin badf24dffc27773f566987e810e36896bbd34c2b 3e387e336fdf267b29ec5e9876db6423516a0a98 && git checkout -B drift-repro badf24dffc27773f566987e810e36896bbd34c2b && git merge --no-ff 3e387e336fdf267b29ec5e9876db6423516a0a98
node scripts/docs-audit/affected-docs.mjs --json badf24dffc27773f566987e810e36896bbd34c2b
|
|
domain:devx#3 · os-elon-musk · session_016WV4cz3RTQjLh7hZBLzgtZ 席位核对 · ACCEPT ·
|
Requested by Elon · project thread
domain:devx#3 · os-elon-musk · session_016WV4cwSsWgu5WEWLNtFrf3
Fixes #30572
Refs #30054
Clause-②: no
Metadata-protocol: none
维护者速读
scripts/codemod-split-engine.mjs --members现在接受「模块头被手工续写过」的 facet 模块,并且在搬移改动了接收模块 import 块时,仍能逐字节证明撤销;随后用它把registerApp、registerDriver、registerHook三个方法体搬进各自的 facet,并删掉登记表里对应的三行例外。engine-registration.ts的模块头被手改过;registerHook的撤销证明在 import 块处失败),只能留在类上当例外。@objectstack/objectql构建出的三个.d.ts在搬移前后逐字节相同。撤销证明仍是逐字节比较,没有做任何空白或 import 归一化。回滚即 revert 本 PR。scripts/codemod-split-engine.mjs的headerNamesOf与importEditsOf;packages/objectql/src/engine-hooks-and-functions.ts的 import 块。node scripts/codemod-split-engine.mjs --members --verify --base origin/main,预期最后一行写 "undoing the moves does rebuild the base engine.ts and its modules byte-for-byte",exit 0;node scripts/codemod-split-engine.mjs --self-test预期 129 cases pass。What changes
scripts/codemod-split-engine.mjs, fourth pass (--members), two shapes it used to refuse:engine-registration.ts's header carries a sentence written by hand after the generated one (isExternalWriteForbiddenwas written there by hand).headerNamesOfnow reads the words after the header sentence, in the same paragraph, as atail, and accepts the header only whenmoduleHeaderLines(title, names, tail)rewraps to it byte for byte. The pass rewrites the sentence it owns (the list grows) and carries the tail over unedited; the undo rewraps the same tail. A tail that does not rewrap as the pass wraps it is still refused.registerHook's parameter docblock linksHookEntry, so the move addsHookEntryto the module'simport typefrom./engine-top-level.js. The base module already carried an unresolved{@link HookEntry.dispatchUnscopedMultiWrite}in a staying docblock; once the binding exists, that link resolves, so "prune what nothing reads" keeps it and the undo stopped one line short of the base.importEditsOfnow reads the edits the move made off the base and head import blocks (bindings added, and bindings widened from type-only to value) and the undo inverts exactly those, then prunes as before. Each inverted edit is checked: a moved member's own text must read the name, and a head that dropped or narrowed a base binding fails, since no undo could restore it. The lines left are rendered as the first pass writes them, and the result is still compared with the base byte for byte.main:registerAppandregisterDriverintoengine-registration.ts,registerHookintoengine-hooks-and-functions.ts. The stubs, facet members, host interfaces, host factories and imports are the pass's own output.engine.tsgoes from 11,309 to 11,086 lines.scripts/facade-delegation-registry.json: the three#30054rows for these members are removed;check:facade-delegation-onlyis green with 53 named exceptions..changeset/30572-objectql-registration-bodies.md:@objectstack/objectqlpatch, following PR refactor(objectql): spell the eight ObjectQL facade methods' inferred return types and move five bodies into their facets (.d.ts byte-equal) #30571's changeset.Tests
The codemod's self-test (
node scripts/codemod-split-engine.mjs --self-test): 129 cases in 9 batteries pass. The fourth-pass battery gains five cases, and its pinned floor goes from 18 to 23:Reverse verification (one-time, run on the committed fix, restored to the HEAD blob)
importEditsOfmade to return no edits: case 4 goes red ("undoing the moves out of engine-lifecycle.ts does not rebuild its base (first difference at line 41)"), and--members registerHookon the real tree fails again at line 46 ofengine-hooks-and-functions.ts, the card's refusal.headerNamesOfmade to accept no tail: the self-test stops at "engine-lifecycle.ts: its header is not as the first pass wrote it", and--members registerAppon the real tree refuses again with the card's message.git checkout HEAD -- scripts/codemod-split-engine.mjsandgit status --porcelainempty.Verification
Final head is the merge of
origin/maina2437b56(which editedregisterApp's body in #30656) into this branch; the moves were regenerated on thatmainrather than text-merged.mainf4d568ba):--members registerApp/registerDriverrefused with "engine-registration.ts: its header is not as the first pass wrote it" (exit 2);--members registerHookfailed the undo proof at line 46 ofengine-hooks-and-functions.ts(exit 1; the card recorded line 44 on an oldermain).node scripts/codemod-split-engine.mjs --members --verify --base a2437b560bexits 0: "3 moved method(s) (registerHook, registerApp, registerDriver); engine.ts 11309 -> 11086 lines; undoing the moves does rebuild the base engine.ts and its modules byte-for-byte once the 7 import binding(s) only moved bodies read are pruned from the base"..d.tsfor@objectstack/objectql: built at basea2437b56and at head;dist/index.d.ts,dist/core.d.tsanddist/util-B0RqjNMv.d.tsare byte-equal (sha2564d00ae43…,a0cdd71a…,69f1c293…on both sides). Control:RegistrationFacet.registerAppoccurs 0 times in the basedist/index.jsand once in the head's, so each side's build is its own.pnpm --filter @objectstack/objectql typecheck: exit 0 (includingcheck:test-typecheck).pnpm --filter @objectstack/objectql test: 556 files, 11068 tests passed (lock VERDICT command-exit 0), at head3e387e33.node scripts/pm/dispatch-gates.mjs --commands: 73 families derived at head3e387e33; 72 exit 0.pnpm check:dual-build-cjs-loadsis NOT MEASURED locally (exit 3, PREREQUISITE NOT MET: it reads every package'sdist/, and only the@objectstack/objectqlclosure was built here); CI runs it inLint & Repo Gates.--ran: 73 derived, 72 run, 1 NOT-MEASURED, 0 UNRUN. The codemod's own self-test (above) is outside the derived set and was run separately.Acceptance notes
scripts/codemod-split-protocol.mjsand other rows ofscripts/facade-delegation-registry.json; this PR does not touch that codemod. Whichever lands second mergesmain.Human Minimum
packages/specholds no runtime logic. (Not touched.)pnpm lintis CI's run.main, one pull request.packages/spectouched: its generated artifacts are regenerated and committed. (Not touched.)content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.Generated by Claude Code