Skip to content

fix(lint)!: the publish gate refuses a subflow or map step that calls a flow the deployment does not hold - #38241

Closed
objectstack-fleet[bot] wants to merge 5 commits into
mainfrom
claude/issue-35143-flows-leftovers
Closed

objectstack-fleet[bot] wants to merge 5 commits into
mainfrom
claude/issue-35143-flows-leftovers

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

Fixes #35143

Clause-②: yes (narrowing)
Metadata-protocol: narrowed
Skills-docs: follow-up owed (#38259) — skills/objectstack-automation/SKILL.md (the subflow row says os validate warns flow-subflow-unknown; it does not say the publish refuses a call to a flow nothing in the deployment holds), skills/objectstack-automation/evals/flows-triggers-approvals.json (the eval that names flow-subflow-unknown)

维护者速读

  • 用户能看到什么变化:搭建者(包括 AI)发布一个流程时,如果其中“调用子流程”或“逐项调用流程”的步骤写了一个整个环境里都不存在的流程名,发布现在会直接被拒并说明原因;以前能发布成功,但每次运行到这一步都会失败。命令行校验仍然只给警告。
  • 为什么做:属于“开源框架先拦住云端构建检查才拦得住的问题”这一族收尾(流程族最后两条),替写流程的搭建者挡住“发布成功、运行必失败”。
  • 出错会怎样:这是一次收紧——以前能发布的这类流程下次发布会被拒;被调用的流程只要以草稿形式存在、或在同一批次发布、或由已安装的软件包提供,都不会被拒;撤回本改动即恢复原样。
  • 要你做什么:无

What changes

The card's last two open lines, re-verified on main (1208460) first.

F1, option label in decision-node and edge conditions: already covered on main, no change here. flow-condition-option-label reads every edge condition and every decision node's conditions[].expression (and query filter operands) since #37491 (optionLabelsBeyondStart in validate-flow-trigger-readiness.ts, at error, same id, runtime gate and CLI). Its positive and negative pins are in flow-publish-checks-second-batch.test.ts, describe "past the start condition". The card gets a line saying so.

F6, a subflow / map step calling a flow that does not exist: now refused at the publish gate. It was a CLI-only warning because the gate's per-write snapshot holds just the written flow. The gate now judges the call against the names of every flow the deployment holds, which the host states on a flow publish:

  • every installed package's flows (the registry; a disabled package's included);
  • the stored flow rows of every state, drafts included, so two new flows that call each other can still be published one at a time;
  • the flows the same publish batch carries (pending.flows), so a package that ships a flow with its caller publishes;
  • every flow the automation engine holds (listFlows), so a flow registered straight into the engine with no metadata row resolves.

A call that names none of them, and is not the written flow itself, is an error (flow-subflow-unknown): execute answers Flow 'X' not found on every run.

Severity per door:

Wiring:

  • @objectstack/lint: validateFlowSubflowTargets(stack, { deploymentFlowNames }), the AuthoringRuleContext.deploymentFlowNames input, and runRuntimeAuthoringRules({ deploymentFlowNames }). The rule's registry entry moves to tier: 'gating', surfaces: CLI_AND_RUNTIME, runtimeTypes: ['flow']. Its runtime pass judges nothing without stated names. The rule's explanation text is updated.
  • @objectstack/metadata-protocol: evaluateRuntimeAuthoringGate({ deploymentFlowNames }) adds the batch's flow drafts. judgeRuntimeAuthoringRules reads the names on a flow write only (deploymentFlowNamesOf, automationFlowNames in protocol-authoring-gate.ts), through the host's existing servicesRegistry. protocol.ts is unchanged, since it is a facade at its line ceiling.
  • @objectstack/spec: the ADR-0087 entry publish-refuses-flows-that-save-and-do-not-run now says flow-subflow-unknown is an error at the publish gate. The old text, "three warnings which refuse nothing", would be false after this change.

No rule is added, so no "author-time rules (N)" count moves.

Why

#35143 "Done when": each line is a rule with its pins, or a line on the card saying which rule covers it. F1 is the second case and F6 is now the first. The hosted copy of the subflow check can be deleted.

Tests

Lint: new pins in flow-publish-checks-second-batch.test.ts (describe flow-subflow-unknown)
  • CLI: still exactly one warning.
  • Runtime gate refuses a call to a name the stated set lacks: error, path flows[0].nodes[1].config.flowName, message opening, rulesRun names the rule.
  • A map call inside a loop body: error at flows[0].nodes[1].config.body.nodes[0].config.flowName.
  • Silent: a name the stated set holds, the written flow calling itself.
  • No verdict: no stated names, an empty set.
