Skip to content

fix(spec): name requiresObject when an app menu entry names an undeclared platform object - #37583

Queued
objectstack-fleet[bot] wants to merge 1 commit into
mainfrom
claude/area-o1A-37404
Queued

objectstack-fleet[bot] wants to merge 1 commit into
mainfrom
claude/area-o1A-37404

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Fixes #37404

Clause-②: no
Metadata-protocol: none

维护者速读

  • 应用作者在菜单里放平台自带的任务或备忘入口却漏写依赖声明时,校验仍会拒绝,但报错现在直接告诉他补哪一项、不要自己再造一份对象;最终用户无感。
  • 属于入门应用与空白模板的跟进工作,替照着平台文档写菜单的作者(含 AI)解决报错指错方向的问题。
  • 只改报错文字与对象说明注释,不放宽也不收紧校验;出错时最坏是提示文字不准,可直接撤回。
  • 无。

What changes

  • packages/spec/src/stack.zod.ts, app-navigation cross-reference check: the refusal for a type: 'object' entry naming an undeclared object is kept. When the name is platform-prefixed (isPlatformObjectName, the sys_/cloud_/ai_ prefix test), the message keeps its first sentence unchanged and adds the fix: add requiresObject: 'NAME' to the entry (the menu hides it wherever the object is not registered) and do not declare a copy of the object in the package. A name without the prefix keeps the old message byte-for-byte.
  • sys_task docblock now shows the entry with requiresObject; sys_note docblock gains the same sentence (it had none).
  • New test packages/spec/src/stack-nav-platform-object-requires-object.test.ts.
  • Changeset: patch for @objectstack/spec and @objectstack/platform-objects.

Why the refusal stays rather than exempting by prefix: the prefix test matches plugin-contributed objects too (e.g. sys_approval_request), so an exemption would let a menu point at an object absent from the environment, with no runtime hiding.

Tests

spec + platform-objects runs at e7621c8
  • pnpm --filter @objectstack/spec exec vitest run --maxWorkers=2 src/stack-nav-platform-object-requires-object.test.ts src/stack-artifact-crossref.test.ts: Test Files 2 passed, Tests 35 passed.
  • pnpm --filter @objectstack/spec test: Test Files 901 passed (901), Tests 28508 passed, 1 todo.
  • pnpm --filter @objectstack/spec typecheck: exit 0. pnpm --filter @objectstack/platform-objects typecheck (after building its dependency closure): exit 0; src/work tests 23 passed.
  • Ablation: with the platform-prefix branch disabled on disk, the new file goes red (2 failed, 3 passed: both sys_ refusal cases); restored from HEAD, porcelain clean.

Acceptance notes

  • The curated PLATFORM_OBJECTS_BY_PACKAGE['platform-objects'] list could tell objects every environment carries apart from plugin ones; exempting those would be a widening (shape A) and is not done here. It is raised to the seat as an open question.
  • The published platform catalog skill text already teaches the entry with requiresObject; untouched.

Verification

Read first: the stack.zod.ts hunk (message branch), then the new test.

Two-minute check: pnpm --filter @objectstack/spec exec vitest run src/stack-nav-platform-object-requires-object.test.ts shows 5 passed.

🤖 Generated with Claude Code

https://claude.ai/code/session_016WV4cyyekQEqLjtrCLLAeV


Generated by Claude Code

…clared platform object

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4cyyekQEqLjtrCLLAeV
@github-actions github-actions Bot added size/m 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 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 2 package(s): @objectstack/platform-objects, @objectstack/spec, touching 3 documentable anchor(s).

1 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/getting-started/your-first-project.mdx (via sys_note (literal, a string literal in a comment on a changed line), sys_task (literal, a string literal in a comment on a changed line))
What this run could not see
  • 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 — 177 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 b69f7157cdd263196f3b5587000f5963c9d27fe2 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 366b7e8f790542e653c3f5d6ac24414c610a397c — the merge of head e7621c87692c7e7d51eca79af7c707bfa73b3013 into base b69f7157cdd263196f3b5587000f5963c9d27fe2, 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 366b7e8f790542e653c3f5d6ac24414c610a397c && git checkout 366b7e8f790542e653c3f5d6ac24414c610a397c
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin b69f7157cdd263196f3b5587000f5963c9d27fe2 e7621c87692c7e7d51eca79af7c707bfa73b3013 && git checkout -B drift-repro b69f7157cdd263196f3b5587000f5963c9d27fe2 && git merge --no-ff e7621c87692c7e7d51eca79af7c707bfa73b3013

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

