Repository navigation
docs(hooks): state what a hook body's ctx.api.transaction joins and where it stops; skills: the measured MongoDB and PostgreSQL rule - #38155
Conversation
…k body joining a body-opened unit; docs: state what ctx.api.transaction joins Claude-Session: https://claude.ai/code/session_01L6bhgTxpM3qHFCaQuC7eyA Co-authored-by: Claude <noreply@anthropic.com>
…l, and the measured MongoDB and PostgreSQL rule Claude-Session: https://claude.ai/code/session_01L6bhgTxpM3qHFCaQuC7eyA Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L6bhgTxpM3qHFCaQuC7eyA Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckNothing in this diff resolved to a documentable surface (no symbol, route or SDK anchor derived from 0 changed package(s)), so this run has no opinion about the docs. What this run could not see
Coarse fallback — 0 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): |
|
repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA Contract reviewServed-tier: Recorded 2026-11-28T04:42Z. PR #38155, card #35324 with #37992 folded in. Read: both cards and every comment, the PR body and file list, the net diff against
① Derived judgments
② Semver level
Clause-②: no. Right: no rule, schema or authorable key is narrowed or widened, and the PR body and the changeset both carry the line. ③ Boundary flags
④ Design judgment
Tried to break it: a nested call under a joined outer (refused, as taught); a hook's No must-fix, no should-fix.
Implemented-by: VERDICT: PASS |
|
repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA 席位核对 — ACCEPT · head 592009f · cards #35324 #37992 · area s2-ai · 2026-11-28T05:07ZL1 checklist
Tier: H. Landing: hand-off to the maintainer follows this record. |
|
repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA Tier H hand-off · 2026-11-28T05:08Z · head 592009f · approver 维护者速读
|
Requested by Sales · project thread
Fixes #35324
Fixes #37992
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
Premise corrected (card comment 7234049171): on
main0e36120 a test already pinned the nested refusal (asserting only the throw), and a body's own unit IS joined:publishTrioHandleFor(packages/objectql/src/engine-middleware-and-context.ts) publishes the trio's handle per operation. Measured on the real engine, real QuickJS and a rollback-honest driver: a hook fired by a write inside a trio-opened transaction,beforeInsertorafterInsert, with or without its ownctx.api.transaction, ran on the one handle with onebegin, and commit kept both rows while rollback kept neither (8 of 8). So the docs and the skill teach the join, not a second unit.packages/runtime/src/sandbox/quickjs-runner.test.ts: "rejects a nested transaction" now asserts aSandboxError, exactly onebegin, the outer unit rolled back, no commit, and nothing after the nested call run.packages/runtime/src/sandbox/transaction-ambient-join.integration.test.ts: two cases on the hook-body face (the engine face isengine-ambient-transaction.test.ts): inside a transaction opened throughScopedContext's trio, as an action body'sctx.api.transactionopens it, the hook body'sctx.api.transactionjoins it (one begin, both writes on its handle, one commit), and its rollback undoes the hook's write.content/docs/automation/hooks.mdx: new subsection "Whatctx.api.transactionjoins, and where it stops": joins any open unit, including one a body opened, and hooks of writes inside it join it; one level per body (nested refused); default datasource only, ledger carve-out; a failed statement aborts the unit on PostgreSQL and a MongoDB replica set even when caught; no unit and no warning on a driver with no transactions. The async after-hook bullet's "A nestedtransaction()joins" is bounded and links there.skills/objectstack-data/references/data-hooks.md: thebefore*Transaction cell replaces "MongoDB needs a replica set (read in code, not measured)" with the measured rule (standalone refuses every write of such a transaction,501 NOT_IMPLEMENTED, a single-node replica set is enough; on PostgreSQL and a MongoDB replica set a failedctx.apistatement refuses the outer write even when caught, logged or retried,25P02/251; SQLite lets it through). Theapi.transactionrow carries the same bounds as the page. The Best Practices ledger sentence points at that row instead of repeating it.skills/objectstack-data/evals/hooks-security-seeds-datasources.json: the "not measured" case now expects the measured rule; the cross-datasource case names the ledger carve-out..changeset/35324-hook-transaction-bounds.md:@objectstack/skillspatch (the package shipsskills/**). The runtime change is tests only and ships nothing.Skills readings (lines / bytes, base 0e36120 → head):
data-hooks.mdhooks-security-seeds-datasources.json(eval, unpriced)skills/**/SKILL.md, linesskills/tree, bytesdata-hooks.mdstays at 10120 tokens, its ceiling (headroom 0). The +878 bytes added are paid by 881 bytes cut in the same file: restating code comments (// Required: Target object(s)→// Requiredand five like it; "Database transaction handle", "Cross-object CRUD API", "Record ID being updated / deleted", "Only fields being changed", "Mask sensitive fields", twocandidateexample comments), section labels ("Insert / Update / Delete / Query operations:", "Mutable data", "Execution context", "Engine access", "Available inafter*hooks:"), and five clauses each stated elsewhere in the file ("awaitis allowed", "In anafter*hook the body is for side effects", "isolated QuickJS VM", ", not a global admin bypass", "(surfaces as a hook error)", the inline-handler-deprecated note, and the ledger definition now in theapi.transactionrow). No fact leaves the file.The
skills/**edits were written by an isolated sub-agent at the contract-review tier;node scripts/pm/verify-review-tier.mjson its transcript:PASS — 22 assistant turn(s), every one served at CONTRACT_REVIEW_TIER.Tests
runs (head 592009f)
pnpm --filter @objectstack/runtime exec vitest run --maxWorkers=2 src/sandbox/transaction-ambient-join.integration.test.ts: 8 passed.… src/sandbox/quickjs-runner.test.ts -t "nested transaction": 1 passed.publishTrioHandleForshort-circuited toreturn chain()in the built@objectstack/objectqldist, both new cases fail (2 failed, 6 passed); dist restored from its saved copy.node scripts/pm/dispatch-gates.mjs --commands(81): run locally, all exit 0:check:doc-anchors,check:doc-authoring,check:skill-links,check:issue-citations,check:nul-bytes,check-skills-token-ratchet.mjs,check:docs-single-h1,check:doc-frontmatter,check:cross-package-test-inputs,check:test-source-alias,check:skill-identifier-liveness,check:corpus-claim-drift,check:docs-transcript-drift,docs-audit/check-affected-docs.mjs,check-issue-citations.mjs,check:engine-double-contract,check:pm-skill-id-lint,check:skill-compatibility,check:skill-frame-sync; and (@objectstack/spec)check:skill-docs,check:skill-refs. The rest,pnpm typecheckfor@objectstack/runtimeand the fullTest Corerun: NOT MEASURED locally (dependencies built withOS_SKIP_DTS=1), left to CI.Acceptance notes
data-hooks.mdhas a code comment "in your plugin's onEnable()" (Plugin Integration section) while the kernel contract has noonEnable; untouched here, noted for the skills lane.before*hook's unit.Verification
Read first: the
api.transactionrow ofdata-hooks.md; the new subsection ofhooks.mdx; the two new cases at the end oftransaction-ambient-join.integration.test.ts.Two-minute check:
pnpm --filter @objectstack/runtime exec vitest run --maxWorkers=2 src/sandbox/transaction-ambient-join.integration.test.tsshows 8 passed.🤖 Generated with Claude Code
https://claude.ai/code/session_01L6bhgTxpM3qHFCaQuC7eyA