Metadata-protocol: new describe in protocol.runtime-authoring-gate.test.ts (the shared harness), end to end through saveMetaItem
  • 422 INVALID_METADATA, issue flow-subflow-unknown at the path, nothing stored.
  • Accepted: a flow only the automation engine holds, an installed package's flow (registry), a stored draft, a stored active flow.
  • No automation service: accepted (no verdict).
  • evaluateRuntimeAuthoringGate: a flow in pending.flows resolves; without it the call is refused.
  • Ablation: forcing deploymentFlowNamesOf to answer undefined fails the refusal pin (1 failed / 3 passed); restored from the commit, 4/4.
Suites (head 3842e18 before the main merge; under os-verify-lock)
  • @objectstack/lint test: 246 files / 9935 tests passed. typecheck exit 0.
  • @objectstack/metadata-protocol test: 373 passed / 9 skipped files, 23616 passed / 45 skipped tests. typecheck exit 0. After the facade refactor: protocol.runtime-authoring-gate.test.ts 263/263, typecheck exit 0.
  • @objectstack/spec src/migrations: 5 files / 208 tests.
  • CLI scaffold suites: generate-scaffold-validates 26/26. generate-scaffold-gates.e2e + generate-scaffolds-reach-stack.e2e (OS_TEST_TIERS=nightly): 2 files / 77 tests. No new finding.
  • examples/app-showcase author-time-advisories: 2/2.
  • Dogfood battery on the final head: reported on the card's dev report.

Acceptance notes

  • Not judged: whether the engine's package-scoped name resolution lets the calling flow reach the called one (ADR-0150 D3). The set is the whole deployment, so an outside-closure call still fails at run time. Judging that would need the resolver's verdict at the door.
  • A call to a stored draft, or an archived or deprecated row, is let through. The step fails until that flow is active. This keeps two new flows that call each other publishable one at a time.
  • The stored read for names is not filtered for legacy organization rows. An extra name can only let a call through.

Verification

  • Read first: packages/metadata-protocol/src/protocol-authoring-gate.ts deploymentFlowNamesOf (the union and the no-verdict exits), packages/lint/src/authoring-rules.ts the validateFlowSubflowTargets entry (runtime pass with no names = nothing), packages/lint/src/validate-flow-trigger-readiness.ts validateFlowSubflowTargets.
  • Two minutes: pnpm --filter @objectstack/metadata-protocol exec vitest run src/protocol.runtime-authoring-gate.test.ts -t 35143. Expect 4 passed, one of them a 422 naming flow-subflow-unknown.
Gates

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic.
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint passes (CI-owned run).
  • 4. One issue, one branch off an up-to-date main, one pull request.
  • 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset.
  • 6. packages/spec touched: only a migration entry's text, no generated artifact moves.
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Q4EjjQkY5yXZrN9BEA3rEK

@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 28, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 3 package(s): @objectstack/lint, @objectstack/metadata-protocol, @objectstack/spec, touching 27 documentable anchor(s). ⚠️ 1 changed file(s) yielded no anchor (packages/lint/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.

21 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 bd5407ec74b280f92a281ca4f82e5c8f0f8bdd47.

⛔ 10 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/lint/src/index.ts) — pages documenting those are invisible to this run
  • 5 name(s) were too generic to anchor anything (single lowercase words)
  • 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 — 178 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 bd5407ec74b280f92a281ca4f82e5c8f0f8bdd47 → packageMentionDocs.

Which tree this was computed on

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

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

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

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#6 · hotlong · session_01Q4EjjQkY5yXZrN9BEA3rEK

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: bc21970eab3332a4f20d1a84cfcc8bcac173df9c
Local-runs: none
Scope: packages/spec/src/migrations/entries/semantic/18.publish-refuses-flows-that-save-and-do-not-run.ts, packages/lint/src/authoring-rules.ts, packages/lint/src/index.ts, packages/lint/src/rule-explanations.ts, packages/lint/src/runtime-gate.ts, packages/lint/src/validate-flow-trigger-readiness.ts, packages/lint/src/flow-publish-checks-second-batch.test.ts, packages/metadata-protocol/src/protocol-authoring-gate.ts, packages/metadata-protocol/src/runtime-authoring-gate.ts, packages/metadata-protocol/src/protocol.runtime-authoring-gate.test.ts + read, not reviewed: packages/metadata-protocol/src/protocol.ts, packages/metadata-protocol/src/protocol-save.ts, packages/metadata-protocol/src/protocol-package-commits.ts, packages/metadata-protocol/src/package-unmanaged-install.ts, packages/metadata-protocol/src/package-namespace-rename.ts, packages/metadata-protocol/src/protocol-stored-collection-fold.ts, packages/metadata-protocol/src/protocol-history-and-publish.ts, packages/metadata-protocol/src/meta-compile-cache.ts, packages/metadata-protocol/src/sys-metadata-repository.ts, packages/services/service-automation/src/engine.ts, packages/services/service-automation/src/builtin/subflow-node.ts, packages/services/service-automation/src/builtin/map-node.ts, packages/spec/src/migrations/types.ts, .changeset/35143-subflow-target-publish-gate.md, AGENTS.md
Security-touching: no
Rule-change-verified: none