⚠️ 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 b69f7157cdd263196f3b5587000f5963c9d27fe2 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-elon-musk · session_016WV4cyyekQEqLjtrCLLAeV

Final head for review: e7621c87692c7e7d51eca79af7c707bfa73b3013 · 2026-11-26T14:42Z · area o1-A. Check-runs on this head: 58 success, 11 skipped, 0 failed; mergeable_state clean. L1 requested from seat 1's L1 thread. The diff touches packages/spec/src/stack.zod.ts (non-test), so the Clause-② path limb owes a contract-tier read before the queue.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-elon-musk · session_016WV4czzx9dtSEm3jWWL9c3

Contract-review-claim: session_016WV4czzx9dtSEm3jWWL9c3 · head e7621c8 · 2026-11-26T14:45Z

L1-a thread of seat repo:objectstack#1: an isolated sub-agent at CONTRACT_REVIEW_TIER reviews this head (schema face, packages/spec/src/stack.zod.ts); the L1 ACCEPT read runs beside it.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-elon-musk · session_016WV4czzx9dtSEm3jWWL9c3

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: e7621c87692c7e7d51eca79af7c707bfa73b3013
Local-runs: none
Scope: packages/spec/src/stack.zod.ts + packages/platform-objects/src/work/sys-task.object.ts, packages/platform-objects/src/work/sys-note.object.ts (the two docblocks that teach the entry the check judges). The new test file and the changeset are the lane seat's ACCEPT at TIER_DEFAULT.

① Derived judgments

  • Accept set of defineStack / os validate: unchanged, and that is right. The hunk sits inside the existing if (!nav.requiresObject) arm of the app-navigation check in validateCrossReferences; the condition that reaches errors.push (type === 'object', a string objectName absent from objectNames, no requiresObject) is untouched, and exactly one error is pushed on both sides of the new ternary. No input accepted on main is refused at this head, and none refused on main is accepted.
  • Public surface: one refusal message changes, for names isPlatformObjectName matches (the sys_ / cloud_ / ai_ prefix test, hasPlatformObjectPrefix). Its first sentence is the old message byte for byte, so a consumer matching on the prefix holds; a name without the prefix gets the old string whole. The only exact-match pin of this message in the tree (stack-artifact-crossref.test.ts, crm_case) names an unprefixed object and is unaffected. Envelope code (STACK_CROSS_REFERENCE_INVALID) and status (422) are unchanged. Right.
  • Both nav containers (app.navigation, areas[].navigation) and nested children go through the same checkNavItems, so the new message reaches every position the refusal does. Right.
  • No schema key, no exported symbol, no generated baseline moves; requiresObject on NavigationItem is read, not changed.

② Semver level

Clause-②: no. Confirmed from the tree: message text plus two docblocks, no accept-set or type change. The changeset declares patch for @objectstack/spec and @objectstack/platform-objects, which matches what the diff publishes (a message string; docblock text carried in the declarations). Check Changeset and Spec property liveness concluded success on this head. Metadata-protocol: none is right: no protocol door is touched.

③ Boundary flags

  • Route flag (shape B over shape A of the card): answered, B holds. The prefix test cannot tell sys_task from a plugin object such as sys_approval_request or a cloud one such as sys_app, so a prefix exemption would admit a menu entry with no runtime hiding for an absent object. The neighbouring checks that do exempt the prefix (seed data, grants, child lists) have no client-side capability gate to fall back on; the navigation entry does, and requiresObject is that gate.
  • open_questions entry (exempt the curated PLATFORM_OBJECTS_BY_PACKAGE['platform-objects'] group instead): answered, not taken here. Its premise is true (sys_task and sys_note are both in that group), but it is an accept-set widening owing its own Clause-② reading, and packages/platform-objects/src/plugin.ts shows the two work objects are registered through the manifest service inside a try that only warns on failure ("Applications that put them in their navigation will find no such object on this kernel"), so requiresObject keeps a runtime meaning even for these two. A separate card if the maintainer wants shorter starter entries; nothing is owed on this head.
  • Deviation, local gate list narrowed to 20 commands and check:i18n not measured locally: answered by the check-runs on this head. Every completed run concluded success; the skipped ones are path-filtered or opt-in jobs (Lint UI, Build Docs, Dogfood Verify CLI, the sharded Dogfood matrix placeholder, Temporal Conformance, the opt-in harnesses, the queue verdict pair). No failure, none pending.
  • Deviation, commit trailer form: outside this record's face; no contract effect.
  • SQL push-down: not applicable. The diff adds no query, no id materialisation and no in-app join; isPlatformObjectName is a string prefix test on a name already in hand.

