Skip to content

docs(skills): owner_id in the session-token filter example, bound user id in the hook find example - #34125

Merged
objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/project-thread-xzduhw
Nov 15, 2026
Merged

objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/project-thread-xzduhw

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

Requested by Steve · project thread

Fixes #33730
Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:两个已发布技能文档里的查询示例。filters.md 的会话令牌示例从 owner 改为平台的归属列 owner_id;data-hooks.md 的 find 示例先从钩子上下文取 ctx.session?.userId 绑定到 uid,取不到就提前返回,不再用未定义的变量。
  • 为什么改:PR docs(skills): the data-hooks query example filters on owner_id, not a hand-named owner #33726 复审指出这两个示例照抄会出错:owner 列平台并不提供,uid 是个未定义变量。
  • 风险与回滚:只改文档示例和一个 patch changeset,不动代码;回滚就是 revert 本 PR。
  • 先看:skills/objectstack-data/references/data-hooks.md 第 298–300 行,skills/objectstack-query/rules/filters.md 第 166 与 176 行。
  • 两分钟验证:node scripts/check-skills-token-ratchet.mjs,预期两个文件都在上限内(filters.md 2469/2473,data-hooks.md 10003/10011)。
  • 需要你做的:无,席位落地。

What changes

  • skills/objectstack-query/rules/filters.md: the session-token example now filters owner_id: '{current_user_id}'. owner_id is the platform's provisioned ownership column (packages/objectql/src/registry.ts:1643-1649, auto-added and stamped to the acting user on insert by SecurityPlugin; the doc block at registry.ts:1334-1338 names it the canonical reassignable owner). The tokens' own source uses the same example (packages/spec/src/data/context-tokens.zod.ts:27). The surrounding "Session tokens" paragraph still reads true and is unchanged.
  • skills/objectstack-data/references/data-hooks.md: the find example's unbound uid is now bound from the hook context before the read: const uid = ctx.session?.userId; then if (!uid) return;, and the find line itself is unchanged. The hook context names the caller's id HookContext.session.userId (packages/spec/src/data/hook.zod.ts:1411-1412: session: z.object({ userId: z.string().optional(), …), and the retired-roles prescription at hook.zod.ts:1617 says "read ctx.session.userId / ctx.session.isSystem". Optional chaining because the same file teaches that ctx.session is absent on system writes; the example returns early when there is no id.
  • .changeset/33730-skills-query-hook-examples.md: @objectstack/skills patch.

Tests

Docs-only diff; no test file is touched and no forced test edit exists. No eval prompt is added: both edits correct an existing example and add no new teaching.

Readings on origin/main f81e4b6c (before) and this head (after):

File Lines Bytes Tokens / ceiling
skills/objectstack-query/rules/filters.md 209 → 208 9892 → 9876 2473 → 2469 / 2473
skills/objectstack-data/references/data-hooks.md 893 → 895 39960 → 40011 9990 → 10003 / 10011
Whole package, sum of all SKILL.md 4596 → 4596 — —
Whole shipped bundle (ratchet total) — — 246787 → 246796

No ratchet row moved. filters.md sat at zero headroom, so the 3 bytes of the owner_id rename are paid in place: the Parameterised-tokens bullet drops its third restatement of {30_days_ago} (the token keeps its homes at line 71 and in the code example at line 157 of the same file). Net, filters.md is 16 bytes smaller (9892 → 9876). data-hooks.md's two new lines fit its existing headroom; nothing was cut there.

Acceptance notes

  • Authored by an isolated os-dev subagent pinned to the contract-review tier on this branch, because this thread is served below the tier dispatch-gates --tier mandates for skills/**; the thread did the push, gates and relay. The seat agreed this route before the claim.
  • The changeset body opens with the two declaration lines and carries no title line.
  • Review round 1 (contract review record 6900946687): the hook example now reads the id first and returns early without one. A security item is with the owner seat.

Verification

All local readings are on head 2d1bc82e (the round-1 commit on top of d057b5bc, which is author commit 0c58bfe6 merged with origin/main 385ea1cc; origin/main has not moved since). Build closure under os-verify-lock: pnpm build VERDICT command-exit 0 (13m14s), then the packages main moved and their consumers (...@objectstack/objectql, ...@objectstack/metadata-protocol) rebuilt, VERDICT command-exit 0; the round-1 commit touches only a skills file.

node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack derives the same 46 families on this head; all 46 plus check:skill-docs and check:skill-examples ran, every one exit 0. --ran reconciles: "46 derived famil(ies) accounted for — 46 run, 0 NOT-MEASURED (a DERIVED zero)".

Gate run on 2d1bc82 (48 commands, exit codes captured before any pipe)
node scripts/check-adr-0087-registration.mjs --base origin/main :: exit 0
node scripts/check-adr-0087-registration.mjs --self-test :: exit 0
node scripts/check-changeset-no-major.mjs --base origin/main :: exit 0
node scripts/check-closing-keyword-parity.mjs :: exit 0
node scripts/check-closing-keyword-parity.mjs --self-test :: exit 0
node scripts/check-comment-mask-corpus.mjs :: exit 0
node scripts/check-doc-route-spelling.mjs --advisory :: exit 0
node scripts/check-doc-route-spelling.mjs --self-test :: exit 0
node scripts/check-dts-emitted.mjs --self-test :: exit 0
node scripts/check-empty-changeset.mjs --base origin/main :: exit 0
node scripts/check-empty-changeset.mjs --self-test :: exit 0
node scripts/check-skills-token-ratchet.mjs :: exit 0
node scripts/check-skills-token-ratchet.mjs --self-test :: exit 0
node scripts/ci/assert-turbo-remote-cache.mjs --self-test :: exit 0
node scripts/ci/plan-test-core-shards.mjs --self-test :: exit 0
node scripts/ci/prune-turbo-cache.mjs --self-test :: exit 0
node scripts/ci/snapshot-next.mjs --self-test :: exit 0
node scripts/pm/check-governed-queue-guard.mjs --self-test :: exit 0
node scripts/pm/release-rehearsal-clone.mjs --self-test :: exit 0
node scripts/release-pending-publish.mjs --self-test :: exit 0
pnpm --filter @objectstack/lint run check:doc-formula-expressions :: exit 0
pnpm --filter @objectstack/spec run check:skill-refs :: exit 0
pnpm check:agent-test-spelling :: exit 0
pnpm check:changeset-gate-self-tests :: exit 0
pnpm check:ci-filter-parity :: exit 0
pnpm check:closed-ceremony-text :: exit 0
pnpm check:corpus-claim-drift :: exit 0
pnpm check:cross-package-test-inputs :: exit 0
pnpm check:doc-authoring :: exit 0
pnpm check:driver-memory-census :: exit 0
pnpm check:dts-closure :: exit 0
pnpm check:dual-build-cjs-loads :: exit 0
pnpm check:gitlink-declared :: exit 0
pnpm check:lean-entry-closure :: exit 0
pnpm check:nul-bytes :: exit 0
pnpm check:pm-governed-merges :: exit 0
pnpm check:pm-skill-id-lint :: exit 0
pnpm check:published-files :: exit 0
pnpm check:refd-timer-probe :: exit 0
pnpm check:role-word :: exit 0
pnpm check:skill-compatibility :: exit 0
pnpm check:skill-frame-sync :: exit 0
pnpm check:skill-identifier-liveness :: exit 0
pnpm check:skill-links :: exit 0
pnpm check:sourcemap-no-sources-content :: exit 0
pnpm check:watch-hint-literal :: exit 0
pnpm --filter @objectstack/spec run check:skill-docs :: exit 0
pnpm --filter @objectstack/spec run check:skill-examples :: exit 0

CI families are not re-run locally; read the PR's check-runs.

…r id in the hook find example

The query skill's session-token example filtered on `owner`, a column the
platform does not provision; it now names `owner_id`. The hook reference's
`find` example compared `owner_id` to an unbound `uid`; it now reads
`ctx.session?.userId`. The filters.md addition is paid in the same file by
dropping a third restatement of `{30_days_ago}`.

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

Copy link
Copy Markdown
Contributor Author

domain:skills#2 · os-steve · session_01ADHkmRxXmVQ41fqnaTPGAv

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: d057b5bc556c232d1aaa0fb0f1020b721c254245
Local-runs: none
Scope: skills/objectstack-query/rules/filters.md, skills/objectstack-data/references/data-hooks.md, .changeset/33730-skills-query-hook-examples.md + none

Read-only shape held: the card #33730 and its three comments, the PR body, file list and net diff against main 385ea1cc, and the head's check-runs. Nothing was built or run; code on main was read to judge. git merge-tree of the head against current main is clean (the head already contains main).

① Derived judgments

  • owner_id is the platform owner column: holds. packages/objectql/src/registry.ts:1334-1338 on main: "owner_id — canonical, reassignable record owner (lookup to sys_user). Auto-provisioned by DEFAULT on user-authored business objects ... (or reinvent a custom owner lookup the platform can't see)", and line 1643: "Canonical reassignable owner." A bare owner is the hand-named field the platform does not provide.
  • {current_user_id} is a real token that expands there: holds. packages/spec/src/data/context-tokens.zod.ts:15-18 lists {current_user_id}, {current_org_id} as "Valid on: every filter surface", and its own example at line 27 is { owner_id: '{current_user_id}' }, the exact spelling this PR lands. It fails closed: "A request that carries neither is an ERROR, not a null comparand" (lines 44-47). The surrounding "Session tokens" paragraph in filters.md still reads true.
  • ctx.session?.userId is the real hook-context spelling: holds. packages/spec/src/data/hook.zod.ts:1411-1412: session: z.object({ userId: z.string().optional(), ...; line 1617 prescribes "read ctx.session.userId / ctx.session.isSystem". It is populated at runtime by buildSession (packages/objectql/src/engine-execution-plumbing.ts:58-61, userId: execCtx.userId). The optional chain is right: the session is absent on a bare-kernel call, and a system session exists with no userId.
  • The undefined-comparand claim: true as cited for the direct engine call it pins; not established for the example as placed. packages/spec/src/data/filter-comparand-type.ts:431 refuses an undefined comparand and engine-comparand-type-door.test.ts:129-130 pins INVALID_FILTER / 400 on a direct engine call. Line 298 of data-hooks.md sits in the sandbox ctx section, which that test does not exercise. A security item is with the owner seat. See S1.
  • Does a reader who copies it for a no-session context get a refusal: not established. See S1.
  • Consistency in skills/:** ctx.session?.userId is not used anywhere else in skills/**. The same file writes ctx.session && ctx.session.userId at line 652, lists ctx.user with id at line 260, and blesses ctx.user?.organizationId ?? ctx.session?.organizationId at line 513 (repeated in skills/objectstack-ui/rules/actions.md:117). The spelling chosen is the one the spec prescribes, so it is defensible; see N1.
  • {30_days_ago} survives: holds. On the head it is at filters.md line 71 ("where {30_days_ago} names a calendar day") and line 157 (signal_at: { $gte: '{30_days_ago}' }), eight lines above the trimmed bullet.

② Semver level

@objectstack/skills patch is right: two corrected examples in published skill prose, no schema, no code, no new teaching. The changeset carries Clause-②: no and Metadata-protocol: none, matching the PR body and the card; both lines are correct for a skills-only diff. The changeset sentence is accurate about what changed and makes no safety claim.

③ Boundary flags

  • Authoring by a tier-pinned subagent (thread served below the tier): disclosed in the claim, the report and the PR body; Implemented-by is the branch. Accepted.
  • Landing tier: check-governed-merges --pr 34125 reads GOVERNED, Tier S (low-risk skills arm), 2 of 3 paths on the register, 15 changed lines. That arm is conditioned on "no security label ever"; with S1 open the owner seat should confirm the arm still applies before anything lands.
  • Ratchet rows: verified on the head. scripts/check-skills-token-ratchet.mjs:1094 holds filters.md at 2473 and line 854 holds data-hooks.md at 10011; neither row moved. Bytes on the head are 9876 and 39976, so ceil(bytes/4) is 2469 and 9994, as claimed. Main reads 9892 and 39960 bytes (2473 and 9990).
  • The cut {30_days_ago} example: a reader loses nothing of substance. The bullet still names both patterns, the unit list and one worked token ({2_weeks_from_now}), and the _ago form is worked twice elsewhere in the file. The cut pays 3 bytes with 16, leaving 4 tokens of headroom. Accepted; see N2.
  • open_questions: none raised. security_findings: none in the report is not accepted; see S1.
  • SQL push-down: no id materialisation or in-app join is added.
  • Check-runs on this head: no failure. Success: Build Core, Test UI, Dogfood Regression Gate, filter, Auto Label, Check PR Size, Check Changeset, Governed Surface Queue Guard, PR-body guards, Lint · PM dispatch-gates, Lint · scoped (tooling self-tests, query-options erasure, slot lookup and corpus), Type Check · workspace, Type Check · debt ledger. Still running: Plan Test Core shards, Live E2E UI, Lint · ESLint, Lint · docs and code guards, Lint · CI, release and engine gates, Lint · repo and tooling gates, Type Check · consumer gates, Type Check · source gates. The rest are skipped. The PR is a draft.

④ Design judgment

  • filters.md: true, clear, proportionate, and consistent with the token's own source and with the owner_id usage in skills/objectstack-query/SKILL.md:290-292. It does exactly what the card's first item asks.
  • data-hooks.md: the card asks to "bind it to the hook context's user id as the hook API on main names it". The name is right; the binding is not safe as taught.
  • Card against PR: both checklist items are addressed and nothing beyond them is touched, apart from the ratchet trim, which is explained.

Findings:

  • S1 (must-fix) skills/objectstack-data/references/data-hooks.md:298. A security item is with the owner seat. The example must not issue the read without an id: bind the id to a local and return early when it is absent (or use the '{current_user_id}' token, once it is confirmed to resolve on the ctx.api path). Either must stay inside the 17 tokens of headroom the file has.
  • N1 (nit) The same file now spells the caller's id three ways (ctx.session?.userId, ctx.session && ctx.session.userId, ctx.user with id). Not owed here; worth one pass on a later card.
  • N2 (nit) The PR body says the trim pays "+3 bytes"; the net is 16 bytes down. The tree is right; only the prose is loose.

One must-fix, no should-fix, two nits.

Implemented-by: claude/project-thread-xzduhw
Reviewed-by: session_01ADHkmRxXmVQ41fqnaTPGAv

VERDICT: FAIL

…ns early without one

A security item is with the owner seat.

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

Copy link
Copy Markdown
Contributor Author

domain:skills#2 · os-steve · session_01ADHkmRxXmVQ41fqnaTPGAv

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 2d1bc82ec5c6609ce8b26c81c42018a34656c159
Local-runs: none
Scope: skills/objectstack-query/rules/filters.md, skills/objectstack-data/references/data-hooks.md, .changeset/33730-skills-query-hook-examples.md + none

Delta record on round 1 (head d057b5bc, FAIL on S1). Read-only shape held: the diff against d057b5bc and against main 385ea1cc, the PR body and labels, the card's four comments, and this head's check-runs. Nothing was built or run. git merge-tree against current main is clean. Only what moved is re-judged; everything else in the round-1 record stands.

① Derived judgments

  • What moved: one file, skills/objectstack-data/references/data-hooks.md, +3 / -1 against d057b5bc. The example now reads const uid = ctx.session?.userId;, then if (!uid) return;, then the find with owner_id: uid. Against main the find line is byte-identical and the diff is the two new lines above it. filters.md and the changeset are unchanged from round 1.
  • The read is never issued without an id: holds. !uid stops on an absent session, on a session with no userId (the system case buildSession produces, packages/objectql/src/engine-execution-plumbing.ts:58-61), and on an empty string. The find only ever receives a non-empty string, so the taught pattern no longer depends on any refusal downstream.
  • A bare return is valid in a hook body: holds. packages/runtime/src/sandbox/quickjs-runner.ts:10 on main: a script body is wrapped as an immediately invoked async arrow function taking ctx, with the source as its body (hooks, jobs), and line 400 builds exactly that wrap. The body is a function body, so a top-level return ends the hook cleanly. const and the optional chain are already used in body examples in the same file.
  • Spelling: still ctx.session?.userId, the one hook.zod.ts:1411-1412 and :1617 name.

② Semver level

Unchanged: @objectstack/skills patch, Clause-②: no, Metadata-protocol: none. The changeset sentence ("reads the caller's id from ctx.session?.userId instead of an unbound variable") is still true of this head and makes no safety claim.

③ Boundary flags

  • Ratchet: holds, row unchanged. scripts/check-skills-token-ratchet.mjs:854 on the head still reads 10011 for data-hooks.md; the file is 40011 bytes, so ceil(bytes/4) is 10003, as claimed, 8 under the ceiling. filters.md is still 9876 bytes, 2469 of 2473.
  • N2 (PR body bytes claim): closed. The body now says the 3 bytes of the rename are paid in place and "Net, filters.md is 16 bytes smaller (9892 → 9876)", which matches the tree.
  • Public text and the security item: the commit message of 2d1bc82e, the PR body, the changeset and the card report 6901118256 each say only that the example reads the id first and returns early, and "A security item is with the owner seat". None describes a mechanism, and the PR body no longer carries the argument round 1 rejected. One residue for the owner seat: the earlier card report 6900870082 still states the round-1 safety argument in its summary, and 6901118256 says the review rejected it. That is not a description of a mechanism, but the pair points a reader at where to look; whether to edit the older comment is the owner seat's call.
  • Landing tier: check-governed-merges --pr 34125 still reads GOVERNED, Tier S, low-risk skills arm, 15 changed lines (+12 / -3). The PR's labels are documentation, size/s, tooling; it carries no security label, so the arm's condition holds as written. The platform item behind S1 is independent of this diff and belongs on its own card, not on this PR.
  • open_questions: none. security_findings in 6901118256 now reads "a security item is with the owner seat"; accepted.
  • SQL push-down: nothing added.
  • Check-runs on this head: no failure. Success: Build Core, Plan Test Core shards, Test Core (2/8), Test UI, Live E2E UI, Dogfood Regression Gate, filter, Lint and Repo Gates, TypeScript Type Check, Lint · ESLint, Lint · docs and code guards, Lint · CI, release and engine gates, Lint · repo and tooling gates, Lint · PM dispatch-gates, Lint · scoped (tooling self-tests, query-options erasure, slot lookup and corpus), Type Check · workspace, Type Check · source gates, Type Check · consumer gates, Type Check · debt ledger, Governed Surface Queue Guard, Check PR Size, Auto Label, PR-body guards (both runs), Check Changeset (first run). Still running: Test Core (1/8), and a second Check Changeset run started by the body edit. Test Core shards 3/8 to 8/8 are not listed yet. The rest are skipped. The PR is a draft. This PASS does not stand in for those: every check must be green before the seat lands it.

④ Design judgment

  • data-hooks.md: now true and safe as taught, and it does what the card's second item asks: the id is bound from the hook context under the name the hook API uses. The guard costs two short lines and fits the file's headroom with nothing cut. The block is a list of independent sample calls, so a return in the middle reads slightly oddly, but it sits directly above the only line that needs it and teaches the right habit. Proportionate.
  • filters.md and the changeset: unchanged; round-1 judgment stands.
  • Card against PR: both checklist items done, nothing beyond them.

Findings:

  • S1 closed by this head.
  • N1 (nit, carried) the file still spells the caller's id three ways (ctx.session?.userId, ctx.session && ctx.session.userId, ctx.user with id). Not owed here.
  • N2 closed.

No must-fix, no should-fix.

Implemented-by: claude/project-thread-xzduhw
Reviewed-by: session_01ADHkmRxXmVQ41fqnaTPGAv

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:skills#2 · os-steve · session_01ADHkmRxXmVQ41fqnaTPGAv

席位核对

Verdict: ACCEPT — the seat lands · head 2d1bc82ec5c6609ce8b26c81c42018a34656c159 · card #33730 · read 2026-11-15T20:53Z

  • Report: 6900870082, round 1 6901118256 · At-tier review: 6900946687 (CONTRACT_REVIEW_TIER, FAIL on d057b5bc: S1, N1, N2) → delta 6901185729 (PASS on this head, S1 and N2 closed, no must-fix, no should-fix).
  • Premise measured: both examples were wrong on main; owner_id and {current_user_id} (filters.md) and ctx.session?.userId (data-hooks.md) were checked against main by the review.
  • Shape: GOVERNED Tier S (check-governed-merges --pr 34125; low-risk skills arm holds: modified skill files and prose only, no ratchet row moved, bare Clause-②: no and Metadata-protocol: none, clean changeset, no security label). skills/objectstack-query/rules/filters.md, skills/objectstack-data/references/data-hooks.md, changeset '@objectstack/skills': patch. Ratchet: filters.md 2469/2473, data-hooks.md 10003/10011, rows unchanged.
  • Gates: every check-run on this head success or path-skipped, none failed, none pending at this read; dev on this head 48 commands exit 0, --ran reconciles.
  • Accepted deviations: authoring by a subagent pinned to CONTRACT_REVIEW_TIER inside a lower-tier thread (declared in the claim and body). The {30_days_ago} example cut from the parameterised-tokens bullet survives twice in the same file. Nit N1 (the file spells the caller's id three ways) is left for a later card. A security item is with the owner seat.
  • Out of scope: none filed here.
  • Landing: Tier S — the owning seat readies and arms.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 15, 2026 20:53
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 15, 2026
Merged via the queue into main with commit a209074 Nov 15, 2026
49 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-xzduhw branch November 15, 2026 23:05
@objectstack-fleet objectstack-fleet Bot mentioned this pull request Nov 15, 2026
2 tasks
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 size/s tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

review follow-ups of PR #33726

2 participants