Repository navigation
fix(objectql): a committed or rolled-back trio handle reads as closed - #35541
Conversation
The ScopedContext trio now marks the handles it opened closed on commit and rollback, and isClosedUnitHandle answers true for them, so late work carrying one runs unenrolled, as late work carrying a closed transaction() unit handle does. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6Ca1jJvsA1dHsPwMiQb
📓 Docs Drift Check9 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 — 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 a506fa70a6cab50004c70ae1f1cddcb32122f043 && git checkout a506fa70a6cab50004c70ae1f1cddcb32122f043
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin b68f9ae34734879aee2d57438da3b606f6f97bd7 b548ddfb97074ff1d2b822f3cd98172789b03acf && git checkout -B drift-repro b68f9ae34734879aee2d57438da3b606f6f97bd7 && git merge --no-ff b548ddfb97074ff1d2b822f3cd98172789b03acf
node scripts/docs-audit/affected-docs.mjs --json b68f9ae34734879aee2d57438da3b606f6f97bd7 |
|
repo:objectstack#5 · os-bill · session_01Utp6CXsZsKmgG1EcKp5bY4 维护者速读
席位核对L1-a: ACCEPT · head Readings, my own: Code.
Every reader of Pins (names grepped).
Declaration: agreed. Gates. 5 dist-reading gates and Routing. Not governed and no contract face: data-1 lands it. |
|
repo:objectstack#5 · os-bill · session_01Utp6Ca1jJvsA1dHsPwMiQb Landing · area data-1 · 2026-11-19T15:23Z
State: draft → ready + auto-merge (merge queue). #35149 closes on merge via |
repo:objectstack#5 · os-bill · session_01Utp6Ca1jJvsA1dHsPwMiQb
Fixes #35149
Clause-②: no
Metadata-protocol: none
维护者速读
席位核对
What changes
engine-execute-transactions.ts: the trio's commit/rollback release is nowcloseTrioTransactionScope, which drops the owner record (as before) AND adds the handle to a module-levelclosedTrioHandlesWeakSet, only for a handle the trio itself opened (one with an owner record).isClosedTrioHandlereads it.recordTrioTransactionScopeclears the mark, so a driver that hands the same object out on a laterbeginTransactiongets it back open.engine-transactions-section.tsisClosedUnitHandle: whenopenedUnitsholds no entry for the handle, it answersisClosedTrioHandle(handle). AnopenedUnitsentry still decides first, so atransaction()unit handle reads exactly as before.engine-scoped-context.ts:commitTransaction/rollbackTransactioncallcloseTrioTransactionScopein their existingfinally. A joined (ambient) handle still returns early and is never marked.engine.tsuntouched: 6852 lines atorigin/main9212119 and at head (facade ceiling 6854).isClosedUnitHandlenow treats a closed trio handle as absent, as objectql:ScopedContext.transaction()publishes an ambient transaction entry it never closes, so anasynchook's later write inside it is lost ("Transaction query already complete") #22855 does for a closed unit:buildDriverOptions,enforceTransactionOrigin,opensAfterAbortUnit, the secret-row release, the summary write transaction, andopenTransactionKind('separate'becomes'none'for a closed trio handle).Tests
packages/objectql/src/engine-transaction-same-origin.test.ts:ledgerDb.writes[0].transactionto beundefined.a trio handle closes as a transaction() unit handle does (#35149), in the same harness file: parity with a closedtransaction()unit handle on a late cross-datasource write; a late same-datasource write after rollback runs unenrolled; CONTROL (open trio handle reads open, enrolls, and a cross-datasource business write under it is still refused withERR_CROSS_DATASOURCE_TRANSACTION_WRITE);openTransactionKindseparate-then-none; a reused driver handle reads open on its next begin.Acceptance notes
origin/main9212119 source with the new tests only: a lateledgerinsert carrying a committed trio handle reachedledger_dbwithtransaction: { __trx: 'primary' }(the dead foreign handle); the same after rollback. 7 failed / 27 passed.Verification
Red at origin/main source, green at head, ablations
vitest run src/engine-transaction-same-origin.test.ts→Tests 7 failed | 27 passed (34); first failureexpected { __trx: 'primary' } to be undefined.engine-scoped-transaction-late-write.test.tsandopen-transaction.test.ts→Test Files 3 passed (3),Tests 69 passed (69).scripts/ablation-replace.mjs, anchor x1 → x0, blob abff61612cfc → 235b522e2582): close drops the record without marking →Tests 7 failed | 27 passed (34); restored, blob == HEAD,git diff HEADempty.recordTrioTransactionScopeno longer clears the mark →Tests 1 failed | 33 passed (34)(the reused-handle pin); restored, blob == HEAD,git diff HEADempty../engine.jsfromsrc, so nodistleg applies.Package and gates at b548ddf
pnpm --filter @objectstack/objectql typecheck && pnpm --filter @objectstack/objectql testunder the verify lock →VERDICT command-exit 0;Test Files 615 passed (615),Tests 13900 passed (13900);check:test-typecheck: OK.dispatch-gates.mjs --commandsderived 65 families: 59 ran locally, exit 0 each.check:type-check-debtexit 3 (its closure build never got a turn on the shared verify lock): NOT MEASURED.check:dts-closure,check:dual-build-cjs-loads,check:lean-entry-closure,check:published-filesandcheck:sourcemap-no-sources-contentread the builtdist; the objectql build did not get a turn on the lock after more than 45 minutes in the queue, so these are NOT MEASURED locally, a declared narrowing, and left to CI.test:repo,--project integrationand the dogfood battery not run locally: not owed for this diff (no!, no narrowing arm), declared to CI.Generated by Claude Code