Skip to content

fix(metadata-protocol): duplicating a package copies its seeds (no stamped name on a seed) - #39347

Draft
objectstack-fleet[bot] wants to merge 3 commits into
mainfrom
claude/issue-39341-duplicate-seed-name
Draft

objectstack-fleet[bot] wants to merge 3 commits into
mainfrom
claude/issue-39341-duplicate-seed-name

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Bill · project thread

Fixes #39341

Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:组织管理员复制一个带示例数据的软件包(首先是入门应用)时,以前提示复制失败且副本没有示例数据,现在复制成功、副本带齐示例数据。
  • 为什么做:属于软件包管理的复制能力,替每个想把官方入门应用拿来改成自己应用的组织解决。
  • 出错会怎样:只影响复制软件包这一条路径里的示例数据项;若有问题,表现为复制结果里某条示例数据失败,可直接撤回本次改动。
  • 要你做什么:无

What changes

ProtocolPackageCommitsFacet.duplicatePackage copies every active row of the source package through the shared rename engine (planNamespaceRename in package-namespace-rename.ts), whose rewrite sets name to the copy name on every body except an object_extension one. A seed body has no name: a seed is addressed by its row name, and the strict SeedSchema refuses the key. So every copied seed met the save door's spec validation ("Unrecognized key(s) on this seed: name") and the duplicate answered success: false, listing each seed in failed.

The duplicate door now takes the stamped name back off a copied seed before it saves it (one line in protocol-package-commits.ts). The seed schema is unchanged (no name added to its accept set, per the card's Done-when). The copy's object still follows the copied object, through the engine's reference rewrite.

Where name enters, and why other types do not trip: the engine's rewrite stamps it; every other copied type declares name in its schema, and object_extension was already exempted at the engine. The sibling copy door, the unmanaged install with targetNamespace, never sends a seed through rewrite (it plans the seed's object name itself), so it is not affected.

Tests

  • New top-level describe in the booted-kernel duplicate harness packages/objectql/src/protocol-duplicate-package-unprefixed-object.test.ts (real ObjectKernel + ObjectQLPlugin, rows read out of the driver): a source package with an object and a seed is duplicated; asserts success: true, failed: [], the copy's seed is stored under dupdst_customer_seed, aimed at dupdst_customer, with the source's records, no name key, and a full SeedSchema.safeParse success.
  • Red before the fix: the same test, run against metadata-protocol built from the base fde47efb, failed with the card's exact refusal (seed/dupdst_customer_seed failed spec validation: Unrecognized key(s) on this seed: name). Green after rebuilding with the fix.

Acceptance notes

  • The reproduction is on a synthetic package that ships one seed (the card's Done-when allows "a package that ships at least one seed"); the installed Starter itself was not booted for this PR.
  • Observation, not filed: the copy of a seed still passes through the rename engine's whole-identifier free-text rewrite, so a record VALUE spelled exactly like a renamed object name of the package would be rewritten in the copy. The unmanaged import skips rewrite for seeds for that reason. Not reproduced on any real package; no reach measured.
  • The class-wide alternative (the engine stamping name only on types whose declaration carries one) lives in package-namespace-rename.ts, outside this card's claimed file surface.

Verification

Two-minute check: pnpm --filter @objectstack/metadata-protocol build && pnpm --filter @objectstack/objectql exec vitest run src/protocol-duplicate-package-unprefixed-object.test.ts -t 39341 shows 1 passed.

Read first: packages/metadata-protocol/src/protocol-package-commits.ts (the seed strip after rename.rewrite), then the new describe at the end of the objectql harness file.


Generated by Claude Code

…opy's seeds save

The rename engine names every copied body; a seed is addressed by its row
name and the strict SeedSchema refuses `name`, so every seed of a duplicated
package was refused at the save door. Pinned on a booted kernel.

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

github-actions Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/metadata-protocol, touching 1 documentable anchor(s).

⛔ 1 release-owned page(s) name something this change touched. These are read-only:

  • content/docs/releases/v18/18-3.mdx (via duplicatePackage (symbol, a method of class ProtocolPackageCommitsFacet))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see
  • the SDK route bridge reached 71 of 256 client-bound route-ledger rows — the other 185 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 185: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 60 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 125 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 — 10 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 c99c8a502209f6e924c77e227c2648993f22f3cb → packageMentionDocs.

Which tree this was computed on

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

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

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

This branch has not been deployed

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

Labels

documentation Improvements or additions to documentation size/s 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.

package duplicate: every seed of the installed Starter is refused "Unrecognized key(s) on this seed: name", so the copy answers success:false

2 participants