Skip to content

docs(skills): teach the approvals inbox nav entry gated on the approvals service, not requiresObject - #33283

Merged
os-zhuang merged 1 commit into
mainfrom
claude/project-thread-dk76uo
Nov 14, 2026
Merged

os-zhuang merged 1 commit into
mainfrom
claude/project-thread-dk76uo

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Leehom · project thread

Fixes #33235

domain:skills#1 · os-project-manager · session_01FEkQ5kCq2ZxdEfiiXADAhS

Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:objectstack-ui 技能的导航规则示例里,审批入口从「type: 'object' 指向 sys_approval_request + requiresObject 门」改为平台 Account 应用同款写法:type: 'component'、componentRef: 'approvals:inbox'、requiresService: 'approvals',并用一句注释说明为何不能用 requiresObject;对应 eval 的期望输出与断言同步改。
  • 为什么改:照抄旧示例的应用里,非管理员审批人(销售经理、主管等)在没有任何审批单涉及他们之前,读 sys_approval_request 的对象元数据得 404,控制台据此把入口裁掉,于是新环境里没有一个审批人看得见审批收件箱。
  • 风险与回滚:纯技能文字,skills/** 两个文件各改 3 行、净增 0 行;不动 schema、不动运行时;回滚即还原本 PR。
  • 先看:skills/objectstack-ui/rules/navigation.md 第 37–39 行,再看 eval 第 17、20–21 行。
  • 两分钟验证:git diff origin/main -- skills/,预期只见审批那一项换成 component + requiresService: 'approvals',eval 断言改为要求 approvals:inbox、requiresService,并禁止 requiresObject: 'sys_approval_request'。
  • 需要你做的:受管面 Tier H(skills/**):请批准或合并。

What changes

  • skills/objectstack-ui/rules/navigation.md lines 37–39, inside the os:check app example. The approvals item

    { id: 'nav_approval_requests', type: 'object', objectName: 'sys_approval_request', label: 'Approval Requests', icon: 'inbox', requiresObject: 'sys_approval_request' }

    becomes

    { id: 'nav_approvals', type: 'component', componentRef: 'approvals:inbox', label: 'Approvals', icon: 'inbox', requiresService: 'approvals' }

    and the comment that taught "Reference system objects via requiresObject so the menu auto-hides" now reads "The inbox component, gated on the approvals service. Not requiresObject: the object read answers 404 to approvers until a request involves them."

  • skills/objectstack-ui/evals/views-apps-actions-pages.json eval 2. expected_output describes the approvals inbox as type: 'component', componentRef: 'approvals:inbox' gated by requiresService: 'approvals', never requiresObject: 'sys_approval_request'. must_contain swaps requiresObject for approvals:inbox and requiresService; must_not_contain adds requiresObject: 'sys_approval_request'.

  • .changeset/33235-skills-approvals-inbox-nav-gate.md: '@objectstack/skills': patch, carrying both declaration lines.

Why

The shape taught is the platform's own, quoted from packages/platform-objects/src/apps/account.app.ts lines 114–128 on origin/main d4fbb4d (comment lines trimmed):

id: 'nav_account_approvals',
type: 'component',
label: 'Approvals',
componentRef: 'approvals:inbox',
icon: 'check-circle',
// `requiresObject` cannot gate a component item — it names the
// object the entry ROUTES to, and this one routes to a component.
// The capability that must be present is the approvals SERVICE
// (`ctx.registerService('approvals', …)` in plugin-approvals), ...
requiresService: 'approvals',

The same file (lines 100–109) also explains why the destination is the component and not the sys_approval_request grid: the decision actions need the viewer block that only the approvals REST path attaches, so the object route renders rows an approver cannot act on. The new example teaches both halves.

How each gate is applied, read on origin/main d4fbb4d:

  • requiresService is enforced server-side. packages/rest/src/meta-item-read-gate.ts:1098 (the app) and :1110 (each navigation entry, inside filterNav) drop an entry whose service the kernel does not hold; resolveRegisteredServices (:1304) probes every requiresService named under navigation, areas, children and widgets, and fails open when the kernel cannot be probed. plugin-approvals registers the service at packages/plugins/plugin-approvals/src/approvals-plugin.ts:414 (ctx.registerService('approvals', this.service)).
  • The console passes requiresService through and prunes requiresObject. ui/packages/app-shell/src/views/nav-menu-renderer.tsx:336-337 asks checkCap('object', …) and checkCap('service', …); checkCap (:251-264) judges objects against the served object scope and returns true for every service, so the console relies on the server having already stripped an unavailable one. This refines the order's mechanism assumption ("the console really prunes requiresService items"): the server prunes, the console does not re-check. It agrees with the card, which says only that the console prunes against the served objects, and with the Account app's own comment.
  • componentRef: 'approvals:inbox' resolves through the console's component registry: ui/apps/console/src/registerApprovalsComponents.tsx:59 registers ref: 'approvals:inbox' to the Approvals Inbox page, mounted at /apps/{app}/component/approvals/inbox.
  • The schema accepts the shape. packages/spec/src/ui/app.zod.ts:451 declares requiresService on every navigation item and :741 declares componentRef on the component item. The example sits in an os:check block and type-checks (Verification below).

The card's measurement on 18.4.0 (a non-administrator approver reads GET /api/v1/meta/object/sys_approval_request as 404 until a request involves them) was not re-measured here; the fix does not depend on it, because the taught item no longer names the object at all.

Acceptance notes

  • Other copies swept with git grep on origin/main d4fbb4d over skills/ for requiresObject, requiresService, sys_approval_request and approvals:inbox: the navigation rule and its eval are the only places that teach the approvals nav entry. skills/objectstack-ui/SKILL.md:166-168 states the general rule (use requiresObject / requiresService on an item that depends on an optional object or service) and stays correct; SKILL.md:192's blueprint row lists requiresObject as a navigation pattern and names no approvals entry, so it is untouched. The sys_approval_request mentions under skills/objectstack-automation/ describe the approval state table, not navigation.
  • HotCRM-derived apps that copied the old shape (the card cites a downstream app) are not touched here; the skill text is the whole scope of this card.

Verification

Head 77236122, base origin/main d4fbb4d.

Line and token budget (skills/**)
  • Net lines in skills/**: +6 / -6, net 0, inside the order's +4 budget.
  • skills/objectstack-ui/rules/navigation.md: 163 to 163 lines, 8713 to 8727 bytes; token ratchet 2179 to 2182 (ceiling 2184, headroom 2). The first wording measured 2185 (over by 1); the comment was shortened, no ceiling moved.
  • skills/objectstack-ui/evals/views-apps-actions-pages.json: 175 to 175 lines; 3992 to 4052 tokens (eval fixture, measured, not ratcheted).
  • Whole package, all skills/*/SKILL.md: 4601 to 4601 lines, 235620 to 235620 bytes (no SKILL.md touched). Bundle total (whole shipped tree): 244205 to 244268 tokens.
  • node scripts/pm/check-skill-line-ratchet.mjs: exit 0 before and after. node scripts/check-skills-token-ratchet.mjs: exit 0.
