Repository navigation
refactor(objectql): move the caller-envelope builders out of engine.ts into engine-execution-plumbing.ts (#25522 cut 9) - #26263
Conversation
…s into engine-execution-plumbing.ts (#25522 cut 9) Move-only. The bodies of buildSession, buildProvenance, buildEvalUser and buildUser move unedited (re-indented one level) into packages/objectql/src/engine-execution-plumbing.ts. None of them reads an engine member, so each method keeps its name, modifiers, signature, docblock and position and calls the function of the same name directly. The system-context census page re-keys row 63 (the isSystem carry in buildSession) to the new module, where the read site now lives. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GYrEgnrA1u8hdMTsRxqJ4L
📓 Docs Drift CheckThis PR changes 1 package(s): 1 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
What this run could not see
Coarse fallback — 19 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 08d258278b93d5d8e8376c7d955e667fabfa8411 && git checkout 08d258278b93d5d8e8376c7d955e667fabfa8411
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 7e4af20efff1cd6c9a6e32b4bbb5106927139100 2b013959bfbe17844e95a8e7f5be76ef533e7251 && git checkout -B drift-repro 7e4af20efff1cd6c9a6e32b4bbb5106927139100 && git merge --no-ff 2b013959bfbe17844e95a8e7f5be76ef533e7251
node scripts/docs-audit/affected-docs.mjs --json 7e4af20efff1cd6c9a6e32b4bbb5106927139100
|
席位核对ACCEPT · The maintainer's standing authorisation for landing reviewed PRs, verbatim: 「按照 pm-dispatch 规则复核过的都授权」.
Generated by Claude Code |
Requested by Leehom · project thread
Part of #25522
Clause-②: no
Metadata-protocol: none
Ruling-ref: 6348891160
Cut 9 of the
packages/objectql/src/engine.tssplit (#24586 ruling A, recorded in6270097840). The claim is6421730179. Four bodies of the "Execution plumbing" section move unedited into a new module,packages/objectql/src/engine-execution-plumbing.ts:buildSession,buildProvenance,buildEvalUserandbuildUser, the builders of the caller envelopes a hook and a validation predicate read. No behaviour changes. #25522 stays open for the later cuts.Branch
claude/project-thread-3pdv8m(the card thread's harness-pinned branch), cut fromorigin/mainat1eebbc08b, which contains cut 8's merge (43f1da0f6, #26229). Nothing was edited before that merge landed.Why this area (the fresh seam table)
Measured on
origin/main1eebbc08bwith cut 8's script, unchanged.engine.tsis 23,095 lines, 7,373 of them (31.9%) from the last 30 days (git blame -s --since=2026-09-26T17:24Z).scripts/pm/git-history.mjs count(window covered, exit 0): 127 commits in 30 days, 33 in 7.class ObjectQLholds 318 members, 255 methods and accessors plus the constructor. Columns as in cut 8: "inferred public" stays, "U" countsthis.FIELD.delete/insert/update(sites, "private statics" stay.txStore…constructorgetStatus…registryregisterHook…triggerHookshasHooksFor…assertBulkPerRowHookBudgetregisterAction…setActionActive_heldFileResolver…registerInsertRecomputeListenerreadableIdsSecurityReported…resolveDefaultPermissionswriteEpoch…hasObjectMiddlewareexecuteWithMiddleware…buildUserbuildDriverOptions…resolveEnginePostureprobeInstallOrganizations…transactionCoversDriverForresolveNowDefault…defaultFieldEntriesapplyAutonumbers…seedAutonumberregistrationConversionWarned…registerDriversupplyFileColumnsMovedResolver…listUnavailableDatasourcesassertWriteAllowed…publishBulkDataEventsetI18nService…objectDisplayLabelassertReferencesResolve…masterDeclaredFieldsinspectDanglingReferences…inspectCascadeDeletesetCryptoProvider…setTenancyPostureProviderencryptSecretFields…resolveInternalFieldgetSchema…judgeFilterLIFECYCLE_DATASOURCE…setDatasourceMappinginit…resolvePrimaryDatasourceobjectHasMediaField…valueShapeStrictForisFileReferencesMigrationVerified…wasDatastoreCreatedFromEmptydestroy…destroyMAX_EXPAND_DEPTH…MAX_BULK_PER_ROW_HOOK_ROWSautonumberCounters…recomputeSummariesexpandRelatedRecords…expandRelatedRecordsresolveFileReferences…readParentDerivedFilesresolveWhereTokens…requireFindOnePredicatefind…staticReadonlyCreateStripvalidate…validatereadUpdatePriorRow…insertManyupdate…updateplanCascadeAtomicity…organizationOwnedRowCountsdelete…deletecount…aggregateexecute…enforceTransactionOriginregisterObject…createThe per-method move screen for every section and the full pricing are in the project file
pm-orders/server/25522-cut9-seam-table.md. A body stays if any of these holds: an inferred-return public method, a U site, a private-static read, anobjectql/src/engine.ts#NAMEpointer underpackages/spec/**ordocs/adr/**, an engine self-call, or a static. Bodies earlier cuts moved count as stubs.Pricing (net
engine.tslines, the seat's rule): a stub costs a comment, the host literal's open and close and the.call, plus two lines per field read and one per method read; a body that reads no member costs two (the comment and the call); the import adds about three.engine.ts#pointer names themadoptExplicitAutonumber19,isIssuedAutonumberCollision5,warnAutonumberReadersUnserved13,seedAutonumber64count58,rejectCredentialAggregation38Cut 8 priced this area at about -55 and the head measures exactly -55 (66 lines removed, 11 added). Areas the seat rejected priced about -5 and -15; it accepted -70 to -117. No other area pays better while being as cold: Autonumber is the only one between -55 and -91 below 100 recent lines, and its 80 recent lines include #26026's edit during cut 7.
What stays in the section:
executeWithMiddleware(ADR-0139 cites it asengine.ts#executeWithMiddleware),buildReferentialFieldClear(1 body line, the stub would cost 2) andclaimReferentialCascadeDelete(5 body lines; it reads thecascadeIssuedDeletesfield, so its stub would cost 6).The shape
private), signature, docblock and position. Each body is now one comment and onereturn NAME(execCtx);, marked[#25522 cut 9], the form earlier cuts use for a member-free body (objectDisplayLabel,assertBulkPerRowHookBudget,resolveSecret).this(AST screen, casts stripped): each is a function of theExecutionContextit is handed. The card's rule is that shared state goes through one named host; here there is no shared state to hand over, so the module declares no host interface and imports nothing from the engine, not even as a type.HookContext(@objectstack/spec/data) andExecutionContext(@objectstack/spec/kernel), both as types, the bindingsengine.tsuses.engine.tskeeps every import it had (both still have readers there) and gains the new module import with a two-line comment.Net lines (the seat's rule)
engine.tsgoes from 23,095 to 23,040 lines, net -55 (11 added, 66 removed). The module is 122 lines: a 38-line header and imports, four one-line docblocks, and the 66 moved body lines with their signatures and closing braces. With the one re-keyed row of the census page, the diff is 201 changed lines over 3 files (+134 / -67), far under the 3,000-line human-merge threshold.The published
.d.tsdoes not change (ruling6348891160)Base:
@objectstack/objectqlbuilt withengine.tsrestored from1eebbc08band the new module removed (tree and index; restored withgit checkout HEAD --, blob hashes compared,git statusclean). Head: built at2b013959b.buildSession(execCtxoccurs 1 time in the basedist/index.mjs(the inline method) and 3 times in the head's (the function, the method, the call), so each leg built the source it names. All six declaration files are byte-identical, and equal to the hashes cuts 7 and 8 recorded:core.d.mtsef178bf0725eccc2f358f082ce13dc5122a6d5a53c19ef630017256f67de03b4core.d.ts1d20303a455a909e4b55fd0802fb0b0bcb59ec51784daf27d5ef4c0659410953index.d.mtsccf900240aa137abe72f82b8abfc872d42c5645467400134c580285f2a3b3090index.d.ts0454d5e70b156d8effbf27b8915587c7cbee241dcd7d698013c0a4c369a02aa5util-CVzOGxAn.d.mts85ef1cbec2b016d5f7afabaa21689c86c6dffc573076fdfdeb8ea0f1a1b1ad53util-CVzOGxAn.d.ts85ef1cbec2b016d5f7afabaa21689c86c6dffc573076fdfdeb8ea0f1a1b1ad53Positive control: the four moved members are private, so the control drops
privatefrom thebuildUserstub (anchor landed once, 1 hit after) and rebuilds: all six hashes and the chunk name changed (util-Bxn7XMk8.d.ts18e7fa2d…,index.d.tse5d86ee9…), and the util chunk now printsbuildUser(execCtx?: ExecutionContext): HookContext['user'];. Restored withgit checkout HEAD --(blob hash compared,git diff HEADempty, 0 hits), rebuilt, and all six files compared equal to the head build again.Proof of move-only
A TypeScript-AST leaf-token compare (recursive
getChildren, JSDoc skipped;pm-orders/server/evidence/25522/astcmp.mjs) of baseengine.ts(1eebbc08b) against the head module:asyncmatches, and every body line equals the base line less two leading spaces, comments included:buildSession205 tokens / 43 lines,buildProvenance109 / 9,buildEvalUser56 / 6,buildUser72 / 8.!flowRunIdtoflowRunIdin the movedbuildProvenancereports DIFFER on its body tokens; editing only one comment in the movedbuildUserfails the line rule. Both exit 1, and the module was restored fromHEADand its blob hash compared after each.Readers of the moved lines
content/docs/permissions/system-context.mdxrow 63 anchoredpackages/objectql/src/engine.ts#buildSession, the read site that carriesisSysteminto the hook session. The read now lives in the module, so the row anchorspackages/objectql/src/engine-execution-plumbing.ts#buildSession; its wording is unchanged.check-system-context-censusat base: 151 read sites in 22 packages across 79 files, 144 of 144 symbols cited; at head: 151 sites across 80 files, 144 of 144 cited, OK. Control: with the base page restored over this head, the gate exits 1 with exactly two findings,file-without-a-rowfor the new module andanchor-is-not-a-read-sitefor the old anchor; restored fromHEAD, blob hash compared, green again.scripts/adr-anchors/entry describes a moved body: the engine entry's one paragraph is the transaction seam, and its ids stay cited inengine.ts. So no entry is added.check-adr-anchorsat base1eebbc08b(clean detached worktree): 90 anchored files, 1,881 decision-letter citations; at head: 90 anchored files, 1,881 (resolving citations 59,224 → 59,226, the module header's two ADR ids). The moved bodies cite no decision letter; the docblocks that do (ADR-0090 D10 onbuildProvenance) stay on the methods.objectql/src/engine.ts#NAMEpointer underpackages/spec/**ordocs/adr/**names the four. Prose that names a method by file (packages/spec/src/data/hook.zod.tsonbuildSession()inpackages/objectql/src/engine.ts,script-runner.tsonbuildUser(), the plugin and test comments) still resolves, because every method stays on the class inengine.ts; none of them reads source text.durability-read-invention.baseline.json,query-options-erasure-baseline.jsonandfederated-injected-column-readers.test.tsname none of the four);check-org-identifier, which reads the session shapebuildSessionemits, is green.Acceptance notes
pr_create: no open PR touchespackages/objectql/src/engine.ts. feat(spec,core,objectql,driver-sql,formula,driver-mongodb,service-analytics): now-anchored filter comparand{ $now: true, addDays }shifted by days held on the record #26261 edits three otherpackages/objectql/srcfiles, feat(spec,cli)!: retire the ≤16.x retirement kits; the strict unknown-key refusal names the protocol upgrade guide #26138 a validation test, chore: version packages #25640 the package'spackage.jsonand changelog. fix(plugin-audit): render the activity summary in the reader's language #26258 (draft) edits row 45 ofsystem-context.mdx(line 174), 39 lines above this PR's row 63 (line 213); the hunks do not overlap, and whichever lands second mergesmainper the card.origin/mainmoved 4 commits after the base, none onpackages/objectql/**,content/docs/permissions/**orscripts/adr-anchors/**.Verification
At
2b013959b:pnpm --filter @objectstack/objectql typecheck(tsc --noEmit+check:test-typecheck, 39 files / 233 errors / 64 pinned signatures held): VERDICT command-exit 0.pnpm exec eslint --no-inline-config packages/objectql: exit 0.pnpm --filter @objectstack/objectql exec vitest run --project local --maxWorkers=2: 471 files, 8,774 tests passed (VERDICT command-exit 0)..d.tsfiles are byte-identical, so no dependant can see a difference. CI'sTypeScript Type Checkcovers them.2b013959b:dispatch-gates --commandsderived 86 families on the real diff. Every one was run, each exit code captured before any pipe, then reconciled with--ran: 86 accounted for, 84 run green, 2 NOT MEASURED (exit 3, PREREQUISITE NOT MET; CI runs both):check:dual-build-cjs-loads(needs every package'sdist/) and@objectstack/spec check:skill-examples(needs the full build). Named readings:check-system-context-censusOK (above),check:org-identifier,check:logger-receiver-detach,check:durability-log-level,check:doc-anchors,check-affected-docsexit 0;check-engine-split-ratio --days 9097.6%.2b013959b:check-adr-anchorsat base and head (above),check-adr-symbol-anchors,check-tenant-audit-census,check-nul-bytes,check-platform-checklist --changed-from origin/mainandcheck-commit-card-trailers --range origin/main..HEAD.test:repowas not run locally; CI'sTest Coreruns it.skip-changeset: move-only. The published.d.tsfiles are byte-identical,liveness/and every other published path are untouched, and the module's runtime is the same code under a different file name. The docs edit changes only the anchor path in one row of the census table.Generated by Claude Code