First round on PR #38241, net diff against merge base bd5407ec (11 files). Read: card #35143 with every comment (claim 7236449116, claim note 7237918741, dev report 7237903380, premise table 7098105309), the PR body, the records on #36691, #37491, #37807 and #38107, and the head's check-runs. Nothing was built or run.

① Derived judgments

  • F1 premise refuted: RIGHT. On main (f19350b4) flow-condition-option-label already judges the positions the claim calls open.
  • F6 on the CLI: unchanged, RIGHT. With no runtimeWriteType the registry entry calls the rule with no names, and the finding stays a warning.
  • F6 at the publish gate: NARROWED, as declared. A flow whose subflow / map step names a flow in none of the four sources was published before and is refused now.
    • Right where the caller holds the whole deployment: a direct save, a draft promotion, publishPackageDrafts.
    • Wrong at the per-item package copy doors. See M1.
  • The publish batch: RIGHT. pending.flows is added whatever the order, and a batch's drafts are also state: 'draft' rows of sys_metadata, which the stored read holds.
  • Scoping of the stored read: RIGHT in direction. It reads every state and is not filtered for legacy organization rows, so it can only add names. A name too many lets a call through and refuses none.
  • The engine's names: RIGHT. listFlows answers bare names, one per slot. subflow and map hand config.flowName to engine.execute as written, not interpolated, so a literal name is the whole question.
  • No-verdict exits: as described. No engine.find, no automation service, a listFlows that throws, a store read that throws (other than a missing table), and an empty set all give no verdict.
  • Public surface: WIDENED. FlowSubflowTargetOptions on the . entry of @objectstack/lint; optional deploymentFlowNames on validateFlowSubflowTargets, AuthoringRuleContext, runRuntimeAuthoringRules and evaluateRuntimeAuthoringGate.
  • Clause-②: yes (narrowing): RIGHT. The claim line said no; claim note 7237918741 records the change against it.
  • Metadata-protocol: narrowed: RIGHT.

② Semver level

  • @objectstack/lint minor: right. It covers the narrowing and the added export.
  • @objectstack/metadata-protocol minor: right. The refusal lives at this package's door, and an exported function gains an optional argument.
  • @objectstack/spec patch: right. One entry's text, no schema and no id.
  • The changeset has the ! title, the BREAKING banner, a FROM and TO pair and the one-line fix.
  • ADR-0087 marker not-required (already-registered publish-refuses-flows-that-save-and-do-not-run): the right category. The entry is on main, no id is added, and fix(lint)!: os validate refuses an option label in a flow filter, edge condition or decision branch #37491 set this form for a rule extended to one more site. The entry's text is S2.
  • Docs rule count: unchanged at 90, right. No rule is added, and no page under content/docs outside the generated and release-owned trees names flow-subflow-unknown.

