Skip to content

docs + skills: state the bounds of a hook transaction (nested transaction() refused in the sandbox, unit not ambient, ledger carve-out, PostgreSQL abort) #35324

Description

@objectstack-fleet

repo:objectstack#5 · os-bill · session_01Utp6CbUb7TcZK1XUAddUmQ

Filing gate: ② out-of-scope finding from the contract review of PR #35309 (record 6999973886, out-of-scope note 1 plus nits N2 and N3), named for a card there. ⛔ Not a claim. p3: the failure is loud, so this card is not dispatched alone; it rides a same-file p2 PR.

What happens (read from code by the review, not run)

  • A ctx.api.transaction nested inside another one in the same sandboxed body is refused: packages/runtime sandbox quickjs-runner.ts:806-807 throws nested ctx.api.transaction is not supported. No test pins it, and no doc or skill says it. content/docs/automation/hooks.mdx:373-374 and the new skill row in PR docs(skills): data-hooks api.transaction row says when it joins an outer unit and that it is one datasource; teach hook texts + ctx.text #35309 both say a nested transaction "joins" with no bound, so an author is now more likely to nest.
  • A unit a sandboxed body opened itself is never ambient. The trio does not publish into the store (packages/objectql/src/engine.ts:6681-6693; the one publisher is engine-transactions-section.ts:177), and the write door opens none under a threaded handle (engine-hooks-and-functions.ts:538-539). So a hook's ctx.api.transaction, fired by a write inside an action body's transaction, opens a second driver transaction instead of joining.
  • Not stated anywhere a hook author reads: a lifecycle-classed ledger (audit, telemetry, event) on another datasource is written outside the transaction, not refused (engine-execute-transactions.ts:318, transaction-errors.ts:144-147); on PostgreSQL a failed statement aborts the whole unit even when the body catches the throw (hooks.mdx:347-354); a driver with no transactions degrades silently.

Do

  1. Add a test that pins the nested refusal (quickjs-runner.ts:806-807).
  2. Bound "joins" in hooks.mdx:373-374 and in the hook skill row PR docs(skills): data-hooks api.transaction row says when it joins an outer unit and that it is one datasource; teach hook texts + ctx.text #35309 adds: one level only in one body, and a body's own unit is not joined by writes it triggers.
  3. Name the ledger carve-out, the PostgreSQL abort and the no-transaction degrade beside it.

Land after PR #35309 merges (same skill row).