④ Design judgment

packages/spec/src/stack.zod.ts, against the card and its first consumers (examples/app-starter/src/apps/starter.app.ts, the platform catalog skill row for sys_task):

  • The message tells the truth about the fix. requiresObject is tested for truthiness only, so the literal the message prints (requiresObject: 'NAME') clears the refusal; the parenthesis "the menu then hides it wherever the object is not registered" agrees with the key's own describe in ui/app.zod.ts ("Hide/disable this entry unless the named object is registered in the runtime"). The starter app and the catalog row already write the entry this way, so the error, the docblocks, the skill and the example now teach one shape.
  • "do not declare a copy of the object in this package" is consistent with the single-owner rule the registration comment in plugin.ts cites (a host declaring its own sys_task is refused), and with the reserved-prefix rule on a stack's own objects.
  • The in-code comment states the reason the refusal stays, and the reason is what the code does. It does not contradict the isPlatformObjectName jsdoc ("cross-reference checks must not demand they appear in config.objects"): the entry is still not required to be declared, it is required to carry its gate.
  • Attempt to break it, typo path: sys_taks now draws the hint and, once requiresObject: 'sys_taks' is added, passes defineStack. That was already true on main for anyone who knew the key, and @objectstack/lint validate-object-references checks both requiresObject and the gated objectName against the curated registry, so the fictional name still surfaces as an advisory. No new hole.
  • Attempt to break it, unprefixed plugin object: unchanged behaviour and unchanged message; the hint is withheld where the stack's own typo is the likelier cause. Sound.

packages/platform-objects/src/work/sys-task.object.ts and sys-note.object.ts, sentence by sentence against the check:

  • "The entry needs requiresObject — defineStack refuses a menu entry for an object the stack does not declare unless the entry says the object comes from elsewhere": agrees with the arm reviewed above.
  • sys_note, "Every environment carries it": agrees with plugin.ts, which registers SysTask and SysNote together in one manifest; the sentence is as true for the note as the existing one is for the task.

No must-fix, no should-fix.

Nits (accepted deviations, no effect on correctness or the contract):

  • N1 (nit) — the message asserts "is provided by the platform or a plugin" on the prefix test alone, so a mistyped sys_ name is told the same. "expected from the platform or a plugin" would be exact; the lint advisory covers the case.
  • N2 (nit) — the docblock entry { type: 'object', objectName: 'sys_task', requiresObject: 'sys_task' } omits the id every navigation item requires. It reads as a fragment showing the keys that matter, and the starter app and the catalog row show the full entry.

Implemented-by: claude/area-o1A-37404
Reviewed-by: session_016WV4czzx9dtSEm3jWWL9c3

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-elon-musk · session_016WV4czzx9dtSEm3jWWL9c3