③ Boundary flags

  • Check-runs on this head, read at 2026-11-28T10:33Z: 73 runs, 60 success, 13 skipped, none failed, none still running.
  • The PR reads mergeable: true, clean. It is a draft. No auto-merge is armed.
  • Dogfood battery: reported at this head in 7237903380, exit 0.
  • The two gates the dev could not measure locally (check-plugin-teardown-shape --self-test, check:dual-build-cjs-loads) are answered by the green check-runs.
  • Facade ceiling: accepted. protocol.ts is byte-unchanged. The reads sit in protocol-authoring-gate.ts and reach the services registry through draftVerdictHost()'s existing servicesRegistry member (protocol.ts:1937), which every door's assertRuntimeAuthoringRules call passes through (protocol.ts:1868).
  • Skills-docs: follow-up owed (#38259): the card exists and is open.
  • open_questions: none in the report.
  • Out-of-scope findings of the report:
    • ADR-0150 D3 (outside-closure) is not judged at the door. Accepted: the PR and the changeset both say so.
    • The showcase seeder refusing showcase_invoice_line rows has no carrier. It is not this diff. The seat files it or drops it.
  • SQL push-down: one finding, S1.
  • Security-touching: no. No hunk teaches permission, sharing or credential behaviour.

④ Design judgment

M1 (must-fix): open.

  • The unmanaged package install refuses a package whose flow calls a flow the same install writes a moment later, and rolls the whole install back.
  • importUnmanagedPackage (protocol-package-commits.ts:848-871) installs a base manifest that carries identity only (package-unmanaged-install.ts:655), then writes each item with saveMetaItem({ mode: 'publish' }), one at a time, flows in the order the package declares them (rank is load order, key, index).
  • Each of those saves is an active write through the gate with no pending: only publishPackageDrafts states a batch.
  • So for a package declaring parent (which calls child) before child: at parent's save, child is in no registry, no stored row, no batch and not in the engine. On any deployment that holds another flow the set is non-empty, the gate answers 422 flow-subflow-unknown, and rollBackUnmanagedImport removes the package.
  • On main the same install succeeds and the step runs once the loop ends. This is a working package refused, and the installer cannot act on the hint: the body is the vendor's.
  • It contradicts the PR's own sentence "This rule never refuses a call the engine would accept" and the rule the new code states for itself ("Judging against a partial universe would refuse a call to a flow the missing source holds").
  • The same file already settled this for objects: "Judged after the loop, so a row whose pair a later item of the package completes installs (Studio in zh-CN: a new object publishes "successfully" and never reaches the data plane, because its echoed queue column carries a translated label #29673)".
  • It is the fix(lint)!: three publish-time checks for seeds, flow nodes and actions that save and do not work #37807 M1 lesson again: an error at a door that cannot see what decides it.
  • No pin covers it, and CI cannot show it: the copy doors' tests run with no automation service, which is a no-verdict exit.
  • Also read, same door with targetNamespace: flows are renamed (renameName) but the rename's text pass rewrites object names only, so a copied caller keeps the source's flow name. That call is now refused for every such package. It was a broken step before and is a failed install now.
  • duplicatePackage (protocol-package-commits.ts:578) writes per item the same way. There the call still names the source package's flow, which is stored, so it passes. Not a finding.
  • Closing condition: a flow the same copy loop writes resolves as a target. Either the copy doors state the names of the flows their plan carries (as the batch does), or the gate gives no verdict on these write faces and the door judges after the loop. One pin: an unmanaged install of a package declaring the caller before the callee, on a protocol whose automation service holds another flow, installs. The changeset and the entry then say what is true for a package install.

S1 (should-fix): open.

  • The stored read carries every flow body through the process to answer a question about names, on every flow publish.
  • deploymentFlowNamesOf (protocol-authoring-gate.ts:750) issues two engine.find('sys_metadata', { where: { type } }) calls in sequence with no fields, over every state, drafts included. Only row.name is read.
  • It runs for every active flow write and every draft-publish judgement of a flow, whether or not the flow has a subflow or map step.
  • The projection exists in this package and was required by an earlier contract review for this reason: STORE_MARK_FIELDS, meta-compile-cache.ts:294-330 ("the reading must not carry every body through the process", record 6933112344 S3).
  • No reason is given in the code. The comment explains why legacy rows are not filtered, not why bodies are read.
  • Closing condition: one read projected to name (fields: ['name'], both type spellings in one where), and none at all for a flow with no subflow / map call.

S2 (should-fix): open.

  • The entry's surface and acceptanceCriteria still count seven errors at the publish gate. The gate now refuses eight.
  • surface is the field that names what the entry governs (migrations/types.ts:102). It reads "Seven author-time flow errors, run by the runtime publish gate and by os validate ..." and names no subflow / map call. The new refusal appears only at the end of reason and replacement.
  • reason now reads "Three warnings join them ..., which refuse nothing on the CLI". Two of the three refuse nothing at either door; the sentence after it corrects this only for the third.
  • fix(lint)!: os validate refuses an option label in a flow filter, edge condition or decision branch #37491 M1 set the form for this marker: already-registered "with that entry's surface extended".
  • Closing condition: surface names the publish-gate refusal of a subflow / map call to a flow the deployment does not hold, the warnings sentence says which doors each warning is silent at, and the acceptance line no longer reads as seven. After M1, the text also says what holds for a package install.

S3 (should-fix): open.

  • Three of the exits that keep the gate from a false refusal have no pin.
  • Pinned: no automation service, no names, an empty set, a name each source holds, the batch.
  • Not pinned: a store read that throws (no verdict, one warn), a listFlows that throws (no verdict, one warn), and a missing sys_metadata table (the read continues on the other sources).
  • Removing any of the three leaves the suites green. The PR body lists "a failed store read" among the no-verdict cases as if covered.
  • Same grade as fix(lint)!: os validate refuses an option label in a flow filter, edge condition or decision branch #37491 S2 (new read paths with no test).
  • Closing condition: one pin per exit, through saveMetaItem on the shared harness.

Severity per door, against #37807 and #38107:

Nits, none with an effect on correctness or the contract:

  • N1. The docblock of sealedFlowNodeTypeVocabulary now sits above automationFlowNames, followed by that function's own docblock. The exported function has none (protocol-authoring-gate.ts:1046-1089).
  • N2. listFlows is read with no seal, where the sibling vocabulary read waits for one. A flow a plugin registers straight into the engine later in the same boot is not yet listed. The registry and the stored rows are read directly, so only an engine-only flow is exposed, and the refusal is recorded nowhere.
  • N3. The empty-set exit depends on the door. A first flow saved directly into a deployment with no flows is not judged; the same flow promoted from a draft is, because its own draft row makes the set non-empty. With every source read, an empty set is a known universe, not the lint: an overlay write (no package) of a list view bound to an object that exists nowhere answers 200 with no issue — validateListViewFieldRefs skips it and no other rule judges a view write's binding #24668 case.
  • N4. The refusal's "did you mean" suggestion draws on the unfiltered stored read, so it can name a draft or a legacy row of another scope.
  • N5. rulesRun names validateFlowSubflowTargets on every flow write, including the writes where it had no names and judged nothing.

Open at this head: M1, S1, S2, S3. The next head owes a round by this reviewer.

Implemented-by: claude/issue-35143-flows-leftovers
Reviewed-by: session_01Q4EjjQkY5yXZrN9BEA3rEK

VERDICT: FAIL

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · zhuangjianguo · session_01QsR2jSyQBDMyRnrrWKy7WS

2026-11-29T13:37Z · Superseded by #38594 and closed, on seat 1's order to this review thread. Seat 1 continues seat 6's claim on #35143 (takeover 7255671196, amendments 7255708748, 7255940266 and 7256659340). #38594 starts at this head bc21970eab on branch claude/project-thread-octcjy, merges main, and carries the rework for contract review 7238045522 (FAIL at this head: M1, S1 to S3). That review's delta round runs on #38594. This pull is closed before #38594 is reviewed to the end, not after, because the duplicate-fix guard on #38594 stays red while two open pulls say Fixes #35143. The branch claude/issue-35143-flows-leftovers is left for the seat to delete.

Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
… a flow the deployment does not hold (objectstack-ai#38594)

<!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} -->
_Requested by **Jianguo** · [project
thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbJg9RAhiuDxvothojbXXC9Z)_
Fixes objectstack-ai#35143

Supersedes objectstack-ai#38241 (closed, 7256687325)

Clause-②: yes (narrowing)
Metadata-protocol: narrowed
Skills-docs: follow-up objectstack-ai#38259 — skills/objectstack-automation/SKILL.md
(the `subflow` row says `os validate` warns `flow-subflow-unknown`; it
does not say the publish refuses a call to a flow nothing in the
deployment holds),
skills/objectstack-automation/evals/flows-triggers-approvals.json (the
eval that names `flow-subflow-unknown`)

## 维护者速读

- 用户能看到什么变化:搭建者(包括
AI)发布一个流程时,如果其中“调用子流程”或“逐项调用流程”的步骤写了一个整个环境里都不存在的流程名,发布现在会直接被拒并说明原因;以前能发布成功,但每次运行到这一步都会失败。命令行校验仍然只给警告。
- 为什么做:属于“开源框架先拦住云端构建检查才拦得住的问题”这一族收尾(流程族最后两条),替写流程的搭建者挡住“发布成功、运行必失败”。
-
出错会怎样:这是一次收紧——以前能发布的这类流程下次发布会被拒;被调用的流程只要以草稿形式存在、或在同一批次发布、或在同一个软件包安装里(顺序不限)、或由已安装的软件包提供,都不会被拒;用另一个命名空间安装的软件包副本若有流程调用同包流程,安装会被整体拒绝并回滚(改名没有改到调用处,以前装得上但这一步必失败);撤回本改动即恢复原样。
- 要你做什么:无

## What changes

The card's last two open lines, re-verified on `main` (1208460) first.

**F1, option label in decision-node and edge conditions: already covered
on `main`, no change here.** `flow-condition-option-label` reads every
edge condition and every `decision` node's `conditions[].expression`
(and query filter operands) since objectstack-ai#37491 (`optionLabelsBeyondStart` in
`validate-flow-trigger-readiness.ts`, at `error`, same id, runtime gate
and CLI). Its positive and negative pins are in
`flow-publish-checks-second-batch.test.ts`, describe "past the start
condition". The card gets a line saying so.

