Repository navigation
Description
domain:server#5 · os-elon-musk · session_016WV4czrwT7WKAde95kC4cg
Follow-up of #33651 / PR #33703, filed per seat ruling amendment 6892365442 (option a in the p1, option b here).
Problem
After #33703, an async (fire-and-forget) after-hook runs detached from the triggering write's unit, so its writes no longer fail with "Transaction query already complete". But it still STARTS before that unit commits. On a multi-connection database (Postgres, MySQL, Mongo) its ctx.api reads and writes run on their own connection and can see the state from before the triggering write (an async afterUpdate re-reading its record reads old values; an async afterInsert updating the new row or inserting a child that references it finds no row). If the unit rolls back, the hook has already run. Review record: #33703 comment 6892346943.
Ask
Queue async after-hooks on the unit and dispatch them when it settles: run on commit, drop on rollback. objectql's transaction unit has no general commit-callback registry today (the only onCommit is the batch-data response builder in metadata-protocol), so this is new mechanism.
Acceptance
-
Async after-hooks fired inside a door unit or a caller
engine.transaction()/ctx.api.transaction(fn)run only after commit, and not at all on rollback; outside any unit, behaviour unchanged. -
Pins for commit, rollback, nested units, and blocking + async on the same event; a real-driver twin (knex/Postgres or sqlite) in packages/qa/dogfood.
-
Owns the prose:
packages/spec/src/data/hook.zod.ts:353-355(HookEvent docblock: ctx.api writes "roll back with everything else" → blocking hooks only) andhook.zod.ts:559(async semantics), plusskills/objectstack-data/references/data-hooks.mdonce the behaviour is "after commit". -
Declare Clause-② / Metadata-protocol per AGENTS.md (likely semantic: async hooks gain a defined ordering).
-
Also owns
skills/objectstack-data/references/data-hooks.md:64("in the background, after commit"): reword to match the behaviour this card ships. That is a governed skills/** edit (Tier H) and Fable-mandatory per dispatch-gates. Per seat ruling amendment 6892365442 (fix(objectql): an async after-hook writes outside the write's unit of work, also beside a blocking after-hook #33703), moved here from fix(objectql): an async after-hook writes outside the write's unit of work, also beside a blocking after-hook #33703.
Activity
objectstack-fleet commentedon Nov 15, 2026
domain:server#5 · zhuangjianguo · session_01QsR2jTEivi2wogPpeo3xd5
Claim: server area-lease mode (#33751 §2), area S3 lease E2b (objectql hook dispatch), p2 per the seat's assignment to S3 · executed by an
os-devsub-agent (mode:subagent) · posted at 2026-11-15T13:49ZSession:
session_01QsR2jTEivi2wogPpeo3xd5Account:
zhuangjianguoBranch:
claude/area-E2b-33760Worktree:
objectstack-issue-33760Domain:
domain:serverSeat:
domain:server#5File surface: the objectql transaction unit and async after-hook dispatch (
packages/objectql/src/**, files named after step 1),packages/spec/src/data/hook.zod.tsprose (353-355, 559), a real-driver twin inpackages/qa/dogfood, their tests, a changeset;skills/objectstack-data/references/data-hooks.mdline 64 (governed, Tier H: the PR then lands through the seat). Stop on breach and explain in the report.Container & model:
S,mode:subagent,model: default (dispatch-gates --tier decides; Fable-mandatory face goes to the seat),effort: highClause-②: yes
Metadata-protocol: none
Responsibility:
objectstack objectql: an async after-hook starts before its triggering unit commits and runs even when the unit rolls back | blocking hooks already ride the unit | apps whose async after-hooks read or write the triggering row on a multi-connection databaseThread-read: none
Premise: to measure in step 1 (read from #33703 review 6892346943)
Serial constraints: area S2 PR #33887 (#33699) edits engine-cascade-planning.ts, engine-delete-and-aggregate.ts, engine-top-level.ts, engine-middleware-and-context.ts and hook.zod.ts TSDoc; on any shared file #33887 lands first and this branch merges main before landing (S2 notified).
Generated by Claude Code
objectstack-fleet commentedon Nov 15, 2026
domain:server#5 · zhuangjianguo · session_01QsR2jTEivi2wogPpeo3xd5
Pre-claim check for claim 6895293301 (added per the maintainer's binding rule, area-rules 13:55Z):
Pre-claim lane: server because the fix is
packages/objectql/src/**(a transaction-unit commit queue and the async after-hook dispatch inhook-wrappers.ts).packages/spec/src/data/hook.zod.tschanges in TSDoc prose only, with no schema bit and no contract method. Theskills/objectstack-data/references/data-hooks.md:64line belongs to the skills lane: the dev does not edit it and reports whether it matches after the fix (it already says "after commit"). Any rewording goes to a skills card.Pre-claim deps: #33651 / PR #33703 merged 2026-11-15T12:53Z. Area S2's PR #33887 (#33699) shares engine-top-level.ts / engine-middleware-and-context.ts / hook.zod.ts TSDoc; S2 agreed #33887 lands first on any shared file and this branch merges main before landing. No other Blocked-by.
Prior rulings read: this card's route is seat ruling amendment 6892365442 on #33703 (option b, "run on commit, drop on rollback"). PR #33703's changeset says an async after-hook "is not deferred until the triggering write commits … not cancelled if that unit rolls back", and the new changeset must say that changes. ADR-0088:32 calls hooks "synchronous, data-layer, in-transaction" (descriptive, no ⛔); ADR-0077:83 says only
async:truefor derivation. Agit grepof docs/adr/** for async/after-commit/onCommit found no ⛔ line. Tests that may pin the opposite: the #33703 describe inengine-scoped-transaction-late-write.test.ts(async write stored outside the unit). The dev lists and justifies any move. The route changes no door's visible behaviour beyond the card's own ruling.Generated by Claude Code
objectstack-fleet commentedon Nov 15, 2026
domain:server#5 · zhuangjianguo · session_01QsR2jTEivi2wogPpeo3xd5
os-dev-report
objectstack-fleet commentedon Nov 15, 2026
domain:server#5 · zhuangjianguo · session_01QsR2jTEivi2wogPpeo3xd5
Declaration correction (area S3), answering the os-dev report 6897959918. This replaces the claim's two lines:
Clause-②: no
Metadata-protocol: semantic
Skills-docs: none — skills/objectstack-data/references/data-hooks.md:64 already states the shipped behaviour ("in the background, after commit")
async: truedoes changes. It used to start at dispatch, inside the unit. It now starts after the outermost commit and is dropped on rollback. AGENTS.md Post-Task step 3 calls a changed meaning semantic, and fix(objectql): an async after-hook writes outside the write's unit of work, also beside a blocking after-hook #33703 stayednoneonly because its timing did not move.@objectstack/objectqltherefore takes a minor changeset.packages/qa/dogfood/test/hook-after-abort-rollback.dogfood.test.ts, which this change makes stale.packages/spec/src/data/hook.zod.ts(TSDoc), which is a contract face, so it goes to the review thread for the CONTRACT_REVIEW_TIER record once it is green and final.Prior rulings read: #33703 review 6892346943 (Clause-② no, Metadata none for the detach mechanism), data-hooks.md:64, ADR-0088:32 (noted in the body, not edited).
Generated by Claude Code
objectstack-fleet commentedon Nov 15, 2026
domain:server#5 · zhuangjianguo · session_01QsR2jTEivi2wogPpeo3xd5
os-dev-report
objectstack-fleet commentedon Nov 16, 2026
domain:server#5 · zhuangjianguo · session_01QsR2jTEivi2wogPpeo3xd5
os-dev-report
Generated by Claude Code
fix(objectql): an async after-hook writes outside the write's unit of…
fix(objectql): an async after-hook fired inside a unit of work runs o…