L1 verdict (L1-a): ACCEPT at head e7621c87692c7e7d51eca79af7c707bfa73b3013 (Fixes #37404). Full read · 2026-11-26T14:49Z

席位核对

Shape and gates. l1-face --pr 37583 CLEAN (13 items, none flagged). Check-runs at e7621c8: 58 success, 11 expected skip, 0 unexpected skip, 0 failed, 0 pending; Lint & Repo Gates and TypeScript Type Check both success; mergeable_state clean. Draft, base main, first line Fixes #37404, no closing keyword next to another card. 5 files, +113/-2. Not governed (no governed path in the file list). Clause-②: no · Metadata-protocol: none in the body and the changeset; Skills-docs: not owed.

Fixes is right. The claim routed shape B (7193370978): keep the refusal, make the error name requiresObject for a platform-prefixed object, and teach the entry in the sys_task and sys_note docblocks. All three are in the diff, so merging delivers the whole card.

The change, read against main.

  • stack.zod.ts nav check: only the message branches. The condition that pushes the error (type: 'object', name not in objectNames, no requiresObject) is untouched, so the accept set does not move; Clause-②: no holds. The helper is the file's own isPlatformObjectName (line 2928), which is hasPlatformObjectPrefix over PLATFORM_OBJECT_PREFIXES = ['sys_', 'cloud_', 'ai_'], so the changeset's "any sys_/cloud_/ai_ name" is exact. The non-prefixed message is byte-identical to main's, and stack-artifact-crossref.test.ts:225 still pins it.
  • The hint is true: requiresObject is described on main as "Hide/disable this entry unless the named object is registered in the runtime" (packages/spec/src/ui/app.zod.ts:442), and the check already skips an entry that sets it.
  • Docblocks: the { type: 'object', objectName: 'sys_task', requiresObject: 'sys_task' } form they now teach is the form examples/app-starter/src/apps/starter.app.ts:28-29 and the blank template (main.app.ts:29-30) carry on main, and the form the objectstack-project eval expects.

Refusal assertions. The new test asserts code: 'STACK_CROSS_REFERENCE_INVALID' and status: 422 on both refusal cases and on the non-prefixed case, then the message, so the green comes from the refusal that was thrown. The report includes a real ablation: with the prefix branch disabled, 2 of the 5 cases fail, then the file is restored from HEAD.

Changeset, sentence by sentence. The refusal still happens (true, the condition is unchanged). The refusal names requiresObject: 'NAME' and warns against a package copy (true, see the message). The menu hides the entry where the object is not registered (true, per the requiresObject describe). A name without the prefix keeps the old message (true, byte-identical). Both docblocks teach the entry (true). Patch for @objectstack/spec and @objectstack/platform-objects matches: both are published (platform-objects files = dist, README.md, CHANGELOG.md, private unset).

Docs drift bot. It flags content/docs/getting-started/your-first-project.mdx:251-254. That paragraph describes the Tasks/Notes entries in prose and shows no entry without requiresObject, so nothing there becomes false.

Open question (dev's shape A'). Exempting the curated PLATFORM_OBJECTS_BY_PACKAGE['platform-objects'] names would widen what os validate accepts (Clause-②: yes). The card does not need it, since requiresObject is harmless on an object that is always present. Not filed: no pull for it, and the startup axis says not to widen without one. The area keeps shape B, so nothing is owed here.

Nit, not blocking. sys-task.object.ts reflows its paragraph with one short line ("from elsewhere. It is an ordinary"). Prose only.

Contract review. The diff touches packages/spec/src/stack.zod.ts (non-test), so a contract review at CONTRACT_REVIEW_TIER is owed. L2 record: PR comment 7195374701, Served-tier: CONTRACT_REVIEW_TIER, head e7621c8, PASS. It comes from an isolated sub-agent; its transcript passed verify-review-tier. I spot-checked two of its readings in the tree: checkNavItems covers app.navigation, areas[].navigation and nested children (lines 6638-6649), and platform-objects/src/plugin.ts:310 only warns if registration fails. The record has no must-fix or should-fix; its nits N1 and N2 are accepted deviations.

Landing: not governed, ≤3000 lines, no narrowing. The area lands it once the L2 PASS is on this head (landing-operations). Fixes closes the card, so no manual pm:dispatched strip is owed.


Generated by Claude Code

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-elon-musk · session_016WV4cyyekQEqLjtrCLLAeV

Landing by area o1-A · 2026-11-26T14:50Z · head e7621c87692c7e7d51eca79af7c707bfa73b3013 · ACCEPT 7195390539 (L1-a) · contract record 7195374701 PASS (same head)

probe reading
check-governed-merges.mjs --pr 37583 NOT governed; 115 changed lines ≤ 3000
landing-k.mjs --pr 37583 K = 5 < 15; no locale pack, no shared book moved; os-regen paths untouched

State: ready + auto-merge now; #37404 closes on merge via Fixes, pm:dispatched cleared then.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 26, 2026 14:50
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 26, 2026
Any commits made after this event will not be merged.

This branch has not been deployed

No deployments
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/m tests 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.

os validate refuses an app menu entry naming the built-in sys_task or sys_note unless it carries requiresObject

2 participants