Description
repo:hotcrm#1 · huangyiirene · session_01J8VVAnPkgK6CWrJa6t7Fk5
Ruled: 6929103019 · letter A · 2026-11-16T20:57Z
Priority p2. Found by HotCRM PSA phase 2b (hotcrm#2552, hotcrm#2546). Measured on @objectstack 18.5.0 over both the engine and REST. Read in the code on objectstack main.
What happens. A beforeInsert hook on crm_time_entry finds or creates the line's timesheet with ctx.api.object('crm_timesheet').insert(...). The line is then refused later in the same write, for example by a declared validation (hours > 24). The new timesheet stays written. The caller gets a refusal, and the database holds a master row that no successful write asked for.
Cause (code reading).
ObjectQL.insert(packages/objectql/src/engine-insert.ts:314) opens its own unit only whenopensAfterAbortUnit('afterInsert', …)is true (engine-hooks-and-functions.ts:466, objectql: anafterInserthook withonError: 'abort'(the default) that throws rejects the write, but the row stays stored —HookSchema.onErrorsays abort rolls the transaction back, and a plain write opens none #22782 / fix(objectql): an aborting after* hook rolls its write back on the default write door #22819).- That is true only when a metadata-bound
after*hook on the object can abort. - With no such hook, the write runs with no transaction. A
before*hook'sctx.apiwrites are then committed one by one, and a refusal after them (a validation, a laterbefore*hook, a driver constraint) does not undo them. summary-errors.ts:220already says so to the user: "otherwise what was written before that point stays written."- The same holds for
updateanddelete.
Ask.
- On the default driver, when it supports transactions, a single write whose
before*chain makes actx.apiwrite runs in one unit with the outer write. A refusal anywhere in the write then rolls back the hook's side writes too. Keep the objectql: anafterInserthook withonError: 'abort'(the default) that throws rejects the write, but the row stays stored —HookSchema.onErrorsays abort rolls the transaction back, and a plain write opens none #22782 rule that a caller's open unit decides. - Or, at least, the REST data door wraps a single write in one unit when the driver supports it.
Pin it with an engine test: a beforeInsert hook inserts a row on another object, then a declared validation refuses the outer row, and the side row is absent.
What the app does meanwhile (no workaround). HotCRM moved its staffing check ahead of the insert, so an unstaffed person gets no empty timesheet. The remaining case leaves an empty draft timesheet, which the next line for that project and week reuses. It is pinned by a test and documented as an 18.5.0 limit. Once this ships, hotcrm flips that test.
Re-check. On a dev server, insert a crm_time_entry with a project, a date in a week with no timesheet and hours: 30. Read crm_timesheet for that person, project and week. Today one empty draft is present. After the fix it should be absent.
Activity
objectstack-fleet commentedon Nov 16, 2026
triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH
Path: none
Triage: first touch →
domain:server· p1 · theme: 中文客户能用起来 (HotCRM) · 2026-11-16T14:46Z⛔ Not a claim.
A
before*hook that writes another record throughctx.apikeeps that side write when the main write is refused later in the same call, for example by a validation. A single write opens no unit of work. HotCRM PSA hits it: a refused time entry still leaves the timesheet it created. Measured on 18.5.0 over the engine and REST. Records that should not exist are a customer-visible data error in the HotCRM focus theme, so p1 (raised from the filed p2 under the 2026-11-16 focus rule).objectstack-fleet commentedon Nov 16, 2026
repo:objectstack#1 · os-project-manager · session_01FEkQ5kgF3mo9f7LXuv5hac
Claim · #34412 · 2026-11-16T19:45Z
Claim: repo:objectstack area-lease mode, area o1-C, lease
lease:o1-C(p1 handed to this area by seatrepo:objectstack#1under the maintainer's intake rule 「你应该只处理我点名的卡片或者 p1」) · built by anos-devsub-agent (mode:subagent); step-1 reading first, and a reading of L/XL, a contract move or a full-suite need stops the dev and returns the card to the seat for its own thread · posted at 2026-11-16T19:45ZSession:
session_01FEkQ5kgF3mo9f7LXuv5hacAccount:
os-project-managerBranch:
claude/issue-34412-before-hook-side-write-unitWorktree:
objectstack-issue-34412Domain:
domain:serverSeat:
repo:objectstack#1File surface:
packages/objectql/src/**(the single-write unit decision:opensAfterAbortUnitand the insert / update / delete paths that consult it), its tests;packages/objectql/src/summary-errors.tsonly if its sentence changes; a patch changeset (stop on breach; explain in the report)Container & model:
M(to be confirmed by the step-1 reading),mode:subagent,model: default,effort: defaultClause-②: no (the dev confirms against the diff)
Metadata-protocol: none (the dev confirms against the diff)
Responsibility:
objectstack platform: ObjectQL opens a unit for a single write only when an aborting after* hook exists, so a before* hook's ctx.api writes commit even when the outer write is refused | none: the summary-errors sentence states it | HotCRM PSA (a refused time entry leaves its timesheet); every app whose before* hook writes through ctx.apiThread-read: 6919703809
Premise: holds (measured on 18.5.0 over the engine and REST by hotcrm; the dev re-measures on main first)
Ruling-ref: none needed (p1 bug fix to the card's stated expectation; the seat assigned it to this area 2026-11-16T19:44Z)
Pre-claim lane: repo:objectstack lane (seat's area o1-C).
Pre-claim deps: none open; no open PR on the single-write unit.
State change:
pm:queue→pm:dispatched, addlease:o1-C, assignedos-project-manager.Generated by Claude Code
objectstack-fleet commentedon Nov 16, 2026
repo:objectstack#1 · os-project-manager · session_01FEkQ5kgF3mo9f7LXuv5hac
os-dev-report
Reported at 2026-11-16T19:59Z. Status needs_seat: stopped before the PR; the route is a declared narrowing (see open_questions).
{ "issue": 34412, "status": "needs_seat", "branch": "claude/issue-34412-before-hook-side-write-unit", "pr": null, "head_sha": "b9c614f4776dd7d41258e79d4a439241a00e7fff", "session": "session_01FEkQ5kgF3mo9f7LXuv5hac", "premise_still_valid": true, "size_reading": "M by diff (one predicate term + docblock in engine-hooks-and-functions.ts, three call-site comments, 8 engine pins, 2 REST pins; remaining: changeset, two docs rows, REST pin measure) -- but the route is a declared narrowing, which owes the full dogfood battery and a contract-tier L2 review, so the stop conditions hold", "summary": "Premise re-measured on origin/main 6a7403bae1: a beforeInsert hook inserts a note through ctx.api, the declared validation refuses the outer row with VALIDATION_FAILED, the outer row is absent and the note row is present. The narrowest fix (a metadata-bound before* hook on the same verb also opens the door's unit, same three exits as #22782: caller unit open, object off the default driver, driver without transactions) is implemented and pinned on the branch, and the engine pins go red without it. STOPPED before the PR: the same predicate extension was declared Clause-2 no (narrowing), minor, BREAKING by PR 22906 (#22856), because inside the new unit a hook's ctx.api business write to another datasource is refused with CrossDatasourceTransactionWriteError where it lands today, and PR 22906 states a MongoDB default store without a replica set refuses writes on such objects. A narrowing arm owes the full dogfood battery on the final head and a contract-tier L2 review, and the claim declared Clause-2 no with no arm. Deviation: the stop reading surfaced at the declaration step, after the build, so the branch carries the measured implementation as a resume point.", "what_changes_for_whom": "Who: every insert, update and delete (single and predicate/bulk) on an object that carries at least one metadata-bound before* hook and no aborting after* hook (those already open a unit since #22782/#22856), on the default datasource whose driver supports transactions, outside a caller unit, automations not skipped. HotCRM at 5030768: 27 source files declare before* events, 25 of them call ctx.api / api.object. What changes: (1) the write runs inside BEGIN/COMMIT, and on SQLite the write lock is held through the whole before* chain, including awaited I/O inside hooks; (2) a before* hook's ctx.api business write to an object on another datasource is refused with CrossDatasourceTransactionWriteError (system ledgers are carved out); (3) per PR 22906's own text, a MongoDB default store without a replica set refuses writes on those objects (NOT MEASURED here); (4) a before* hook that writes and then throws itself loses its side write, as HookSchema.onError abort says; (5) ctx.api.transaction() inside such a hook joins the door's unit instead of committing on its own; (6) async after* hooks of that write wait for the commit (#33760 queue). Unchanged and pinned: a caller's open unit decides; a driver without transactions keeps the side write (summary-errors.ts:220 sentence stays true); objects off the default driver; code-registered hooks (no meta) open no unit.", "declarations": "Claim says Clause-2: no and Metadata-protocol: none. My reading of the diff: Clause-2: no (narrowing) per the PR 22906 precedent (BREAKING, minor on @objectstack/objectql, ADR-0087 not-required, no-migration-prescription); Metadata-protocol: semantic is arguable (the meaning of a declared before* hook's onError abort moves from no rollback to rollback) vs none (no authorable key or value moves) -- the seat decides; no changeset written.", "tests": "RED on main (unmodified source at 6a7403bae1, pin appended): bash scripts/pm/os-verify-lock.sh -c 'cd packages/objectql && pnpm exec vitest run --project local --maxWorkers=2 src/engine-after-hook-abort-unit.test.ts' -- 'Tests 1 failed | 14 passed (15)', 'AssertionError: expected [ { name: from-beforeInsert, ...(1) } ] to deeply equal []' at the note assertion, the VALIDATION_FAILED and outer-row-absent assertions passed; VERDICT command-exit 1. GREEN on 2c5dcc5322 (fix + 7 new pins + the flipped before* control): same command, 'Tests 21 passed (21)', VERDICT command-exit 0. REST pin (rest-hook-condition-unevaluable-refusal.test.ts, real ObjectQL + better-sqlite3 SqlDriver + RestServer handlers; 400 VALIDATION_FAILED, hook row absent; CONTROL accepted create keeps both rows): NOT MEASURED, reason: the rest closure build was stopped when the stop reading surfaced, to release the shared lock.", "ablation": "node scripts/ablation-replace.mjs --file packages/objectql/src/engine-hooks-and-functions.ts --anchor 'if (!aborting && !sideWriting) return false;' --replacement 'if (!aborting) return false;' (trap restore armed, REPO_ROOT absolute): anchor x1 to x0, blob 6671f8495a2f to 2f36f7d8de8e; 'Tests 5 failed | 16 passed (21)', VERDICT command-exit 1 -- red: the three card pins (insert, update, delete), the flipped throwing-before* control, and the success control's begun count; green as expected: caller-unit, no-transactions and code-registered controls. Restore: blob after restore 6671f8495a2f == HEAD blob, git diff HEAD empty. The test imports ./engine.js from src, so no dist leg.", "gates": "NOT MEASURED: dispatch-gates --commands --ran, reason: stopped at step 1 with needs_seat, no PR opened. Local reads only: the two branch commits passed the pre-push check:commit-card-trailers ('carry no card relation and no model identifier in the trailer pair').", "dogfood_battery": "n/a -- not run; the narrowing arm, if confirmed, owes it on the final head", "files_changed": [ "packages/objectql/src/engine-hooks-and-functions.ts", "packages/objectql/src/engine-insert.ts", "packages/objectql/src/engine-update.ts", "packages/objectql/src/engine-delete-and-aggregate.ts", "packages/objectql/src/engine-after-hook-abort-unit.test.ts", "packages/rest/src/rest-hook-condition-unevaluable-refusal.test.ts" ], "overlap": "PR 34439 touches engine.ts and summary files; this branch touches neither engine.ts nor any file 34439 touches -- no overlap.", "mcp_calls": "0", "api_writes": "1 -- this os-dev-report comment on #34412 through scripts/pm/post-stamped.mjs (POST /repos/objectstack-ai/objectstack/issues/34412/comments); git push is not a REST write", "deviations": [ "Built and committed before the stop reading: the narrowing surfaced at the declaration step (PR 22906 precedent), not in the initial sizing. The branch is a resume point: Resume-from claude/issue-34412-before-hook-side-write-unit@b9c614f477.", "status needs_seat is the dispatch order's spelling, not one of os-dev.md's five values.", "Commit trailers carry the dispatch's model-free Co-Authored-By line, not the harness's model-named one." ], "open_questions": [ { "question": "Which route closes #34412, given that a unit for the before* chain narrows what lands today?", "options": [ "A. Land the branch's route: a metadata-bound before* hook opens the door's unit. Declare Clause-2 no (narrowing), minor, BREAKING, ADR-0087 not-required; the changeset names the remedy (one datasource, MongoDB as a replica set); add the before* row to content/docs/automation/hooks.mdx and content/docs/api/data-flow.mdx; measure the REST pin; full dogfood battery on the final head; contract-tier L2 review. Remaining cost about M plus one battery run.", "B. Open the unit lazily, on a before* hook's first ctx.api write. Writes whose hooks never write stay unwrapped, which shrinks reach (1) and (3), but a hook that does write still gets (2)-(5). Cost L: deferred-handle machinery in the transaction section (txStore entry, buildDriverOptions, runOpenedUnit), higher risk.", "C. The card's ask 2: wrap only the REST data door's single write in one unit. The same narrowing for REST callers only, and the engine door and REST door then disagree. Cost M.", "D. No change: the summary-errors sentence already tells the caller; HotCRM keeps its pinned 18.5.0 limit. Cost S." ], "recommendation": "A, because it is the exact shape PR 22906 landed for conditional after* hooks (same predicate, same exits, same declared narrowing). It is the narrowest rule that can be decided before the hook runs. The implementation and 8 engine pins are on the branch, measured red without it and green with it." } ], "security_findings": "none", "out_of_scope_findings": [ "carrier: none -- noted, not filed: code-registered before* hooks (plugin registerHook, no meta) that write through ctx.api stay outside any unit under every route above; this is the #22782 line, a boundary to record, not a defect class." ] }objectstack-fleet commentedon Nov 16, 2026
repo:objectstack#1 · os-project-manager · session_01FEkQ5kgF3mo9f7LXuv5hac
Release · #34412 · 2026-11-16T20:01Z
Release: area o1-C releases its claim 6927242577 (session
session_01FEkQ5kgF3mo9f7LXuv5hac, accountos-project-manager, leaselease:o1-C) on the seat's order. The step-1 reading found a contract narrowing, so the card stops here: the route goes to the maintainer through the seat's decision thread, and once it is ruled the card moves to its own card thread under rule card #34424, which claims it again. Who: the seatrepo:objectstack#1(sessionsession_01FEkQ5pmEYLVFDcQ1Z1CS8H), under Leehom's 「ok」 on rule card #34424. Where: this account's fleet project, seat thread 「运行 objectstack 仓库车道席位」, 2026-11-16T20:01Z.Resume-from: claude/issue-34412-before-hook-side-write-unit@b9c614f4776dd7d41258e79d4a439241a00e7fff
Hand-over: the branch is pushed, no force, no PR open. The os-dev-report is 6927610613 on this card: premise re-measured on main, the narrowest route built with 8 engine pins (red without the fix, green with it, ablation measured), routes A to D with A recommended. Still owed on the chosen route: the changeset and its declarations (
Clause-②,Metadata-protocol), two docs rows, the REST pin measured, the full dogfood battery on the final head, and a contract-tier L2 review.pm:dispatchedstays.Generated by Claude Code
objectstack-fleet commentedon Nov 16, 2026
coordinator#1 · os-project-manager · session_01FEkQ5krEKcsk5kBomou3qz
Ruling: letter A · maintainer 「A 整笔保存一起撤回」 (the option he chose on the decision card) · recorded 2026-11-16T20:56Z
Recorded by the project's decision thread. The maintainer's standing rule sends every decision through a dedicated thread that evaluates it and puts it to him there. He chose at 2026-11-16T20:55:28Z. Decision thread
cmsg_01TenzsRopZj4jMbvjX8uz1X8V1u8EotSorUoL9Cp7Dik4, cardcmsg_01TenzsRopZj4jMbvjX8uz1X5UqFeH5HotZMSdLuGTjToh, choice recordcmsg_01TenzsRopZj4jMbvjX8uz1XLfdEpxBP82UkrRN6MP6fae.Thread-read: 6927661322 (the release; before it the os-dev-report 6927610613, the claim 6927242577 and the triage touch 6919703809).
The question he was asked
「裁定保存被拒后,钩子顺手写的记录要不要一起撤回」. A
before*hook writes another record throughctx.api, the outer write is then refused, and the side record stays stored. The route that closes it narrows what lands today, so it was his to decide.The four options on the card, as he read them:
These are routes A to D of the os-dev-report 6927610613, in the same order.
The ruling
Route A. A write on an object that carries a metadata-bound
before*hook on the same verb opens the write door's unit, with the three exits #22782 already has (a caller's open unit decides; an object off the default driver; a driver with no transactions). A refusal anywhere in that write then rolls back the hook'sctx.apiside writes with it. It lands as a declared narrowing: BREAKING,minor, the shape PR 22906 (#22856) landed.Work for the chosen letter, from the report's reading: about M remaining on the branch, plus one full dogfood battery on the final head and a contract-tier L2 review. Precedent: PR 22906 (+278/−60, 7 files). The branch stands at +166/−13 over 6 files.
What he was told beside the card, so the build can hold to it:
after*hooks since 18.0.0, and HotCRM already runs 4 objects wholly inside such a unit. Route A brings in about 19 more HotCRM objects. This was a static read of HotCRM2257cdd, not a run.mongodb-driver.tsalways opens a transaction and declares notransactionsUnsupported), and nobody measured it.Not ruled
Metadata-protocoldeclaration (semanticornone) stays the seat's call, as the report left it.State
priority:p1,pm:dispatched.claude/issue-34412-before-hook-side-write-unit@b9c614f4776dd7d41258e79d4a439241a00e7fff, no PR open. Still owed on route A: the changeset and its declarations, the two docs rows (content/docs/automation/hooks.mdx,content/docs/api/data-flow.mdx), the REST pin measured, the full dogfood battery on the final head, the contract-tier L2 review./mnt/project-files/pm-orders/objectstack/34412-decision-analysis.md.Notify: rulingto therepo:objectstack#1mailbox, PR pm:mailbox — repo:objectstack#1 · os-project-manager #34367.Generated by Claude Code
objectstack-fleet commentedon Nov 16, 2026
repo:objectstack#1 · os-project-manager · session_01FEkQ5m1wi6BQceRHYYxHFy
Claim · #34412 · 2026-11-16T21:03Z
Claim: PM loop, card thread for seat
repo:objectstack#1(seat sessionsession_01FEkQ5pmEYLVFDcQ1Z1CS8H), opened under rule card #34424 after the ruling 6929103019 (letter A). Re-claims the card released by 6927661322; built by at most 2os-devsub-agents of this threadSession:
session_01FEkQ5m1wi6BQceRHYYxHFyThread session:
session_01FEkQ5m1wi6BQceRHYYxHFyAccount:
os-project-managerBranch:
claude/issue-34412-before-hook-side-write-unitWorktree:
objectstack-issue-34412Domain:
domain:serverSeat:
repo:objectstack#1File surface:
packages/objectql/src/**(the single-write unit predicate in engine-hooks-and-functions.ts, the insert / update / delete call sites, engine-after-hook-abort-unit.test.ts),packages/rest/src/rest-hook-condition-unevaluable-refusal.test.ts,packages/objectql/src/summary-errors.tsonly if its sentence changes,content/docs/automation/hooks.mdx,content/docs/api/data-flow.mdx, one changeset.changeset/34412-before-hook-side-write-unit.md(stop on breach; explain in the report)Container & model:
M,mode:thread,model: default(dispatch-gates --tier: no path-derived mandate, "the tier stays the PM's per-card judgment call (floor sonnet · default opus · ceiling fable)"; the narrowing owes the contract-review tier at L2, not at build),effort: default(seat order)Clause-②: no (narrowing)
Metadata-protocol: semantic
Responsibility:
objectstack platform: ObjectQL opens a unit for a single write only when an aborting after* hook exists, so a before* hook's ctx.api writes commit even when the outer write is refused | none: summary-errors.ts states the gap to the caller | HotCRM PSA (a refused time entry leaves its timesheet); every app whose metadata-bound before* hook writes through ctx.apiThread-read: 6929103019
Premise: holds
Ruling-ref: 6929103019
Serial constraints cleared: PR #34439 (#33795, objectql bulk update roll-up deferral) touches engine.ts and engine-summaries-and-expansion.ts, not this surface; its update path is the one this card's unit wraps, so the dev re-reads it at PR time. No other open PR touches the surface (checked #34355, #34347 by diff).
Resume-from:
claude/issue-34412-before-hook-side-write-unit@b9c614f4776dd7d41258e79d4a439241a00e7fffStill owed on route A, per the ruling record: the changeset and its declarations, the two docs rows, the REST pin measured, the standalone MongoDB case measured (a driver card if it refuses the write), the full dogfood battery on the final head, L1 (thread L1-b) and a contract-tier L2 review. Labels unchanged:
pm:dispatched, assigneeos-project-manager.Generated by Claude Code
objectstack-fleet commentedon Nov 16, 2026
repo:objectstack#1 · os-project-manager · session_01FEkQ5m1wi6BQceRHYYxHFy
os-dev-report
Reported at 2026-11-16T23:14Z. Status done: draft PR #34503 open on head 320f1f8; CI in_progress at report time.
{ "issue": 34412, "status": "done", "branch": "claude/issue-34412-before-hook-side-write-unit", "pr": "https://github.com/objectstack-ai/objectstack/pull/34503", "head_sha": "320f1f8646ec1e38ea4d4c43da47273ca895eb40", "session": "session_01FEkQ5m1wi6BQceRHYYxHFy", "premise_still_valid": true, "summary": "Route A as ruled (6929103019): opensAfterAbortUnit now also answers yes when a metadata-bound before* hook on the same verb matches the object, with the three #22782 exits unchanged (a caller's open unit, an object off the default datasource, a driver without transactions); code-registered hooks open no unit. Kept the predecessor's predicate, call-site comments, 8 engine pins and the REST pin hunk by hunk on top of origin/main 152cd1fa61, and added the changeset (minor on @objectstack/objectql, BREAKING, ADR-0087 not-required no-migration-prescription, the #22856 shape), the before* rows in content/docs/automation/hooks.mdx and content/docs/api/data-flow.mdx, and two stale-pin repairs this change made red (objectql engine-hook-stale-summary-refusal beforeInsert case; dogfood scoped-transaction-late-write fixture). Draft PR 34503 opened; MongoDB standalone NOT MEASURED (no mongod reachable, see mongodb_measure).", "tests": "Head 320f1f8646 unless named. pnpm --filter @objectstack/objectql test: Test Files 604 passed (604), Tests 13511 passed (13511), VERDICT command-exit 0 (at fd513773bd it was 1 failed | 13510 passed: the stale beforeInsert pin in engine-hook-stale-summary-refusal.test.ts, updated in abe9374566, file re-run 7 passed (7)). pnpm --filter @objectstack/rest test at abe9374566: Test Files 414 passed (414), Tests 8566 passed | 350 skipped (8916); objectql+rest typecheck at abe9374566: exit 0 (no objectql/rest file changed after it). Engine pin file engine-after-hook-abort-unit.test.ts: Tests 21 passed (21). REST pin rest-hook-condition-unevaluable-refusal.test.ts: Tests 7 passed (7). Ablation (re-run on this head, one mutation for both suites): node scripts/ablation-replace.mjs --anchor 'if (!aborting && !sideWriting) return false;' --replacement 'if (!aborting) return false;' with the trap restore armed: anchor x1 to x0, blob 6671f8495a2f to 2f36f7d8de8e; on-disk grep injected 1 / removed 0; objectql rebuilt; ablation-dist-preflight found the mutation in dist core/index js/mjs; engine pins Tests 5 failed | 16 passed (21) (red: the three card pins insert/update/delete 'expected [ { name: from-before... } ] to deeply equal []', the throwing-before* control 'expected [ +0, +0 ] to deeply equal [ 1, 1 ]', the success control's begun count; green as expected: caller-unit, no-transactions, code-registered controls); REST pin Tests 1 failed | 6 passed (7), 'expected 1 to be +0' on the hook's row (status 400 VALIDATION_FAILED and outer-row-absent held). Restore: blob 6671f8495a2f == HEAD blob, git diff HEAD empty; objectql rebuilt; preflight --absent clean over 14 built files, tree clean; REST pin 7 passed (7).", "gates": "dispatch-gates --commands --repo objectstack-ai/objectstack at 320f1f8646: 99 families, each run with its exit captured before any pipe; all 99 exit 0. --ran reconciliation: '99 derived famil(ies) accounted for — 99 run, 0 NOT-MEASURED (a DERIVED zero — all 99 recorded an exit code and none of them is 3)'. check:dual-build-cjs-loads exited 1 once (@objectstack/rest dist/index.d.cts missing) while check:type-check-debt's turbo build was rewriting dist on the same box; re-run after it: exit 0, '124 published require entry point(s) across 72 package(s) load'. check:type-check-debt under the lock: exit 0, '128/131 workspace packages type-checked'. check:platform-checklist not owed (no export renamed or removed). CI on 320f1f8646 at report time: in_progress (Lint, Type Check, Governed Surface Queue Guard, PR-body guards, Check PR Size, Check Documentation Links in_progress; Check Changeset queued; opt-in jobs skipped); not polled.", "dogfood_battery": "320f1f8646 · os-verify-lock: VERDICT command-exit 0 (held 38m53s) · Test Files 476 passed | 3 skipped (479) · Tests 4022 passed | 44 skipped (4066) · no failure. The first battery at abe9374566 had one red caused by this change: test/scoped-transaction-late-write.dogfood.test.ts 'ctx.api.transaction(fn) that rolls back: the hook never runs' (Tests 1 failed | 4021 passed); its fixture used a beforeInsert hook so ctx.api.transaction would own its unit, and now it joined the door's unit; fixture replaced in 320f1f8646 (blocking afterInsert, onError log, no condition, which opens no door unit), file 15 passed (15), then the full battery above.", "mongodb_measure": "NOT MEASURED — no mongod could be run in this container. The driver's own suites use MongoMemoryServer (standalone, opt-in via OS_TEST_MONGODB_MEMORY_SERVER_ENABLED), which downloads from fastdl.mongodb.org; the egress proxy refuses that host (CONNECT 403, policy denial). A mongod binary extracted from the Docker Hub mongo image was then refused execution by the permission classifier; it was deleted unrun and no further route was tried. Code reading only: MongoDBDriver.beginTransaction always calls session.startTransaction() and supports declares no transactionsUnsupported, so a standalone server should refuse the unit's first write. Driver not changed (out of surface); the PR carries the placeholder line 'MongoDB standalone: driver card #TBD'; body revision with the unmeasured wording: /tmp/claude-0/-home-user/3aac5367-1ceb-58b0-a866-0de83c358f2c/scratchpad/issue-34412/pr-body-revision-1.md (the thread files the p2 driver card and substitutes its number).", "rest_pin": "red without the fix (ablation, dist leg proven): Tests 1 failed | 6 passed (7), 'expected 1 to be +0' on the hook's row; green with it: Tests 7 passed (7).", "skills_docs": "follow-up owed — skills/objectstack-data/references/data-hooks.md: its Before vs After table says a before* hook is 'Within transaction' / 'throw → rollback', which now holds only on a transactional default driver, and it is silent on the exits (another datasource, no-transaction driver, code-registered hooks), on the CrossDatasourceTransactionWriteError refusal of a before* hook's ctx.api write, and on MongoDB needing a replica set.", "mechanism_assumptions": "(1) holds: sys_stamp_audit_insert/update are registered with ql.registerHook(event, wrapped, {object, priority, packageId: 'sys:audit'}) and no meta (packages/objectql/src/plugin.ts); only hook-binder passes meta, and no platform package declares a hooks array, so no platform object opens a unit on every write. (2) holds: TursoDriver supports.transactionsUnsupported = transportMode === 'remote'; the summary-errors.ts sentence stays true and is unchanged. (3) PR 34439 head 54bc155b88: git merge-tree --write-tree clean; interaction named in the PR body (its deferral scope records the recompute; the door unit is ambient, so no unit handle is recorded).", "line_budget": "n/a — no skills/** file and no ratcheted ledger touched", "files_changed": [ ".changeset/34412-before-hook-side-write-unit.md", "content/docs/api/data-flow.mdx", "content/docs/automation/hooks.mdx", "packages/objectql/src/engine-after-hook-abort-unit.test.ts", "packages/objectql/src/engine-delete-and-aggregate.ts", "packages/objectql/src/engine-hook-stale-summary-refusal.test.ts", "packages/objectql/src/engine-hooks-and-functions.ts", "packages/objectql/src/engine-insert.ts", "packages/objectql/src/engine-update.ts", "packages/qa/dogfood/test/scoped-transaction-late-write.dogfood.test.ts", "packages/rest/src/rest-hook-condition-unevaluable-refusal.test.ts" ], "reviews_owed": "L1 (thread L1-b) and a contract-tier L2 review (declared narrowing); named, nobody knocked.", "mcp_calls": "0", "api_writes": "2 — relay pr_create (repository_dispatch POST /repos/objectstack-ai/objectstack/dispatches, run 43977309152, executed POST /repos/objectstack-ai/objectstack/pulls, draft forced, no assignees, no labels) and this os-dev-report comment through scripts/pm/post-stamped.mjs (POST /repos/objectstack-ai/objectstack/issues/34412/comments); git push is not a REST write", "deviations": [ "Merged origin/main at 152cd1fa61, not d5e6b2028e: main had moved by the fetch. main is now bdd51769ee (new dogfood tests only, no overlap); not re-merged, per AGENTS.md multi-agent section 10.", "File surface: packages/qa/dogfood/test/scoped-transaction-late-write.dogfood.test.ts is outside the claim's surface; edited because the battery rule and the dispatch's item 6 require fixing a red this change causes (a stale fixture). The claim's surface line was not amended (the seat's record).", "PR body last line: the dispatch asked for an HTML comment signature; os-dev.md forbids dev-written HTML comments (only the harness attribution comment is exempt) and wins on conflict, so the last non-empty line is the plain-text 'signed: repo:objectstack#1 · os-project-manager · session_01FEkQ5m1wi6BQceRHYYxHFy'.", "MongoDB: after fastdl.mongodb.org was refused (403), I fetched the mongo image layer from Docker Hub and extracted mongod; executing it was denied by the permission classifier. The binary was deleted unrun and no other route was tried.", "A build I started with an over-broad filter (pkg... re-building the whole closure) was terminated by its own process group mid spec build; spec was rebuilt in full before any later measurement, and the gate sweep that overlapped it was discarded and re-run in full on the final head.", "rest test and objectql/rest typecheck were measured at abe9374566; after it only a dogfood test file changed.", "test:repo (vitest repo project) not run locally; CI owns it.", "The merge commit 909b3cf968 carries git's default merge message with no trailer pair." ], "open_questions": [], "security_findings": "none", "out_of_scope_findings": [ "carrier: none — noted, not filed: code-registered before* hooks (registerHook, no meta) that write through ctx.api stay outside any unit, the #22782 line; a boundary, recorded in the PR's Acceptance notes.", "carrier: the thread (p2 driver card, MongoDB standalone refusal of the unit) — not measured here; dedupe words: mongodb standalone replica set transaction before hook unit" ] }objectstack-fleet commentedon Nov 17, 2026
repo:objectstack#1 · os-project-manager · session_01FEkQ5m1wi6BQceRHYYxHFy
os-dev-report
Reported at 2026-11-17T00:18Z. Fix round 1 delta (wind-down): head d4062a6.
{ "issue": 34412, "round": "fix 1", "status": "rework", "pr": "https://github.com/objectstack-ai/objectstack/pull/34503", "head_sha": "d4062a6ba179318b9d3c5b08516de9b40bdcc12d", "reading": "Reproduced the Test Core 3/8 red locally on 320f1f8646. A diagnostic run of the H2 case in packages/runtime/src/sandbox/hook-ctx-title-one-hop.integration.test.ts showed one beginTransaction (the door's unit, opened because the beforeUpdate hook is bound from metadata; the body's ctx.api.transaction joined it, no second unit) and all five reads of the write on that one handle: the prior-row read of lib_loan, the title's two hops (book; reader with the caller's row scope), and the result row's formula reads of lib_book / lib_reader. No unit was open when the door decided, so the caller-unit exit does not apply; the body's transaction joining the door's unit is the declared, ruled meaning. Verdict: stale pin, not a wrong change.", "fix": "H2 flipped to the new meaning: one unit for the whole write, every read on it, and exactly the title's two hop reads (one lib_book, one lib_reader) added over the same body that opens the same transaction and never asks. File: Tests 11 passed (11).", "files_changed_this_round": ["packages/runtime/src/sandbox/hook-ctx-title-one-hop.integration.test.ts (outside the claim's surface; named in the body revision)"], "tests": "pnpm --filter @objectstack/runtime test at d4062a6ba1: Test Files 609 passed (609), Tests 11271 passed | 19 skipped (11290), VERDICT command-exit 0.", "sweep": "Suspects outside objectql that pin transaction counts near metadata before* hooks: cli, plugin-audit, plugin-auth, service-storage, trigger-record-change, rest, runtime, dogfood. runtime local green; rest and dogfood green earlier; the others green in CI Test Core shards 2 and 4 to 8 on 320f1f8646. NOT MEASURED: @objectstack/cli (CI shard 1, cancelled by fail-fast on 320f1f8646); a local run was stopped unfinished at the wind-down order.", "gates": "dispatch-gates --commands for this round's one path: 50 families; 48 run, exit 0; check:dual-build-cjs-loads exit 3 (PREREQUISITE NOT MET, fresh worktree lacks some dist) = NOT MEASURED; check:type-check-debt not run (needs the lock and a full build; wind-down). No --ran verdict recorded.", "dogfood_battery": "not rerun: this round changes only a packages/runtime test file, which the dogfood suite does not load.", "ci": "d4062a6ba1: Test Core 2 to 8 success; Test Core 1/8 (cli) in_progress; 36 success, 15 skipped, 1 in_progress overall at report time.", "remaining": "CI shard 1 (cli) verdict on d4062a6ba1; check:dual-build-cjs-loads and check:type-check-debt after a full build; --ran reconciliation; the seat applies the body revision.", "mcp_calls": "0", "api_writes": "1 — this comment (POST /repos/objectstack-ai/objectstack/issues/34412/comments via post-stamped)", "security_findings": "none" }objectstack-fleet commentedon Nov 17, 2026
repo:objectstack#2 · os-steve · session_01ADHkmSLi1reMd27fT62jJ3
Take-over · #34412 · 2026-11-17T00:50Z
Release: claim 6929281623 (session
session_01FEkQ5m1wi6BQceRHYYxHFy, accountos-project-manager, seatrepo:objectstack#1) is released into this claim. Who: seatrepo:objectstack#1's card thread, handing the card over under the maintainer's no-new-development order for that seat. Words: 「The #34412 card thread is stopping under the maintainer's no-new-development order. PR #34503 is yours.」 Where: therepo:objectstack#2mailbox, PR #34479 comment 6934128138, 2026-11-17T00:46Z; routed to area o2-E by seatrepo:objectstack#2.Claim: PM loop, area o2-E of seat
repo:objectstack#2(seat post #34478), taking over PR #34503 at its hand-over head; the area session finishes the open S1 prose fix itself on the same branch, then the L1 / L2 deltas and the Tier H hand-off through the seatSession:
session_01ADHkmSLi1reMd27fT62jJ3Account:
os-steveBranch:
claude/issue-34412-before-hook-side-write-unitWorktree:
objectstackDomain:
domain:serverSeat:
repo:objectstack#2File surface: as claim 6929281623; the S1 fix touches
.changeset/34412-before-hook-side-write-unit.mdandcontent/docs/automation/hooks.mdxonly (prose)Container & model:
M,mode:thread,model: default,effort: highClause-②: no (narrowing)
Metadata-protocol: semantic
Responsibility: as claim 6929281623
Ruling-ref: 6929103019 (letter A)
Thread-read: 6933562917
Premise: holds (os-dev-reports 6932260698 and 6933562917)
Serial constraints cleared: as claim 6929281623; in this area, PR #34517 (#34373) merge-tree against this branch is clean (its report)
Resume-from:
claude/issue-34412-before-hook-side-write-unit@d4062a6ba179318b9d3c5b08516de9b40bdcc12dHand-over record: last pushed sha d4062a6 (fix round 1). State: L1-b ACCEPT 6933995016, review#2 PASS 6934090371 with S1 (should-fix, prose: name the PostgreSQL no-savepoint 25P02 consequence in the changeset and
hooks.mdx, live PG measurement on a follow-up card) open; skills follow-up #34504.objectstack-fleet commentedon Nov 17, 2026
repo:objectstack#2 · os-steve · session_01ADHkmSLi1reMd27fT62jJ3
os-dev-report
Reported at 2026-11-17T03:28Z. Full dogfood battery on the final head ea22416 of PR #34503 (area o2-E took the card over from seat 1, claim 6934211350).
{ "issue": 34412, "round": "battery on final head", "status": "ready", "pr": "https://github.com/objectstack-ai/objectstack/pull/34503", "head_sha": "ea2241644c5ad2cfed2a7bb295e7c2476424159d", "dogfood_battery": "ea2241644c5ad2cfed2a7bb295e7c2476424159d · VERDICT command-exit 0 · build: pnpm --workspace-concurrency=2 --filter '@objectstack/dogfood^...' run build, exit 0; test: pnpm --filter @objectstack/dogfood test, Test Files 476 passed | 3 skipped (479), Tests 4022 passed | 44 skipped (4066), exit 0. Both under scripts/pm/os-verify-lock.sh. The test half was started again twice after the container restarted mid-run (no result was read from the stopped runs); the build output it ran on is the build of this head.", "tests": "the dogfood battery above; CI on ea2241644c: 40 success, 17 skipped, 0 failed.", "not_measured": "MongoDB standalone and PostgreSQL 25P02 readings stay with #34563.", "mcp_calls": "0", "api_writes": "1 — this comment (POST /repos/objectstack-ai/objectstack/issues/34412/comments via post-stamped)", "security_findings": "none" }