Repository navigation
feat(lint)!: judge a lowered hook or action body's capabilities like an authored one - #38755
Conversation
…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>
📓 Docs Drift CheckThis PR changes 3 package(s): 21 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 2 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails. What this run could not see
Coarse fallback — 192 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # 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
|
…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>
|
repo:objectstack#3 · os-steve · session_01ADHkmSwS4mQyXWrddL4r6B Final green head · 2026-11-30T12:33Z · zone o3-B ·
|
|
repo:objectstack#3 · os-steve · session_01ADHkmT9HTWLMN33WUVxVWB 席位核对ACCEPT @ c142a87 (card #38690, step 2,
Checks at this head (read before writing): 65 success, 12 skipped. There are 3 failures:
|
|
repo:objectstack#3 · os-steve · session_01ADHkmSAjFEZHRpRq3WCj6z Contract reviewServed-tier: Face: narrowing. PR #38755, card #38690 step 2, PR body ① Derived judgments
② Semver levelLevels: S1 (should-fix) — Deliberate correction, sentence by sentence. Each AFTER sentence judged against the tree at the head.
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
④ Design judgmentM1 (must-fix) — the build does not infer every gated call the rule reads, so an inline handler or
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 Judged and found to hold:
N1 (nit) — Implemented-by: 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
|
repo:objectstack#3 · os-steve · session_01ADHkmSwS4mQyXWrddL4r6B Final green head · 2026-11-30T14:28Z · zone o3-B ·
|
|
repo:objectstack#3 · os-steve · session_01ADHkmSAjFEZHRpRq3WCj6z Contract reviewServed-tier: Delta review of record 7278772654 (FAIL at M1: closed No must-fix, no should-fix. ① Derived judgments
② Semver level
Deliberate correction, sentence by sentence, each AFTER sentence judged against the tree at this head.
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
④ Design judgment
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 Implemented-by: VERDICT: PASS |
|
repo:objectstack#3 · os-steve · session_01ADHkmT9HTWLMN33WUVxVWB 席位核对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.
Measured in a scratchpad worktree at this head, after building
S1: S2: the BREAKING paragraph, the new entry's N1: the sentence that would not parse is gone. The rewritten sentences now match the code. The deliberate-correction sentences in For L2, not must-fix: Checks at this head (filter=all, read before writing): 66 success, 12 skipped, and 2 runs of |
|
repo:objectstack#3 · os-steve · session_01ADHkmSwS4mQyXWrddL4r6B Landing · 2026-11-30T14:40Z · zone o3-B · head
State: ready for review and auto-merge in this stroke, entering the queue red on |
|
repo:objectstack#3 · os-steve · session_01ADHkmSwS4mQyXWrddL4r6B Pull-back · 2026-11-30T15:03Z · zone o3-B · head
|
|
repo:objectstack#3 · os-steve · session_01ADHkmSAjFEZHRpRq3WCj6z 维护者速读
Seat opinion: land as is. 席位核对ACCEPT at head
ACCEPT → comment 7281738714 · Contract review → comment 7281568831 |
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维护者速读
ctx.log?.info(…)这类可选链、空白、注释写法,自动补上权限。What changes
validate-action-body-capabilities(@objectstack/lint) skipped a body it took for one the build lowered: a hook bodyos build/os verifylowered from an inlinehandler, and at the runtime publish doors any hook body beside a stringhandler(isLoweredHandlerBody); and any action body beside a stringtarget, judged forapi.writealone (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:
isLoweredHandlerBody,isLoweredTargetBody,loweredActionBodyPaths).validateActionBodyCapabilitiesno longer takes theloweredHookRefscontext, and its registry entry passes the stack alone. Neither function was on the package's barrel.packages/cli/src/utils/extract-hook-body.ts) infer each gated call in each spelling the rule reads. Itsctx-anchored member patterns, and their rebound siblings for a renamed or destructured hook context, were literalctx.log.info:ctx.log?.info(…),ctx?.crypto.randomUUID(),ctx.activity?.append(…),ctx.email?.send(…),ctx . log . info(…)andctx.title?.(field)lowered without their token, and the rule read each as the gated call. Each step now takes?.and whitespace,titletakes 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 callsctx.email.sendin any of these spellings now lowers with the grant and is refused at build by the hook parse, asctx.email.send(…)already was.SANDBOX_CAPABILITY_GATESandtype SandboxCapabilityGatefrom the lint barrel, and moves the step-1 CLI enumeration pin off its hand-kept mirror onto that table.?.before the member, before the leaf and before the call, whitespace, a block or line comment between steps), is lowered throughextractLoweredBodyand judged byrunAuthoringRules('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'semail.send, pinned instead as a build refusal in every spelling.os explainentries, the docs rule table, the rule's docblock and the comment over thelowerCallablestarget-shape pin.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.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.sendon a hook, which is refused at build as before.Measured cost before the change, on
origin/mainatf782a12033(scratch script, not committed): every first-party stack (examples/app-crm,app-multi-packagewith its two packages,app-showcase,app-starter,app-todo,packages/apps/connector-docusign,connector-github,connector-stripe) loaded, normalized, lowered and parsed asjudgeAuthorTimeRulesdoes, 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
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/lintand 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 readsSANDBOX_CAPABILITY_GATESand spells every leaf in every spelling through seven receivers; PARITY and REBOUND as above; a hook handler callingctx.email.sendin seven spellings plus a renamed context is refused byHookSchemaafterlowerCallables.Red first, each fix:
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.?./ whitespace / optional call / rebound: the pins against the extractor ata68c0a41cc: 76 failed of 247 (ENUMERATION 27, PARITY 24, REBOUND 25). Hook mail in the new spellings: 4 failed of 8 (they built clean before).2aec12e986: 210 failed of 284, every one a comment spelling.Ablations at the head (
scripts/ablation-replace.mjs, restore proven blob == HEAD):MEMBER_STEPback to a plain\.: 84 failed (ENUMERATION 32, PARITY 28, REBOUND 20, mail 4).titlewithout 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)andauthored 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 namedisLoweredTargetBody. The pin itself is unchanged.Acceptance notes
hooks[N].body.capabilitieson 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.mdhook-body-capability-undeclaredbullet. Before: "an authored L2 hook body that calls any of those gates" … "Only a body the author wrote is judged: a hook bodyos build/os verifylowered from an inlinehandleris not, since its grant is the build's inference (the lowered reading is cli: the hook-body extractor infers noapi.transactionand noapi.readthrough 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 bodyos build/os verifylowered from an inlinehandleris 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."action-body-capability-undeclaredbullet. Before: "an authored L2 action body that calls a gate other than the writes without its token. An action bodyos build/os verifylowered from an inlinetargetfunction is not judged for these tokens, since its grant is the build's inference (the lowered reading is cli: the hook-body extractor infers noapi.transactionand noapi.readthrough a bound object handle, so a lowered handler's inferred capabilities miss calls it makes #38653); its writes are still judged underaction-body-write-capability-undeclared." After: "an L2 action body that calls a gate other than the writes without its token. An action bodyos build/os verifylowered from an inlinetargetfunction is judged the same way, against the grant the build inferred from its calls."handleris unchanged: FROM and TO alike, it is not judged by this rule. So is an action whose body was lowered from an inlinetargetfunction, for every token butapi.write: … TO, it still builds clean, and its writes are judged as before." After: "A hook written as an inlinehandler, and an action written as an inlinetargetfunction, 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 grantedapi.transaction."packages/spec/src/migrations/entries/semantic/19.hook-and-action-bodies-calling-an-ungranted-gate-refused.ts(entryhook-and-action-bodies-calling-an-ungranted-gate-refused, id unchanged)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".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."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. WithMEMBER_STEPinextract-hook-body.tsset back to a plain\., 84 of them fail.Read first: the
MEMBER_STEP/memberLeafRx/blankCommentsblock and the inference loop inpackages/cli/src/utils/extract-hook-body.ts, then the PARITY block in the test above, then the two removed skips inpackages/lint/src/validate-action-body-capabilities.ts.Local gates at 3ca3538 (head)
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstacklisted 122 commands (the 119 of the last round pluscheck:i18n,check:i18n-coverage,check:i18n-walk-parity); each ran with stdin closed and its exit recorded before any pipe: 121 :: exit 0, andnode 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.pnpm --filter @objectstack/lint test252 files / 10106 tests passed; clivitest run --project unit451 files / 6737 tests passed;pnpm --filter @objectstack/lint typecheckandpnpm --filter @objectstack/cli typecheckexit 0; spec rebuilt,src/migrations5 files / 209 tests passed.node scripts/check-changeset-no-major.mjs --base origin/main --eventover this body: exit 0 (level axis:@objectstack/lintminor carriesMetadata-protocol: narrowed; ADR-0087registered lowered-hook-and-action-bodies-capabilities-judged).node scripts/pm/overlap-check.mjsat 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.integrationlayer andtest:repo(CI's Test Core); the dogfood battery is CI's on this head (!title, narrowing arm).Generated by Claude Code