Activity

  1. added
    pm:queue
    finding
    area:ai
    domain:server
    on Nov 19, 2026
  2. objectstack-fleet commented on Nov 27, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Triage: lands in area:ai · domain:server · Task · p2 · pm:queue · size S; rationale: docs and skills do not state the bounds of a hook transaction: a nested transaction() is refused in the sandbox, the unit is not ambient, the ledger carve-out, and the PostgreSQL abort rule. An agent writing hooks from the skill meets these only as failures. A skill omission is p2 (p3 → p2), even though each failure is loud. Audit restatement, tier 3. Recorded 2026-11-27T19:12Z.

  3. added
    priority:p2
    and removed on Nov 27, 2026
  4. objectstack-fleet commented on Nov 28, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA

    Claim: PM loop round 1 · 2026-11-28T04:25Z
    Picked by card-pick.mjs --order area:ai --seat repo:objectstack#2 at 2026-11-28T04:14Z, rank 10, with #37992 (rank 16) folded in: both rewrite the same before* Transaction cell of skills/objectstack-data/references/data-hooks.md and the matching hooks.mdx text, so two PRs would conflict on one cell. The maintainer in this seat's project, verbatim: 「ai你为什么没认领」, 「并发5」, and the standing 「能合并处理的卡尽量合并处理」.
    Session: session_01L6bhgV6i8jfWwSXjpWJrjA
    Thread session: session_01L6bhgTxpM3qHFCaQuC7eyA
    Account: os-sales
    Branch: claude/project-thread-ohd9ea (from main 0e36120)
    Domain: domain:server, domain:skills
    Seat: repo:objectstack#2
    Area: s2-ai
    Cards: #35324 (lead), #37992 (folded).
    File surface: a test pinning the nested ctx.api.transaction refusal in packages/runtime's sandbox runner; content/docs/automation/hooks.mdx (bound "joins", name the ledger carve-out, the PostgreSQL abort, the no-transaction degrade); skills/objectstack-data/references/data-hooks.md (the same bounds in the api.transaction row, and the MongoDB cell rewritten to the #34563 measurement); skills/objectstack-data/evals/hooks-security-seeds-datasources.json (the case that says "not measured"); one changeset for the test-only package if the gate asks.
    Container & model: S, mode:thread, model: fable — dispatch-gates.mjs --tier: MANDATORY skills/** (clause ①, no one-line exit); the thread session serves opus (the fable name was refused when the thread was opened), so per 定档 「不达档起隔离达档子代理」 every write under skills/** is made by an isolated fable sub-agent the thread starts, its served model read with verify-review-tier.mjs on the agent transcript before push; if fable is not served, the thread stops and reports (等档), never builds at opus. effort: high (reason: the thread session serves effort high)
    Clause-②: no
    Metadata-protocol: none
    Responsibility: an author writing hooks from the docs or the skill learns the bounds of a hook transaction before they meet them as failures.
    Thread-read: 7226303408
    Premise: #35324's lines are from a review read, not run; the thread re-reads each cited line on main (PR #35309 merged 2026-11-19T05:39Z). #37992's measurement is PR #37990's.
    Serial constraints cleared: open PR #36158 edits skills/objectstack-data/SKILL.md and rules/*, not references/data-hooks.md or the eval file; no open PR names hooks.mdx or data-hooks (search 2026-11-28T04:21Z).

    skills/** is Tier H: L2 at the contract-review tier, then the maintainer. The PR says Fixes #35324 and Fixes #37992.

  5. added
    pm:dispatched
    and removed
    pm:queue
    on Nov 28, 2026
  6. objectstack-fleet commented on Nov 28, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA

    Premise corrected · 2026-11-28T04:26Z — the card thread's read on main 0e36120, accepted by the seat. The card's goal is unchanged; two of its items change shape.

    1. Item 1, "no test pins the nested refusal": a test exists (quickjs-runner.test.ts, "rejects a nested transaction"), but it asserts only the throw. The PR strengthens that test (one begin, the outer unit rolled back, no commit). It adds no new file.
    2. Item 2, "a body's own unit is not ambient": this does not hold on main. The trio's handle is published into the transaction store per operation (engine-middleware-and-context.ts, publishTrioHandleFor). The thread measured this on the real engine, real QuickJS and a rollback-honest driver. A hook fired by a write inside a body's transaction joins that unit, with one begin and the same handle, in 8 of 8 combinations. So the docs and the skill teach the join, not a second unit. The PR adds a sandbox-side pin beside the engine-side one (engine-ambient-transaction.test.ts).
    3. The ledger carve-out, the PostgreSQL abort and the no-transaction degrade hold as the card says.

    The skills/objectstack-data/references/data-hooks.md file sits at its token ceiling, so every line added there is paid for by an equal cut.

  7. objectstack-fleet commented on Nov 28, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#2 · os-sales · session_01L6bhgTxpM3qHFCaQuC7eyA
    os-dev-report

    {
      "issue": 35324,
      "status": "done",
      "branch": "claude/project-thread-ohd9ea",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/38155",
      "session": "session_01L6bhgTxpM3qHFCaQuC7eyA",
      "premise_still_valid": true,
      "summary": "Folds #37992. Premise corrected on main 0e361201 (card comment 7234049171): the nested refusal test existed but asserted only the throw, now it pins one begin, the outer rollback, no commit and nothing after the nested call; a body's own trio unit IS joined (publishTrioHandleFor), measured 8/8 and pinned on the hook-body face in transaction-ambient-join.integration.test.ts. hooks.mdx gains a subsection on what ctx.api.transaction joins and where it stops; data-hooks.md and the eval file carry the same bounds and the measured MongoDB/PostgreSQL rule, written by an isolated sub-agent at the contract-review tier (verify-review-tier PASS, 22 turns). data-hooks.md stays at its 10120-token ceiling: +878 bytes paid by 881 bytes of restating comments and labels cut in the same file.",
      "tests": "runtime vitest: transaction-ambient-join.integration.test.ts 8 passed; quickjs-runner.test.ts -t 'nested transaction' 1 passed. Ablation: publishTrioHandleFor short-circuited in the built objectql dist -> both new join cases fail (2 failed, 6 passed); dist restored.",
      "gates": "local subset of dispatch-gates --commands (81 derived), all exit 0: check:doc-anchors, check:doc-authoring, check:skill-links, check:issue-citations, check:nul-bytes, check-skills-token-ratchet, 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, check-affected-docs, check-issue-citations, check:engine-double-contract, check:pm-skill-id-lint, check:skill-compatibility, check:skill-frame-sync; spec check:skill-docs, check:skill-refs. Runtime typecheck and the rest: NOT MEASURED locally (deps built OS_SKIP_DTS=1), CI check-runs pending.",
      "dogfood_battery": "n/a — no `!` in the PR title and no (narrowing) arm",
      "mcp_calls": "4 — issue_read x4 (read only)",
      "api_writes": "1 — fleet-write relay pr_create (POST pulls + POST issues/38155/assignees); plus this report comment",
      "open_questions": [],
      "security_findings": "none",
      "out_of_scope_findings": ["carrier: none · data-hooks.md Plugin Integration code comment names onEnable(), which the kernel contract does not have; noted in the PR acceptance notes, not filed"]
    }
  8. objectstack-fleet commented on Nov 28, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA

    Landed · 2026-11-28T06:05Z

    PR #38155 merged at 2026-11-28T06:04Z on the maintainer's approval, and its Fixes lines close the folded cards #35324 and #37992. What changed:

    • hooks.mdx and the data skill now teach the bounds of a hook transaction: the nested refusal, the one-level join, the default-datasource and ledger carve-outs, the abort of a whole unit on PostgreSQL or a MongoDB replica set, and the silent degrade.
    • The MongoDB cell and its eval case carry review follow-ups of PR #34503 #34563's measurement.
    • The nested-refusal test is strengthened, and two sandbox-side join pins are added.

    pm:dispatched is cleared on each card and pm:awaiting-merge on the PR. Follow-up: #38161 (the onEnable() comment), built with #37642 on PR #38182. Two review nits were accepted as deviations.

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

Metadata

Metadata

Assignees

Labels

area:aidomain:serverfindingpriority:p2

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions