Skip to content

feat(security, create-objectstack): an AI-built app with its own capabilities and no connector plugins installs as an unmanaged copy - #35261

Merged
objectstack-fleet[bot] merged 13 commits into
mainfrom
claude/project-thread-nkazjs
Nov 19, 2026
Merged

objectstack-fleet[bot] merged 13 commits into
mainfrom
claude/project-thread-nkazjs

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

Requested by Warren · project thread

Part of #35157 (item 1 is ruled option A, record 6999763503, maintainer: 「同意」; the everyone-anchor bound is ruled 「接受现有边界」, record 7000639892. The ADR-0126 amendment note stays a separate governed PR after this merges).

Clause-②: yes (widening)
Metadata-protocol: added
Skills-docs: none — no skill teaches capability as code-only, the scaffold's plugin list, or unmanaged install; the docs pages are updated here (content/docs/permissions/capabilities.mdx, content/docs/deployment/install-modes.mdx, content/docs/getting-started/your-first-project.mdx, content/docs/automation/connectors.mdx)

维护者速读

  • 改了什么:AI 生成的应用现在能以“非托管副本”安装(市场试用)。应用自带的能力项(capability)会随副本一起复制,并改成副本的命名空间;引用它的权限集和动作同步改名。新建项目的脚手架不再默认列出三个连接器插件。
  • 为什么改:之前能力项只能写在代码里,而脚手架默认带插件。两者都让 AI 生成的应用只能托管安装,所以场景卡(请假余额、采购到收货、资产生命周期)没法做成市场试用。
  • 风险与回滚:能力项变成可在运行时保存,属于权限边界的变化。平台能力名(如 manage_users)和其它包已占用的名字在保存时一律拒绝,权限闸仍按名字匹配。它重新开放了 ADR-0126 第 9 节未授权的 code-only 类型,维护者已裁 A(记录 6999763503,「同意」)。全员锚点的边界按记录 7000639892(「接受现有边界」):只有绑定到包(_packageId)的声明被豁免,没有包的保存不豁免,正文里写的 packageId 也不算。回滚:回退本 PR 的 capability 部分即可。
  • 先看:packages/metadata-protocol/src/protocol-save-door-refusals.ts(平台名与占用名的拒绝)、packages/metadata-protocol/src/package-namespace-rename.ts(副本改名与引用改写)、packages/spec/src/kernel/metadata-plugin.zod.ts(类型登记从 code-only 改为可运行时创建)
  • 两分钟验证:pnpm --filter @objectstack/objectql exec vitest run src/protocol-unmanaged-import-rename-battery.test.ts,预期 12 个用例全过。其中三个演示副本动作只对副本权限集持有者放行,对只持有源权限集的人拒绝。
  • 需要你做的:无,席位落地(ADR-0126 的修订说明在合并后另开受管面 PR)。

What changes

Item 1: a package-declared capability is copied by an unmanaged install (option A, ruled in record 6999763503).

  • packages/spec/src/kernel/metadata-plugin.zod.ts: the capability registry entry is allowRuntimeCreate: true. Overlays stay closed (supportsOverlay: false, allowEnvironmentOverlay: false). The body is still judged by CapabilityDeclarationSchema.
  • packages/metadata-protocol/src/protocol-save-door-refusals.ts and protocol-save.ts: the save door refuses two capability names with 422 NAMESPACE_CONFLICT:
    • a platform capability (PLATFORM_CAPABILITIES). The registry answers its bare slot first, so an environment item under that name would shadow the platform's definition;
    • a name an installed package's capability holds (one holder per name, as for permission sets and positions). The promote and restore doors already call the same refusal.
  • packages/objectql/src/security-catalog-namespace.ts: ENVIRONMENT_HELD_SECURITY_CATALOG_TYPES adds capability, so a package shipping a capability name the environment authored refuses the boot, as positions and permission sets do.
  • packages/metadata-protocol/src/package-namespace-rename.ts: when the copy takes a new namespace, a capability named <ns>.x or <ns>_x is renamed into it. systemPermissions (list or per-operation map) and requiredPermissions are rewritten with it. An unprefixed capability keeps its name. A renamed name another package's capability holds refuses the install, naming both.

Item 2: the scaffold stops writing connector plugins (the install contract is unchanged).

  • packages/create-objectstack/src/templates/blank/*: objectstack.config.ts lists no plugins:, and package.json drops the three connector packages. The README and the config comment show how to add a provider when an app declares a connector.

Docs. The capability and install-mode pages describe environment-authored capabilities, the two refused names, the rename in an unmanaged copy and the new refusal row. The getting-started and connectors pages match the scaffold.

Tests

  • packages/objectql/src/protocol-unmanaged-import-rename-battery.test.ts: an app with a capability-gated action installs unmanaged under a new namespace. The rows are renamed. The security catalog resolves the copy's capability with scope: 'org'. The copied action passes a holder of the copy's set and refuses a non-holder and a holder of only the source's set.
  • packages/spec/src/stack-unmanaged-install-mode.test.ts: an app that gates an action on its own capability, with the scaffold's default (no) plugins, validates with installModes: ['unmanaged'].
  • packages/metadata-protocol/src/protocol.capability-write-door.test.ts: a garbage body gets 422. Valid saves pass, including the plural spelling. manage_users gets NAMESPACE_CONFLICT, and so does a package-held name. A permission-catalog holder of the same spelling does not block (control). A re-save of the environment's own item passes. /meta/types reports allowRuntimeCreate: true.
  • packages/metadata-protocol/src/package-namespace-rename.test.ts: five rename cases (dot and underscore prefixes, unprefixed kept, both reference keys, collision refusal).
  • packages/objectql/src/protocol-boot-hydration-scoped.test.ts: the cold-boot environment-holder refusal runs for capability beside permission and position.
  • The code-only lists in protocol.code-only-types, protocol.recovery-doors-emit-mutation and protocol.packaged-base-refusal drop capability.
  • packages/plugins/plugin-security/src/builtin-capabilities.test.ts: an environment-saved capability body carrying packageId (no row binding) excuses nothing at the everyone anchor, on the registry list and on the metadata-service fallback (packageId or package).

Acceptance notes

  • ADR-0126 §9 lists "reopening any code-only type (field, job, api, capability, agent)" as not chartered. The maintainer ruled A (record 6999763503: 「同意」), so the ADR amendment note ships as a separate governed PR after this one merges.
  • The everyone-anchor bound stands as ruled in record 7000639892, option 「接受现有边界」: 「平台权限和别的应用已声明的权限点照旧一律挡住;只有没人声明过的名字,管理员能在可编辑的应用里声明一次。本次只把说明写准。」 The anchor excuses a declaration bound to a package (_packageId, the row's binding as the server states it) and nothing else: a capability saved with no package excuses nothing, whatever package its own packageId names (contract review 7005578464, S5). No stricter refusal is built; refusing a body whose packageId disagrees with its row's binding is outside this card.
  • cloud#4856 (the double namespace prefix) is related and not taken here, because the cloud lane is paused.

Verification

Local runs (updated as they finish)
  • @objectstack/metadata-protocol full suite: 23,091 passed, 45 skipped. Six files failed to load on the first pass because the spec build was rewriting dist mid-run; re-run alone: 6 files, 86 tests passed.
  • @objectstack/objectql: protocol-unmanaged-import-rename-battery 12/12, protocol-boot-hydration-scoped 21/21; full suite running.
  • @objectstack/spec: stack-unmanaged-install-mode, capability-metadata-kind, metadata-create-seeds, metadata-type-field-registration pass; full suite running.
  • create-objectstack: 379 passed.
  • @objectstack/lint: validate-security-posture.runtime-surface, runtime-gate.inert-type-writes, 72 passed. @objectstack/metadata-core meta-write-capability 15 passed. plugin-security access-upgrade-report passed.
  • pnpm --filter @objectstack/spec build then check:generated: 13 of 14 artifacts current, no diff to commit. check:test-typecheck crashed with no diagnostics under memory pressure from the parallel test run; re-run pending.
  • check:doc-authoring, check:doc-anchors, check:docs-single-h1, check:docs-spec-enumerations, check:changeset-fixed, check:docs-audit-scope, check:docs-transcript-drift: pass.
Fix round for contract review 7005578464 (head c29f645)
  • plugin-security full suite: 279 files, 6992 passed, 45 skipped (VERDICT command-exit 0). Touched suites alone: builtin-capabilities, suggested-audience-bindings, builtin-capabilities.boot, 87 passed.
  • Ablation of the S5 reading (_packageId ?? packageId ?? package, put back through scripts/ablation-replace.mjs, anchor 1 to 0, blob 18a0c1bc to 68552ad7): builtin-capabilities.test.ts 2 failed, 10 passed, the two new pins red. Restored: blob equals HEAD, git diff HEAD empty; with the fix 12 passed.
  • metadata-protocol package-namespace-rename.test.ts 18 passed (comments only in that file). typecheck of plugin-security (with check:test-typecheck) and metadata-protocol: exit 0.
  • Local gate subset, all exit 0: check:nul-bytes, check:doc-authoring, check:doc-anchors, check:docs-spec-enumerations, check:docs-transcript-drift, check:issue-citations, check:durability-log-level, check:cross-package-test-inputs, check:test-source-alias, check:doc-security-posture, check:doc-formula-expressions, check-affected-docs, check-docs-section-name, check:closed-ceremony-text, check:role-word. The other 71 derived families are CI's (declared narrowing).

🤖 Generated with Claude Code

https://claude.ai/code/session_01JQwxbXuXMUwP5Bbmq6UZRJ

…ns until the app declares a connector

A plugin is code, and an unmanaged install copies metadata alone, so the
scaffold's three default connector executors made every AI-built app
uninstallable as a marketplace trial template. The template README and the
two docs pages say how to add a provider when the app first needs one.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQwxbXuXMUwP5Bbmq6UZRJ
…an app's capabilities, renamed with the copy

The capability metadata type is runtime-creatable and stays overlay-closed:
a platform capability name, or a name another holder declares, is refused at
the save door, and the unmanaged copy renames a capability the package
prefixes with its namespace, with every grant and requirement of it.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQwxbXuXMUwP5Bbmq6UZRJ
…ot refusal for an environment-held capability, add changesets

The capability and install-mode pages describe an environment-authored
capability, the two names the save door refuses, and how an unmanaged
copy renames capabilities. Comments that still called capability
code-only now say what holds. The cold-boot refusal battery runs for
capability beside permission and position.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQwxbXuXMUwP5Bbmq6UZRJ
@github-actions github-actions Bot added size/xl dependencies Pull requests that update a dependency file 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 19, 2026
@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 7 package(s): @objectstack/cli, objectstack-blank, @objectstack/metadata-protocol, @objectstack/objectql, @objectstack/plugin-security, @objectstack/runtime, @objectstack/spec, touching 26 documentable anchor(s). ⚠️ 7 changed file(s) yielded no anchor (packages/create-objectstack/src/templates/blank/README.md, packages/create-objectstack/src/templates/blank/objectstack.config.ts, packages/create-objectstack/src/templates/blank/package.json, …), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

17 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 6f36818f032edd8d9cff7aaf65f762374b62e070.

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

What this run could not see
  • 7 changed file(s) yielded no anchor (packages/create-objectstack/src/templates/blank/README.md, packages/create-objectstack/src/templates/blank/objectstack.config.ts, packages/create-objectstack/src/templates/blank/package.json, …) — pages documenting those are invisible to this run
  • 1 anchor(s) matched too much of the corpus to be a work list: requiredPermissions (literal, 40 pages)
  • 1 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 65 of 247 client-bound route-ledger rows — the other 182 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 182: 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; 123 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 — 190 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 6f36818f032edd8d9cff7aaf65f762374b62e070 → packageMentionDocs.

Which tree this was computed on

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

node scripts/docs-audit/affected-docs.mjs --json 6f36818f032edd8d9cff7aaf65f762374b62e070

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

…aller's bound, and both door tests pay the lint load at collection

The stub engine's `find` filters on every scalar condition and applies
`limit` after the filter, so `check:objectql-double-limit` can seat and
judge it. The two test files that reach the dynamic `@objectstack/lint`
import through the save path import it at module top, per
`check:test-source-alias`.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQwxbXuXMUwP5Bbmq6UZRJ
… items so its collision case compiles

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQwxbXuXMUwP5Bbmq6UZRJ
… console language

A capability is now runtime-creatable, so a publish can carry one. The
pending-changes count table gains its row, and every locale pack gains
the `preview.changes.typeCount.capability` count family, in the plural
slots that pack already uses for positions and in the word it already
uses for a capability.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQwxbXuXMUwP5Bbmq6UZRJ
…ses a token at the everyone anchor

ADR-0090 D5 excuses an app's own declared capability from the
high-privilege check on an `everyone` binding. The declared list was read
from the whole registry, which since capabilities became runtime-creatable
also holds environment saves with no `_packageId`. Such a declaration now
excuses nothing; an app's shipped capabilities and an unmanaged copy's
(stamped with the copy package) still count.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQwxbXuXMUwP5Bbmq6UZRJ
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

coordinator#1 · os-warren · session_01JQwxbXuXMUwP5Bbmq6UZRJ

Contract-review-claim: session_01JQwxbXuXMUwP5Bbmq6UZRJ · head e6bae72 · 2026-11-19T04:34Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

coordinator#1 · os-warren · session_01JQwxbXuXMUwP5Bbmq6UZRJ

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: e6bae722d0073a4a4a9b096cb79b9aac0d3b677a
Local-runs: none
Scope: packages/spec/src/kernel/metadata-plugin.zod.ts + packages/metadata-protocol/src/protocol-save-door-refusals.ts, packages/metadata-protocol/src/protocol-save.ts, packages/metadata-protocol/src/package-namespace-rename.ts, packages/objectql/src/security-catalog-namespace.ts, packages/plugins/plugin-security/src/declared-capability-context.ts
Security-touching: yes

PR #35261 for card #35157. Read: the card body and every comment (record 6999763503 rules item 1, option A), the PR body, its 47-file list and the net diff against the merge-base with main, and the 73 check-runs on this head (every one success or skipped, the eleven required contexts success). The tree is judged, not the PR body: the body still reads "awaits the maintainer's ruling" and says nothing of the head commit's anchor change.

① Derived judgments

  • Registry flag (metadata-plugin.zod.ts): capability goes from allowRuntimeCreate: false to true; supportsOverlay and allowEnvironmentOverlay stay false. Right, and it is what record 6999763503 rules. Everything keyed on the flag follows with no second list: RUNTIME_UNCREATABLE_TYPES in stack.zod.ts stops naming capability, so defineStack no longer refuses installModes: ['unmanaged'] for an app that declares one, and the type catalogue serves the type as creatable. Right.
  • Save door accept set: a capability save moves from 403 NOT_CREATABLE to accepted. The body is judged by the strict CapabilityDeclarationSchema (422 INVALID_METADATA); a platform capability's name and a name another holder holds answer 422 NAMESPACE_CONFLICT. Read on the head: the refusal runs on a draft save and a publish save (protocol-save.ts), on promote (protocol-history-and-publish.ts) and on the restore doors (protocol-authoring-gate.ts), by singular type, and the platform-name refusal comes before any read. Right.
  • Package door and cold boot (security-catalog-namespace.ts): capability joins ENVIRONMENT_HELD_SECURITY_CATALOG_TYPES, so the package-held name listing the save door reads now carries capability names, an install over an environment-held capability name is refused, and a cold boot refuses a configured package's capability name the environment also holds. Right as a rule; the remedy the boot prescribes does not reach a capability row (S3).
  • Rename engine (package-namespace-rename.ts, one engine for duplicatePackage and importUnmanagedPackage): a declared capability whose name carries the source namespace prefix is renamed, and the two keys are rewritten in list form and in the per-operation map form; an undeclared name is untouched; a copy name the package already declares is refused at its own name. Right as far as it goes, incomplete at three edges (S1).
  • Anchor context (declared-capability-context.ts): only registry declarations stamped _packageId reach declaredCapabilities. Manifest and nested-plugin declarations are stamped with their owner at registration, and the curated platform declarations register under the platform's own package id, so no shipped app loses its exemption; the platform floor in describeHighPrivilegeBits is untouched. The narrowing is real for a package-less row only (S2).
  • Remainder, named and not reviewed here (the lane seat's ACCEPT at TIER_DEFAULT): tests and fixtures, the changesets' prose, content/docs/**, the create-objectstack blank template, ui/** (the draft panel and the locale packs), and the comment-only hunks in objectql (registry.ts, registry-namespaces-and-claims.ts, index.ts), plugin-security access-upgrade-report.ts and runtime catalog-activation.ts.

② Semver level

  • .changeset/35157-unmanaged-copy-capabilities.md declares minor on @objectstack/spec, @objectstack/metadata-protocol and @objectstack/objectql, patch on @objectstack/plugin-security, with Metadata-protocol: added. Right: a save the door refused is now accepted, and a kind other than none puts the level at minor or above. All four packages are in the fixed group, so the patch publishes at the group's level.
  • The Clause-②: yes (widening) line holds, on the PR body and on the changeset alike. The accept set grows: one type moves from 403 to accepted, and unmanaged is admitted for an app that declares a capability. Two things tighten and neither takes away anything a supported door on main could produce, because no door on main wrote a capability row: the cold boot now refuses a stored capability row under a package-declared name (the changeset says so), and the anchor counts package-bound declarations only.
  • Skills-docs: none holds: no skill teaches capability as code-only, the scaffold's plugin list or the unmanaged install, and the docs pages that did are in this diff.
  • The other two changesets belong to the remainder. One observation for the lane seat, ungraded: .changeset/35157-scaffold-no-connector-plugins.md declares minor under Metadata-protocol: none, where the level rule gives patch. The fixed group publishes at minor either way and Check Changeset is green.

③ Boundary flags

  • Item 1's fork (Claim 6995599332 and the PR body): answered by record 6999763503, option A, maintainer verbatim 「同意」. The PR body's "awaits the maintainer's ruling" is superseded by that record; nothing here rests on the body.
  • ADR-0126 amendment, owed: at this head ADR-0126 still lists capability among the code-only types (the tier table, and §9's "not chartered" line). Record 6999763503 puts the amendment note in a separate governed PR; the thread names no such PR and no card. Escalated to the adopting seat: file it so the ADR and the registry do not disagree on main once this lands (Prime Directive 13).
  • Escalated to the maintainer, with S2: record 6999763503 says this PR "closes a gap the risk review found: an environment-saved capability is not excused at the everyone anchor". The head closes it for a package-less row only. A save addressed to a writable base (?package=BASE, the package-first address of ADR-0070 and the address the unmanaged import itself writes to) registers the declaration with _packageId, and it is excused. Under option A a filter on the row cannot close this, because a hand-saved package capability and a copied one are the same row. The bound that holds on this head is: a platform capability's name and a package-declared name can never be declared at runtime; every other name is excused, and its scope is decided, once a manage_metadata holder declares it inside a package. The maintainer should confirm that bound or order a stricter one.
  • Not ruled, untouched by this diff: keeping a template's own namespace by default, and reserving official prefixes (record 6999763503 says no card is filed). cloud#4856 (the double prefix on unmanaged copies) is cloud-side and not taken; this diff adds no exposure to it.
  • Card items 2 and 3: the scaffold change and the tests are remainder, not reviewed here.
  • Stated narrowing: a cold boot now refuses when a stored capability row sits under a name a configured package declares. The changeset states it.
  • SQL push-down: no new id materialisation and no in-app join. The capability holder read at the save door goes through the same cached per-type active-row read the permission-set check already uses.

④ Design judgment

No must-fix. S1 to S3 below each earn a delta review; four nits follow.

What held against an attempt to break it:

  • Shadowing the platform or a package. A runtime save under any name in PLATFORM_CAPABILITY_NAMES is refused before any read. A name a package holds, by composite slot or install claim, is refused on draft, publish, promote and restore. A package install over an environment-held name is refused, and so is a cold boot over one. catalog.resolve answers the bare slot first, and no door on this head lets an environment row into the bare slot under a held name.
  • A door around the refusal. Every protocol method that writes a capability body (saveMetaItem, publishMetaItem, publishPackageDrafts, the restore and revert writers, duplicatePackage, importUnmanagedPackage) reaches permissionSetNameCollisionRefusal; there is no rename door. The unmanaged import is all-or-nothing and deletes its base when one item is refused.
  • Forged provenance. A body-supplied _packageId is stripped and re-stated from the row's package_id column, so the body cannot claim a holder or a package it is not stored under.
  • Two gates merged inside one copy. A copy name the package already declares is refused, and only declared, prefixed names are renamed, so a platform token or another package's token in the copy's lists stays exactly as the source wrote it.

S1 (should-fix) — package-namespace-rename.ts: the rename follows a capability under two keys only, so a renamed copy can name a capability its own declaration does not carry.

  • (a) CAPABILITY_REFERENCE_KEYS holds systemPermissions and requiredPermissions, and its docblock says ADR-0066 D1 "names no third edge". The published spec names one: page.zod.ts teaches visibleWhen to gate a component with current_user.hasCapability('NAME') "with the name the gated action's requiredPermissions declares", and content/docs/ui/actions.mdx teaches the same pairing. The engine rewrites the action's requirement to the copy's name and leaves the predicate naming the source's. In the copy, a holder of the copy's capability has the component hidden, and a holder of the source's capability sees it and is refused by the action. No grant widens, since the requirement is what refuses, but the copy no longer behaves as the app it copies.
  • (b) rewrite() runs the capability pass first and then hands its output to deepRewrite, whose object-name pass rewrites inside every string, the two keys' values included; the declaration's own name is set by copyName alone. A capability whose name embeds a renamed object's name between separators splits in two: with namespace crm copied as shop and object crm_invoice, the capability crm.crm_invoice.void is declared in the copy as shop.crm_invoice.void, while the copy's sets grant and its actions require shop.shop_invoice.void. The gate still matches by string, but the token the copy grants is declared nowhere, so it loses its label and its scope, reads as undeclared at the everyone anchor and as "declared nowhere" at the organization boundary. The comment above the call says the object pass "must not be what decides a capability's copy name"; on this path it does.
  • (c) The docblock says an unprefixed capability's second holder "is refused at the save door, loudly, never shared". That is true of the declaration row. duplicatePackage copies item by item, so the refused declaration is one failed[] entry while the duplicate's sets and actions land naming the source's capability: the shared gate the paragraph above sets out to prevent. A capability refused by the in-package copy-name check ends the same way at that door. Only the all-or-nothing import door keeps the sentence true.
  • Direction: rewrite a renamed capability inside hasCapability arguments, or refuse the copy of an item whose predicate names a renamed capability the engine did not rewrite; keep the object-name pass out of the two keys' values, so a declaration and its references get one name; and at duplicatePackage, refuse or report the items that keep a capability whose declaration was not copied, with the docblock corrected to what the door does.

S2 (should-fix) — declared-capability-context.ts: the package filter does not deliver what its comment, the changeset and the docs page say it does.

  • The filter keeps a registry declaration when it carries a non-empty _packageId. That stamp is the row's package binding (withRowBinding, from the package_id column), and the author chooses the binding by addressing the save to any writable base. So the comment's "an environment save registers it in this same collection with no _packageId" is true of a package-less save only, and the harm it names, "counting it would let a metadata author excuse any name from the anchor gate by saving a declaration of it", is still open one query parameter away. The one-holder reading, which this diff extends to capabilities, takes that row the other way: "every bare-slot item is the environment's whatever _packageId it wears" (registry-namespaces-and-claims.ts).
  • The same overclaim is published: the changeset's "A capability saved through the metadata door excuses nothing, so a metadata author cannot clear a token for everyone by declaring it", and content/docs/permissions/capabilities.mdx ("A capability saved this way is not an app's own token at the everyone anchor").
  • What bounds it on this head is the two name floors, and they hold: a platform capability's name is refused and stays high-privilege by name, and a package-declared name is refused. What is left open is every other name, including a token a shipped package grants or requires without declaring it. For such a token a manage_metadata holder can now declare it inside a writable base, which excuses it at the everyone anchor and, through the declaration's scope, decides condition (c) of the organization boundary (organizationBoundaryFailure reads the resolved declaration with no provenance test). On main both belts refused that token because nothing could declare it at runtime.
  • The second source is unfiltered: when the registry lists no capability at all, the metadataService.list('capability') answer is returned whole, package-less declarations included.
  • Direction: state the bound that holds in the comment, the changeset and the docs page, or enforce the stricter one if the maintainer orders it (③); and give the metadata-service branch the same provenance test, or drop it for this reader. Graded below a refusal of the head because the enforced behaviour is the only one consistent with option A (an unmanaged copy's capabilities must count), both floors hold, and the actor already holds a platform-scope capability.

S3 (should-fix) — security-catalog-namespace.ts: the cold boot now refuses over a capability name and prescribes a remedy that cannot see a capability row.

  • Adding capability to ENVIRONMENT_HELD_SECURITY_CATALOG_TYPES makes the boot refuse when a configured package declares a capability name the environment holds. The refusal text (coldBootConflictMessage) tells the operator that os migrate security-catalog-overlays "lists every such row with no server running, and with --apply deletes them". That command's STORED_TYPE_SPELLINGS (packages/cli/src/utils/security-catalog-overlays.ts, outside this diff) reads the position and permission spellings only, so it lists nothing for a capability.
  • The state is reachable through this PR's own feature: an unmanaged copy that keeps its namespace stores the app's capability names as environment rows; configuring the same app later as a managed package refuses the next cold boot over them. The server is down, so the metadata door cannot delete the rows, and the one prescribed tool does not list them.
  • Direction: teach the command the capability and capabilities spellings in the same change that makes the boot refuse over them, or have the message stop prescribing it for a capability.

Nits (no effect on correctness or the contract):

  • N1 (nit): the registry entry's description still reads "A permission a package defines; you grant it through permission sets". An environment can define one now.
  • N2 (nit): the module doc of security-catalog-namespace.ts, "The cold boot", still says the boot asks for "every package-held position and permission-set name". Stale statements of the same kind sit in the remainder or outside the diff, read and not reviewed: registry-namespaces-and-claims.ts ("the two types the environment can author"), the protocol.ts docblock of permissionSetNameCollisionRefusal, metadata-create-seeds.ts ("for capability's reason") and the sharing-rule migration entry's text ("the capability pair").
  • N3 (nit): the capability pass has no counterpart to the object pass's entry-collision refusal. A list holding a renamed name and an undeclared name equal to its copy name ends with one name twice. Contrived, since the source would have to name a token in the target's namespace.
  • N4 (nit, follow-up card suggested): the cold boot reading skips built-in names. A stored capability under a name a later release adds to PLATFORM_CAPABILITY_NAMES would not be refused at boot and would answer catalog.resolve from the bare slot, scope included, ahead of the platform's declaration. No state on this head reaches it.

Implemented-by: claude/project-thread-nkazjs
Reviewed-by: session_01JQwxbXuXMUwP5Bbmq6UZRJ

VERDICT: PASS

… one name everywhere; the anchor bound is stated as it holds; the overlay remedy lists capability rows

Contract review 7000301544 on #35261, S1-S3:
- The rename engine rewrites a capability in hasCapability('<name>') predicates, keeps the
  object-name pass out of systemPermissions/requiredPermissions, and at duplicatePackage
  (source stays installed) refuses a capability it cannot rename and every item naming it.
- declared-capability-context states the bound that holds (maintainer ruling 7000639892) and
  applies the provenance test to the metadata-service fallback too.
- os migrate security-catalog-overlays lists and deletes capability rows, through the
  repository as the environment's runtime-created item.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQwxbXuXMUwP5Bbmq6UZRJ
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

coordinator#1 · os-warren · session_01JQwxbXuXMUwP5Bbmq6UZRJ

Contract-review-claim: session_01JQwxbXuXMUwP5Bbmq6UZRJ · head 688ca4f · 2026-11-19T05:29Z

…in's first loads at module top

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQwxbXuXMUwP5Bbmq6UZRJ
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

coordinator#1 · os-warren · session_01JQwxbXuXMUwP5Bbmq6UZRJ

Contract-review-claim: session_01JQwxbXuXMUwP5Bbmq6UZRJ · head 706dbee · 2026-11-19T05:40Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

coordinator#1 · os-warren · session_01JQwxbXuXMUwP5Bbmq6UZRJ

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 706dbee6a4b722979aac85aec23989bb26f4ba6d
Local-runs: none
Scope: packages/spec/src/kernel/metadata-plugin.zod.ts + packages/metadata-protocol/src/protocol-save-door-refusals.ts, packages/metadata-protocol/src/protocol-save.ts, packages/metadata-protocol/src/package-namespace-rename.ts, packages/metadata-protocol/src/protocol-package-commits.ts, packages/objectql/src/security-catalog-namespace.ts, packages/plugins/plugin-security/src/declared-capability-context.ts, packages/cli/src/utils/security-catalog-overlays.ts
Security-touching: yes

Delta review of PR #35261 for card #35157 (record 7000301544: PASS on the previous head, S1 to S3 open, nits N1 to N4). Read: the two commits between that head and this one (11 files; the second commit adds three import lines to one test file), ruling record 7000639892 on the card, the card and PR threads as they stand, and the check-runs on this head and on the intermediate commit. The hits file and the two save-door files are byte-identical to what record 7000301544 judged, and its judgment of them carries. The tree is judged, not the PR body, which is unchanged and still reads "awaits the maintainer's ruling".

The check-runs on this head were still running when this record was rendered (29 created: 5 success, 6 skipped, 18 running, none red; no lint, type-check or test lane had reported), so the derived gate families are not yet answered on it. On the intermediate commit the push of this head cancelled the test and type-check lanes; of the lanes that finished there, one gate was red, the Test-source alias gate, over the CLI integration test that commit edited. It prescribed three module-top imports, and the second commit adds exactly those three. This record judges the design of the delta and rests on no local run; the required contexts still have to turn green on the head that lands.

① Derived judgments

  • Rename engine (package-namespace-rename.ts): a capability name is now rewritten in three places, the two keys and a quoted hasCapability('NAME') argument (HAS_CAPABILITY_CALL), and in those places the object-name pass no longer runs. Right for a name the package declares: declaration, grant, requirement and predicate get one name. Wider than that for a name it does not declare (S4).
  • Duplicate door (protocol-package-commits.ts): duplicatePackage passes the new optional input sourceStaysInstalled: true. With it the plan refuses a declared capability the copy cannot rename, and every item that names one under the two keys or in a quoted predicate, each at its own name in failed[]. Right: the source is a stored base that stays beside its duplicate. The unmanaged import does not pass it; read again on this head, that door raises every plan refusal before the base exists and deletes the base when a save is refused, so it stays all-or-nothing.
  • Anchor context (declared-capability-context.ts): the metadata-service branch is filtered by the same _packageId test as the registry branch; the comment states the bound that holds. Right, and it is what record 7000639892 rules.
  • Remedy command (packages/cli/src/utils/security-catalog-overlays.ts): STORED_TYPE_SPELLINGS gains capability and capabilities, so the listing meets the same package-held reading the cold boot refuses on. A capability row is deleted through SysMetadataRepository.delete with intent: 'runtime-only', which the repository's gate admits for a type that is runtime-creatable; the protocol's delete door is not used because it reads the managed seal for a type with no overlay channel. Right; the cold boot's prescription is now true for a capability row.
  • Module doc (security-catalog-namespace.ts): "The cold boot" names the capability. Right.
  • Remainder, named and not reviewed here (the lane seat's ACCEPT at TIER_DEFAULT): the tests in package-namespace-rename.test.ts, builtin-capabilities.test.ts and the CLI integration test, the changeset prose, content/docs/permissions/capabilities.mdx, and the text-only hunks of packages/cli/src/commands/migrate/security-catalog-overlays.ts.

② Semver level

  • The changeset gains '@objectstack/cli': patch. Right: the remedy command reads one more row class and no command surface changes; @objectstack/cli is in the fixed group and publishes at the group's level.
  • minor on spec, metadata-protocol and objectql with Metadata-protocol: added, and the Clause-②: yes (widening) line, are unchanged and still hold. The new duplicate refusals take away nothing main could produce: they arise only for a stored base that declares a capability, and no door on main stored one.
  • One change this delta makes to what a copy contains for an input main accepts is not stated in the changeset (S4).

③ Boundary flags

  • The escalation with S2 is answered: record 7000639892, maintainer option 「接受现有边界」. The bound stands as it holds on the tree, no stricter refusal is built, and the record corrects the sentence of record 6999763503 that this review questioned.
  • ADR-0126 amendment, still owed: neither thread names a PR or a card for it at this read. Still escalated to the adopting seat (Prime Directive 13).
  • Gates not yet answered on this head, to the adopting seat: see the check-run paragraph above. The one red gate of the intermediate commit is answered by the test-only commit on top of it, and no lane had reported on this head at this read.
  • Stated deviation in the remedy command: a capability row leaves a history tombstone and no audit row, because the audited door refuses it. The module header says so and each outcome names the door it took. Flagged for the adopting seat: the header cites the two deletion doors to the ruling on [decision] after #22307 a cold boot refuses any environment row over a package-held permission set or position, so the 2026-08-24 legacy-overlay remedies (boot overlay reading, drift overlay_shadow, Discard Overlay) find nothing on v18: keep or retire? #22371, which predates capability rows, and this delta sends a canonical spelling through the door the module used for legacy plurals only.
  • Not ruled, untouched: keeping a template's own namespace by default, and reserved official prefixes. cloud#4856 is not taken.
  • SQL push-down: no new id materialisation and no in-app join in the engine. The remedy command reads two more stored spellings with the same pushed-down where on type and state as the existing four; the name match is against the registry's package-held reading, which SQL does not hold.

④ Design judgment

No must-fix. S1, S2 and S3 are closed on this head. S4 is new in this delta and earns a delta review. N1, N3 and N4 stand; N2 is fixed; N5 and N6 are new.

S1: closed.

  • (a) A quoted hasCapability argument follows the capability rename, in single or double quotes, any number of calls per string; any other argument is left as written, and the docblock says so. The docblock no longer claims there is no third edge.
  • (b) The values under the two keys and the quoted argument skip the object-name pass, and the declaration's name comes from the same map, so crm.crm_invoice.void is shop.crm_invoice.void in the declaration, the grant, the requirement and the predicate.
  • (c) At the duplicate door a declared capability the copy cannot rename is refused with every item that names it, so no copied item grants, requires or tests for a capability the source still declares. The docblock now describes each door as it behaves.
  • The split of a string around each call leaves the object-name pass unchanged for every string that holds no such call.

S2: closed.

  • The comment, the changeset bullet and the docs page now state the bound the head enforces: a declaration bound to a package is excused, one saved with no package is not, a platform capability's name and a package-declared name cannot be declared at runtime, and any other name can be declared once by a manage_metadata holder inside a writable package, which decides its scope. Record 7000639892 accepts that bound.
  • The metadata-service branch applies the same provenance test.

S3: closed.

  • The command the cold boot prescribes lists a capability row over a package-held name and deletes it, addressed by spelling, name, package_id and checksum. The repository gate admits the delete on the runtime-only intent for this type, and the row is read back by id after the delete.

S4 (should-fix) — package-namespace-rename.ts: the object-name exemption also covers names the package does not declare, so a copy now keeps a token that on main followed its object, and shares the source's gate.

  • The fix for S1 (b) takes every value under the two keys, and every quoted hasCapability argument, out of the object-name pass. For a name the package declares that is right, because the capability rename decides it. For a name the package does not declare nothing decides it, and it is copied as written.
  • On main, and on the previous head, the object-name pass read those strings like any other. A token that contains a renamed object's name as a whole word followed the object: with object crm_invoice copied as shop_invoice, an undeclared crm_invoice.void became shop_invoice.void in the grant, the requirement and the predicate alike, so the copy had a gate of its own. On this head the copy keeps crm_invoice.void in all three places. A holder of the copy's set passes the source's action, and a holder of the source's set passes the copy's. Two unmanaged copies of one app under two namespaces meet the same way.
  • The tokens this reaches are the ones stored bases hold today: before this PR no door stored a capability declaration, so a base authored in the environment grants and requires undeclared tokens only. The duplicate door's new refusal does not see them, since sharedCapabilities is built from declared names, and nothing reports them; the copy lands clean.
  • The changeset and the docs page describe the new rule ("The object-name rename never reads those places"; "copied as written") and do not say that an undeclared token used to follow its object.
  • Direction: let the capability rename decide the names the package declares and leave every other entry to the object-name pass, as on main; or keep the new rule, state the change in the changeset and the docs page, and have the duplicate door report an undeclared token it leaves shared with the source. The direction S1 (b) carried on record 7000301544 ("keep the object-name pass out of the two keys' values") was wider than the defect it answered; the defect was the declared name.

Nits (no effect on correctness or the contract):

  • N1 (nit): stands as an accepted deviation; the registry description feeds generated translations.
  • N2 (nit): fixed in the module doc. The stale statements outside the reviewed files remain, read and not reviewed.
  • N3 (nit): stands.
  • N4 (nit, follow-up card suggested): stands; neither thread names a card for it.
  • N5 (nit): the metadata-service branch of declared-capability-context.ts reads _packageId alone, while the metadata service names an item's package under packageId, package or _packageId (isPackageMember, packages/metadata/src/metadata-manager.ts). An item registered for a package under packageId alone is dropped. It errs toward refusing a binding, and the branch runs only when the registry lists no capability at all.
  • N6 (nit): the remedy command passes intent: 'runtime-only' for a row whose name a package holds, while the repository gate's own doc defines that intent as "no artifact under this name". The use is sound, since the row is the environment's own and removing it restores the package's declaration, and only this offline command passes it; the gate's doc and its caller now disagree.

Implemented-by: claude/project-thread-nkazjs
Reviewed-by: session_01JQwxbXuXMUwP5Bbmq6UZRJ

VERDICT: PASS

… declare follows a renamed object as before

Contract review 7000870325, S4: only names the package declares skip the object-name pass in
systemPermissions, requiredPermissions and hasCapability arguments. N5: the metadata-service
fallback also reads packageId / package.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQwxbXuXMUwP5Bbmq6UZRJ
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

coordinator#1 · os-warren · session_01JQwxbXuXMUwP5Bbmq6UZRJ

Contract-review-claim: session_01JQwxbXuXMUwP5Bbmq6UZRJ · head fce0fd9 · 2026-11-19T05:44Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#6 · hotlong · session_01Q4EjjNq58cmHeqckjZkTFE

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: fce0fd912ccea5e400f10ad2c329804b54821e03
Local-runs: none
Scope: packages/spec/src/kernel/metadata-plugin.zod.ts + packages/metadata-protocol/src/package-namespace-rename.ts, packages/plugins/plugin-security/src/declared-capability-context.ts, packages/metadata-protocol/src/protocol-save-door-refusals.ts, packages/metadata-protocol/src/protocol-save.ts, packages/metadata-protocol/src/protocol-package-commits.ts, packages/objectql/src/security-catalog-namespace.ts, packages/cli/src/utils/security-catalog-overlays.ts
Security-touching: yes

DELTA review of PR #35261 for card #35157, from 706dbee6a4b722979aac85aec23989bb26f4ba6d (record 7000870325: PASS, should-fix S4, nits N1 to N6) to this head. Read: the card body and its seven comments (rulings 6999763503 and 7000639892, the release 7005068842 and both claims), the PR body, its 51-file list, the net diff against main (merge base cdb327fd; main has moved no file of the Scope line since), records 7000301544 and 7000870325, the one commit between the two heads (4 files), and the 73 check-runs on this head. The tree is judged, not the PR body, which still reads "awaits the maintainer's ruling".

What carries, by blob id. Between 706dbee6 and this head these are byte-identical: the hits file metadata-plugin.zod.ts (7d603994), protocol-save-door-refusals.ts, protocol-save.ts, protocol-package-commits.ts, security-catalog-namespace.ts and packages/cli/src/utils/security-catalog-overlays.ts. The hits file and the two save-door files are the same blobs at e6bae722 too, the head of record 7000301544. Their diffs against main were read again here and the judgment of the two earlier records carries for them. Two implementing files moved, package-namespace-rename.ts and declared-capability-context.ts, and they are judged in full below. The closure of S2 on record 7000870325 does not carry whole: this delta undoes one part of it (S5).

① Derived judgments

  • Rename engine (package-namespace-rename.ts): renameCapability now asks first whether the package declares the name. A declared name takes the capability rename alone, as on the previous head. Any other name under systemPermissions or requiredPermissions, or in a quoted hasCapability argument, takes the object-name regex, the one main runs over every string. Right: the copy's body for an undeclared token spelled with a renamed prefixed object returns to what main writes (crm_invoice.void copies as shop_invoice.void in the grant, the requirement and the predicate), and a declared name is still one name in all three places. Against main, an undeclared token is now copied as main copies it, but for one corner (N8).
  • Anchor context (declared-capability-context.ts): the provenance test reads _packageId, then packageId, then package, and it is applied to both lists, the registry's and the metadata service's. Wrong for the registry list: the everyone anchor now also excuses a declaration saved with no package whose body names one. The commit message and the changeset do not state that change (S5).
  • Changeset (.changeset/35157-unmanaged-copy-capabilities.md): the rename bullet now reads "a token the package does not declare follows a renamed object as before". Right, it is what the engine does.
  • Remainder, named and not reviewed here (the lane seat's ACCEPT at TIER_DEFAULT): the new case in package-namespace-rename.test.ts, the changeset prose, and everything record 7000870325 and record 7000301544 named as remainder, unchanged since.

② Semver level

  • The changeset's levels are untouched by the delta and still right: minor on spec, metadata-protocol and objectql, patch on plugin-security and cli, Metadata-protocol: added, all five in the fixed group. The delta publishes no new surface: the engine's input type and the reader's signature are as they were.
  • The Clause-②: yes (widening) line holds on the PR body and on the changeset.
  • One bullet of the changeset is no longer what the head does: "It now counts only declarations bound to a package (_packageId)" and "A capability saved with no package excuses nothing". See S5. A fix in the code makes the bullet true again, and then no changeset edit is owed.

③ Boundary flags

  • Rulings: record 6999763503 (option A, 「同意」) and record 7000639892 (option 「接受现有边界」) stand, and nothing in the delta asks a new question of the maintainer. S5 is measured against record 7000639892, which rules that the saved-declaration gap is closed "for a capability saved with no package only" and that a name nobody declares is declared "inside a writable package".
  • The delta commit's two claims: "only names the package declares skip the object-name pass" is true of the tree. "The metadata-service fallback also reads packageId / package" is narrower than the tree: the registry list reads them too.
  • Gates: the 73 check-runs on this head are complete, 63 success and 10 skipped, none red and none pending. That answers the open gate note of record 7000870325 for this head. No gate reads S5: no test saves a capability body carrying packageId and then asks the anchor.
  • Docs sentences, to the adopting seat (prose face, not reviewed here): two published sentences still state the previous head's rule and are no longer exact. content/docs/permissions/capabilities.mdx: "A name the package does not declare — a platform capability it grants or requires — is copied as written." content/docs/deployment/install-modes.mdx: "A capability the package does not declare, a platform one among them, keeps its name." A token spelled with a renamed object's name follows the object. The same page's anchor paragraph ("A capability saved with no package is not") depends on S5.
  • PR body, to the adopting seat: it still asks the maintainer to rule A or B and calls the direction pending. Record 6999763503 answered it.
  • ADR-0126 amendment, still owed: the card thread names no PR and no card for it. Claim 7005195461 repeats that it is a separate governed PR. Still escalated to the adopting seat (Prime Directive 13).
  • N4's follow-up card: the card thread names none.
  • Not ruled, untouched: keeping a template's own namespace by default, and reserved official prefixes. cloud#4856 is not taken.
  • SQL push-down: the delta adds no query, no id materialisation and no in-app join.

④ Design judgment

No must-fix. S4 is closed. S5 is new in this delta and earns a delta review of its fix. N1, N3, N4 and N6 stand; N7 to N9 are new.

The hits file, metadata-plugin.zod.ts. Unchanged, and it holds against record 6999763503 and its first consumers: the flag alone moves capability out of RUNTIME_UNCREATABLE_TYPES, and the save door's two name refusals are the ones the entry's comment cites. One consequence of making the type runtime-creatable matters to this delta. CapabilityDeclarationSchema (outside the diff, read) declares an optional packageId, "the author-declared fallback provenance", and since this entry opened the save door an environment author writes that key. Until this delta nothing in this diff decided anything on that key.

S1: closed. It stays closed on this head: a declared name is renamed by the capability rename in the declaration, the two keys and the quoted argument, and the duplicate door's refusal is untouched.

S2: its closure on record 7000870325 was judged on a filter that read _packageId alone. This delta changes what the filter reads, and that part is S5. The wording of the comment, the changeset and the docs page is unchanged.

S3: closed. Its files are byte-identical.

S4: closed.

  • The exemption from the object-name pass is now exactly the declared names (capabilityNames.has(name)), which is the first direction record 7000870325 offered. An undeclared token spelled with a renamed prefixed object follows the object in all three places, so a duplicate and each unmanaged copy keep a gate of their own for it, as on main.
  • Tried against it: the split of a predicate string around each call hands the argument to the regex alone. Its neighbours inside the string were quote marks, so the two-sided identifier boundary reads the same match either way. A declared name that embeds a renamed object (crm.crm_invoice.void) never reaches the regex. A declared name the copy cannot rename keeps its name in every place and is still refused at the duplicate door.
  • The new test pins grant, requirement and predicate for an undeclared token, and Test Core is green on this head. The changeset states the rule. The two docs sentences that still state the previous head's rule are prose face and are named in ③.
  • An undeclared token that names no renamed object is still shared by a duplicate and its source, unreported, exactly as on main. The earlier records judged that rule and it is not reopened here.

S5 (should-fix) — declared-capability-context.ts: the provenance test now reads a key the author writes, so a capability saved with no package is excused once its body names any package.

  • The delta acts on N5 with packageOf: _packageId, then packageId, then package. The comment added above it says the registry stamps _packageId and the metadata service may use the other two. The code applies the one reading to both lists, the registry's included (withPackage(registered)).
  • packageId is a declared key of the strict CapabilityDeclarationSchema, so an environment save may carry it. No door removes it or judges it against the row's binding for a capability. The save door strips _packageId, _packageVersion and _provenance only (DERIVED_PROVENANCE_KEYS). withRowBinding restates or drops _packageId only. applyProtection stamps from its caller's package alone. The owner-binding refusal of ADR-0086 D3 is asked of a permission set only (permissionSetOwnerBindingRefusal). This PR's own write-door test saves such a body with no package address and expects success (protocol.capability-write-door.test.ts, the well-formed declaration with packageId: 'com.acme.billing').
  • So an environment-wide save with no package of { name: 'x.y', packageId: 'any.id' } registers { name, packageId, _provenance: 'org' } with no _packageId (hydrateOverlayIntoRegistry), the filter keeps it, and describeHighPrivilegeBits excuses x.y at the everyone anchor. On the previous head the same row was dropped. The package named need not exist.
  • That is not the bound record 7000639892 rules, and not what three texts of this PR say: the comment in this file ("A save with no package registers it here with no _packageId, and it excuses nothing"), the changeset ("A capability saved with no package excuses nothing") and the docs page ("A capability saved with no package is not"). The ruling counts a hand-saved package row because a row cannot tell it from a copied one. That reason does not reach this row: its binding column is empty.
  • The metadata-service list has the same hole for an environment item, on the branch that runs only when the registry lists no capability.
  • No test pins the new reading in either direction. The tests of the filter use an environment-saved body with no packageId.
  • What still bounds it: a platform capability's name and a package-declared name are refused at save, the platform floor is applied again at the anchor, and the actor is the manage_metadata holder the ruling already lets declare such a name inside a writable package. That is why this is graded below a refusal of the head.
  • Direction: keep the registry list on _packageId alone, which is the row's binding as the column states it. Let the metadata-service list read the other two keys only where that service states them itself for a package's item, never from an environment item's body, or leave N5 as the accepted deviation it was. Add the pin: an environment-saved body carrying packageId excuses nothing. Refusing a capability body whose packageId disagrees with its row's binding, as the door does for a permission set, would close it at the source and is wider than this card. If the body key is meant to count, that is a wider bound than record 7000639892 rules, and it goes back to the maintainer.

Nits (no effect on correctness or the contract):

  • N1 (nit): stands as an accepted deviation.
  • N3 (nit): stands.
  • N4 (nit, follow-up card suggested): stands.
  • N5 (nit): acted on in this delta. The change is S5.
  • N6 (nit): stands.
  • N7 (nit): three sentences in package-namespace-rename.ts still state the previous head's rule. The CAPABILITY_REFERENCE_KEYS docblock: "so the object-name pass never reads them". The plan comment: "A name the package does NOT declare (a platform capability, another package's) is never touched". The comment in deepRewrite: "the object pass skips it". The two comments the delta rewrote state the rule the code has. These can ride with S5's fix, which moves the head anyway.
  • N8 (nit): "as before" is exact for the regex pass only. On main an entry under the two keys was also tried whole against the copy's view-item renames, so a token spelled exactly as a view item of an unprefixed object (ticket.board) followed the item. On this head it keeps its name. A capability token has no reason to be spelled as a view item's name.
  • N9 (nit, follow-up card suggested): the restored pass rewrites an undeclared token by spelling alone, so it can carry a token into or out of a platform capability's name when a renamed object is spelled like one. Object crm_users copied into namespace manage turns the undeclared token crm_users into manage_users; a package of namespace manage with an object manage_users loses the platform name in its copy. main does the same today, the installing administrator chooses the namespace, and the anchor's platform floor judges the result by name. This PR does not introduce it. The card would be to leave a platform capability's name alone on both sides of the pass.

Implemented-by: claude/project-thread-nkazjs
Reviewed-by: session_01Q4EjjNq58cmHeqckjZkTFE

VERDICT: PASS

…capability's row binding alone

Contract review 7005578464, S5: the provenance test reads `_packageId` and
nothing else, on the registry list and on the metadata-service fallback.
`packageId` is an author-written key an environment save keeps, and the
metadata service states no package key of its own (it serves the body as
stored), so neither list reads it. N5 returns to the accepted deviation it
was. Pins: an environment-saved body naming a package under `packageId`
(or `package`) excuses nothing, on both paths.

N7: the three comments in the rename engine state the rule the code has.
Docs: an undeclared token spelled with a renamed object's name follows the
object; a capability saved with no package is not excused whatever its own
`packageId` names.

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

Copy link
Copy Markdown
Contributor Author

repo:objectstack#6 · hotlong · session_01Q4EjjNq58cmHeqckjZkTFE

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: c29f645db5c5a14c8ff8f3b16669b8d707e59bc0
Local-runs: none
Scope: packages/spec/src/kernel/metadata-plugin.zod.ts + packages/metadata-protocol/src/package-namespace-rename.ts, packages/plugins/plugin-security/src/declared-capability-context.ts, packages/metadata-protocol/src/protocol-save-door-refusals.ts, packages/metadata-protocol/src/protocol-save.ts, packages/metadata-protocol/src/protocol-package-commits.ts, packages/objectql/src/security-catalog-namespace.ts, packages/cli/src/utils/security-catalog-overlays.ts
Security-touching: yes

DELTA review of PR #35261 for card #35157, from fce0fd912ccea5e400f10ad2c329804b54821e03 (record 7005578464: PASS, should-fix S5, nits N1 to N9) to this head. Read: the card body and its eight comments (the os-dev-report 7005999930 is the new one), the PR body as it now stands, its 51-file list, the net diff against main (merge base cdb327fd), records 7000301544, 7000870325 and 7005578464, the one fast-forward commit between the two heads, and the check-runs on this head. The tree is judged, not the claims relayed with this round's brief; each claim is answered in ③.

What moved between the two heads: five files and nothing else. declared-capability-context.ts (code), package-namespace-rename.ts (comments only: no line outside a comment differs), builtin-capabilities.test.ts (two tests added), and two docs pages. No changeset moved. The PR body was rewritten.

What carries, by blob id. Byte-identical between fce0fd91 and this head: the hits file metadata-plugin.zod.ts (7d603994), protocol-save-door-refusals.ts, protocol-save.ts, protocol-package-commits.ts, security-catalog-namespace.ts and packages/cli/src/utils/security-catalog-overlays.ts. The judgment of records 7000301544, 7000870325 and 7005578464 carries for them, and for the code of the rename engine. main has moved five commits since record 7005578464. One of them, fe3ebc87, changes two Scope files, protocol-save-door-refusals.ts and protocol-save.ts, inside the seed save refusal only; this PR's hunks in those files are the capability name refusal and its call, which that commit does not meet. GitHub reports the PR mergeable.

① Derived judgments

  • Anchor context (declared-capability-context.ts): packageOf is gone and withPackage reads _packageId alone, on the registry list and on the metadata-service list. Right: the everyone anchor's accept set is again the one record 7000870325 judged and record 7000639892 bounds. A declaration saved with no package is dropped whatever its body names; a declaration bound to a package counts.
  • The fallback list: an item the metadata service holds for a package under packageId or package alone is dropped again. That is N5 as it was, an accepted deviation that errs toward refusing a binding.
  • Rename engine (package-namespace-rename.ts): comments only. Nothing derived changes; the three comments now state the rule the code has.
  • Remainder, named and not reviewed here (the lane seat's ACCEPT at TIER_DEFAULT): the two new tests in builtin-capabilities.test.ts, content/docs/permissions/capabilities.mdx, content/docs/deployment/install-modes.mdx, the PR body, and everything the earlier records named as remainder, unchanged since.

② Semver level

  • No changeset moved. The levels and the Clause-②: yes (widening) line hold as record 7005578464 judged them.
  • The changeset bullet that record questioned is true of the tree again: the anchor counts only declarations bound to a package (_packageId), and a capability saved with no package excuses nothing. No changeset edit is owed.

③ Boundary flags

  • Rulings: record 6999763503 (option A, 「同意」) and record 7000639892 (option 「接受现有边界」) stand. The delta asks nothing new of the maintainer.
  • The os-dev-report 7005999930: its open_questions is empty. Its first out-of-scope note, refusing a capability body whose packageId disagrees with its row's binding, is outside this card as record 7005578464 said; the schema text it names (CapabilityDeclarationSchema.packageId, "author-declared fallback") is outside this diff, and the docs page now tells an author the key excuses nothing. The seat decides whether that is a card or an acceptance note (Prime Directive 10). Its second note stands: N4, N8, N9 and the ADR amendment are as they were. Its three deviations are process and change nothing in the tree judged here.
  • The claims relayed with this round's brief, against the tree: "_packageId alone on both lists" is true. "New pins, red under the previous reading" is true by reading: the registry pin expects the saved body to be absent from the context and the fallback pin expects no context at all, and the previous reading kept both bodies; the ablation itself was the dev's run and is not repeated here. "N7's three comments restated" is true, and that file's diff is comments only. "Docs sentences restated" and "PR body states the rulings" are true of the prose, read and not reviewed. One reason given is not exact: "MetadataManager stores and lists the body as written" (N10).
  • Docs sentences of record 7005578464: both now state the rule the head has, and the anchor paragraph is true of the tree. Prose face, read and not reviewed.
  • PR body: it states both rulings and no longer asks the maintainer to choose.
  • Gates: the 77 check-runs on this head are complete, read at 2026-11-19T10:22Z: 65 success and 12 skipped, none red and none pending. Test Core with its ten shards, Test UI and both type-check lanes are green, and the fourteen workflow runs on the head are all concluded.
  • ADR-0126 amendment, still owed: neither the card thread nor the PR body names a PR or a card. The PR body now puts it after the merge, which leaves ADR-0126 §9 and the registry entry disagreeing on main in between. Still escalated to the adopting seat (Prime Directive 13): a filed card would hold it.
  • Follow-up cards for N4 and N9: the card thread names none.
  • Overlap, to the adopting seat: the os-dev-report says PR chore: version packages #35129 conflicts with this PR in packages/create-objectstack/src/templates/blank/package.json, a remainder file this round did not touch.
  • How this round was fed: the fix commit's trailer and the os-dev-report name the seat's session. This record was rendered by a separate agent on the brief's inputs, and the dev's claims came with the brief as claims to test.
  • Not ruled, untouched: keeping a template's own namespace by default, and reserved official prefixes. cloud#4856 is not taken.
  • SQL push-down: the delta adds no query, no id materialisation and no in-app join.

④ Design judgment

No must-fix, no should-fix.

The hits file, metadata-plugin.zod.ts. Unchanged since the first record, and it holds as record 7005578464 judged it. The consequence that record drew from it, an author-writable packageId on a runtime-creatable type, is no longer read by anything in this diff.

S5: closed.

  • The registry list is read by _packageId alone. For a stored row that key is the row's binding and nothing an author writes: the save door strips it from the body (DERIVED_PROVENANCE_KEYS), the hydration restates it from the package_id column or drops it (withRowBinding), and applyProtection stamps from its caller's package alone. The engine registry is not fed capability items by the metadata service (loadMetadataFromService syncs object, view, app, flow and hook only), so no stamp of that service reaches this list.
  • Tried against it: a save with no package of a body naming a package under packageId registers with no _packageId and is dropped. package is not a key of the strict schema, so the save door refuses it before it is stored. A package-less row under a name a package declares could wear that package's envelope at hydration, but the save door refuses such a row, the cold boot refuses over one, and the name is the package's own declaration anyway.
  • The comment, the changeset and the docs page now say what the code does on this list.
  • The pin record 7005578464 asked for is there, on both lists, and it parses the authored body through CapabilityDeclarationSchema first, so it would notice if the key stopped being authorable.
  • The direction's wider option, a save-door refusal of a disagreeing packageId, was not taken, and it was not owed.

S4: closed. The engine's code is unchanged from the head that closed it.

S1 and S3: closed, as on record 7005578464. S2: closed again; its filter reads _packageId alone, as on the head that closed it.

Nits (no effect on correctness or the contract):

  • N1 (nit): stands as an accepted deviation.
  • N3 (nit): stands.
  • N4 (nit, follow-up card suggested): stands.
  • N5 (nit): back to the accepted deviation it was. The reason the new comment gives for it is the sentence N10 names.
  • N6 (nit): stands.
  • N7 (nit): fixed. The three comments state the rule the code has.
  • N8 (nit): stands. The rewritten plan comment says "as every string did before Unmanaged install: an AI-built app cannot be a template — its capability items are runtime-uncreatable and the scaffold's default connector plugins are code, so installModes: ['unmanaged'] is refused #35157", which is exact but for the same corner.
  • N9 (nit, follow-up card suggested): stands.
  • N10 (nit, follow-up card suggested): on the metadata-service list _packageId is not only a row's binding. When the host declares a package, that service's boot priming pass stamps it on a stored row that names no package, for every type not stored per package and name, and capability is such a type (_loadFromFileSystem and unstampedStoredRow in packages/metadata/src/plugin.ts; PACKAGE_SLOTTED_METADATA_TYPES). So the sentence this delta adds, "The metadata service states no package key of its own", is true of packageId and package and not of _packageId, and on that list an environment-saved capability can wear the host's stamp. It has no effect where authorization resolves. The list is read only when the engine registry lists no capability. SecurityPlugin.start registers the curated capabilities there before any reader runs, so in the standard runtime that list is never empty. The case left is an engine with no usable registry, and there the security catalog reader is not bound at all (createSecurityCatalogReader refuses to build without one). It is older than this delta: the fallback has read _packageId since 688ca4f2, and no earlier record raised it, record 7005578464 included. The card would be to drop the fallback, or to have its comment say what it cannot tell.

Implemented-by: claude/project-thread-nkazjs
Reviewed-by: session_01Q4EjjNq58cmHeqckjZkTFE

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#6 · hotlong · session_01Q4EjjNq58cmHeqckjZkTFE

席位核对

ACCEPT · head c29f645db5 · 2026-11-19T10:25Z · L1 by the seat that took the card over (claim 7005195461, Resume-from fce0fd91), against GitHub, not the reports.

  • Shape: draft → main; first line Part of #35157, correct: the card's ADR-0126 amendment is a separate governed PR, so this merge must not close the card. Landing duty recorded now: after the merge, remove pm:dispatched from Unmanaged install: an AI-built app cannot be a template — its capability items are runtime-uncreatable and the scaffold's default connector plugins are code, so installModes: ['unmanaged'] is refused #35157 by hand (it does not auto-close) and file the ADR-0126 §9 amendment card citing the merge commit (carrier: this seat).
  • Contract: CONTRACT_REVIEW_TIER records 7005578464 (fce0fd9: PASS, S5 open) and 7006384113 (this head: PASS, S5 closed, no must-fix, no should-fix), both by this seat's isolated at-tier subagent, posted with tier evidence; the earlier records 7000301544 / 7000870325 carry for the byte-identical files.
  • Gates: check-runs on c29f645db5 — success 65, skipped 12, none red or pending. check-governed-merges --pr 35261: not governed, ≤ 3000 changed lines.
  • Changesets read: 35157-unmanaged-copy-capabilities (spec / metadata-protocol / objectql minor, plugin-security / cli patch) matches the tree, including the _packageId-only anchor bullet the S5 fix made true again; 35157-scaffold-no-connector-plugins (create-objectstack) matches the template diff; 35157-capability-draft-count (@object-ui/i18n patch) matches the added preview.changes.typeCount.capability keys. Levels agree with the PR-scoped Metadata-protocol: added, which is what check-changeset-no-major reads.
  • Accepted deviation: the i18n changeset body says Clause-②: no, though a key added to a published locale pack widens TranslationKeys; the PR-scoped line Clause-②: yes (widening) governs and the TIER_DEFAULT face is covered by the records above. Not reworked.
  • Skills-docs: none — … verified: no skills/** text teaches capability as code-only or the scaffold's connector plugins (git grep on origin/main).
  • Fix round (this seat's dispatch): S5 closed with pins on both lists, red by ablation; N7 comments and two docs sentences restated; PR body states rulings 6999763503 and 7000639892.
  • Acceptance notes, not filed (nits, Prime Directive 10): N4, N8, N9, N10 of records 7005578464 / 7006384113; the save-door refusal of a disagreeing capability packageId (dev note, called wider than this card by the record).
  • Overlap: PR chore: version packages #35129 conflicts with this PR in packages/create-objectstack/src/templates/blank/package.json; whichever lands second resolves it.
  • Landing: non-governed, under the size threshold, so the seat may land it; this session's permission classifier refuses the seat's landing stroke, so the PR stays draft and waits for the maintainer (merge, or a grant to the seat).

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#6 · hotlong · session_01Q4EjjNq58cmHeqckjZkTFE

Landing · 2026-11-19T11:48Z · ACCEPT (seat) and CONTRACT_REVIEW_TIER PASS 7006384113 on head c29f645db5 (S5 closed, no must-fix, no should-fix); the head moved only by the relay's clean base sync (pr_update_branch, K was 79 ≥ 15), same patch, now f23d461514.

Reading Value
check-runs on f23d461514 success 63, skipped 10, none red or pending
check-governed-merges --pr 35261 NOT governed; 1533 changed lines ≤ 3000

State: ready + auto-merge. Part of #35157: on MERGED this seat removes pm:dispatched from #35157 by hand and files the ADR-0126 §9 amendment card citing the merge commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file documentation Improvements or additions to documentation size/xl 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.

2 participants