Derived gates: 44 derived, 40 run green, 4 NOT MEASURED

node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack derived 44 families for the three paths. Each was run with its exit code captured before any pipe:

  • 39 exit 0 on the first run, among them check-adr-0087-registration (scan and --self-test), check-changeset-no-major, check-empty-changeset (scan and --self-test), check-skills-token-ratchet (scan and --self-test), check:changeset-gate-self-tests, check:doc-authoring, check:nul-bytes, check:pm-governed-merges, check:published-files, check:skill-compatibility, check:skill-frame-sync, check:skill-identifier-liveness, check:skill-links.
  • @objectstack/lint check:doc-formula-expressions: first exit 3 (no lint dist); after building @objectstack/formula and @objectstack/lint under the verify lock (VERDICT command-exit 0, 95s) it exits 0.
  • NOT MEASURED, exit 3 PREREQUISITE NOT MET, each reading every package's dist/: check:dts-closure, check:dual-build-cjs-loads, check:lean-entry-closure, check:sourcemap-no-sources-content. No package source is touched, so no full build was paid locally; CI builds and runs them.
  • --ran reconciliation: "44 derived famil(ies) accounted for — 40 run, 4 NOT-MEASURED (4 DERIVED from a recorded exit 3)".
  • Extra, not derived: pnpm --filter @objectstack/spec check:skill-examples exit 0 after building the @objectstack/client-react closure under the verify lock (VERDICT command-exit 0, 210s): "344 prose examples type-check across 3 surface(s) — every marked block parsed, so tsc ran the SEMANTIC pass on all of them". That covers the edited os:check block.
  • CI families are read from this PR's check-runs, not re-run here.
