Skip to content

feat(lint)!: judge a lowered hook or action body's capabilities like an authored one - #38755

Merged
os-zhuang merged 8 commits into
mainfrom
claude/project-thread-d2qcry
Nov 30, 2026
Merged

os-zhuang merged 8 commits into
mainfrom
claude/project-thread-d2qcry

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Steve · project thread

Fixes #38690

Clause-②: no (narrowing)
Metadata-protocol: narrowed
Skills-docs: none — no skills/** text taught the lowered exemption; the one docs page that did (content/docs/deployment/validating-metadata.mdx, the two capability rows) is corrected here

维护者速读

  • 用户能看到什么变化:挂在字符串 handler / target 旁的钩子和脚本动作函数体(构建产物,或手写的)现在也会被校验权限声明,缺权限时在发布和 os validate 时就报错,而不是上线后每次运行被沙箱拒掉;同时构建能认出 ctx.log?.info(…) 这类可选链、空白、注释写法,自动补上权限。
  • 为什么做:这是「钩子与动作函数体权限校验」这张卡的第二步;取消当时为构建产物留的豁免,并把构建的推断补到与校验规则逐个写法一致。
  • 出错会怎样:手写在字符串 handler / target 旁、漏声明权限的函数体,以及构建后丢了权限的产物,发布会被拒并点名缺的权限;首方示例与连接器应用实测零新增拒绝,可整 PR 撤回。
  • 要你做什么:无。

What changes

validate-action-body-capabilities (@objectstack/lint) skipped a body it took for one the build lowered: a hook body os build / os verify lowered from an inline handler, and at the runtime publish doors any hook body beside a string handler (isLoweredHandlerBody); and any action body beside a string target, judged for api.write alone (isLoweredTargetBody). The skip covered a body written by hand beside a string ref as well, since the rule cannot tell the two apart. The reason was that the build's capability inference did not read every gated call the rule reads. Step 1 of this card (PR #38731) and #38653 (PR #38686) closed that gate by gate; this PR closes it spelling by spelling.

So this PR:

  • drops both skips and the three helpers that only served them (isLoweredHandlerBody, isLoweredTargetBody, loweredActionBodyPaths). validateActionBodyCapabilities no longer takes the loweredHookRefs context, and its registry entry passes the stack alone. Neither function was on the package's barrel.
  • makes the CLI extractor (packages/cli/src/utils/extract-hook-body.ts) infer each gated call in each spelling the rule reads. Its ctx-anchored member patterns, and their rebound siblings for a renamed or destructured hook context, were literal ctx.log.info: ctx.log?.info(…), ctx?.crypto.randomUUID(), ctx.activity?.append(…), ctx.email?.send(…), ctx . log . info(…) and ctx.title?.(field) lowered without their token, and the rule read each as the gated call. Each step now takes ?. and whitespace, title takes the optional call, and inference also reads a comment-blanked copy of the source (the rule's own walk, strings kept), so a comment between steps no longer hides a call. Every change widens: what inferred a token before still does. A hook handler that calls ctx.email.send in any of these spellings now lowers with the grant and is refused at build by the hook parse, as ctx.email.send(…) already was.
  • exports SANDBOX_CAPABILITY_GATES and type SandboxCapabilityGate from the lint barrel, and moves the step-1 CLI enumeration pin off its hand-kept mirror onto that table.
  • adds a PARITY pin in the CLI. Every gate, leaf, receiver shape and face, in each spelling the rule reads (plain, ?. before the member, before the leaf and before the call, whitespace, a block or line comment between steps), is lowered through extractLoweredBody and judged by runAuthoringRules('build', …) twice: ungranted it must draw the gate's finding (so the rule reads that spelling and the pin is not vacuous), lowered it must draw none. A REBOUND block does the same through a hook handler's renamed and destructured context parameter. The one exclusion is a hook body's email.send, pinned instead as a build refusal in every spelling.
  • corrects the text that described the exemption: the two os explain entries, the docs rule table, the rule's docblock and the comment over the lowerCallables target-shape pin.
  • registers the narrowing as ADR-0087 semantic entry lowered-hook-and-action-bodies-capabilities-judged, with a BREAKING changeset carrying FROM → TO for both authors (a body lowered by the build or written by hand beside a string ref) and the remedy for each: rebuild, or declare the token.
  • corrects the pending lint: action-body capability family follow-ups after #37807 (hook bodies, other capability tokens, updateById advice, ADR-0141 D1 binding list) #37815 changeset and its semantic entry, whose sentences this PR makes false (see Deliberate correction).

The limit, stated: the build's reading covers the rule's by the pin's enumeration (census × receivers × spellings × faces), not by proof. Where the two differ outside it, the build reads more (a renamed context root, a spelling inside a string), and the over-inferred grant is one the sandbox never checks, except email.send on a hook, which is refused at build as before.

Measured cost before the change, on origin/main at f782a12033 (scratch script, not committed): every first-party stack (examples/app-crm, app-multi-package with its two packages, app-showcase, app-starter, app-todo, packages/apps/connector-docusign, connector-github, connector-stripe) loaded, normalized, lowered and parsed as judgeAuthorTimeRules does, then judged by the shipped rule and by the rule with both skips emulated away. 70 hook and action bodies, 1 of them lowered (app-crm's opportunity hook): 0 findings shipped, 0 without the skips, 0 newly refused. The population holds one lowered body, so it bounds authored bodies; the lowered side is bounded by the PARITY pin.

Tests

  • New packages/lint/src/validate-action-body-capabilities.lowered-38690.test.ts (26 tests). Per removed skip, a lowered body calling each gate ungranted, spelled directly and through an alias: refused (hook: os validate / build / lint and the hook save door; action: top level, object-inline, os validate / build / lint, the action and object doors). Controls: the same lowered body granted is not refused. A lowered body's write keeps its own id beside the other tokens.
  • packages/cli/test/extract-hook-body-local-alias-38690.test.ts (284 tests): the mirror table is deleted; ENUMERATION reads SANDBOX_CAPABILITY_GATES and spells every leaf in every spelling through seven receivers; PARITY and REBOUND as above; a hook handler calling ctx.email.send in seven spellings plus a renamed context is refused by HookSchema after lowerCallables.

Red first, each fix:

  • PARITY harness: the earlier PARITY judged the extracted record without language: 'js', which the rule skips, so it could not go red. With the body record the build writes and the widened spellings, against the old extractor: 51 failed.
  • Extractor ?. / whitespace / optional call / rebound: the pins against the extractor at a68c0a41cc: 76 failed of 247 (ENUMERATION 27, PARITY 24, REBOUND 25). Hook mail in the new spellings: 4 failed of 8 (they built clean before).
  • Comment between steps: against the extractor at 2aec12e986: 210 failed of 284, every one a comment spelling.

Ablations at the head (scripts/ablation-replace.mjs, restore proven blob == HEAD): MEMBER_STEP back to a plain \.: 84 failed (ENUMERATION 32, PARITY 28, REBOUND 20, mail 4). title without the optional call: 11 failed. Inference over the raw source only: 210 failed. The skips re-inserted in the rule, per removed skip: hook 14 failed / 12 passed, non-write action 12 failed / 14 passed of the lint file.

Forced test edits, named:

  • packages/lint/src/validate-action-body-capabilities.hook-and-tokens-37815.test.ts: two describe blocks deleted, authored hook bodies only: a body lowered from a handler is not judged (#37815 route C) and authored action bodies only past the writes: a body lowered from a target is judged for api.write alone (#37815 M1). They pinned the two skips this PR removes; the new file pins the opposite. Their authored-body halves stay covered by the same file's arm (a)/(b) cases. The two predicate imports go with them.
  • packages/cli/test/lower-callables.test.ts: comment only, over the [#38653] target-shape pin, which named isLoweredTargetBody. The pin itself is unchanged.

Acceptance notes

  • The lowered hook finding's path stays hooks[N].body.capabilities on the seat's answer (claim amendment 5). Its premise, that a fresh build never draws the finding, holds again at this head for every spelling the PARITY pin enumerates; for an artifact that lost a grant, or a hand-written body, that key is the right one.

Deliberate correction

Check Changeset (check-empty-changeset) is red on purpose: this PR edits a pending release note it did not add. DELIBERATE CORRECTION, not a collision; ⛔ do not restore the base text. Both files below are unreleased (merged after 19.0.0-next.2) and ship in the same release as this PR, and this PR makes their sentences about lowered bodies false. Text only: no code, no entry id, no level or disposition line changes. Scope per claim amendment 5 (7276409399); rewrites 2 and 4 of the changeset and 3 and 4 of the entry re-trued per L2 7278772654.

.changeset/37815-body-capabilities-every-gate.md

  1. BREAKING paragraph. Before: "whose authored L2 body calls a member". After: "whose L2 body calls a member".
  2. hook-body-capability-undeclared bullet. Before: "an authored L2 hook body that calls any of those gates" … "Only a body the author wrote is judged: a hook body os build / os verify lowered from an inline handler is not, since its grant is the build's inference (the lowered reading is cli: the hook-body extractor infers no api.transaction and no api.read through a bound object handle, so a lowered handler's inferred capabilities miss calls it makes #38653)." After: "an L2 hook body that calls any of those gates" … "A hook body os build / os verify lowered from an inline handler is judged the same way: its grant is the one the build inferred from its calls, and the build reads each gated call in each spelling the rule reads."
  3. action-body-capability-undeclared bullet. Before: "an authored L2 action body that calls a gate other than the writes without its token. An action body os build / os verify lowered from an inline target function is not judged for these tokens, since its grant is the build's inference (the lowered reading is cli: the hook-body extractor infers no api.transaction and no api.read through a bound object handle, so a lowered handler's inferred capabilities miss calls it makes #38653); its writes are still judged under action-body-write-capability-undeclared." After: "an L2 action body that calls a gate other than the writes without its token. An action body os build / os verify lowered from an inline target function is judged the same way, against the grant the build inferred from its calls."
  4. Paragraph after FROM → TO. Before: "A hook whose body was lowered from an inline handler is unchanged: FROM and TO alike, it is not judged by this rule. So is an action whose body was lowered from an inline target function, for every token but api.write: … TO, it still builds clean, and its writes are judged as before." After: "A hook written as an inline handler, and an action written as an inline target function, need no change: the build infers the grant from each gated call in each spelling the rule reads (?., whitespace or a comment between steps, the optional call), so the body it lowers carries the token. … TO, it still builds clean, its lowered body granted api.transaction."

packages/spec/src/migrations/entries/semantic/19.hook-and-action-bodies-calling-an-ungranted-gate-refused.ts (entry hook-and-action-bodies-calling-an-ungranted-gate-refused, id unchanged)

  1. Header comment. Before: "an authored L2 hook body that calls". After: "an L2 hook body that calls".
  2. surface. Before: "only a body the author wrote (a hook body lowered from an inline handler is not judged, and an action body lowered from an inline target function is judged for its writes alone, as before)". After: "whether the author wrote the body or os build lowered it from an inline handler or target function".
  3. replacement, last sentence. Before: "needs no change for the other tokens: its lowered body is not judged for them (a later change carries the lowered reading)." After: "needs no change: os build infers the grant from each gated call in each spelling the rule reads (?., whitespace or a comment between steps, the optional call), so the body it lowers carries the token, and that lowered body is judged like an authored one."
  4. reason. Before: "A hook body os build lowered from an inline handler is not judged, and an action body it lowered from an inline target function is judged only for api.write, as before: such a grant is the build's inference, not the author's, and the inference does not yet read every gated shape, so a hook written as a handler and an action written as a target function are unchanged." After: "A hook body os build lowered from an inline handler, and an action body it lowered from an inline target function, are judged the same way: their grant is the build's inference, which reads each gated call in each spelling the rule reads, pinned spelling by spelling against the rule, so a hook written as a handler and an action written as a target function build clean."

Verification

Two-minute check: pnpm --filter @objectstack/cli exec vitest run test/extract-hook-body-local-alias-38690.test.ts. Expect 1 file, 284 tests passed. With MEMBER_STEP in extract-hook-body.ts set back to a plain \., 84 of them fail.

Read first: the MEMBER_STEP / memberLeafRx / blankComments block and the inference loop in packages/cli/src/utils/extract-hook-body.ts, then the PARITY block in the test above, then the two removed skips in packages/lint/src/validate-action-body-capabilities.ts.

Local gates at 3ca3538 (head)
  • Derived round: node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack listed 122 commands (the 119 of the last round plus check:i18n, check:i18n-coverage, check:i18n-walk-parity); each ran with stdin closed and its exit recorded before any pipe: 121 :: exit 0, and node scripts/check-empty-changeset.mjs --base origin/main :: exit 1, the DELIBERATE CORRECTION refusal above, by design. dispatch-gates --ran: 122 derived, 122 run, 0 NOT-MEASURED, 0 UNRUN.
  • Packages: pnpm --filter @objectstack/lint test 252 files / 10106 tests passed; cli vitest run --project unit 451 files / 6737 tests passed; pnpm --filter @objectstack/lint typecheck and pnpm --filter @objectstack/cli typecheck exit 0; spec rebuilt, src/migrations 5 files / 209 tests passed.
  • node scripts/check-changeset-no-major.mjs --base origin/main --event over this body: exit 0 (level axis: @objectstack/lint minor carries Metadata-protocol: narrowed; ADR-0087 registered lowered-hook-and-action-bodies-capabilities-judged).
  • node scripts/pm/overlap-check.mjs at this head: clean against origin/main (f576dee), feat(objectql): a record in a closed state, and its lines, are closed to change (closedStates, ADR-0162) — trunk #38497 and chore: version packages (next) #38192.
  • Not run locally: the cli integration layer and test:repo (CI's Test Core); the dogfood battery is CI's on this head (! title, narrowing arm).

Generated by Claude Code

…an authored one

validate-action-body-capabilities drops the isLoweredHandlerBody skip and
the non-write isLoweredTargetBody skip: the extractor now infers every gate
through every receiver the rule reads, so a lowered body calling a gate
without its token is one the sandbox refuses at the call. The lint barrel
exports SANDBOX_CAPABILITY_GATES and SandboxCapabilityGate, and the CLI's
alias pin reads that table instead of a mirror, with a parity pin over
every gate, receiver and face.

Claude-Session: https://claude.ai/code/session_01ADHkmSa9QNE6qXdrFAvnUr
Co-authored-by: Claude <noreply@anthropic.com>
…hangeset

The upgrade-guide entry lowered-hook-and-action-bodies-capabilities-judged
records the narrowing; the changeset carries the BREAKING banner and the
FROM -> TO for a build artifact's lowered hook and action.

Claude-Session: https://claude.ai/code/session_01ADHkmSa9QNE6qXdrFAvnUr
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/l documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 30, 2026
@github-actions

github-actions Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 3 package(s): @objectstack/cli, @objectstack/lint, @objectstack/spec, touching 21 documentable anchor(s). ⚠️ 1 changed file(s) yielded no anchor (packages/lint/src/index.ts), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

21 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: node scripts/docs-audit/affected-docs.mjs --json f576dee5816597cfe3aa044a3f6020754c48327b.

⛔ 2 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails.

What this run could not see
  • 1 changed file(s) yielded no anchor (packages/lint/src/index.ts) — pages documenting those are invisible to this run
  • 4 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 69 of 252 client-bound route-ledger rows — the other 183 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 183: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 124 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 192 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json f576dee5816597cfe3aa044a3f6020754c48327b → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 341fb9fd5592e57318141bc1101504d361cd9b2f — the merge of head 3ca3538893ae0eca3b69f3a7f6334362b0b2d2a3 into base f576dee5816597cfe3aa044a3f6020754c48327b, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 341fb9fd5592e57318141bc1101504d361cd9b2f && git checkout 341fb9fd5592e57318141bc1101504d361cd9b2f
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin f576dee5816597cfe3aa044a3f6020754c48327b 3ca3538893ae0eca3b69f3a7f6334362b0b2d2a3 && git checkout -B drift-repro f576dee5816597cfe3aa044a3f6020754c48327b && git merge --no-ff 3ca3538893ae0eca3b69f3a7f6334362b0b2d2a3

node scripts/docs-audit/affected-docs.mjs --json f576dee5816597cfe3aa044a3f6020754c48327b

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs f576dee5816597cfe3aa044a3f6020754c48327b → pass the list as
args.docs, on the commit named under Which tree this was computed on.

…ered body is judged

The unreleased #37815 changeset and its upgrade-guide entry said a hook
body lowered from a handler is not judged and an action body lowered from
a target function is judged for its writes alone. They ship in the same
release as the lowered reading, so their sentences now say what that
release does. Text only; no entry identity changes.

Claude-Session: https://claude.ai/code/session_01ADHkmSa9QNE6qXdrFAvnUr
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-steve · session_01ADHkmSwS4mQyXWrddL4r6B

Final green head · 2026-11-30T12:33Z · zone o3-B · c142a87b35 · check-runs (latest per name): 63 success, 12 expected skips, 1 failure by design, 0 pending · draft, Clause-②: no (narrowing) and Metadata-protocol: none, +356 / -214 over 13 files against origin/main. Not governed.

  • The one red is Check Changeset: a DELIBERATE CORRECTION of .changeset/37815-body-capabilities-every-gate.md, which the PR body's ## Deliberate correction section quotes sentence by sentence. Claim amendment 5 (7276409399) orders it on the seat's word, because that note is unreleased and ships in the same release as this PR. Per landing-operations.md it is confirmed by the seat's same-head contract-review PASS judging each rewritten sentence, and then the PR enters the queue red on that check alone. The gate is not changed.
  • PR-body guards is green at this head (rerun 11:42Z) on the card's Claim: 7276543353.
  • needs:dogfood-battery: the opt-in battery and its three shards are green at this head.
  • What changes. validate-action-body-capabilities drops the isLoweredHandlerBody skip and the non-write isLoweredTargetBody skip, so a lowered body is judged like an authored one. Lint's barrel exports SANDBOX_CAPABILITY_GATES and SandboxCapabilityGate, and the step-1 CLI pin reads the real table, with a parity pin over every gate, leaf, receiver and face. Measured on first-party stacks: 70 hook and action bodies, 0 newly refused. A new ADR-0087 semantic entry is added.
  • Tests. The new file has 26 cases, red on main's rule and green here; two ablations went red and were restored. Lint 10106 passed.
  • Owed: the contract review at the contract-review tier on this head (the narrowing arm, plus the two rewritten release notes); the seat runs it. Sent to L1-b. Fixes #38690.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-steve · session_01ADHkmT9HTWLMN33WUVxVWB
L1-b, the seat's L1 thread · 2026-11-30T12:38Z · first review

席位核对

ACCEPT @ c142a87 (card #38690, step 2, Fixes; 13 files; title !, Clause-②: no (narrowing))

  • Relation. Fixes #38690 delivers the card's remaining step. Step 1 (fix(cli): the hook-body extractor infers member tokens through a body-local alias of ctx.MEMBER #38731) made the build infer every gate. This step removes the two exemptions that inference was owed. No closing keyword binds any other card.

  • The narrowing, read on the code. In validateActionBodyCapabilities:

    • the hook loop's isLoweredHandlerBody return is gone;
    • the action loop's if (lowered) continue is gone, with loweredActionBodyPaths.

    Neither removed helper, nor the dropped ctx parameter, was reachable. The lint exports are ., ./runtime and ./rule-explanations, and the barrel exported only the three rule ids from this file. loweredHookRefs still serves the other rules that read it (validate-hook-body-writes, validate-hook-body-compiles).

  • Added export. SANDBOX_CAPABILITY_GATES and type SandboxCapabilityGate are new on the lint barrel. The changeset names them, and the CLI ENUMERATION and PARITY pins now read that table instead of a hand-kept mirror. Whether Clause-②: no holds beside an added barrel export is L2's to say. I name it so it is not missed; it does not block.

  • Declarations and the ADR-0087 face.

    • The new changeset is patch for @objectstack/lint and @objectstack/spec. It has a BREAKING paragraph, two FROM → TO cases with the fix, and the marker registered lowered-hook-and-action-bodies-capabilities-judged.
    • The new semantic entry is present, and I read its surface, replacement, reason and acceptanceCriteria.
    • @objectstack/cli is touched only by test files, so it needs no entry. That clears the l1-face changeset flag.
    • Metadata-protocol: none is the zone's reading for a rule narrowing with no schema change. L2 owns the level.
  • DELIBERATE CORRECTION, read sentence by sentence. .changeset/37815-body-capabilities-every-gate.md and 19.hook-and-action-bodies-calling-an-ungranted-gate-refused.ts are both unreleased. I checked each of the eight edits the body lists against the diff, and each matches. Each corrected sentence is true at this head, since lowered bodies are now judged. No entry id, level or disposition line moves. Check Changeset is red by design on that edit. Per the recipe, a same-head L2 PASS confirms it, because the PR also changes code.

  • Docs. The two validating-metadata.mdx rows and the two os explain entries no longer say a lowered body is exempt. That is true to the code.

  • Exposure. The changeset's "no body newly refused" rests on the dev's scratch measurement, which found 70 bodies, 1 of them lowered. That is not committed. I did not re-run it; that part is NOT MEASURED by me.

  • My runs at this head (fresh worktree, offline install, @objectstack/lint^... built):

    • validate-action-body-capabilities.lowered-38690.test.ts together with …hook-and-tokens-37815.test.ts: 64/64 passed.
    • Ablation. I put the hook exemption back (if (typeof hook.handler === 'string' && hook.handler !== '') return;). Exactly 14 cases went red, matching the dev's hook leg, and I restored the file.
    • I did not run the action-skip leg or the CLI PARITY block, which needs the CLI closure. That part is NOT MEASURED by me.

Checks at this head (read before writing): 65 success, 12 skipped. There are 3 failures:

  • both Check Changeset runs, red by design;
  • the 11:04Z PR-body guards run, which was superseded by the 11:42Z run of the same check, a success. The filter=latest reading still lists the old one.

Dogfood battery (opt-in) concluded success at this exact head (check run 141818967053), so the dogfood owed for ! is met at c142a87. Any further push owes a new run.
L2: the seat's CONTRACT_REVIEW_TIER review is owed on this head. It confirms the deliberate correction, and it judges the added barrel export against Clause-②: no. Not governed; the zone lands it.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-steve · session_01ADHkmSAjFEZHRpRq3WCj6z

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: c142a87b353663f270431848ce7901f225ff4f3d
Local-runs: none
Scope: packages/spec/src/migrations/entries/semantic/19.hook-and-action-bodies-calling-an-ungranted-gate-refused.ts, packages/spec/src/migrations/entries/semantic/19.lowered-hook-and-action-bodies-capabilities-judged.ts + packages/lint/src/validate-action-body-capabilities.ts, packages/lint/src/authoring-rules.ts, packages/lint/src/index.ts, packages/lint/src/rule-explanations.ts, packages/lint/src/validate-action-body-capabilities.lowered-38690.test.ts, packages/cli/test/extract-hook-body-local-alias-38690.test.ts, content/docs/deployment/validating-metadata.mdx
Security-touching: yes
Rule-change-verified: none

Face: narrowing. PR #38755, card #38690 step 2, PR body Clause-②: no (narrowing) and Metadata-protocol: none. Read: the card body and its 12 comments, the PR body, the 13-file diff against main (merge base f782a12033), the check-runs on the head. Read but not reviewed, outside the diff: packages/cli/src/utils/extract-hook-body.ts and packages/runtime/src/sandbox/quickjs-runner.ts at the head. No .claude/** path, no skills/** path. Security-touching: yes because the changed hunks teach the sandbox's capability grants (which token a body must hold).

① Derived judgments

  • Accept-set, lowered hook bodies: RIGHT as a narrowing. validateActionBodyCapabilities no longer returns early on a hook with a string handler, so hooks[N].body is judged for every token on every door. The refusal is true of the runtime: installCtx always installs ctx.log, ctx.crypto, the two doors and the api leaves, and throws 403 INSUFFICIENT_PRIVILEGES at an ungranted call, so no refused body ever ran clean.
  • Accept-set, lowered action bodies: RIGHT as a narrowing. The if (lowered) continue after the api.write arm is gone, so an action with a string target beside its body is judged for the six non-write tokens too. Rule id, message and hint are the authored body's, unchanged (action-body-capability-undeclared, hook-body-capability-undeclared, path ….body.capabilities).
  • Accept-set, bound of the narrowing: WRONG as stated. The PR, both changesets and both semantic entries say a fresh build is never refused. It is, for the spellings in M1.
  • Accept-set, who is newly refused: UNDER-STATED. The removed predicates read a string handler or target beside a body as "lowered" by shape alone, so an AUTHORED body beside a string ref was exempt too (the removed docblock said so: "an authored body beside a string target is not judged either"). Those are newly refused and no text names them. See S2.
  • Public surface, @objectstack/lint root barrel: SANDBOX_CAPABILITY_GATES and type SandboxCapabilityGate added. A widening, declared in the changeset's last paragraph. RIGHT.
  • Public surface, validateActionBodyCapabilities(stack, ctx?) to (stack), and the three deleted helpers: none is on any of the package's three entries (., ./runtime, ./rule-explanations); the one caller is the registry line in authoring-rules.ts, changed with it. No published surface moves. RIGHT.
  • @objectstack/cli: test files only. No changeset owed. RIGHT.
  • Gates on the head: 80 check-runs. Dogfood battery (opt-in) success (141818967053), its three shards success. PR-body guards latest run success (11:43Z; the 11:04Z run was red). Check Changeset failure, latest 141824341086: its one annotation names .changeset/37815-body-capabilities-every-gate.md under the COLLISION / DELIBERATE CORRECTION refusal and nothing else. Every other run success or skipped.

② Semver level

Levels: @objectstack/lint patch, @objectstack/spec patch, BREAKING banner, adr-0087: registered lowered-hook-and-action-bodies-capabilities-judged, FROM and TO present. Clause-②: no (narrowing) matches the diff: a narrowing, and the arm is the right one. @objectstack/spec patch is right (one upgrade-guide entry, string edits in another). @objectstack/cli none is right. The lint level and the kind line are not: S1.

S1 (should-fix) — Metadata-protocol: none with @objectstack/lint: patch does not match what the diff publishes. AGENTS.md Post-Task step 3: "a value refused or a requirement tightened is narrowed" and "a kind takes at least minor on a package the diff moves". This diff makes the hook, action and object save doors answer 422 to metadata they accepted (the new entry's own header: "It narrows what the authoring doors accept"). The sibling note for the same two rule ids, .changeset/37815-body-capabilities-every-gate.md, declares Metadata-protocol: narrowed with lint minor, as does every other pending fix(lint)! publish refusal on main (34562, 37909, 37936, 38019, 38041, 38433, 38630). Owed: Metadata-protocol: narrowed in the PR body and the changeset, lint at minor. The release-note section does not move (the (narrowing) arm and the registered marker already place it), which is why this is not a must-fix.

Deliberate correction, sentence by sentence. Each AFTER sentence judged against the tree at the head.

.changeset/37815-body-capabilities-every-gate.md

  1. Before: "whose authored L2 body calls a member". After: "whose L2 body calls a member". TRUE: the rule judges every js body.
  2. Before: "an authored L2 hook body that calls any of those gates" … "Only a body the author wrote is judged: a hook body os build / os verify lowered from an inline handler is not, since its grant is the build's inference (the lowered reading is cli: the hook-body extractor infers no api.transaction and no api.read through a bound object handle, so a lowered handler's inferred capabilities miss calls it makes #38653)." After: "an L2 hook body that calls any of those gates" … "A hook body os build / os verify lowered from an inline handler is judged the same way: its grant is the one the build inferred from its calls, and the build reads every gate the rule reads." First clause TRUE. Last clause TRUE gate by gate (the eight census rows) and NOT TRUE call by call, which is what the paragraph below builds on: M1.
  3. Before: "an authored L2 action body that calls a gate other than the writes without its token. An action body os build / os verify lowered from an inline target function is not judged for these tokens, since its grant is the build's inference (the lowered reading is cli: the hook-body extractor infers no api.transaction and no api.read through a bound object handle, so a lowered handler's inferred capabilities miss calls it makes #38653); its writes are still judged under action-body-write-capability-undeclared." After: "an L2 action body that calls a gate other than the writes without its token. An action body os build / os verify lowered from an inline target function is judged the same way, against the grant the build inferred from its calls." TRUE.
  4. Before: "A hook whose body was lowered from an inline handler is unchanged: FROM and TO alike, it is not judged by this rule. So is an action whose body was lowered from an inline target function, for every token but api.write: … TO, it still builds clean, and its writes are judged as before." After: "A hook written as an inline handler, and an action written as an inline target function, need no change: the build infers the grant from every gated call the rule reads, so the body it lowers carries the token. … TO, it still builds clean, its lowered body granted api.transaction." The api.transaction example is TRUE. "need no change: the build infers the grant from every gated call the rule reads" is NOT TRUE: M1.

packages/spec/src/migrations/entries/semantic/19.hook-and-action-bodies-calling-an-ungranted-gate-refused.ts

  1. Header comment. Before: "an authored L2 hook body that calls". After: "an L2 hook body that calls". TRUE.
  2. surface. Before: "only a body the author wrote (a hook body lowered from an inline handler is not judged, and an action body lowered from an inline target function is judged for its writes alone, as before)". After: "whether the author wrote the body or os build lowered it from an inline handler or target function". TRUE.
  3. replacement. Before: "needs no change for the other tokens: its lowered body is not judged for them (a later change carries the lowered reading)." After: "needs no change: os build infers the grant from every gated call the rule reads, so the body it lowers carries the token, and that lowered body is judged like an authored one." "judged like an authored one" is TRUE. "needs no change: os build infers the grant from every gated call the rule reads" is NOT TRUE: M1.
  4. reason. Before: "A hook body os build lowered from an inline handler is not judged, and an action body it lowered from an inline target function is judged only for api.write, as before: such a grant is the build's inference, not the author's, and the inference does not yet read every gated shape, so a hook written as a handler and an action written as a target function are unchanged." After: "A hook body os build lowered from an inline handler, and an action body it lowered from an inline target function, are judged the same way: their grant is the build's inference, which reads every gated shape the rule reads, so a hook written as a handler and an action written as a target function build clean." "judged the same way" is TRUE. "reads every gated shape the rule reads … build clean" is NOT TRUE: M1.

The deliberate correction is the right class (not a collision; both notes are unreleased, no id, level or disposition line moved) and five of the eight rewrites are true. Three are not, so it is NOT confirmed on this head.

③ Boundary flags

  • open_questions 1 (L2 owed on the narrowing arm): this record.
  • open_questions 2 (a lowered hook finding keeps hooks[N].body.capabilities and the hint "Add 'TOKEN' to the hook's body.capabilities"; seat ruling in claim amendment 5: stays as built): the ruling rests on "by the PARITY pin a fresh build never draws it". M1 shows a fresh build does draw it, and then the hint sends the author of an inline handler to a key the build writes. Not re-ruled here; it goes back to the seat with M1. If M1 is closed in the extractor the premise holds again and the ruling stands.
  • open_questions 3 (correct the pending lint: action-body capability family follow-ups after #37807 (hook bodies, other capability tokens, updateById advice, ADR-0141 D1 binding list) #37815 note and entry): answered by amendment 5 and done; judged in ② above.
  • Dev flags: file surface held to the claim restated in 7276543353 (13 files, all named there). Skills-docs: none with a reason; the one docs page that taught the exemption is corrected in the diff. Head-tree search for other text teaching the exemption (content, skills, packages/lint/src, packages/cli/src, packages/spec/src, .changeset): none left.
  • The dev's cost measurement (70 first-party bodies, 0 newly refused) holds ONE lowered body, so it bounds the authored population and says almost nothing about lowered handlers.
  • SQL push-down: the diff adds no query, id materialisation or in-app join. Nothing to flag.

④ Design judgment

M1 (must-fix) — the build does not infer every gated call the rule reads, so an inline handler or target function is refused by its own build, and the contract says it cannot be. The rule's first receiver is ctx\s*\??\.\s*MEMBER and its leaf reader is \s*\??\.\s*LEAF\s*(?:\?\.\s*)?\( (memberReceivers, memberLeafCalls, calledWithArgument); the lint suite pins it: ctx.log?.info?.('a') reads as log (validate-action-body-capabilities.hook-and-tokens-37815.test.ts:229). The extractor's ctx-anchored patterns are literal: /ctx\.log\.(?:info|warn|error|debug)\b/, /ctx\.crypto\.randomUUID\b/, /ctx\.email\.send\b/, /ctx\.activity\.append\b/, and /\.\s*title\s*\(\s*[^)\s]/ (CAPABILITY_PATTERNS; the contextRoots and memberLocals siblings in reboundCapabilities are as strict). So these infer no token and are read by the rule: ctx.log?.info(…), ctx?.log.info(…), ctx.crypto?.randomUUID(), ctx.activity?.append(…), ctx.email?.send(…) on an action, and ctx.title?.(FIELD) on a hook. Only the body-local alias path added in step 1 allows ?.. Before this PR such a handler built clean and failed at the call; on this head os build and os validate fail it with hook-body-capability-undeclared or action-body-capability-undeclared and a hint naming body.capabilities. The refusal itself is honest (the call would 403). What fails is the bound:

  • card cli: the hook-body extractor infers nothing through a body-local alias of ctx.log, ctx.crypto, ctx.activity or ctx.title, so a lowered handler is refused at the call #38690 Ask 1, the prerequisite of this step ("the extractor infers the member tokens through the receivers lint's memberReceivers reads"), is not met for the optional-chain form of the first receiver;
  • 19.lowered-hook-and-action-bodies-capabilities-judged.ts: replacement "Nothing to change for a handler or target function the build lowers: the build infers the grant from every gated call the rule reads"; its remedy "spell the call off ctx directly" does not help, the refused calls ARE off ctx directly; reason "The inference now reads every gate through every receiver the rule reads"; acceptanceCriteria "Run os validate or os build over a stack with inline hook handlers and action target functions: no … finding" fails on such a stack;
  • 19.hook-and-action-bodies-calling-an-ungranted-gate-refused.ts: rewrites 3 and 4 in ②;
  • .changeset/37815-… rewrites 2 and 4, and .changeset/38690-lint-lowered-bodies.md "A handler or target function the build lowers is not refused by its own build";
  • validate-action-body-capabilities.ts docblock: "The extractor infers every gate through every receiver this rule reads";
  • the PARITY pin does not hold the property it is named for. It fails when a census row or one of four receiver declarations diverges, which is real and worth having, but it spells every call as plain RECEIVER.LEAF(…), so it is green on the divergence above.
    Close it either way, both move the head: (A) the extractor reads the member gates as the rule does (?. and whitespace on either side of the member, the optional call, the title?.( form, the rebound siblings), with the PARITY and ENUMERATION spellings widened to the rule's own (?. before the member, before the leaf, before the call) — this needs packages/cli/src/utils/extract-hook-body.ts on the claim, and care that a hook's email.send still refuses at build; or (B) the code stays and every sentence above states the real bound and a remedy that works for an inline handler. (A) is what the card asked for.

S2 (should-fix) — the new entry and changeset name only "a body os build / os verify lowered" and "a build artifact". The rule cannot tell a lowered body from an authored one beside a string handler or target, and before this PR it exempted both: an authored action body beside a string target on every door (non-write tokens), an authored hook body beside a string handler on the runtime hook door. Those authors are newly refused and the upgrade guide's surface does not describe them; the FROM examples show exactly their shape under the label "A build artifact's lowered hook". Owed: surface and the changeset's BREAKING paragraph say "a body beside a string handler or target, lowered by the build or written by hand", and the remedy for the hand-written one (declare the token).

Judged and found to hold:

  • validate-action-body-capabilities.ts code: the two skips and only the two skips are removed; authored-body behaviour, ids, messages and the api.write id are untouched. The new lint test pins both removals per token and per door with granted controls.
  • authoring-rules.ts: the ctx argument had no reader left; runtimeTypes unchanged, so the same three doors run it.
  • index.ts: the export is the table the rule itself filters in bodyGatedCalls, not a copy; the type's kinds field resolves through the same module.
  • rule-explanations.ts: both closing sentences ("judged the same way: its grant is the one the build inferred from its calls") are true of the code and claim nothing about parity.
  • validating-metadata.mdx rows 527 and 529: "(authored, or lowered by os build from a target function)" and "(authored, or lowered by os build from a handler)" are true of the code.
  • Dogfood battery: green on this head.

N1 (nit) — .changeset/38690-lint-lowered-bodies.md: "or a call in a shape neither the build nor the rule reads differently" does not parse; it goes away with the M1 rewrite.

Implemented-by: claude/project-thread-d2qcry
Reviewed-by: session_01ADHkmSAjFEZHRpRq3WCj6z

VERDICT: FAIL

…on both sides of the parity pin

Claude-Session: https://claude.ai/code/session_01ADHkmSa9QNE6qXdrFAvnUr
Co-authored-by: Claude <noreply@anthropic.com>
The extractor's member patterns spelled ctx.MEMBER.LEAF with plain dots, so
ctx.log?.info(...), ctx?.crypto.randomUUID(), ctx . email.send(...) and
ctx.title?.(field) lowered without their token while the publish rule, now
judging lowered bodies, read each of them as the gated call. Each ctx-anchored
member pattern and its rebound siblings now step through ?. and whitespace,
and the title pattern takes the optional call. The parity pin judges the body
record the build writes (language js), so an ungranted spelling must draw the
gate's finding before a granted one may draw none; the rebound hook shapes
run through both sides too.

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ADHkmSa9QNE6qXdrFAvnUr
…y spelling the rule reads

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ADHkmSa9QNE6qXdrFAvnUr
…t from the build

The publish rule blanks comments before it reads a body, so ctx/* c */.log.info()
and a member step broken by a line comment are a gated call to it, while the
extractor read the raw source and inferred nothing. Inference now reads the
source and its comment-blanked copy (the rule's own walk, strings kept), so a
spelling inside a comment still infers what it did.

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ADHkmSa9QNE6qXdrFAvnUr
…d, and name the hand-written body

The release notes, both upgrade-guide entries and the rule docblock said the
build infers every gated call the rule reads; that held gate by gate, not
spelling by spelling. They now say what the parity pin holds (each spelling the
rule reads, judged ungranted and lowered) and that it is an enumeration. The
narrowing also refuses a body written by hand beside a string handler or
target, which the removed skips took for a lowered one: the entry, the
BREAKING paragraph and the FROM examples name both authors and the remedy for
each. The new note declares Metadata-protocol narrowed and moves lint minor.

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ADHkmSa9QNE6qXdrFAvnUr
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-steve · session_01ADHkmSwS4mQyXWrddL4r6B

Final green head · 2026-11-30T14:28Z · zone o3-B · 3ca3538893ae0eca3b69f3a7f6334362b0b2d2a3 · check-runs (latest per name): 66 success, 12 expected skips, 1 failure by design, 0 pending · draft, Clause-②: no (narrowing) and Metadata-protocol: narrowed, @objectstack/lint at minor, +609 / -246 over 14 files against origin/main. Not governed.

  • The one red is Check Changeset, the same DELIBERATE CORRECTION of .changeset/37815-body-capabilities-every-gate.md as at the previous head. The PR body's ## Deliberate correction section is updated for this head. It is confirmed only by the seat's same-head contract-review PASS judging each rewritten sentence. The level axis of that check passes: lint minor under Metadata-protocol: narrowed.
  • needs:dogfood-battery: the opt-in battery and its three shards are green at this head.
  • Since c142a87b35, the card thread reworked to the seat's contract review 7278772654. Claim amendment 6 (7278799670) adds the CLI extractor and its test.
    • M1 (route A): the build's extractor reads each gated call the rule reads, in every spelling the rule accepts: ?. and whitespace at each step, the optional call on title, the rebound siblings, and calls behind comments. Each change only widens, so everything inferred before is still inferred. A hook's email.send still refuses at build, with 8 new pins. The old PARITY pin was idle: its records lacked language: 'js', so the rule skipped them. It now runs the build's real records and asserts a finding when the grant is missing. Red first: the old extractor failed 76 of 247 cases. Three ablations each went red and were restored. The stated limit: parity rests on the pins' enumeration, not on a proof. Where the two sides differ, the build reads more (a renamed ctx root, a spelling inside a string). Ruling (a), "a fresh build never draws it", holds again for the enumerated spellings.
    • S1: Metadata-protocol: narrowed is in the PR body and both changesets; lint is at minor and cli at patch.
    • S2: the new entry, the BREAKING paragraph and the FROM example name both authors: a body beside a string handler or target, lowered by the build or written by hand. The remedy for a hand-written body is to declare the token.
    • N1: the unparseable sentence is removed. All eight deliberate-correction sentences are rewritten to the new tree.
  • Gates: 122 run, 121 exit 0, and 1 is check-empty-changeset (red by design); 0 NOT-MEASURED. Tests: lint 10106, cli unit 6737 and spec migrations 209 pass. overlap-check was clean before the push.
  • Owed: the seat's contract-review delta on this head, including the deliberate-correction sentences. Sent to L1-b for its delta.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-steve · session_01ADHkmSAjFEZHRpRq3WCj6z

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 3ca3538893ae0eca3b69f3a7f6334362b0b2d2a3
Local-runs: none
Scope: packages/spec/src/migrations/entries/semantic/19.hook-and-action-bodies-calling-an-ungranted-gate-refused.ts, packages/spec/src/migrations/entries/semantic/19.lowered-hook-and-action-bodies-capabilities-judged.ts + packages/cli/src/utils/extract-hook-body.ts, packages/cli/test/extract-hook-body-local-alias-38690.test.ts, packages/lint/src/validate-action-body-capabilities.ts, packages/lint/src/authoring-rules.ts, packages/lint/src/index.ts, packages/lint/src/rule-explanations.ts, packages/lint/src/validate-action-body-capabilities.lowered-38690.test.ts, content/docs/deployment/validating-metadata.mdx
Security-touching: yes
Rule-change-verified: none

Delta review of record 7278772654 (FAIL at c142a87b35). Face: narrowing; PR body Clause-②: no (narrowing), Metadata-protocol: narrowed. Read: the five commits c142a87b35..3ca3538893 (7 files, +315 / -94), the PR body at this head, claim amendment 6 (7278799670), the final-green note 7281443549, the check-runs on this head, and the net diff against main (14 files, merge base f782a12033). Read but not reviewed, outside the diff: packages/cli/src/utils/config.ts. The four files the delta does not touch (authoring-rules.ts, index.ts, rule-explanations.ts, validating-metadata.mdx) stand as judged in the first record. No .claude/** path, no skills/** path.

M1: closed
S1: closed
S2: closed
N1: closed

No must-fix, no should-fix.

① Derived judgments

  • M1, route A, on the code. CAPABILITY_PATTERNS now builds the four member gates with memberLeafRx('ctx', MEMBER, LEAVES), each step \s*\??\.\s*, which is the rule's own step in memberReceivers and memberLeafCalls. The title pattern takes the optional call. The rebound siblings (contextRoots, memberLocals) take the same step and the optional call. Inference runs over the source and over a comment-blanked copy, so a comment between steps is read as the rule reads it. Each of the spellings named in M1 (ctx.log?.info(…), ctx?.log.info(…), ctx.crypto?.randomUUID(), ctx.activity?.append(…), an action's ctx.email?.send(…), a hook's ctx.title?.(FIELD)) now infers its token. RIGHT.
  • Every change widens. Each new pattern matches whatever the old literal matched, and the two scanned copies are unioned, so nothing that inferred a token before stops inferring it. RIGHT.
  • Accept-set of the build, hooks and mail: a hook handler that spells ctx.email.send with ?., whitespace or the optional call now lowers WITH the grant and is refused by the hook parse at build; before, it lowered without it and failed at the call. A narrowing of what os build accepts, on the cli side, declared in the new changeset's second paragraph and in the new entry's replacement, and pinned (seven spellings and a renamed context, through lowerCallables and HookSchema). RIGHT.
  • The PARITY pin. In the first round its body record lacked language: 'js', which the rule skips, so it could not go red; the first record did not catch that. At this head it builds the record the build writes, and judges each spelling twice: with capabilities: [] it must draw the gate's finding, lowered it must draw none. So it fails on a divergence in either direction for what it enumerates: every census row and leaf, both faces, seven receivers (ctx.MEMBER, ctx?.MEMBER, whitespace, a block comment, a bound local, a destructure, a renamed destructure), and the call spellings (plain, ?. before the leaf, the optional call, whitespace, block comment, line comment). The REBOUND block does the same through a hook's renamed and destructured parameter. RIGHT, with the one gap in N2.
  • Public surface: unchanged since the first record, plus @objectstack/cli now moves (extractor source), declared at patch.
  • Gates on the head, latest run per name: one failure, Check Changeset (141901738767), whose one annotation names .changeset/37815-body-capabilities-every-gate.md under the DELIBERATE CORRECTION refusal and nothing else; everything else success or skipped, none pending. Dogfood battery (opt-in) success (141917924093) with its three shards.

② Semver level

@objectstack/lint minor, @objectstack/cli patch, @objectstack/spec patch; Clause-②: no (narrowing); Metadata-protocol: narrowed in the PR body and the changeset; BREAKING banner, FROM and TO for both authors, adr-0087: registered lowered-hook-and-action-bodies-capabilities-judged. This matches what the diff publishes: the save doors refuse metadata they accepted (the kind), lint carries the rule (the level), cli carries a widening fix to inference, spec carries one upgrade-guide entry. It is the sibling #37815 note's shape. S1 is closed by it.

Deliberate correction, sentence by sentence, each AFTER sentence judged against the tree at this head.

.changeset/37815-body-capabilities-every-gate.md

  1. Before: "whose authored L2 body calls a member". After: "whose L2 body calls a member". TRUE.
  2. Before: "an authored L2 hook body that calls any of those gates" … "Only a body the author wrote is judged: a hook body os build / os verify lowered from an inline handler is not, since its grant is the build's inference (the lowered reading is cli: the hook-body extractor infers no api.transaction and no api.read through a bound object handle, so a lowered handler's inferred capabilities miss calls it makes #38653)." After: "an L2 hook body that calls any of those gates" … "A hook body os build / os verify lowered from an inline handler is judged the same way: its grant is the one the build inferred from its calls, and the build reads each gated call in each spelling the rule reads." TRUE of what os build lowers (see N2 for the one spelling outside it).
  3. Before: "an authored L2 action body that calls a gate other than the writes without its token. An action body os build / os verify lowered from an inline target function is not judged for these tokens, since its grant is the build's inference (the lowered reading is cli: the hook-body extractor infers no api.transaction and no api.read through a bound object handle, so a lowered handler's inferred capabilities miss calls it makes #38653); its writes are still judged under action-body-write-capability-undeclared." After: "an L2 action body that calls a gate other than the writes without its token. An action body os build / os verify lowered from an inline target function is judged the same way, against the grant the build inferred from its calls." TRUE.
  4. Before: "A hook whose body was lowered from an inline handler is unchanged: FROM and TO alike, it is not judged by this rule. So is an action whose body was lowered from an inline target function, for every token but api.write: … TO, it still builds clean, and its writes are judged as before." After: "A hook written as an inline handler, and an action written as an inline target function, need no change: the build infers the grant from each gated call in each spelling the rule reads (?., whitespace or a comment between steps, the optional call), so the body it lowers carries the token. … TO, it still builds clean, its lowered body granted api.transaction." TRUE of what os build lowers. One reading aid for the seat: a hook handler that sends mail is the stated exception two bullets above ("A hook body is never granted email.send"), so "need no change" does not promise it a clean build.

packages/spec/src/migrations/entries/semantic/19.hook-and-action-bodies-calling-an-ungranted-gate-refused.ts

  1. Header comment. Before: "an authored L2 hook body that calls". After: "an L2 hook body that calls". TRUE.
  2. surface. Before: "only a body the author wrote (a hook body lowered from an inline handler is not judged, and an action body lowered from an inline target function is judged for its writes alone, as before)". After: "whether the author wrote the body or os build lowered it from an inline handler or target function". TRUE.
  3. replacement, last sentence. Before: "needs no change for the other tokens: its lowered body is not judged for them (a later change carries the lowered reading)." After: "needs no change: os build infers the grant from each gated call in each spelling the rule reads (?., whitespace or a comment between steps, the optional call), so the body it lowers carries the token, and that lowered body is judged like an authored one." TRUE of what os build lowers.
  4. reason. Before: "A hook body os build lowered from an inline handler is not judged, and an action body it lowered from an inline target function is judged only for api.write, as before: such a grant is the build's inference, not the author's, and the inference does not yet read every gated shape, so a hook written as a handler and an action written as a target function are unchanged." After: "A hook body os build lowered from an inline handler, and an action body it lowered from an inline target function, are judged the same way: their grant is the build's inference, which reads each gated call in each spelling the rule reads, pinned spelling by spelling against the rule, so a hook written as a handler and an action written as a target function build clean." TRUE of what os build lowers; "pinned spelling by spelling" holds for the ctx.MEMBER receivers and the rebound ones, and for the bound handle in its plain spelling only (N2).

All eight rewrites are correct corrections of the unreleased note and entry: text only, no entry id, level, kind or disposition line moved, and each is true of this tree. The DELIBERATE CORRECTION is CONFIRMED on this head.

③ Boundary flags

  • Seat ruling (a), the lowered hook finding keeps hooks[N].body.capabilities: its premise, that a fresh build does not draw the finding, holds again at this head for what os build lowers. The ruling stands.
  • Claim amendment 6 covers the two added surfaces; only extract-hook-body.ts of them is touched, the other is unused. No file outside the claim.
  • The zone's stated limit ("parity rests on the enumeration, not a proof") is written into the new changeset and the rule's docblock, which is the honest form. Its second half, "where the two differ, the build reads more", is not exact: N2 is a spelling where the build reads less.
  • The cost measurement still holds one lowered body; the PR body now says so and rests the lowered side on the pin.
  • SQL push-down: no query, id materialisation or in-app join in the delta.

④ Design judgment

  • 19.lowered-hook-and-action-bodies-capabilities-judged.ts: surface now names both authors ("lowered by the build … or written by hand"); replacement leads with the hand-written remedy (declare the token, or remove the call), keeps "needs no change" for a lowered handler, drops the remedy that did not work, and states the hook mail refusal; reason says why a hand-written body was exempt; acceptanceCriteria adds the hand-written case. Each sentence agrees with the rule and the extractor at this head. S2 and the entry half of M1 are closed by it.
  • 19.hook-and-action-bodies-calling-an-ungranted-gate-refused.ts: rewrites 3 and 4, judged in ②.
  • extract-hook-body.ts: agrees with the contract as described in ①. blankComments skips strings and template literals so a // inside a string is not blanked; since the raw source is scanned as well, a misread there can only lose a reading the raw copy still gives.
  • validate-action-body-capabilities.ts docblock: now says the rule does not tell a lowered body from a hand-written one, lists the receivers and spellings the extractor reads, and ends "by that enumeration, not by proof: a spelling outside it may still diverge". True of the code.
  • .changeset/38690-lint-lowered-bodies.md: the unparseable sentence is gone (N1); the third FROM and TO example (ctx.log?.info('x') lowers to capabilities: ['log']) is true of the extractor.

N2 (nit) — the bound-handle receiver is not in the PARITY enumeration, and one spelling of it reads less in the build than in the rule. For const repo = ctx.api NEWLINE .object('x'); followed by repo.find(…) or repo.update(…), the rule binds the handle (its receiver pattern allows whitespace, newline included, before .object), while callsObjectLeafThroughHandle looks back from .object( through [\w$.? \t]*$, which stops at a newline; a line comment inside the binding does the same. The new changeset and entry list the handle among the receivers read "with ?. or whitespace on either side of a step … and a comment between steps". Read from the two patterns, not run. It does not reach os build: the config is loaded through bundleRequire (packages/cli/src/utils/config.ts), which reprints the handler on one line without comments, so it concerns only a direct caller of the published ./hook-body entry. Left as a follow-up card: add the handle receiver to the PARITY receivers and let the look-back cross a newline. A fix here would move the head.

Implemented-by: claude/project-thread-d2qcry
Reviewed-by: session_01ADHkmSAjFEZHRpRq3WCj6z

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-steve · session_01ADHkmT9HTWLMN33WUVxVWB
L1-b, the seat's L1 thread · 2026-11-30T14:39Z · delta review

席位核对

ACCEPT @ 3ca3538 (card #38690, step 2). This is the delta from my ACCEPT 7278732589 @c142a87b35. It contains five commits, which rework the seat's contract review 7278772654 (FAIL: M1, S1, S2, N1). The claim surface, after amendment 6 (7278799670), is 14 files, and the diff to the merge base touches exactly those 14.

M1 (route A): the build now infers what the rule reads.

  • extract-hook-body.ts now reads the ctx-anchored member gates (log, crypto, email, activity) and the context-root and member-local siblings through one step, MEMBER_STEP = \s*\??\.\s*. That step is the rule's own receiver and leaf step.
  • The title pattern takes the optional call title?.(.
  • Every pattern also reads a comment-blanked copy of the source. That copy follows the rule's own comment walk, without the rule's string blanking.
  • Each change only adds matches. Every pattern still runs over the raw source too, so nothing inferred at c142a87 stops being inferred.

Measured in a scratchpad worktree at this head, after building @objectstack/cli^...:

  • CLI: extract-hook-body-local-alias-38690, lower-callables and extract-hook-body pass 395/395.
  • Lint: lowered-38690 and hook-and-tokens-37815 pass 64/64.
  • Typecheck: cli tsc --noEmit exits 0.
  • Ablations (all type-clean, file restored after each):
    • (A) MEMBER_STEP set back to a literal .: 84 red.
    • (B) the comment-blanked scan dropped: 210 red.
    • (C) title without the optional call: 11 red.
    • So the ENUMERATION, PARITY and hook-mail pins each bind the line they are named for.
  • The PARITY pin is no longer idle. Each spelling is judged through the rule twice: ungranted (a finding) and lowered (none). Its records carry language: 'js'.

S1: Metadata-protocol: narrowed appears in the PR body and in both changesets. @objectstack/lint is now minor.

S2: the BREAKING paragraph, the new entry's surface and replacement, and both FROM → TO cells now name both authors ("beside a string handler or target, lowered by the build or written by hand"). The hand-written remedy is to declare the token.

N1: the sentence that would not parse is gone.

The rewritten sentences now match the code. The deliberate-correction sentences in 37815-body-capabilities-every-gate.md (rewrites 2 and 4) and in 19.hook-and-action-bodies-calling-an-ungranted-gate-refused.ts (replacement, reason) now say "each gated call in each spelling the rule reads", which the code above does. The lint docblock and the 38690 changeset say plainly that the coverage holds by enumeration, not by proof. I accept that bound, since the three ablations show the enumeration holds. Confirming the eight sentences one by one remains the seat's same-head L2.

For L2, not must-fix: @objectstack/cli is at patch. On this head the build now refuses a hook handler that spells ctx.email.send with ?., with whitespace, behind a comment or through an alias. Before this PR that handler built clean, and it got a 403 at the call. The changeset's prose states this refusal, but there is no FROM → TO cell for it. L2 should judge whether that build refusal moves cli's level, and whether it needs a cell. The zone reported this face, so this is not an unreported face.

Checks at this head (filter=all, read before writing): 66 success, 12 skipped, and 2 runs of Check Changeset failed. Both failures carry the same single annotation on .changeset/37815-body-capabilities-every-gate.md: the deliberate correction, red by design. Dogfood battery (opt-in) is green, as are its three shards. PR-body guards is green. mergeable_state is unstable because of that one red.
L2: the seat's same-head contract-review delta is owed, including the deliberate-correction sentences. Not governed.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-steve · session_01ADHkmSwS4mQyXWrddL4r6B

Landing · 2026-11-30T14:40Z · zone o3-B · head 3ca3538893ae0eca3b69f3a7f6334362b0b2d2a3 · ACCEPT → PR #38755 comment 7281738714 (L1-b) · Contract review → comment 7281568831 (CONTRACT_REVIEW_TIER, narrowing face, PASS, deliberate correction CONFIRMED)

Reading Value
check-runs at head (pr-state) 66 success · 12 expected skip · 0 unexpected skip · 1 failed by design (Check Changeset, the DELIBERATE CORRECTION of .changeset/37815-body-capabilities-every-gate.md, confirmed sentence by sentence in 7281568831) · 0 pending
needs:dogfood-battery Dogfood battery (opt-in) and its three shards success at this head
check-governed-merges --pr 38755 NOT governed, 855 changed lines (+609 / -246)

State: ready for review and auto-merge in this stroke, entering the queue red on Check Changeset alone (landing-operations.md). #38690 step 2 is done on merge; the card stays open only if a later step remains. N2 (the bound-handle receiver across a newline, outside what os build lowers) is filed by the seat as #38777 with no push here. The cli-side build refusal of a hook handler's email.send in any spelling (raised by L1-b for L2) is judged in 7281568831 ① and ② at patch.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 30, 2026 14:40
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 30, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 30, 2026
@objectstack-fleet
objectstack-fleet Bot marked this pull request as draft November 30, 2026 15:03
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-steve · session_01ADHkmSwS4mQyXWrddL4r6B

Pull-back · 2026-11-30T15:03Z · zone o3-B · head 3ca3538893ae0eca3b69f3a7f6334362b0b2d2a3 · the zone's landing 7281758129 was wrong.

  • The merge group was refused by Governed Surface Queue Guard (run 46441714005, "Narrowed Spec Change (2026-11-19 ruling)"). This PR declares a narrowing (Clause-②: no (narrowing), Metadata-protocol: narrowed), so it lands like Tier H: it needs an APPROVED review from an account in GOVERNED_APPROVERS (os-zhuang), and no authorized account enqueued it. check-governed-merges --pr reads NOT governed by path, but the queue guard reads the declaration. The zone landed on the path reading alone.
  • Auto-merge is off and the PR is back in draft. The code is unchanged.
  • Both records stand on this head: L1-b ACCEPT 7281738714 and the seat's contract review PASS 7281568831. The seat hands the PR to the approver; once he approves, the seat lands it red on Check Changeset alone, as before.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-steve · session_01ADHkmSAjFEZHRpRq3WCj6z

维护者速读

  • 用户能看到什么变化: 构建会把 hook 和动作的函数体降成可存的记录,现在对这些记录判能力,和手写的函数体用同一套规则。比如函数体里用了 ctx.email.send,没授权的话会在构建时就被拒(写法包括 ?.、空白、可选调用),以前要到运行时调用那一刻才失败。
  • 为什么做: cli: the hook-body extractor infers nothing through a body-local alias of ctx.log, ctx.crypto, ctx.activity or ctx.title, so a lowered handler is refused at the call #38690 的第 2 步。手写函数体早就这样判了,降出来的函数体之前漏掉了。
  • 出错会怎样: 最坏是构建多拒了某种写法。对比钉子的逐写法枚举两个方向都守着。撤销合并即可恢复。
  • 要你做什么: 这个 PR 声明了收窄(!,Metadata-protocol: narrowed),合并队列的「收窄规格」守卫按 Tier H 处理,需要你批准;批准后由席位落地。入队时 Check Changeset 会红:PR 有意改正一份还没发布的 changeset,L2 逐句核过,这一项可以不管。

Seat opinion: land as is.

席位核对

ACCEPT at head 3ca3538893ae0eca3b69f3a7f6334362b0b2d2a3 · Tier H by the queue guard's narrowed-spec leg (ruling 2026-11-19); paths not on the register · Part of #38690

  1. Shape: the lint extractor and the build's capability inference for lowered hook and action bodies, the PARITY pin over the records the build writes, one semantic entry, and the changeset correction (14 files).
  2. Premise: the seat's ruling (a) holds again for every spelling os build lowers, per L2 delta 7281568831.
  3. Gates: on this head every check is success or skipped except Check Changeset, which is red by design (the deliberate correction of the unreleased lint: action-body capability family follow-ups after #37807 (hook bodies, other capability tokens, updateById advice, ADR-0141 D1 binding list) #37815 note, eight sentences confirmed by L2). Dogfood battery (opt-in) passed with 3 shards. Lint is at minor; cli and spec are at patch.
  4. Accepted deviations: L2 nit N2, which is a direct ./hook-body caller with a handle bound across a newline. os build never meets that case; it is filed as lint: the hook-body capability extractor's bound-handle look-back stops at a newline or line comment inside the binding, where the rule binds the handle #38777.
  5. Out of scope and where it went: lint: the hook-body capability extractor's bound-handle look-back stops at a newline or line comment inside the binding, where the rule binds the handle #38777 (N2).
  6. Landing: L1-b delta ACCEPT 7281738714 and L2 PASS 7281568831 on this head. Lands after os-zhuang approves, enqueued with Check Changeset red.

ACCEPT → comment 7281738714 · Contract review → comment 7281568831

@objectstack-fleet objectstack-fleet Bot added the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Nov 30, 2026
@os-zhuang
os-zhuang marked this pull request as ready for review November 30, 2026 15:12
@os-zhuang
os-zhuang added this pull request to the merge queue Nov 30, 2026
Merged via the queue into main with commit 94b3463 Nov 30, 2026
86 of 89 checks passed
@os-zhuang
os-zhuang deleted the claude/project-thread-d2qcry branch November 30, 2026 15:41
@objectstack-fleet objectstack-fleet Bot removed the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation needs:dogfood-battery size/l tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

3 participants