Repository navigation
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
Conversation
…ter unit and that it is one datasource; teach hook texts + ctx.text The api.transaction capability row now states one transaction on one datasource (a write to another datasource is refused with 400 ERR_CROSS_DATASOURCE_TRANSACTION_WRITE) and that inside an open unit it joins that unit: its return is no commit, its throw no rollback. A Declared texts block beside Declared refusals teaches a hook's texts and ctx.text. Paid by seven same-file restatement cuts; the remainder raises the data-hooks.md ratchet row by measurement (10011 -> 10123). Two eval cases added. Claude-Session: https://claude.ai/code/session_01Utp6CazXu8zyYD5PC6J2u7 Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#5 · os-bill · session_01Utp6CbUb7TcZK1XUAddUmQ Contract reviewServed-tier: PR #35309 (draft, author Why ① Derived judgmentsNo accept-set or published-surface change: served skill text, two eval cases, one ratchet row. Each claim the diff makes, judged:
② Semver levelRight. ③ Boundary flags
④ Design judgment
M1 (must-fix) — the "Declared texts" example writes
S1 (should-fix) — "one transaction on one datasource" does not say which. It is the default datasource (① item 2). A callback whose writes are ALL on one non-default datasource is refused too, and a reader of the row, and of eval 28's "keep the objects one transaction writes on one datasource", concludes the opposite. S2 (should-fix) — the translation key is nowhere in the skills on this head. N1 (nit) — eval 28's N2 (nit) — two bounds on "joins" that neither the row nor N3 (nit) — not stated by the row, each for the follow-up card: the ledger carve-out (a lifecycle-classed ledger on another datasource is written outside the transaction, not refused); on PostgreSQL a throw that is a failed statement aborts the whole unit even when the body catches it (
Cases 28 and 29 test what the text teaches (① item 9). Case 29 exercises the M1 line without asserting on it; when M1 is fixed, a
Agrees with the contract it enforces (① item 10): the ceiling equals the measured count, the comment's arithmetic matches the diff, and the raise path is the one the header recognises. It must move again with the M1, S1 and S2 fixes, by measurement. Implemented-by: VERDICT: FAIL |
…ransaction is on the default datasource; texts block names its key Review fix round. The Declared texts example is an afterInsert body, so it links the task by ctx.result.id (ctx.input.id is undefined on insert). The api.transaction row says the transaction is on the default datasource and a write to any other is refused. The texts block names its translation key inline and keeps the objectstack-i18n pointer. The "Why so few?" per-row sentence is restored, since another open PR cites it as a home. Paid by four more same-file restatement cuts; the ratchet row re-pinned at the measurement (10122). Eval 28 says default datasource and uses a neutral object name; eval 29 pins the link. Claude-Session: https://claude.ai/code/session_01Utp6CazXu8zyYD5PC6J2u7 Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#5 · os-bill · session_01Utp6CbUb7TcZK1XUAddUmQ Contract reviewServed-tier: Delta review of PR #35309. Round 1 is record 6999973886 on head
① Derived judgmentsEach claim of the fix round, judged against the tree:
② Semver levelUnchanged and right: ③ Boundary flags
④ Design judgmentNo must-fix, no should-fix.
N4 (nit) — two of the new cuts leave a rule stated less directly, and both are accepted as they stand. The
Implemented-by: VERDICT: PASS |
|
repo:objectstack#5 · os-bill · session_01Utp6CbUb7TcZK1XUAddUmQ 维护者速读
席位核对 — ACCEPT · repo:objectstack#5 · head
|
Requested by Bill · project thread
Fixes #34967
Fixes #35117
Part of #34546
Clause-②: no
Metadata-protocol: none
The declaration half of #34546 only: hook
texts+ctx.texttaught once in objectstack-data. The translation-bundle half is in PR #35302, which owns the bundle shape; #34546 stays open until both PRs merge, and the area then closes that card by hand.维护者速读
data-hooks.md的api.transaction一行写明:回调是一个数据源上的一个事务,写到其他数据源的对象会在执行前被拒(400 ERR_CROSS_DATASOURCE_TRANSACTION_WRITE);在已打开的单元里(钩子所在写入的单元,或调用方的)它并入该单元,返回不提交、抛错不回滚。另在refusals旁新增texts+ctx.text的教学块,附两条 eval。skills/objectstack-data/references/data-hooks.md的api.transaction行与新的Declared texts块;scripts/check-skills-token-ratchet.mjs的 data-hooks 行注。node scripts/check-skills-token-ratchet.mjs | grep data-hooks,预期见10122 tokens (ceiling 10122; headroom 0)。skills/**)。What changes
skills/objectstack-data/references/data-hooks.md:api.transactionrow (Capabilities table). Was: "runs the callback'sctx.apiops in one driver transaction (commit on return, rollback on throw)", with no condition. Now: one transaction on the default datasource, commit on return, rollback on throw; a write in it to an object on any other datasource is refused before it runs (400 ERR_CROSS_DATASOURCE_TRANSACTION_WRITE); inside a unit already open (the one the hook's write runs in, or a caller's) it joins that unit: its return is no commit and its throw no rollback, the outer unit commits or rolls back all of it, so a throw the body catches keeps the callback's writes. Worded fromcontent/docs/automation/hooks.mdx("A nestedtransaction()joins the outer unit, so its return is no commit") and from PR fix(objectql)!: an action body's write inside ctx.api.transaction keeps its audit rows beside a telemetry datasource #35102'sCrossDatasourceTransactionWriteErrorand its ADR-0119 note (2026-11-18), which says the trio the sandbox uses gets the same refusal astransaction(cb). Runtime read:packages/runtime/src/sandbox/quickjs-runner.ts__txCommit/__txRollbackabstain on a joined handle and the rollback leaf re-throws;ScopedContext.beginTransactionjoins the ambient transaction (owned: false).texts)" block right after "Declared refusals", in its compact form: declare on the hook, ask withctx.text(key, params?)(no capability; ajsbody or ahandler, never anexpressionbody); the organization's language (Setup → Localization, elsei18n.defaultLocale), never the saver's; translated first, then filled fromparams; a missing translation never fails the hook; an unreadable Localization setting rejects; only declared keys. Worded fromhooks.mdx§ "Writing a sentence people read —texts" and thetextsTSDoc inpackages/spec/src/data/hook.zod.ts. The block names the translation key inline,hooks.HOOK.texts.KEY.message, and points to objectstack-i18n for the bundle; the bundle shape is not restated (PR docs(skills): teach the mappings group, action and hook texts, and drop the stale label-serving caveat #35302 owns it).ctx.textrow in the sandboxctxtable: one cell, a pointer to the block.skills/objectstack-data/evals/hooks-security-seeds-datasources.json: two cases, ids 28 and 29 (25 and 26 are taken by open draft PR #34964), inserted after id 17 so they do not touch that PR's hunk at the end of the array:afterUpdatebody whosectx.api.transactionthrows after an insert and catches it, plus an insert to a business object on a non-default datasource (join,ERR_CROSS_DATASOURCE_TRANSACTION_WRITE).afterInserthook writing a task subject in the organization's language (texts,ctx.text,params); it links the task byctx.result.idand pinsrelated_to_lead: ctx.input.idas must_not_contain.scripts/check-skills-token-ratchet.mjs: the data-hooks row 10011 → 10122 with its note..changeset/34967-data-hooks-transaction-texts.md:@objectstack/skillspatch.Paid down first, remainder by measurement
Raise path: the standing ruling 「A:先削重复,余额按实测提高」 (ruling record 6513306068, letter B). Ten restatements cut in the same file, each keeping its other home:
bodyvshandlertable under Sandboxed Hook Bodies.HookContextlisting comment onorganizationIdand the code line's own comment.body— Implementation: the example block. Other home: "Thebodyshape" block and thebefore*bullet under it (ctx.input.x = …).session.rolescomment (now one line). Other home: thectx.sessionrow ("session.roleswas retired in 17.0.0") and the field-level callout above the pattern.ctx.resultis the PARTIAL patch" comment. Other home: Gotcha 1 right above it, and the example's intro sentence.// the FUNCTION BODY only — not a modulecomment. Other home: the bullet under the block (sourceis the function body the runtime wraps) and Sandbox restrictions (import/require rejected).ctxtable,ctx.emailrow: "; not in a hook body". Other home: theemail.sendcapability row ("Not in a hook body (refused at parse and at bind)").api.readcapability row: thectx.titleclauses. Other home: thectx.titlerow.notice?comment. Other home: thectx.noticerow, which links rules/lifecycle.md § Save Notice.Restored in the fix round (review 6999973886): the "Why so few?" per-row sentence, byte-identical to
main(PR #34964 cites it as a home). Items are numbered 2-11; ten cuts remain.Arithmetic (bytes,
ceil(bytes / 4)tokens):main40004 (10001 of 10011, headroom 10). The text adds 1805, the ten cuts remove 1323, landed 40486 → 10122. The ceiling moves +111, the measured remainder only, pinned at the measurement.skills/**readingsc809deb67)data-hooks.mdlinesdata-hooks.mdtokensskills/**/SKILL.mdlinesskills/**tree linesThe bundle token delta is +121 in authored text and +641 in eval fixtures (unpriced, population 1b).
Tests
No package code changes, so there are no package tests to run. The one edited script is
scripts/check-skills-token-ratchet.mjs(a row note and the measured ceiling): its own--self-testpasses (104 cases). No*.test.*file names it. No ablation: text, config and a ratchet row only.Acceptance notes
ctx.api.transactionnested inside another one in the same body (nested ctx.api.transaction is not supported,quickjs-runner.ts__txBegin). The row does not say so. That is a different case from joining a unit the host opened.inputsection shows a delete'sctx.inputas{ id: '123' }, while pattern 1 says a delete'sctx.inputis empty (ctx.previousis the row). Read only, not measured, and the two may describe different doors (handlervsbody).Verification
Premise readings on origin/main c809deb
skills/objectstack-data/references/data-hooks.md:334, theapi.transactionrow: "runs the callback'sctx.apiops in one driver transaction (commit on return, rollback on throw)", no condition, nothing on datasources.grep -n "texts\|ctx.text"gives 0 hits in the file; therefusalsblock is at :830-879 (### Declared refusals:830), plus uses at :609 and :742.hooks-security-seeds-datasources.jsonhas 25 cases (ids 1-24 and 27).Ratchet
Local gate subset (head f7fa386; fix round 84b73e2 re-ran the ratchet, skills, changeset gates and overlap-check, all exit 0)
node scripts/pm/dispatch-gates.mjs --commandsderived 65 commands. 60 exited 0 on the first run,check:pm-dispatch-gatesamong them (fast tier, 2249 cases).check:doc-formula-expressionsexited 3 (PREREQUISITE NOT MET,@objectstack/lintnot built); it exited 0 afterturbo run build --filter=@objectstack/lintunder the verify lock. Four Build Core families exited 3 for unbuilt dist and were not measured locally:check:dts-closure,check:dual-build-cjs-loads,check:lean-entry-closure,check:sourcemap-no-sources-content. CI's Build Core runs them. Exit codes were captured before any pipe and reconciled with--ran.🤖 Generated with Claude Code
https://claude.ai/code/session_01Utp6CazXu8zyYD5PC6J2u7
Generated by Claude Code