Skip to content

objectql: run async after-hooks on commit of the triggering unit (drop on rollback) #33760

Closed

Description

@objectstack-fleet

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) and hook.zod.ts:559 (async semantics), plus skills/objectstack-data/references/data-hooks.md once 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

  1. added
    priority:p2
    pm:queue
    domain:server
    and removed on Nov 15, 2026
  2. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    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-dev sub-agent (mode:subagent) · posted at 2026-11-15T13:49Z
    Session: session_01QsR2jTEivi2wogPpeo3xd5
    Account: zhuangjianguo
    Branch: claude/area-E2b-33760
    Worktree: objectstack-issue-33760
    Domain: domain:server
    Seat: domain:server#5
    File surface: the objectql transaction unit and async after-hook dispatch (packages/objectql/src/**, files named after step 1), packages/spec/src/data/hook.zod.ts prose (353-355, 559), a real-driver twin in packages/qa/dogfood, their tests, a changeset; skills/objectstack-data/references/data-hooks.md line 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: high
    Clause-②: 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 database
    Thread-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

  3. added
    pm:dispatched
    and removed
    pm:queue
    on Nov 15, 2026
  4. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    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 in hook-wrappers.ts). packages/spec/src/data/hook.zod.ts changes in TSDoc prose only, with no schema bit and no contract method. The skills/objectstack-data/references/data-hooks.md:64 line 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:true for derivation. A git grep of docs/adr/** for async/after-commit/onCommit found no ⛔ line. Tests that may pin the opposite: the #33703 describe in engine-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

  5. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#5 · zhuangjianguo · session_01QsR2jTEivi2wogPpeo3xd5
    os-dev-report

    {
      "issue": 33760,
      "status": "needs_area",
      "branch": "claude/area-E2b-33760",
      "pr": null,
      "head": "a3d85bbecfbc95cc8f9e4039fa908a8d4fd73604",
      "session": "session_01QsR2jTEivi2wogPpeo3xd5",
      "premise_still_valid": true,
      "summary": "Premise measured and holds (step 1, origin/main 63e47feec): on Postgres 16 and on SQLite through knex, an async afterInsert fired inside engine.transaction(), ctx.api.transaction(fn), a nested unit and the door's own unit (blocking + async on one event) started before COMMIT, read saw=0 of its own row on Postgres (ctx.api.transaction path: hook-read saw=0 before COMMIT), and ran to completion after ROLLBACK, writing a note for a row that was never stored. The fix is built, pinned, ablated and pushed: a UnitCommitQueue per engine-owned unit (unit-detach.ts), opened by ObjectQL.transaction() and ScopedContext.transaction() and carried by runOpenedUnit on the txStore entry, settled after commit (start) or on rollback (drop); the beginTransaction trio (the sandbox runner's ctx.api.transaction) keeps a per-handle queue settled by its own commit/rollback; a nested transaction() joins and opens no queue, so only the outermost commit starts the run; outside any unit the run starts at dispatch as before. Door unit, cascades and atomic batches ride ObjectQL.transaction(), so no S2 file is touched. STOPPED before pr_create per order amendment item 2: my measured declaration disagrees with the claim's lines (Clause-② yes, Metadata-protocol none); see open_questions. The prepared, pre-gated PR body (claim lines verbatim) is at /mnt/project-files/server-seat-5/area-S3/pr-33760-body.md; title: fix(objectql): an async after-hook fired inside a unit of work runs once the unit commits, and not at all when it rolls back. skills/** untouched per the amendment: data-hooks.md:64 says 'then in the background, after commit' and matches the shipped behaviour word for word (inside a unit: after the outermost commit; outside a unit the write is already committed when the after-hook starts). ADR-0088:32 ('synchronous, data-layer, in-transaction') noted in the body, not edited. #33703 pin that moves: engine-scoped-transaction-late-write.test.ts describe 'an async after-hook beside a blocking one writes outside the door's unit' - its blocking leg waited for the async hook's write to reach the driver inside the unit (the old ordering); it now records whether the async hook had started and the pins read false; its #33651 assertions (stored, unenrolled) stand.",
      "tests": "At a3d85bbecf unless noted. objectql unit pins src/engine-scoped-transaction-late-write.test.ts: Tests 25 passed (25) (new #33760 describe: commit/rollback x engine.transaction, ctx.api.transaction, trio; nested inner-return+outer-rollback drops, outer commit starts once; door unit blocking+async commit and abort-rollback; CONTROL outside any unit). Full pnpm --filter @objectstack/objectql test: Test Files 596 passed (596), Tests 13179 passed (13179). Dogfood twin test/scoped-transaction-late-write.dogfood.test.ts: before the fix (origin/main build) Tests 6 failed | 6 passed (12), e.g. 'expected [ true, 1 ] to deeply equal [ false, +0 ]'; after rebuilding objectql: Tests 12 passed (12). runtime src/sandbox/ (trio consumer): Test Files 41 passed, Tests 431 passed. spec test: Test Files 842 passed, Tests 26956 passed | 1 todo; spec typecheck exit 0; spec check:generated: all 14 generated artifacts up to date. dogfood typecheck exit 0. Postgres/SQLite scratch probe after the fix: every rollback path notes=0 with no hook-start; every commit path COMMIT > hook-start > hook-read saw=1. Ablations (ablation-replace.mjs, trap restore, each restored with blob == HEAD and git diff HEAD empty): A1 start-at-dispatch ('if (queue || !queue)' in runOutsideOpenUnitsOnCommit) Tests 11 failed | 14 passed; A2 rollback starts runs (run.commit() for both outcomes in settleUnitCommitQueue) exactly the 5 rollback pins red; A3 no trio queue (openTrioCommitQueue removed) exactly the 2 trio pins red. Unit ablations run against src (objectql local project resolves source); the dogfood twin's ablation leg is the origin/main dist run above. test:repo not run (CI's Test Core).",
      "gates": "dispatch-gates --commands --repo objectstack-ai/objectstack derived 94 for 8 paths at e9a0a4f993-era tree; 92 run locally, every one exit 0 (exit captured before any pipe, per-command logs); pnpm check:type-check-debt exit 0 under the lock (re-measure OK, 0 ledger entries); pnpm check:dual-build-cjs-loads NOT MEASURED, reason: left to CI. --ran reconciliation: '94 derived, 92 run, 0 NOT-MEASURED, 2 UNRUN' on the first record (dual-build-cjs-loads, type-check-debt), type-check-debt since run. objectql typecheck exit 0 (tsc + check:test-typecheck OK). eslint --no-inline-config on the 7 changed .ts files exit 0 (full pnpm lint is CI's). PR-body gates on the prepared body: check-changeset-no-major exit 0, check-adr-0087-registration exit 0 ('adds no declared-breaking changeset'), check-closing-keyword-parity exit 0, check:partof-closing-keyword exit 0. dispatch-gates --tier: no path-derived mandate; Clause-② SUSPECT hint for packages/spec/src/data/hook.zod.ts (TSDoc only). No PR, so no check-runs to cite.",
      "dogfood_battery": "n/a - no PR opened; with my recommended declaration (no '!', no (narrowing) arm) none is owed; option C below would owe it",
      "mcp_calls": "0",
      "api_writes": "1 - POST issues/33760/comments via scripts/pm/post-stamped.mjs (this report). git push x4 to claude/area-E2b-33760 (not REST).",
      "open_questions": [
        {
          "question": "Which Clause-② line does this PR declare? The claim says 'Clause-②: yes'.",
          "options": [
            "A 'Clause-②: no' - no published accept set or public surface widens: the new symbols (UNIT_ROLLED_BACK, UnitCommitQueue, run helpers) are not on any exports entry; ScopedContext's symbol-keyed DETACHED_HOOK_RUN member changed signature but its key is an unexported unique symbol; no answer to the triggering request moves (nothing waits for an async hook). Same class the #33703 contract review (6892346943) ruled 'no'. Cost: none; patch or minor per the Metadata line.",
            "B 'Clause-②: yes' as claimed - reads a widening that the diff does not contain; costs a TIER_DEFAULT review owed for the declaration alone.",
            "C 'Clause-②: no (narrowing)' - treats 'an async hook no longer runs for a rolled-back write' as served-to-refused; owes '!' in the title, a BREAKING banner, an ADR-0087 marker and the full dogfood battery (about 20 min). Cost: high for a side effect no caller receives."
          ],
          "recommendation": "A. Real business need: apps that read or reference the triggering row in an async hook (measured saw=0 on Postgres) get correct behaviour, nothing they receive as an answer changes. Long-term soundness: one declared contract, matching the #33703 precedent for the same mechanism. AI-safety: no declaration of a widening the code does not deliver. Focus: no extra surface, no battery for a non-breaking fix."
        },
        {
          "question": "Which Metadata-protocol line? The claim says 'Metadata-protocol: none'.",
          "options": [
            "A 'Metadata-protocol: semantic' - the meaning of the authorable key async: true changes: it now means 'after the outermost unit commits, dropped on rollback' where it meant 'starts at dispatch, in the background'. AGENTS.md Post-Task step 3: 'a changed meaning or default is semantic'; the card itself predicted semantic. Cost: changeset level becomes minor for @objectstack/objectql (check-changeset-no-major refuses patch beside a non-none kind) and the PR body owes a Skills-docs line, e.g. 'Skills-docs: none - skills/objectstack-data/references/data-hooks.md:64 already states the shipped behaviour (\"in the background, after commit\")'.",
            "B 'Metadata-protocol: none' as claimed - the #33703 review's reasoning (no key, value or default changes). Cost: under-declares a change in what an author's async: true does, which is what the line exists to tell upgraders."
          ],
          "recommendation": "A. Real business need: an author upgrading needs to know async: true changed timing and no longer runs on rollback. Long-term soundness: the declaration follows AGENTS step 3's definition literally. AI-safety: an AI author reading the changelog kind sees the meaning moved. Focus: one-line declaration change plus a level bump, no new surface."
        }
      ],
      "security_findings": "none",
      "out_of_scope_findings": [
        "carrier: area S3 - packages/qa/dogfood/test/hook-after-abort-rollback.dogfood.test.ts header comment still says an async hook 'is started inside the unit and writes after it commits'; its tests still pass; outside the claim's file surface, so not edited (comment-only fix, under 30 lines) - noted, not filed",
        "carrier: none - HookContext.transaction / ScopedContext#transactionHandle inside a deferred run still expose the committed handle (#33703 review nit, unchanged) - noted, not filed"
      ],
      "deviations": [
        "Stopped before pr_create (order amendment item 2): measured declaration differs from the claim on both lines; no PR, no draft. Branch pushed at a3d85bbecf; prepared body at /mnt/project-files/server-seat-5/area-S3/pr-33760-body.md carries the claim's lines verbatim and must be edited to the decided lines (and the changeset .changeset/33760-async-hook-on-commit.md with them) before pr_create.",
        "Branch not yet merged with origin/main (47 commits behind at the last fetch; none touches any of the 9 changed files, and no async-hook commit among them). The merge-once-before-pr_create step is owed when the area resumes.",
        "Order's skills exception withdrawn by the amendment: skills/** not edited; data-hooks.md:64 matches word for word, so no skills finding.",
        "hook.zod.ts line numbers moved since the card (353-355 is now 512-518, 559 is now 719-732); edited there. S2 #33887 touches hook.zod.ts only at about lines 1359 and 1765 (HookContextSchema), and none of my objectql files; S1's head claude/area-A2-33782 (PR #33927, draft) adds only packages/plugins/plugin-security/src/cascade-delete-security-parity.test.ts: no shared file.",
        "Scope beyond the order's three paths: the beginTransaction trio got a queue too, because the sandbox runner's ctx.api.transaction(fn) uses it; inside the claim's surface (packages/objectql/src/**).",
        "dev-common pre-push: 'pnpm lint' narrowed to eslint on the 7 changed .ts files (exit 0); dependents' tests narrowed to runtime src/sandbox/ (the trio's only consumer) because no published bytes of objectql's exports move and the spec change is TSDoc only; test:repo left to CI.",
        "Worktree /home/claude/objectstack-issue-33760 kept (not removed): no PR opened yet; remove after pr_create.",
        "A local Postgres 16 cluster (pid 23924, /tmp/pg-s3-33760) was started for step 1 and stopped and deleted afterwards."
      ],
      "line_budget": "9 files, +600 / -42 (generated files included; under the 3000 human-merge threshold); not governed (no skills/** edit)",
      "files_changed": [
        ".changeset/33760-async-hook-on-commit.md",
        "packages/objectql/src/unit-detach.ts",
        "packages/objectql/src/engine-transactions-section.ts",
        "packages/objectql/src/engine-scoped-context.ts",
        "packages/objectql/src/engine.ts",
        "packages/objectql/src/hook-wrappers.ts",
        "packages/objectql/src/engine-scoped-transaction-late-write.test.ts",
        "packages/qa/dogfood/test/scoped-transaction-late-write.dogfood.test.ts",
        "packages/spec/src/data/hook.zod.ts"
      ]
    }
    
  6. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    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")

    • Clause-② no follows the fix(objectql): an async after-hook writes outside the write's unit of work, also beside a blocking after-hook #33703 contract-review ruling on the same mechanism (6892346943): nothing waits for an async hook, so no answer to the triggering request moves, and nothing in the diff is a published accept set or export. The report's option C (narrowing) is declined: a hook that no longer runs for a rolled-back write is not a refusal of anything an author writes or a caller receives.
    • Metadata-protocol semantic: what an author's async: true does 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 stayed none only because its timing did not move. @objectstack/objectql therefore takes a minor changeset.
    • File surface adds one comment-only ride-along: the header of packages/qa/dogfood/test/hook-after-abort-rollback.dogfood.test.ts, which this change makes stale.
    • This PR touches 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

  7. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#5 · zhuangjianguo · session_01QsR2jTEivi2wogPpeo3xd5
    os-dev-report

    {
      "issue": 33760,
      "status": "done",
      "branch": "claude/area-E2b-33760",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/34043",
      "head": "709b3aeea17aa4b50a6cf985be96a6d65684287e",
      "session": "session_01QsR2jTEivi2wogPpeo3xd5",
      "premise_still_valid": true,
      "summary": "Draft PR #34043 opened through the relay (read back identical, 10710 bytes; no assignees, no labels), Fixes #33760, declared per the area decision (card comment 6897999027): Clause-② no, Metadata-protocol semantic, Skills-docs: none - data-hooks.md:64 already states the shipped behaviour. An async: true after-hook fired inside a unit the engine owns (engine.transaction(), ctx.api.transaction(fn) on both surfaces including the sandbox runner's beginTransaction trio, the door's own unit, cascades, atomic batches) now starts after the outermost commit and is dropped on rollback; outside any unit it starts at once as before. Mechanism: a UnitCommitQueue per unit (unit-detach.ts) carried by runOpenedUnit and settled by the owner after commit or on rollback; the trio keeps a per-handle queue. Step-1 premise (measured before the fix on Postgres 16 and SQLite/knex) and all readings are in the earlier report 6897959918 and the PR body. Since then: origin/main merged once (no rebase) at a777ec04b9 (main b4ce310b88; none of its commits touches the 9 changed files), changeset now objectql minor + spec patch (spec ships src/**/*.zod.ts and dist TSDoc) with the two decided lines, the stale header of hook-after-abort-rollback.dogfood.test.ts corrected (comment only), pins re-run on the final head. No review requested; head 709b3aeea1 is final unless CI says otherwise.",
      "tests": "Final head 709b3aeea1 (after merge, install --frozen-lockfile, rebuilt dogfood closure under the lock, VERDICT command-exit 0): objectql src/engine-scoped-transaction-late-write.test.ts + src/hook-run-as.test.ts Tests 60 passed (60); dogfood test/scoped-transaction-late-write.dogfood.test.ts + test/hook-after-abort-rollback.dogfood.test.ts Tests 18 passed (18); objectql tsc --noEmit exit 0. Pre-merge head a3d85bbecf: full objectql 596 files / 13179 tests passed; spec 842 files / 26956 passed + 1 todo, spec typecheck 0, check:generated all 14 up to date; runtime src/sandbox/ 41 files / 431 tests passed; dogfood twin 12/12 (6 red against the origin/main build). Ablations (each restored, blob == HEAD, git diff HEAD empty): A1 start-at-dispatch 11 red / 14 green; A2 rollback-starts-runs exactly the 5 rollback pins red; A3 no trio queue exactly the 2 trio pins red.",
      "gates": "On 709b3aeea1 with the final PR body as GITHUB_EVENT_PATH: check-changeset-no-major exit 0 (LEVEL AXIS: clause-② no, metadata-protocol semantic, graded minor - accounted for), check-adr-0087-registration exit 0 (no declared-breaking changeset), check-closing-keyword-parity exit 0, check:partof-closing-keyword exit 0; dispatch-gates --tier exit 0: 10 files, 653 changed lines (+608/-45), no path-derived model mandate, Clause-② SUSPECT hint for packages/spec/src/data/hook.zod.ts (TSDoc; contract face, so a CONTRACT_REVIEW_TIER record is owed - the area routes it). Derived families (pre-merge, a3d85bbecf-era tree): 92 of 94 run locally, all exit 0; check:type-check-debt exit 0 under the lock; check:dual-build-cjs-loads NOT MEASURED, reason: left to CI. Not re-run after the merge (merge touched none of the 9 files; the ride-along is a comment). PR check-runs at 709b3aeea1 when read: in_progress=18, skipped=5, success=1, none failed - CI not converged, left to the area.",
      "dogfood_battery": "n/a - no '!' in the PR title and no (narrowing) arm",
      "mcp_calls": "0",
      "api_writes": "3 - POST issues/33760/comments (report 6897959918, post-stamped), pr_create via scripts/pm/fleet-write/dispatch.mjs (PR #34043), POST issues/33760/comments (this report, post-stamped). git push x5 to claude/area-E2b-33760 (not REST).",
      "open_questions": [],
      "security_findings": "none",
      "out_of_scope_findings": [
        "carrier: none - HookContext.transaction / ScopedContext#transactionHandle inside a deferred run still expose the committed handle (#33703 review nit, unchanged) - noted in the PR's Acceptance notes, not filed"
      ],
      "deviations": [
        "Declaration lines differ from the claim's (Clause-② yes, Metadata-protocol none): changed per the area's correction 6897999027, not by me alone.",
        "hook.zod.ts edits sit at lines 512-518 and 722-732 (the card's 353-355 and 559 moved); S2 #33887 edits hook.zod.ts only near 1359 and 1765 and none of my objectql files; S1 #33927 (head claude/area-A2-33782) adds one plugin-security test file: no overlap.",
        "Scope: the beginTransaction trio also got a commit queue (the sandbox runner's ctx.api.transaction uses it), inside the claim surface.",
        "dev-common pre-push narrowed: eslint on the 7 changed .ts files instead of pnpm lint (exit 0); dependents' tests limited to runtime src/sandbox/; test:repo and check:dual-build-cjs-loads left to CI; derived gate sweep not repeated after the merge.",
        "Worktree /home/claude/objectstack-issue-33760 removed after the PR opened (node_modules first, no --force); temporary refs refs/s3-33760/* deleted. A local Postgres 16 cluster used in step 1 was stopped and deleted."
      ],
      "line_budget": "10 files, +608 / -45 (generated included); not governed (no skills/** edit); contract face: packages/spec/src/data/hook.zod.ts TSDoc",
      "files_changed": [
        ".changeset/33760-async-hook-on-commit.md",
        "packages/objectql/src/unit-detach.ts",
        "packages/objectql/src/engine-transactions-section.ts",
        "packages/objectql/src/engine-scoped-context.ts",
        "packages/objectql/src/engine.ts",
        "packages/objectql/src/hook-wrappers.ts",
        "packages/objectql/src/engine-scoped-transaction-late-write.test.ts",
        "packages/qa/dogfood/test/scoped-transaction-late-write.dogfood.test.ts",
        "packages/qa/dogfood/test/hook-after-abort-rollback.dogfood.test.ts",
        "packages/spec/src/data/hook.zod.ts"
      ],
      "mergeable_state": "mergeable=true, mergeable_state=blocked (draft, checks running) at 709b3aeea1"
    }
    
  8. objectstack-fleet commented on Nov 16, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#5 · zhuangjianguo · session_01QsR2jTEivi2wogPpeo3xd5
    os-dev-report

    {
      "issue": 33760,
      "status": "done",
      "branch": "claude/area-E2b-33760",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/34043",
      "session": "session_01QsR2jTEivi2wogPpeo3xd5",
      "premise_still_valid": true,
      "summary": "Final head 7c8f07ee9206d796306c810c67e05fa68eb7952a, the head contract delta record 6903738456 passed. Nothing has been pushed since then and nothing is left uncommitted: local HEAD == origin/claude/area-E2b-33760 == 7c8f07ee, git status is empty, git diff HEAD is 0 bytes, and the ABLATION-M1 marker is absent from src. Review 6898709123 finding 1 (runAs 'user' on a user-less trigger) was fixed in 1621f1e998: the engine-built ctx.api is held before the runAs install. Review#2 6899793526 is folded in: (1) M1 in c122a90f45: only a write event's async run (afterInsert/afterUpdate/afterDelete, waitsForUnitCommit in unit-detach.ts) waits for its unit's commit and is dropped on rollback; an async afterFind run starts at dispatch, outside the units, as under #33651. (2) S1 in 4c4fc03985: content/docs/automation/hooks.mdx, where the unit-of-work section, its bullets and its callout now speak of blocking hooks, and a new subsection covers async: true after hooks. (3) N4 and N1: the unreleased 33651 changeset was amended so the timing rule is stated once, and the 33760 changeset now states the N1 (a) and (b) deviations, the afterFind exception and the one-pass start (N5); the spec async TSDoc names afterFind. (4) N3: a throw-after-commit pin was added. (5) The query-options-erasure red at 4c4fc039 was mine: two `as any` casts on read options in the new afterFind pins. 7c8f07ee92 removes them, and the ratchet holds at 236. The S2 body edits (Skills-docs line, stale head and test count) are in the seat's file /mnt/project-files/server-seat-5/area-S3/pr-33760-body.md, which I did not PATCH. DECLARATION BLOCK: check-empty-changeset expects no fixed text and parses none from the body. Its remedy line (scripts/check-empty-changeset.mjs:560, the same as the job 132985990076 annotation) reads: `do NOT restore it -- declare the DELIBERATE CORRECTION on the PR, naming each note; the dispatching seat confirms it by its own record (its ACCEPT, or its same-head at-tier contract-review PASS: pm-dispatch references/landing-operations.md), never a maintainer wait`. Its long form (:618-619) asks to `declare it on the PR as a DELIBERATE CORRECTION, naming each note and quoting the corrected sentences`, and says the gate `stays red either way`. Check Changeset is not a required context. The block ready in the body file is the section `## DELIBERATE CORRECTION — .changeset/33651-async-hook-outside-door-unit.md`. Corrected 33651 text as it stands at 7c8f07ee: (a) the paragraph now reads `An async after-hook now runs outside every unit of work open when it is dispatched. From the first write on, its writes are enrolled in no unit and run on their own connection, as they would with no unit open. A unit the hook opens itself (ctx.api.transaction(fn)) is its own. When the hook starts, and whether it runs at all when that unit rolls back, is stated in one place, the entry for the follow-up fix: an async after-hook fired inside a unit of work runs once that unit commits, and not at all when it rolls back.` It replaces `What they see is not the same as with no unit open: there, the triggering write is already committed; here, it may not be yet (see the first bullet below).` (b) The first bullet was removed: `An async after-hook runs in the background but is not deferred until the triggering write commits. It can start before that write's unit commits, ... and it is not cancelled if that unit rolls back. ... An async hook that must see the triggering write should be a blocking hook instead.` (c) The bullet now reads `An async hook's writes no longer roll back with the write that triggered it. Before, they rolled back only when they happened to run before that unit settled.`, with `An async hook that must undo its effect when the triggering write fails should be a blocking hook instead.` dropped. The declaration lines are unchanged: Clause-②: no, Metadata-protocol: semantic, objectql minor + spec patch.",
      "tests": "objectql pins (src/engine-scoped-transaction-late-write.test.ts + src/hook-run-as.test.ts) at c122a90f45, under the lock: `Test Files 2 passed (2) / Tests 66 passed (66)`, PINS_EXIT=0. The late-write file holds 31 cases. Two red first runs were fixed before that commit: the thrower needed the default onError, and the double's snapshot rollback hides the afterFind note row, so the unit pin reads unenrolled instead and the dogfood twin reads the row. Dogfood twin (scoped-transaction-late-write + hook-after-abort-rollback) on the rebuilt objectql dist: `Test Files 2 passed (2) / Tests 21 passed (21)`, DF_EXIT=0. 7c8f07ee92 only drops two `as any` casts on options and was not re-run locally; CI Test Core 1-8/8 is success at 7c8f07ee. Ablation A4 (rework 1, at 1621f1e998): `void runDetachedHook(detached.api /* ABLATION-4 */, ` gave `Tests 2 failed | 25 passed (27)`, exactly the two user-pin pins red. It was restored (`ok restored: blob == HEAD (55a457f8235d) and git diff HEAD is empty`). The first A4 attempt was void, because the worktree had no dist; that run is NOT MEASURED. Ablation M1 (`waitsForUnitCommit(ctx.event)` -> `\"ABLATION-M1\".length > 0`, with build, dist preflight and trap restore, scripted in scratchpad issue-33760/m1.sh): NOT MEASURED. Reason: six lock queue-timeouts (exit 99), with sibling dogfood and final runs holding the lock for 15-40 min each. The last waiter was stopped on the coordinator's stop order before it acquired the lock, so the tree was never mutated (git diff HEAD empty, marker absent). eslint on the 9 changed source files: exit 0. check-nul-bytes: OK.",
      "gates": "Local: check-query-options-erasure-ratchet at the fix: `✓ query-options-erasure ratchet holds ... test surface: 236 site(s) in 47 file(s) — at the ceiling`, exit 0. Exit 0: check:doc-authoring, docs-audit check-affected-docs, check-drift-comment, check-issue-citations (✅ every citation this change adds resolves), check-changeset-no-major (LEVEL AXIS clause-② no, metadata-protocol semantic, objectql minor), check:nul-bytes, check:closed-ceremony-text, check:spec-docblock-symbol-anchors, check:adr-symbol-anchors. check-empty-changeset --base origin/main: exit 1, DELIBERATE CORRECTION by design (33651 note CHANGED). The full dispatch-gates --commands set was not re-run for this round; CI ran it. CI at 7c8f07ee (68 check-runs): 57 success, 10 skipped, 1 failure. The failure is Check Changeset, the route-0 DELIBERATE CORRECTION red (not a required context; it stays red). Success includes Test Core (1/8)..(8/8) and Test Core, Lint · scoped · query-options erasure, Lint · ESLint, Lint · docs & code guards, Lint · repo & tooling gates, Lint · CI, release & engine gates, Lint · PM dispatch-gates, Lint & Repo Gates, TypeScript Type Check, Type Check · workspace/source/consumer/debt, Spec property liveness, Build Core, Dogfood Regression Gate, Flag docs affected by code changes, Test UI, PR-body guards. At 1621f1e9 the Test Core (7/8) red was packages/qa/scenarios test/runner/run-date.test.ts timing out at 5000ms (it ran 6160ms; neighbouring cases took 1.9-4.8s). That is the known flake #34081 (fix PR #34104), not this diff: the test is synchronous in-memory date rebasing with no units or hooks. I did not re-run it, and it is green at 7c8f07ee. At 4c4fc039 the query-options-erasure red was this diff (test surface 236 -> 238) and is fixed in 7c8f07ee.",
      "dogfood_battery": "n/a — no `!` in the PR title and no (narrowing) arm",
      "mcp_calls": "0",
      "api_writes": "4 — POST pulls (pr_create via relay, draft), POST issues/33760/comments x3 (os-dev-report rounds 1, 2 and this one, via post-stamped). git pushes are not REST writes. No PR body PATCH, no label write.",
      "open_questions": [],
      "security_findings": "none",
      "out_of_scope_findings": ["carrier: seat · skills follow-up owed for skills/objectstack-data/references/data-hooks.md (async hooks dropped on rollback; afterFind exception) — the seat files it", "carrier: seat · PR body edits (S2 Skills-docs line, stale head/count, DELIBERATE CORRECTION block, Verification readings for 7c8f07ee) are staged in /mnt/project-files/server-seat-5/area-S3/pr-33760-body.md for the seat to apply"],
      "deviations": "The M1 ablation is NOT MEASURED (lock queue, then stopped on the stop order). Three rounds were pushed rather than one (c122a90f45+4c4fc03985 together, then 7c8f07ee92 for the erasure red). Commit trailers are exactly as the binding order gives them (Co-Authored-By: Claude (noreply address) + Claude-Session), not the harness reminder's model-named line. The harness-written attribution comment on the PR body's first line is left as is, and reported here."
    }
    
    

    Generated by Claude Code

  9. removed
    pm:dispatched
    on Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

domain:serverpriority:p2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions