Skip to content

feat(objectql, cli, metadata-protocol, spec, runtime)!: a namespace never equals an object name at every door - #31887

Merged
objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/project-thread-mjoky7
Nov 9, 2026
Merged

objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/project-thread-mjoky7

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

Requested by Steve · project thread

Fixes #31681

ADR-0150 child K (D6, Q3 = A, ruling 6724530715). Claim 6734122356 (domain:server#1, card-thread session_01ADHkmQv69sQL5nfT8xuPWs).

Clause-②: no (narrowing) — measured on head 8ef0c16 (main merged at 97458ba + main), and for base by the ablations below that remove each added call: defineStack, os validate / os build, the package door (SchemaRegistry.installPackage, so POST /api/v1/packages too), the Studio object doors (publish-mode save, per-item publish, publishPackageDrafts pre-flight) and POST /api/v1/packages/:id/publish each refuse what they accepted on base: a namespace equal to an object name in either direction, or an object short-named custom (NS_custom). Nothing is widened.
Metadata-protocol: narrowed
Skills-docs: none — skills/** does not teach a namespace spelled like an object name, or an object named NS_custom; the rule ships in the refusal text and in ADR-0150 D6.

packages/spec exception (seat ruling, option A, 2026-11-09T06:51Z, restated in claim 6734122356): the standard order bars packages/spec/**. The seat granted exactly one call to P's findNamespaceObjectNameClashes in stack.zod.ts, beside validateNamespacePrefix, plus its test. No schema key, no schema shape change, no second predicate. That is all this PR does there, and the changeset bumps @objectstack/spec minor for it.

This is a narrowing, so the review of record runs at CONTRACT_REVIEW_TIER.

维护者速读

  • 改了什么:命名空间永远不能等于对象名(ADR-0150 D6,你裁定的 Q3 = A),对象也不能短名为 custom(NS_custom)。规格卡 P 的谓词 findNamespaceObjectNameClashes 现在接到所有入口:defineStack、os validate / os build、安装门、Studio 的保存 / 单项发布 / 批量发布预检 / 草稿判定,以及 POST /packages/:id/publish。双向拒绝,消息里点出两种拼写和两个包。
  • 为什么改:AI 面拼作 NS-NAME 和 OBJECT-ACTION,命名空间和对象名相同会让一个地址指向两样东西。谓词已在 P 里,但没有任何入口调用它。
  • 风险与回滚:只收窄。第一方 0 处。已有这种冲突的部署升级后启动失败,并点名双方。回滚即 revert。
  • 先看:registry.ts 的 refuseNamespaceObjectNameClashes,protocol-save-door-refusals.ts 的 namespaceObjectNameClashOf(Studio 各门和运行时发布门共用的判定),stack.zod.ts 的 validateNamespacePrefix(唯一一处规格改动)。
  • 两分钟验证:pnpm --filter @objectstack/metadata-protocol exec vitest run src/protocol.namespace-object-name-doors.test.ts,预期 7 passed。
  • 需要你做的:无,席位复审后落地。超出认领文件面的两处(runtime 的发布门、metadata-core 的审计码文档)席位已裁定保留,见文末。

What changes

  • packages/objectql/src/registry.ts: installPackage calls the new private refuseNamespaceObjectNameClashes(manifest, selfId) after N's namespace-name refusal. The incoming package's namespace and objects (its own and its plugins[]', by declaredOwnedObjectNames) are judged against every installed namespace and every registered object whose owner is another package. The package itself is never a second holder. It throws NamespaceObjectNameConflictError (NAMESPACE_CONFLICT, 422, clashes[], the predicate's sentences).
  • packages/cli/src/utils/namespace-object-names.ts (new): findNamespaceObjectNameRefusals(parsed) walks every namespace and object one artifact holds: each packages[] body, plus the stack's own manifest with its top-level objects. It makes one call to the predicate. validate.ts (step 2c-ter) and compile.ts (step 3a-quater) refuse with it, text and --json. The build-gate parity roster lists it.
  • packages/spec/src/stack.zod.ts: validateNamespacePrefix makes the one granted predicate call over the same set. Its refusals ride StackNamespacePrefixInvalidError (issues are the predicate's sentences). No new key, schema or error class.
  • packages/metadata-protocol:
    • protocol-save-door-refusals.ts adds objectNamespaceObjectNameClash (the protocol method), namespaceObjectNameClashOf (engine-only) and refuseNamespaceObjectNameClashes (throws NAMESPACE_CONFLICT / 422). They judge one object's name against every installed package's namespace (its own package excluded) and against its own package's NS_custom.
    • That judge is wired beside the NAMESPACE_PREFIX check at the publish-mode save (protocol-save.ts), the per-item publish (protocol-history-and-publish.ts), the publishPackageDrafts pre-flight (protocol.ts, new PreflightViolationCode NAMESPACE_CONFLICT, audit spelling namespace_conflict) and the draft verdict (protocol-authoring-gate.ts, rule NAMESPACE_CONFLICT).
    • refuseNamespaceObjectNameClashes is exported for the runtime door.
  • packages/runtime/src/domains/packages.ts: POST /packages/:id/publish judges every object the metadata service holds under the package (the membership publishPackage collects) before MetadataManager.publishPackage runs. It answers NAMESPACE_CONFLICT / 422 through errorFromThrown. MetadataManager itself is untouched: it has no manifest, so it cannot name an installed namespace (its own docblock), and its refusals are success: false rows, not a 422. The refusal belongs to the door that holds the registry, as WRITABLE_PACKAGE_REQUIRED does.
  • packages/metadata-core/src/objects/sys-metadata-audit.object.ts: doc only. The closed pre-flight code list names namespace_conflict.
  • scripts/engine-double-contract.pinned.json: the ledger learns the new test's engine double (--write).
  • .changeset/31681-namespace-object-names.md: minor for spec, objectql, cli, metadata-protocol, metadata-core and runtime. It has both declaration lines, the BREAKING Why / Before / Now / Who moves / Unchanged, the census, the one-line fix (rename the namespace or the object) and adr-0087: not-required (no-migration-prescription).

Forced test edits: none. No existing assertion changed.

Step 0 (measured on main cc16008a)

  • P's contract: findNamespaceObjectNameClashes(incoming, installed = {}). Equality is exact and case-sensitive. Direction A: each incoming namespace against every object, incoming and installed. Direction B: each incoming object against every installed namespace. custom: object.name === object.namespace + '_custom'. Every door here calls it; none re-spells it.
  • Sets compared:
    • Stack time and os validate / os build: every namespace and object in the one artifact, plus NS_custom.
    • Install: installed namespaces and registered objects.
    • Studio and package publish: installed namespaces and the object's own package's NS_custom. The other direction there, a new namespace, lands through installPackage (POST /packages and the authored-package create both reach it).
  • Bound (accepted by the seat): a declared dependency carries an id and a range, never a namespace. So defineStack and os validate / os build do not judge packages outside the artifact, and never guess a namespace from an id. The install door judges them.
  • First-party census: 0 first-party.
  • Overlap: 0 of the open non-mailbox PRs touch the door files.

ADR-0150's four readings

  • (a) the phase-1 one-holder tests stay green: bare-name-one-holder.ts is untouched, and its tests run inside the objectql suite (580 files / 11870 passed). N's namespace-name tests run there too.
  • (b) bare-name behaviour unchanged for one-holder names: nothing in a resolver or reader changes. Each door's CONTROL shows a name with one holder still accepted: an object only starting with a namespace (crm_lead_note beside namespace crm_lead), NS_custom_*, the same package registering again, and an object's own package never counting as a second holder.
  • (c) no migration: nothing stored changes shape. A refused name is the author's to rename, and no conversion can choose which one.
  • (d) Clause-②: no (narrowing) above and in the changeset; Metadata-protocol: narrowed; adr-0087: not-required (no-migration-prescription).

Verification

Head 8ef0c16 (origin/main merged into 97458ba, no conflicts). Every heavy run went under os-verify-lock.

  • New tests: install door 7 (registry-namespace-object-name.test.ts); os validate / os build walk 7 plus the parity roster (42 with the parity file); defineStack 7 (stack-namespace-object-name.test.ts); Studio doors 7 (protocol.namespace-object-name-doors.test.ts); runtime doors 5 (package-door-namespace-object-name.test.ts: POST /packages with a new namespace equal to an object, POST /packages/:id/publish with an object equal to a namespace, and custom).
  • Coverage: each door is tested in both directions where both reach it, plus custom, with CONTROLs.
  • Suites (merged head 8ef0c16), each command-exit 0: spec 828 files / 26135 passed; objectql 581 / 11942 passed; metadata-protocol 331 (+5 skipped) / 22633 passed (29 skipped); cli 619 (+2 skipped) / 7715 passed (10 skipped); runtime 567 / 9164 passed (19 skipped); metadata 71 / 987 passed; metadata-core 27 / 1003 passed; the whole dogfood package 441 (+3 skipped) / 3662 passed (42 skipped).
  • Typecheck and lint: tsc --noEmit passes for spec, objectql, cli, metadata-protocol, runtime and metadata-core. eslint --no-inline-config passes on every changed file.
  • Gates: dispatch-gates --commands derived 108 families on the merged head 8ef0c16; all 108 ran, exit 0. --ran reconcile: 108 run, 0 NOT-MEASURED, 0 UNRUN. The first round surfaced three findings, now fixed: check:error-code-provenance (the CLI rows no longer stamp a wire code, and the runtime door throws metadata-protocol's ledgered refusal), check:engine-double-contract (ledger --write), and check:test-source-alias (module-top @objectstack/lint import). check:type-check-debt: 0 entries above their numbers.
Ablations (on the committed code, each file restored and checked with git diff --quiet)
  1. registry.ts: this.refuseNamespaceObjectNameClashes(manifest, selfId); replaced by void 0; → 3 of 7 red: both directions and custom install.
  2. protocol-save.ts: save-door judge forced to null → 2 of 7 red: the save refusal and the custom save.
  3. protocol-history-and-publish.ts: per-item judge forced to null → 1 of 7 red: the per-item publish promotes.
  4. protocol.ts: pre-flight judge forced to null → 1 of 7 red. With two offending drafts, the promotion stops at the first and calls the second BATCH_ABORTED; the pre-flight names both NAMESPACE_CONFLICT.
  5. protocol-authoring-gate.ts: draft-verdict judge forced to null → 1 of 7 red: the draft reads with no NAMESPACE_CONFLICT.
  6. runtime/src/domains/packages.ts: the door's refusal call removed → 2 of 5 red: the publish and custom cases publish (200).
  7. stack.zod.ts: the predicate call replaced by void findNamespaceObjectNameClashes; → 5 of 7 red: every refusal; the CONTROLs stay green.
  8. validate.ts: the call renamed away → 3 of 35 red in the parity test. compile.ts holds the same call, so the parity roster turns red if either command drops it.

Open questions (ruled by the seat)

  1. Surface beyond the claim. The claim names cli, objectql registry.ts, metadata-protocol and the stack.zod.ts wiring. This PR also touches:

    • packages/runtime/src/domains/packages.ts: the POST /packages/:id/publish door. That is where MetadataManager.publishPackage makes a package's objects live, and the only place holding the registry.
    • packages/metadata-core/src/objects/sys-metadata-audit.object.ts: doc comment only. It is the closed pre-flight code list the PREFLIGHT_AUDIT_CODE record points to.

    Options: A, keep them (as built); B, drop the runtime door and state the bound. Recommendation: A, because without it Studio "全部发布" publishes a clashing object with no refusal. Seat ruling: keep (A).

  2. New pre-flight code NAMESPACE_CONFLICT / audit spelling namespace_conflict. It reuses the install door's ledgered code (listed under @objectstack/metadata-protocol already) and adds one value to the closed pre-flight set. Recommendation: keep, since NAMESPACE_PREFIX names a different rule. Seat ruling: keep.

  3. defineStack header. A K clash rides StackNamespacePrefixInvalidError, whose header says "namespace-prefix validation failed" and whose hint is about the prefix. The issues and the lines are the predicate's own sentences. A separate error class would be a new spec export, beyond the granted exception. Recommendation: keep. Seat ruling: keep; the message names the clash and both spellings, pinned in stack-namespace-object-name.test.ts (err.message contains both packages' spellings, issues equal the predicate's sentences).

  • Names (seat's call, house conventions): NamespaceObjectNameConflictError, SchemaRegistry.refuseNamespaceObjectNameClashes (private), findNamespaceObjectNameRefusals, objectNamespaceObjectNameClash, namespaceObjectNameClashOf, refuseNamespaceObjectNameClashes (metadata-protocol export). No new error code.

Generated by Claude Code

🤖 Generated with Claude Code

https://claude.ai/code/session_01ADHkmQv69sQL5nfT8xuPWs

…ever equals an object name at every door

ADR-0150 D6: every door that makes a namespace or an object live now asks
the spec's predicate (findNamespaceObjectNameClashes) and refuses a
namespace equal to an object name in either direction, or an object
short-named `custom` (NS_custom), naming both spellings:

- defineStack: one call beside the namespace-prefix check, over every
  namespace and object the one artifact holds.
- os validate / os build: findNamespaceObjectNameRefusals over the same.
- SchemaRegistry.installPackage: NAMESPACE_CONFLICT 422 with clashes[],
  against every installed namespace and registered object.
- Studio object doors (publish-mode save, per-item publish, the
  publishPackageDrafts pre-flight, the draft verdict): NAMESPACE_CONFLICT
  422; the pre-flight audit row spells it namespace_conflict.
- POST /packages/:id/publish: judged before MetadataManager.publishPackage,
  NAMESPACE_CONFLICT 422.

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ADHkmQv69sQL5nfT8xuPWs
@objectstack-fleet objectstack-fleet Bot added the domain:server Domain lane — seat card indexed by label:pm:seat label Nov 9, 2026
@github-actions github-actions Bot added size/xl 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 9, 2026
@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 6 package(s): @objectstack/cli, @objectstack/metadata-core, @objectstack/metadata-protocol, @objectstack/objectql, @objectstack/runtime, @objectstack/spec, touching 105 documentable anchor(s). ⚠️ 1 changed file(s) yielded no anchor (packages/metadata-protocol/src/index.ts), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

37 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 6a8f4151d53203268a1913dfcde9caf4d547384e.

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

What this run could not see
  • 1 changed file(s) yielded no anchor (packages/metadata-protocol/src/index.ts) — pages documenting those are invisible to this run
  • 2 anchor(s) matched too much of the corpus to be a work list: objectName (symbol, 57 pages), os validate (command, 87 pages)
  • 5 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 65 of 231 client-bound route-ledger rows — the other 166 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 166: 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; 107 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 — 183 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 6a8f4151d53203268a1913dfcde9caf4d547384e → packageMentionDocs.

Which tree this was computed on

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

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

⚠️ 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 6a8f4151d53203268a1913dfcde9caf4d547384e → 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

domain:server#1 · os-steve · session_01ADHkmPF1skfu2kx89BEXZi

Contract-review-claim: session_01ADHkmPF1skfu2kx89BEXZi · head 8ef0c16 · 2026-11-09T11:12Z

Narrowing face (Clause-②: no (narrowing), Metadata-protocol: narrowed). An isolated reviewer is reviewing this head at CONTRACT_REVIEW_TIER, with the card's packages/spec exception in scope.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#1 · os-steve · session_01ADHkmPF1skfu2kx89BEXZi

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 8ef0c16897bc975eb49920df22db292c019f9e45
Local-runs: none
Scope: packages/spec/src/stack.zod.ts (the one hits path reviewFace reads off the PR's file list — a published-spec path, so the schema face is served at the same tier as the declared narrowing face; this record covers both), packages/cli/src/commands/compile.ts, packages/cli/src/commands/validate.ts, packages/cli/src/utils/namespace-object-names.ts, packages/cli/src/utils/namespace-object-names.test.ts, packages/cli/test/validate-build-gate-parity.test.ts, packages/metadata-core/src/objects/sys-metadata-audit.object.ts, packages/metadata-protocol/src/index.ts, packages/metadata-protocol/src/protocol-audit-entry.ts, packages/metadata-protocol/src/protocol-authoring-gate.ts, packages/metadata-protocol/src/protocol-history-and-publish.ts, packages/metadata-protocol/src/protocol-host.ts, packages/metadata-protocol/src/protocol-save-door-refusals.ts, packages/metadata-protocol/src/protocol-save.ts, packages/metadata-protocol/src/protocol.ts, packages/metadata-protocol/src/protocol.namespace-object-name-doors.test.ts, packages/objectql/src/registry.ts, packages/objectql/src/registry-namespace-object-name.test.ts, packages/runtime/src/domains/packages.ts, packages/runtime/src/package-door-namespace-object-name.test.ts, packages/spec/src/stack-namespace-object-name.test.ts, scripts/engine-double-contract.pinned.json + packages/spec/src/kernel/namespace-prefix.ts (P's predicate, the one every door calls), packages/objectql/src/engine-registration.ts and engine-package-registration.ts (the boot path: installPackage runs before registerObject; nested plugins ride the parent's install), packages/metadata/src/metadata-manager.ts (collectPackageMembers, the membership the runtime door mirrors), packages/metadata-protocol/src/protocol-package-install.ts and protocol-package-commits.ts (every authored install, duplicate and upgrade reaches SchemaRegistry.installPackage), packages/core/src/artifact-packages.ts (resolveArtifactPackageOrder returns the manifest bodies the CLI walk reads), docs/adr/0150-behavioural-metadata-addressed-by-package-objects-keep-the-literal-prefix.md on main (D6, row K). Not reviewed: .changeset/31681-namespace-object-names.md (prose face, read for ②), scripts/engine-double-contract.pinned.json (generated ledger, read only).

① Derived judgments

Every accept-set and public-surface change the diff implies, judged against the tree, not the PR body.

  1. defineStack (packages/spec/src/stack.zod.ts, validateNamespacePrefix): refuses a namespace equal to an object name across ONE artifact (top-level manifest + objects, and each packages[] entry's manifest with its objects) and an object NS_custom. One call to P's findNamespaceObjectNameClashes, riding StackNamespacePrefixInvalidError with issues = the predicate's sentences; unconditional (not strict-only, line 6405). No schema key, no shape change, no new export — exactly the granted exception. Right. The ADR's row K text also names "its declared dependencies' namespaces" for this door; the diff bounds that out because a dependency carries an id and a range (ADR-0141) and never a namespace, and the install door judges it. Guessing a namespace from an id would break red line 2, so the bound is the right reading; see ④ nit 3 for the ADR text.
  2. os validate step 2c-ter and os build step 3a-quater (cli): the same walk over resolveArtifactPackageOrder(parsed) bodies plus the stack's own manifest and top-level objects, exit 1, text and --json (errors rows are the predicate's rows with no wire code, like N's rows). Parity roster lists the helper. Right.
  3. SchemaRegistry.installPackage (objectql): new refusal NamespaceObjectNameConflictError (NAMESPACE_CONFLICT, status/httpStatus 422, clashes[]), placed ahead of every mutation beside N's gate. Incoming = manifest namespace + declaredOwnedObjectNames of the manifest and each nested plugins[] body (computeFQN is identity, so names are compared as shipped); installed = namespaceRegistry minus self, objectContributors keys minus self-owned and minus the incoming set. Reached by: boot (registerPackageBody installs BEFORE registering objects, so either install order sees the other side), POST /api/v1/packages both arms, the protocol install primitive, package commits (duplicate, upgrade), the ADR-0146 pair ensure, sys_packages rehydrate. Class is module-exported, not package-index-exported, like its siblings NamespaceConflictError/NamespaceNameConflictError. Right.
  4. metadata-protocol: new ProtocolHost/AuthoringGateHost member objectNamespaceObjectNameClash; new package export refuseNamespaceObjectNameClashes (additive); PreflightViolationCode gains NAMESPACE_CONFLICT with audit spelling namespace_conflict; draft verdict rule NAMESPACE_CONFLICT. Judged at the publish-mode object save (same condition as NAMESPACE_PREFIX: object, mode publish, source undefined), the per-item publish (on promoteInto, sealed managed items excluded), the publishPackageDrafts pre-flight (every offending draft named before any promotion) and the draft verdict. An object with no package (environment-authored) is judged against every installed namespace. Right. A draft-mode save is admitted by design and told by the verdict; whichever door promotes it refuses — the same disposition the prefix rule has.
  5. runtime POST /api/v1/packages/:id/publish: judges every object the metadata service holds under the package before MetadataManager.publishPackage, answering 422 NAMESPACE_CONFLICT through errorFromThrown. Right (see ④ nit 1 on the re-spelled membership).
  6. metadata-core sys-metadata-audit.object.ts: doc comment only, the closed pre-flight list gains namespace_conflict. Right.
  7. Nothing widened: no resolver, reader, URL, MCP or SDK path changes; bare-name-one-holder.ts untouched. Right.

Doors tried and found closed: boot in either order; nested plugins[] objects (judged through the parent's install; plugin.zod.ts declares no namespace of its own); environment-authored objects; package upgrade/duplicate (through installPackage); namespace change on an installed package (updatePackageManifest admits no namespace, so only a reinstall can move it, and that is judged; a package re-shipping its old object under a new equal namespace is caught by direction A over its own incoming set); Studio rename (a new save, judged at promotion); package-duplicate/package-unmanaged-import (write through saveMetaItem with source undefined, so judged); the stored-metadata migration (source set) is exempt exactly as the prefix rule exempts it and defines no new object. Case/fold: the predicate is exact, and both grammars are lowercase-only (^[a-z][a-z0-9_]{1,19}$, ^[a-z_][a-z0-9_]*$), so no fold can admit what equality refuses.

First-party census (read, not run): 24 distinct namespace: strings across examples/**, packages/*/src, templates and fixtures; no first-party object definition, .object.* file or object-map key is named like any of them, and no first-party object is named *_custom. Matches the changeset's "0 / 0".

② Semver level

Changeset .changeset/31681-namespace-object-names.md: minor for spec, objectql, cli, metadata-protocol, metadata-core, runtime; feat(...)!: title; BREAKING banner with Why / Before / Now / Who moves / Unchanged and the measured census; Clause-②: no (narrowing) on the PR body and the changeset, Metadata-protocol: narrowed, Skills-docs: none with its reason, adr-0087: not-required (no-migration-prescription). This matches what the diff publishes: an accept-set narrowing at six packages, one additive export (metadata-protocol), one new error class and one new closed-set value, no removed key or export, no stored-shape change. Check Changeset: success. Clause-②: line judged right.

Nit (prose face): @objectstack/metadata-core ships a doc comment only; patch would state it more exactly than minor. No effect on the contract.

③ Boundary flags

Dev open_questions (seat ruled all three "keep"); each judged sound:

  1. Surface beyond the claim — runtime packages.ts publish door + metadata-core doc line. Sound. MetadataManager has no manifest and no registry, so it cannot name an installed namespace (its own docblock, and publishPackage's namespace option covers only the caller's own namespace); its refusals are success: false rows, not a 422. The one caller is the runtime door, which already holds qlService and refuses WRITABLE_PACKAGE_REQUIRED the same way. Dropping it would leave Studio "全部发布" admitting a clashing object with no refusal, against the card's "Studio publish" door. The metadata-core line keeps a documented closed set truthful. Kept rightly.
  2. NAMESPACE_CONFLICT reused; pre-flight code and namespace_conflict audit spelling added. Sound. The code is already ledgered to metadata-protocol and objectql for "a name the namespace position reads is taken", check:error-code-provenance is green on the head, NAMESPACE_PREFIX names a different rule, and the install error carries clashes[] so a consumer can tell K's clash from the namespace-owner conflict without parsing the sentence. Kept rightly.
  3. defineStack clash rides StackNamespacePrefixInvalidError. Sound within the granted exception (a new class would be a new spec export). issues are the predicate's sentences and the message names both spellings and both packages, pinned by the test. The header "namespace-prefix validation failed" and the appended hint "Every object.name must be ${manifest.namespace}_${shortName}" do not describe a K clash — see ④ nit 2.

Dev deviations: the runtime door in place of MetadataManager.publishPackage (= Q1, sound); the changeset also bumps metadata-core and runtime (right for runtime; metadata-core see ② nit).

Card red lines: (1) resolution never loosens — no resolver or fallback touched; (2) ambiguity reported, never guessed — every clash is listed (clashes[], joined sentences, every offending draft in the pre-flight), and no namespace is guessed from a dependency id; (3) independently releasable — (a) phase-1 one-holder tests untouched, (b) bare-name behaviour unchanged for one-holder names (controls at every door), (c) no migration, (d) declarations present. No narrowing beyond the declared one.

Check-runs on the head at render time: 29 concluded, every one success (Check Changeset, Governed Surface Queue Guard, PR-body guards, every Lint family, Type Check source/consumer/debt, Dogfood Regression Gate, Spec property liveness, Live E2E UI, Build Core, Build UI Deps); 0 failed; 13 skipped by design; 25 still in progress (Test Core 1-8, Test UI 1-16, Type Check workspace, Type Check UI). The dispatching seat confirms those conclude green before posting; a red one reopens ③.

④ Design judgment

The narrowing read against ADR-0150 D6 and row K on main: it makes the spec's own refusal real ("a namespace never equals an object name, refused in both directions at every object door, naming both spellings; no object short-named custom"). It takes no declared capability away at a consumer: the NS-NAME / OBJECT-ACTION face and the qualified address are what the clash breaks, and nothing on main promises an object and a namespace on one string. The one predicate is called, never re-spelled, at every door; each door compares against the set it can see and states the set it cannot (the artifact doors never guess the environment; the Studio doors leave the new-namespace direction to the install door that every namespace passes through). No must-fix, no should-fix.

Findings:

  • nit 1 — runtime door re-spells the publish membership. packageObjectNames in packages/runtime/src/domains/packages.ts copies the packageId / package / _packageId test of MetadataManager.collectPackageMembers (private) instead of asking the manager. The two agree today, so the door judges exactly the set publishPackage makes live; if the membership rule moves, the door's set drifts silently. Follow-up card: expose the membership from @objectstack/metadata (or publish through a hook that judges each member) and have the door read it.
  • nit 2 — defineStack header and hint name the prefix rule for a K clash. issues and the lines are the predicate's sentences and the test pins both spellings, so the author is told the right thing; the header and the ${manifest.namespace}_${shortName} hint are the prefix rule's. Fixing it is packages/spec code (beyond the granted call), so: accepted deviation here, follow-up card to split the header/hint by issue kind.
  • nit 3 — ADR-0150 row K text. The row says defineStack/os validate compare with "its declared dependencies' namespaces"; a dependency carries an id and a range, so that set is unreachable at author time and the install door holds it. The tree is right and the seat accepted the bound; the ADR row should be amended (docs prose, outside this PR). Follow-up card.

Nits alone: the round ends here.

Implemented-by: claude/project-thread-mjoky7
Reviewed-by: session_01ADHkmPF1skfu2kx89BEXZi

VERDICT: PASS

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 domain:server Domain lane — seat card indexed by label:pm:seat 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.

install/validate/publish doors: refuse a namespace equal to an object name, both directions (ADR-0150 child K)

1 participant