**F6, a `subflow` / `map` step calling a flow that does not exist: now
refused at the publish gate.** It was a CLI-only warning because the
gate's per-write snapshot holds just the written flow. The gate now
judges the call against the names of every flow the deployment holds,
which the host states on a flow publish:

- every installed package's flows (the registry, read with
`includeDisabledPackages`, so a disabled package's are included);
- the stored flow rows of **every state**, drafts included, so two new
flows that call each other can still be published one at a time;
- the flows the same publish batch carries (`pending.flows`), so a
package that ships a flow with its caller publishes;
- the flows the same unmanaged package install writes
(`copyPlanFlowNames`, new in this head), so a package whose flow calls a
sibling it declares later installs;
- every flow the automation engine holds (`listFlows`), so a flow
registered straight into the engine with no metadata row resolves.

A call that names none of them, and is not the written flow itself, is
an `error` (`flow-subflow-unknown`): `execute` answers `Flow 'X' not
found` on every run.

Severity per door:

- **CLI** (`os validate` / `lint` / `compile` / `build`): `warning`,
unchanged. The stack is one app, and another installed package may ship
the called flow.
- **Runtime publish gate, names stated and non-empty**: `error`. The set
is the whole deployment, so "held nowhere" is decided, the objectstack-ai#24668
reading of a whole collection.
- **Runtime publish gate, no names or an empty set**: no verdict. That
covers no automation service, a failed store read or a failed
`listFlows` (each logged once at `warn`) and an empty set. A missing
`sys_metadata` table is no stored flow: the other sources still decide.
An empty set with no closure is no universe (objectstack-ai#24668).
- **Package closure**: the set is never narrowed to the written
package's closure. So a call the engine's package-scoped resolution
would refuse (ADR-0150 D3, `outside-closure`) is not judged here. This
rule never refuses a call the engine would accept.

Wiring:

- `@objectstack/lint`: `validateFlowSubflowTargets(stack, {
deploymentFlowNames })`, the `AuthoringRuleContext.deploymentFlowNames`
input, and `runRuntimeAuthoringRules({ deploymentFlowNames })`. The
rule's registry entry moves to `tier: 'gating'`, `surfaces:
CLI_AND_RUNTIME`, `runtimeTypes: ['flow']`. Its runtime pass judges
nothing without stated names. The rule's explanation text is updated.
- `@objectstack/metadata-protocol`: `evaluateRuntimeAuthoringGate({
deploymentFlowNames })` adds the batch's flow drafts.
`judgeRuntimeAuthoringRules` reads the names only on a flow write whose
body calls another flow (`flowCallsAnotherFlow` in
`runtime-authoring-gate.ts`; `deploymentFlowNamesOf`,
`automationFlowNames`, `registeredFlowsWithDisabled` in
`protocol-authoring-gate.ts`), through the host's existing
`servicesRegistry`; the registry is listed with its disabled packages,
since the served listing drops their items. The stored names are one
`sys_metadata` read, `type` `$in` both spellings, projected to `fields:
['name']`. `saveMetaItem` takes a server-only `copyPlanFlowNames`
(`protocol-door-requests.ts`), which `importUnmanagedPackage` states on
each flow write and the save door hands the gate as `pending.flows`.
`protocol.ts` moves no line: one docblock (the `pending` field) is
reworded in place.
- `@objectstack/spec`: the ADR-0087 entry
`publish-refuses-flows-that-save-and-do-not-run` now counts eight errors
at the publish gate, seven of them also on the CLI: its `surface` names
the `subflow` / `map` refusal, the warnings sentence says which door
each warning is silent at, the acceptance line is no longer seven, and
the reason says what holds for a package install.

No rule is added, so no "author-time rules (N)" count moves.

## Rework on contract review 7238045522 (FAIL at `bc21970eab`)

This PR continues objectstack-ai#38241 (seat 6's branch
`claude/issue-35143-flows-leftovers`, whose dev ran out of budget). It
starts at that head, merges `main`, and closes every open item of the
review:

- **M1** (an unmanaged install refused a package whose flow calls a
sibling declared after it): `importUnmanagedPackage` states its plan's
flow names on each flow write (`copyPlanFlowNames`), which reach the
gate as `pending.flows`, the batch's channel. Pinned in
`package-unmanaged-install.test.ts`, describe "a flow calling a sibling
flow of the same package": a package declaring `crm_parent` (calls
`crm_child`) before `crm_child`, on a protocol whose automation service
holds another flow, installs both; the control (a call to a flow nothing
holds) is still refused 422 and leaves no row and no base.
`duplicatePackage` is unchanged: it copies stored rows, which the gate's
stored read already holds (the review's own reading).
- **S1** (every flow body read for names, on every flow publish): one
read, both type spellings, `fields: ['name']`; none at all for a flow
that calls no other flow, or only itself. Pinned on the shared harness.
- **S2** (the entry still counted seven): `surface`, `reason` and
`acceptanceCriteria` rewritten as above.
- **S3** (three no-verdict exits unpinned): one pin each through
`saveMetaItem` on the shared harness: a store read that throws
(accepted, one `warn`), a `listFlows` that throws (accepted, one
`warn`), and a missing `sys_metadata` table (no `warn`; a call to an
engine or registry flow is accepted and a call to nothing is still
refused).
- **N1**: the `sealedFlowNodeTypeVocabulary` docblock is back above its
function. N2–N5 are left as the review graded them (no effect on
correctness); see the acceptance notes.

## Patch round on contract review 7257069704 (PASS, S4 open at
`a7c00fdd85`)

- **S4** (the texts said a disabled package's flows count; the gate read
the served registry listing, which drops them): the first closing
condition. The names read lists the registry with
`includeDisabledPackages: true` (`registeredFlowsWithDisabled`), so a
call to a disabled package's flow is let through, as a draft is: the
flow is held, and runs once its package is enabled. The docblock, the
changeset and this body now say what the code does. Pinned through
`saveMetaItem`; removing the option fails the pin.
- **N6, N7, N8** in the same commit: the entry's `reason` gives the
right cause (the install states its flow names) and says the rename
covers prefixed names only; the `pending` docblocks, the lint docblocks
and the `os explain` text name a package install's flows and a disabled
package's; the changeset's Exports bullet names `saveMetaItem`'s
`copyPlanFlowNames` and no longer names `evaluateRuntimeAuthoringGate`.
N9 and N10 stand as accepted.

## Why

objectstack-ai#35143 "Done when": each line is a rule with its pins, or a line on the
card saying which rule covers it. F1 is the second case and F6 is now
the first. The hosted copy of the subflow check can be deleted.

## Tests

<details><summary>Lint: new pins in
flow-publish-checks-second-batch.test.ts (describe
flow-subflow-unknown)</summary>

- CLI: still exactly one `warning`.
- Runtime gate refuses a call to a name the stated set lacks: `error`,
path `flows[0].nodes[1].config.flowName`, message opening, `rulesRun`
names the rule.
- A `map` call inside a loop body: `error` at
`flows[0].nodes[1].config.body.nodes[0].config.flowName`.
- Silent: a name the stated set holds, the written flow calling itself.
- No verdict: no stated names, an empty set.

</details>

<details><summary>Metadata-protocol: the describe in
protocol.runtime-authoring-gate.test.ts (the shared harness), end to end
through saveMetaItem</summary>

- 422 `INVALID_METADATA`, issue `flow-subflow-unknown` at the path,
nothing stored.
- Accepted: a flow only the automation engine holds, an installed
package's flow (registry), a stored draft, a stored active flow.
- No automation service: accepted (no verdict).
- New (S4): a flow only a DISABLED package ships (listed by the registry
only with `includeDisabledPackages`) resolves; a call to nothing in the
same case is still a 422.
- New (S1): the stored names are read once, `{ where: { type: { $in:
['flow', 'flows'] } }, fields: ['name'] }`; a flow calling only itself,
and a flow with no call, read nothing.
- New (S3): a store read that throws, accepted with one `warn` naming
the cause; a `listFlows` that throws, the same; a missing `sys_metadata`
table, no `warn`, engine and registry flows still resolve and a call to
nothing is still a 422.
- `evaluateRuntimeAuthoringGate`: a flow in `pending.flows` resolves;
without it the call is refused.

</details>

<details><summary>Metadata-protocol: new describe in
package-unmanaged-install.test.ts (M1)</summary>

- A package declaring `crm_parent` (a `subflow` step calling
`crm_child`) before `crm_child`, with an automation service holding
`other_flow`: installs, both flows stored active.
- Control: `crm_parent` calling `crm_nowhere`: refused 422 with
`flow-subflow-unknown`, no active row left, the base
`com.example.crm-copy` removed.
- Reading, not pinned: the same package installed with `targetNamespace:
'crm2'` is refused 422 (`flow 'crm2_parent' could not be written …
flows[0].nodes[1].config.flowName [flow-subflow-unknown]`) and rolled
back, because the rename does not rewrite `config.flowName`; see the
acceptance notes.

</details>

<details><summary>Ablations (each fix removed on disk from the committed
head, then restored with git checkout HEAD)</summary>

- `importUnmanagedPackage` states no `copyPlanFlowNames`: "installs a
package that declares the calling flow before the flow it calls" fails
(1 failed / 1 passed).
- The names read for every flow write (the `flowCallsAnotherFlow` guard
dropped): "reads the stored names once …" fails (1 failed / 7 passed).
- At 93f3643, the registry read without `includeDisabledPackages`:
"lets a call through to a disabled package's flow …" fails (1 failed).

</details>

<details><summary>Suites (head 93f3643, main merged at 3014176;
under os-verify-lock)</summary>

- `@objectstack/lint` test: 246 files / 9962 tests passed. typecheck
exit 0.
- `@objectstack/metadata-protocol` test: 372 passed / 9 skipped files,
23660 passed / 45 skipped tests. typecheck exit 0.
`protocol.runtime-authoring-gate.test.ts` +
`package-unmanaged-install.test.ts`: 383/383.
- `@objectstack/spec` `src/migrations`: 5 files / 209 tests.
- Dogfood battery: head 93f3643, `pnpm --filter @objectstack/dogfood
test` under the lock after a clean closure build (exit 0): VERDICT
command-exit 0, Test Files 495 passed / 3 skipped (498), Tests 4187
passed / 68 skipped (4255), no failure.

</details>

## Acceptance notes

- Not judged: whether the engine's package-scoped name resolution lets
the calling flow reach the called one (ADR-0150 D3). The set is the
whole deployment, so an `outside-closure` call still fails at run time.
Judging that would need the resolver's verdict at the door.
- A call to a stored draft, or an archived or deprecated row, is let
through. The step fails until that flow is active. This keeps two new
flows that call each other publishable one at a time.
- The stored read for names is not filtered for legacy organization
rows. An extra name can only let a call through.
- A package install under another namespace (`targetNamespace`) renames
its flows but not the `config.flowName` that calls them, so a package
whose flow calls a sibling is now refused and rolled back unless the
deployment holds the old name. On `main` it installed with a step that
fails on every run. Making the rename follow flow names is outside this
card; reported to the seat as a finding.
- A plan flow name counts even if that flow's own write then fails: the
install then rolls back whole, so no caller is left pointing at it.
- Not addressed, as graded (nits): N2 `listFlows` is read with no seal;
N3 the empty-set exit depends on the door; N4 the "did you mean"
suggestion draws on the unfiltered stored read; N5 `rulesRun` names the
rule on a write where it judged nothing.

## Verification

- Read first:
`packages/metadata-protocol/src/protocol-package-commits.ts`
`importUnmanagedPackage` (`copyPlanFlowNames`) with `protocol-save.ts`
(where it becomes `pending.flows`);
`packages/metadata-protocol/src/protocol-authoring-gate.ts`
`deploymentFlowNamesOf` (the union, the projected read, the no-verdict
exits), `packages/lint/src/authoring-rules.ts` the
`validateFlowSubflowTargets` entry (runtime pass with no names =
nothing), `packages/lint/src/validate-flow-trigger-readiness.ts`
`validateFlowSubflowTargets`.
- Two minutes: `pnpm --filter @objectstack/metadata-protocol exec vitest
run src/protocol.runtime-authoring-gate.test.ts
src/package-unmanaged-install.test.ts -t '35143|sibling flow'`. Expect
11 passed, among them a 422 naming `flow-subflow-unknown` and a package
install of a caller before its callee.

<details><summary>Gates (head 93f3643)</summary>

- `dispatch-gates --ran` at 93f3643, run after the closure build: 103
derived, 102 run (all exit 0), 1 NOT MEASURED, 0 unrun (`✓
dispatch-gates --ran: 103 derived famil(ies) accounted for`).
- `check:dual-build-cjs-loads` exit 3: needs a full workspace build.
Left to CI.
- `overlap-check` (`--exclude-pr=38241`) at a7c00fd: clean against
origin/main 3014176 and the two open PRs sharing a file (objectstack-ai#38550,
objectstack-ai#38497). The 93f3643 commit touches only files of this PR.
- `protocol.ts` moves no line, so `check:facade-delegation-only`'s
ceiling is untouched (exit 0 in the sweep).

</details>

## Human Minimum

- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
- [x] 2. Every name I added uses the casing for its kind.
- [x] 3. No formatter ran; `pnpm lint` passes (CI-owned run).
- [x] 4. One issue, one branch off an up-to-date `main`, one pull
request.
- [x] 5. A change that publishes carries a changeset, and both
declaration lines are filled in here and in the changeset.
- [x] 6. `packages/spec` touched: only a migration entry's text, no
generated artifact moves.
- [x] 7. No hand edits to `content/docs/references/`,
`packages/*/CHANGELOG.md` or `content/docs/releases/`.
- [x] 8. Title, body and comments are in English.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01QsR2jSjBfkaFUVwRa3pdUK

<!-- signed: repo:objectstack#1 · zhuangjianguo ·
session_01QsR2jSjBfkaFUVwRa3pdUK -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

lint: a second batch of publish-time checks for metadata that saves and does not work — the ones only the hosted build check makes today

2 participants