Skip to content

fix(metadata-protocol): a package copy under a new namespace calls its own flows - #38642

Draft
objectstack-fleet[bot] wants to merge 4 commits into
mainfrom
claude/issue-38595-rename-flow-refs
Draft

objectstack-fleet[bot] wants to merge 4 commits into
mainfrom
claude/issue-38595-rename-flow-refs

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

Requested by Steve · project thread

Fixes #38595

Clause-②: no
Metadata-protocol: none

维护者速读

  • 管理员把一个应用包以新的命名空间安装或复制之后,复制出来的流程调用的是复制包自己的子流程,按钮触发的也是复制包自己的流程;以前调用的是原包的流程,或者因为找不到流程而每次运行都失败。
  • 属于"软件包安装与复制"这块能力,替用新命名空间安装应用包、或复制一份应用包来改的管理员解决"复制后流程跑不起来或串到原包"的问题。
  • 只影响带新命名空间的安装和复制;如果改名规则出错,复制包里的某个流程调用会指向错误的名字,原包不受影响,可以直接撤回这次合并恢复原来的行为。
  • 无

What changes

planNamespaceRename (packages/metadata-protocol/src/package-namespace-rename.ts), the one rename engine behind the unmanaged install's targetNamespace and duplicatePackage, renamed a package flow under the prefix swap (crm_child to crm2_child) but rewrote no name that calls it. It now builds a flow rename map from the package's own flow items and rewrites a value that EQUALS a renamed flow name, whole, at:

  • the derived index's flow sites, REFERENCE_SITES.byTarget.get('flow'), read the same way the object sites are (by property, wherever it occurs). Dumped at runtime on this tree it holds {fromType:'flow', property:'flowName'} and {fromType:'translation', property:'flows'}, so a subflow step's config.flowName and a translation's flows keys follow;
  • the one hand-written site, commented as such in the code: a target whose sibling executor is 'flow'. That is type: 'flow' on an action (ActionSchema, an object's actions[], an inline action, an action:group member, an API endpoint) and actionType: 'flow' on an action:button / action:icon page block, where type is the component. The index cannot carry target, because on every other executor it names a URL, script, page, endpoint or form, and a property-wide site would rewrite those too and list them in the "Used by" answer.

A flow the package does not hold keeps its name, a flow the prefix swap keeps keeps its name, and nothing is substring-rewritten. A value that is not a renamed flow name falls through to the rules every string already took, so nothing that read the same before reads differently now. Collisions work as they do for objects: a renamed flow name that meets a name the item already holds at that site (a translation keyed by both crm_child and crm2_child) refuses the item, and the refusal names the flow. The internal atReference: boolean of the walk became the site's rename map (object or flow), so both kinds share one walk and one collision rule.

The publish gate of PR #38594 is not touched.

Tests

Engine pins, package-namespace-rename.test.ts (7 new cases)

flowName follows; other_flow, an unprefixed bare_child and a superstring crm_child_v2 keep their names; a flow action's target follows while modal / script / api targets equal to the same string do not; the object actions[], API endpoint and page actionType spellings; translation flows keys; the collision refusal; and a copy that keeps the source namespace renames nothing.

Door pins, new package-namespace-rename-flow-refs-38595.test.ts (6 cases)

The harness (makeEngine, crmBody) is copied from package-unmanaged-install.test.ts, which is not edited. Its automation service answers listFlows, so a gate that judges a step's called flow has a non-empty universe.

  • an unmanaged install with targetNamespace: 'crm2' installs, and the stored crm2_parent calls crm2_child;
  • the copied flow action reads target: 'crm2_child', and the modal control keeps target: 'crm_child';
  • with the source package installed under its own names beside the copy, the copy's crm2_parent calls crm2_child;
  • a call to other_flow keeps its name;
  • duplicatePackage into crm2 gives the same result with the source installed, and the source still calls crm_child;
  • parity: the duplicate and the import into crm2 store identical flow and action items.
Package run at 5ec669b

pnpm --filter @objectstack/metadata-protocol typecheck && … exec vitest run --maxWorkers=2 under the verify lock: VERDICT command-exit 0, Test Files 373 passed | 9 skipped (382), Tests 23670 passed | 45 skipped (23715). The typecheck program lists the test files.

Ablation

The fix commit came first. Then scripts/ablation-replace.mjs swapped the one line that fills the flow rename map for a no-op (anchor 1 to 0, blob e90813508b99 to 114356add0b3). With that in place, 9 of the 13 new cases failed (Tests 9 failed | 26 passed (35)): every rewrite pin on both test files. The four that stayed green were the three controls and the parity case, which stays equal when both doors are equally wrong. The tool then restored the file: the blob matched HEAD again and git diff HEAD was empty.

Under PR #38594's gate (head 93f3643)

In a throwaway tree at that head, with this branch's two commits cherry-picked, the closure was built and both test files passed (Tests 42 passed). With the same ablation there, the install pins fail with the gate's own 422: INVALID_METADATA, flow-subflow-unknown at flows[0].nodes[1].config.flowName, "calls flow 'crm_child' … Did you mean crm2_child". So the gate is live in this harness and the pins pass under it, without depending on its code. The tree was removed afterwards.

Acceptance notes

  • When this branch and PR fix(lint)!: the publish gate refuses a subflow or map step that calls a flow the deployment does not hold #38594 are both applied, a parent-first duplicate fails, and the remedy belongs in PR fix(lint)!: the publish gate refuses a subflow or map step that calls a flow the deployment does not hold #38594. In that tree, duplicatePackage of a base whose stored rows hold crm_parent (calling crm_child) before crm_child answers failed: [crm_parent: flow/crm2_parent failed author-time validation … config.flowName [flow-subflow-unknown]] and writes only crm2_child. PR fix(lint)!: the publish gate refuses a subflow or map step that calls a flow the deployment does not hold #38594's duplicate leg states no copy-plan flow names. Its own comment says "duplicatePackage copies stored rows, which the gate's own read of the stored flows already holds", and that stops being true once the copy's calls name the copy's flows. The install leg states them (copyPlanFlowNames) and passes in either order. This PR's duplicate pins store the called flow first, so they hold on both trees. The parent-first duplicate under the gate is reported for that PR's seat. It is not worked around here.

  • Measured with the same engine probe, outside this card: the names of other non-object items (dashboard, page, report) are renamed by the prefix swap, but their references are not. That covers app navigation's dashboardName / pageName / reportName and a translation's dashboards / pages / reports keys. A dashboard header action with actionType: 'flow' keeps its actionUrl. These are reported to the seat as one family. They are not fixed here.

  • Outside the dispatched file surface, added by the PM's amendment: scripts/engine-double-contract.pinned.json gains 3 rows (15 lines) for the new test file's copied stub engine, produced by node scripts/check-engine-double-contract.mjs --write. No existing row changed, and pnpm check:engine-double-contract exits 0 at fb44b0f.

Verification

Read first, by risk:

  1. package-namespace-rename.ts, the deepRewrite object branch: the child-site expression referenceSiteOf(k) ?? (site && k === 'name' ? site : flowTargetSite(v, k)) replaced the old boolean. Object sites must behave exactly as before.
  2. package-namespace-rename.ts, flowTargetSite and FLOW_EXECUTOR_KEYS: the one hand-written site.
  3. package-namespace-rename-flow-refs-38595.test.ts: the source-still-installed case and the duplicate parity.

Two-minute check: pnpm --filter @objectstack/metadata-protocol exec vitest run --maxWorkers=2 src/package-namespace-rename-flow-refs-38595.test.ts src/package-namespace-rename.test.ts should report 2 files and 35 tests passing.

🤖 Generated with Claude Code

https://claude.ai/code/session_01ADHkmRar3Kkg6SpwVgaaVE

…enamed flows

planNamespaceRename renamed a package flow under the prefix swap but kept
every name that calls it: a subflow step's config.flowName, a translation's
flows keys and a flow action's target still named the source's flow. The
copy now rewrites a value equal to a renamed flow name, whole, at the derived
index's flow sites and at a target beside a 'flow' executor.

Claude-Session: https://claude.ai/code/session_01ADHkmRar3Kkg6SpwVgaaVE
Co-authored-by: Claude <noreply@anthropic.com>
…'s renamed flows

Engine pins (subflow flowName, flow action target with a non-flow control,
the API endpoint and page action-block spellings, translation flows keys and
their collision refusal) and door pins for the unmanaged import with
targetNamespace and duplicatePackage, including the source-still-installed
case and the parity of the two doors.

Claude-Session: https://claude.ai/code/session_01ADHkmRar3Kkg6SpwVgaaVE
Co-authored-by: Claude <noreply@anthropic.com>
…ng a copy's flows

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

github-actions Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

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

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

  • content/docs/automation/flows.mdx (via actionType (literal, a string literal in FLOW_EXECUTOR_KEYS))
  • content/docs/deployment/validating-metadata.mdx (via actionType (literal, a string literal in FLOW_EXECUTOR_KEYS))
  • content/docs/frontend/layout.mdx (via actionType (literal, a string literal in FLOW_EXECUTOR_KEYS))
  • content/docs/frontend/quick-start.mdx (via actionType (literal, a string literal in FLOW_EXECUTOR_KEYS))
  • content/docs/frontend/schema-rendering.mdx (via actionType (literal, a string literal in FLOW_EXECUTOR_KEYS))
  • content/docs/ui/create-vs-edit-form.mdx (via actionType (literal, a string literal in FLOW_EXECUTOR_KEYS))

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

  • content/docs/releases/v16.mdx (via actionType (literal, a string literal in FLOW_EXECUTOR_KEYS))
  • content/docs/releases/v17/17-0.mdx (via actionType (literal, a string literal in FLOW_EXECUTOR_KEYS))
  • content/docs/releases/v17/17-6.mdx (via actionType (literal, a string literal in FLOW_EXECUTOR_KEYS))
  • content/docs/releases/v17/17-7.mdx (via actionType (literal, a string literal in FLOW_EXECUTOR_KEYS))

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 69 of 252 client-bound route-ledger rows — the other 183 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 183: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 124 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 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 e6634cebd7ad07587f74b4bee8dfaa05235360bc → packageMentionDocs.

Which tree this was computed on

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

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

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

…ne doubles

The door pins for the flow-reference rename copy the stub engine of
package-unmanaged-install.test.ts; `check-engine-double-contract --write`
records its three pinned verbs (15 lines added, none changed, no seam lost).

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

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/l tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

2 participants