Tier and governed readings
  • dispatch-gates --tier: MANDATORY contract-review tier, both skills/** paths under clause ① (the published catalog); no one-line exit for this surface.
  • node scripts/pm/check-governed-merges.mjs --branch claude/project-thread-dk76uo: exit 3, GOVERNED, landing tier H (人合). 2 of 3 paths hit the register (skills/** x2); the changeset is not on it. Size +16 / -6, under the 3000 threshold.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FEkQ5kCq2ZxdEfiiXADAhS

…als service, not requiresObject

The objectstack-ui navigation rule and its eval taught the approvals
entry as an object item gated by requiresObject: 'sys_approval_request',
which hides it from non-admin approvers until a request involves them.
Teach the Account app's shape instead: type 'component',
componentRef 'approvals:inbox', requiresService 'approvals'.

Claude-Session: https://claude.ai/code/session_01FEkQ5kCq2ZxdEfiiXADAhS
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 14, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:skills#1 · os-project-manager · session_01FEkQ5pjSPT7ui2EUcunaVb

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 772361229675bef1e94d2b8aa974476a7d57d7e0
Local-runs: none
Scope: skills/objectstack-ui/evals/views-apps-actions-pages.json, skills/objectstack-ui/rules/navigation.md + none

Inputs read: card #33235 (body and all 3 comments: triage 6874756402, claim 6879488025, dev report 6879770686; no ruling and no earlier record on it), PR #33283 (body, the 3-file list, the net diff against main d4fbb4d), and the check-runs on the head. The diff holds no implementing file: no gate, schema or runtime code moves, so + none. The changeset is the lane seat's remainder and is read only for ②.

① Derived judgments

  • Accept-set: unchanged, right. No schema, validator or runtime file is in the diff. The taught item uses keys the published spec already declares on main: requiresService on every navigation item (packages/spec/src/ui/app.zod.ts:451) and componentRef on the component item (:741). packages/lint/src/validate-nav-target-refs.ts:51 records componentRef as a verified non-rule, so the taught ref raises no lint finding in a customer app.
  • Public surface: the published skill package (@objectstack/skills) changes its teaching in one os:check example and one eval fixture. Right: the old item was a shape that validates and stages clean and then hides the entry from the users it exists for, so replacing it is a correction of guidance, with no capability added or taken away.
  • Eval assertions: must_contain drops requiresObject and gains approvals:inbox and requiresService; must_not_contain gains requiresObject: 'sys_approval_request'. Right against the eval prompt ("an Approvals group that only shows when approvals are installed"): the new example satisfies every must_contain token and none of the must_not_contain ones, and objectName, viewName, filters are still carried by the Sales group.
  • Gate verdicts, read off the head's check-runs: 44 runs, every one success or skipped; none failing, none pending at the time of this record (two Test Core shards were still running on the first read and have since completed green). Check Changeset, Governed Surface Queue Guard, PR-body guards, Lint · docs & code guards and the Type Check families are among the green ones.

② Semver level

.changeset/33235-skills-approvals-inbox-nav-gate.md declares '@objectstack/skills': patch. That matches what the diff publishes: skill prose and an eval fixture, no schema and no runtime. The package name is the real one (packages/skills/package.json), and patch is the level other skill-text changesets on main use.

Clause-②: no — agrees on the card claim, the PR body and the changeset. Correct: nothing a consumer could author yesterday is refused today, and nothing new is accepted. Metadata-protocol: none is likewise correct.

③ Boundary flags

  • open_questions: empty in the dev report. Nothing to answer.
  • Deviation "the server strips requiresService, the console does not re-check it": confirmed in the tree and it does not weaken the fix. filterAppForUserWithReason drops an item whose service is unregistered (packages/rest/src/meta-item-read-gate.ts:1110), and the console's checkCap returns true for every service (ui/packages/app-shell/src/views/nav-menu-renderer.tsx:251-264). Accepted.
  • Deviation "no HTML-comment trailer on the PR body", "no labels key on pr_create", "model-free commit trailer": process matters outside this record's faces; PR-body guards is green on the head. Not escalated.
  • Deviation "first wording measured 2185 tokens, shortened to 2182 under the 2184 ceiling": no ceiling moved; the ratchet families are green on the head. Accepted.
  • Out-of-scope note "the card's 18.4.0 measurement was not re-measured": answered here by reading the code instead. ApprovalService.authorizeSchemaRead / servesAnyRequest (packages/plugins/plugin-approvals/src/approval-service.ts:10503) admits a caller to the definition of sys_approval_request only when the approvals door serves them at least one request; its own docblock says a member party to no request "is refused and keeps the absent answer". The card's premise holds on main.
  • Out-of-scope note "SKILL.md:192 still lists requiresObject": see the first nit in ④.
  • No dev flag is left unanswered and nothing is escalated.

④ Design judgment

Judged from the seat of a customer agent that loads the whole objectstack-ui skill and is given eval 2's prompt.

skills/objectstack-ui/rules/navigation.md — holds.

  • The item is the platform's own. nav_account_approvals in packages/platform-objects/src/apps/account.app.ts:114-128 is type: 'component', componentRef: 'approvals:inbox', requiresService: 'approvals'; the taught item differs only in id, icon and its place inside a group. plugin-approvals contributes the same component ref to Setup (approvals-plugin.ts:187).
  • The ref resolves in any app, not only Account: ui/apps/console/src/registerApprovalsComponents.tsx:59 registers approvals:inbox and documents the route as /apps/APP/component/approvals/inbox.
  • The service name is the registered one: ctx.registerService('approvals', this.service) at approvals-plugin.ts:414.
  • "Only shows when approvals are installed" is really delivered. With the service absent the server drops the child (meta-item-read-gate.ts:1110), and the now childless group_approvals is dropped too (the [console][nav] filterNav never drops a group DECLARED with children: [] — Setup renders an inert 「Approvals」 group on a runtime without plugin-approvals #7380 rule in the same filterNav, lines 1151-1196), so no dead "Approvals" label is left behind. With the service present every member is served the entry, whatever their approval history: this is the history-independence the card asked for.
  • The one-line reason is true on main. The console prunes requiresObject against the served object scope (nav-menu-renderer.tsx:251-264, :336), the server deliberately does not gate requiresObject (meta-item-read-gate.ts:995-1009), and the definition read of sys_approval_request is refused to a member party to no request (authorizeSchemaRead, above).
  • Attempts to break it, all failed: an unprobeable kernel fails open, so the entry shows rather than vanishing; the component item needs no objectName, so the spec's object-target exclusivity rules do not apply; SKILL.md:162 already lists the component type with componentRef, and SKILL.md:166-168 already names requiresService beside requiresObject, so the example contradicts nothing else in the package.

skills/objectstack-ui/evals/views-apps-actions-pages.json — holds.

  • expected_output describes exactly the item the rule teaches and gives the same reason; the assertions agree with it and with the rule's example (checked token by token against the new os:check block). The rest of eval 2 (one app per package, the requiredPermissions-gated support group) is untouched.

Findings:

  1. nit — skills/objectstack-ui/SKILL.md:192 (outside the diff, read not reviewed) still names requiresObject as the CRM blueprint's app-navigation pattern, and after this PR the package holds no worked requiresObject example at all: the only one was the line this PR replaces. Nothing is wrong (the general rule at SKILL.md:166-168 names both gates and requiresObject stays right for an object item on an optional object), but an agent that reads the blueprint row without opening the rule file is still pointed at requiresObject first. Follow-up card: make the row read requiresObject / requiresService. Not owed on this head.
  2. nit — the new must_not_contain string requiresObject: 'sys_approval_request' is quote- and spacing-sensitive; an answer that writes the trap with double quotes passes the assertion. expected_output still states the rule, so a grader reading it is not misled. Accepted deviation.
  3. nit — the comment and expected_output say "the object read answers 404 to approvers". Precisely it is the object's metadata (definition) read, and it is refused to any non-administrator who is party to no request, submitters included. The short wording is true and the token ceiling (2182 of 2184) leaves no room for more. Accepted deviation.

No must-fix and no should-fix. Nits alone end the round; no delta review is owed.

Implemented-by: claude/project-thread-dk76uo
Reviewed-by: session_01FEkQ5pjSPT7ui2EUcunaVb

VERDICT: PASS

Adopted by the seat 2026-11-14T15:44Z · isolated sub-agent at CONTRACT_REVIEW_TIER · Ruling-ref: Leehom card cmsg_01TenzsRopZj4jMbvjX8uz1XFhuiZmTH8VFgMmHRmpiGAb, option A, tapped 2026-11-14T15:37Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:skills#1 · os-project-manager · session_01FEkQ5pjSPT7ui2EUcunaVb

维护者速读

  • 改了什么:objectstack-ui 技能导航规则里的审批入口,从 type: 'object' + requiresObject: 'sys_approval_request' 改成平台 Account 应用同款:type: 'component'、componentRef: 'approvals:inbox'、requiresService: 'approvals';eval 期望与断言同步。
  • 为什么改:照抄旧写法的应用里,非管理员审批人在还没有审批单涉及自己之前读不到该对象元数据(404),控制台把入口裁掉,新环境里没有审批人看得见收件箱(下游 blackcat-crm 在 18.4.0 实测)。
  • 风险与回滚:只改技能文字两文件、净增 0 行,不动 schema 和运行时;回滚即还原本 PR。
  • 先看:skills/objectstack-ui/rules/navigation.md 第 37–39 行。
  • 两分钟验证:git diff origin/main -- skills/,只见审批那一项换形与 eval 断言。
  • 需要你做的:受管面 Tier H(skills/**),契约复审 PASS 评论 6880008562(Head-sha 772361229675bef1e94d2b8aa974476a7d57d7e0)已在案,请批准或直接合并。
  • 席位意见:可以合。复审核对了 Account 应用原样(account.app.ts:114-128)、服务端按服务裁剪(meta-item-read-gate.ts:1110)与控制台只按对象裁剪(nav-menu-renderer.tsx:251-264),教的写法与代码一致。

席位核对

Verdict: ACCEPT, held for the maintainer · head 772361229675bef1e94d2b8aa974476a7d57d7e0 · card #33235 · report 6879770686 · contract review 6880008562 (PASS, skills face, CONTRACT_REVIEW_TIER; Ruling-ref for the in-seat review: Leehom card cmsg_01TenzsRopZj4jMbvjX8uz1XFhuiZmTH8VFgMmHRmpiGAb option A).

  • Shape: draft → main, Fixes #33235. skills/objectstack-ui/rules/navigation.md and evals/views-apps-actions-pages.json (+6/-6, net 0 against a budget of +4), one '@objectstack/skills': patch changeset. GOVERNED, Tier H (check-governed-merges --pr 33283). Clause-②: no; Metadata-protocol: none.
  • Premise, read in the diff: the approvals item now matches nav_account_approvals in @objectstack/platform-objects; the line-37 comment no longer teaches requiresObject for this entry; the eval requires approvals:inbox and requiresService and refuses the old gate string.
  • Gates: 44 derived, 40 run exit 0, 4 dist-reading gates NOT MEASURED with no package touched. Check-runs on the head: 44, all success or skipped; mergeable clean.
  • Accepted deviations (contract review nits): the eval's refused string is quote-sensitive; "the object read answers 404" is shorthand for the definition read; no HTML signed trailer on the PR body (os-dev.md wins).
  • Out of scope: skills/objectstack-ui/SKILL.md:192 still names requiresObject as the blueprint's nav pattern — Acceptance notes, still true for object items; a later skills/objectstack-ui card picks it up.
  • Landing: Tier H. The seat does not flip this PR ready or enqueue it. It needs the maintainer's merge, or an authorised APPROVED review after which the seat lands it.

@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 14, 2026
@os-zhuang
os-zhuang marked this pull request as ready for review November 14, 2026 15:53
@os-zhuang
os-zhuang enabled auto-merge November 14, 2026 15:53
@os-zhuang
os-zhuang added this pull request to the merge queue Nov 14, 2026
Merged via the queue into main with commit 6a28a27 Nov 14, 2026
50 checks passed
@os-zhuang
os-zhuang deleted the claude/project-thread-dk76uo branch November 14, 2026 16:20
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 pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue size/s tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

3 participants