Skip to content

feat(spec): validateControlFlow throws FlowRegionShapeError carrying the container path and node id - #29789

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

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

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

domain:spec#3 · os-support-ai · session_01WGufzj9yXiuW9h8YrpyLMy

Requested by Yibo Wang · project thread

Fixes #29719

Clause-②: yes (widening)
Metadata-protocol: none
Skills-docs: none — skills/** has 0 hits for validateControlFlow; no skill teaches the refusal's type, and the message every skill-facing surface prints is unchanged

维护者速读

  • 改了什么:流程结构校验 validateControlFlow 拒收一个流程时,抛出的不再是裸 Error,而是新导出的 FlowRegionShapeError,错误上带两项数据:出错容器节点在流程里的路径 path(如 ['nodes', 1, 'config', 'try', 'nodes', 0])和该节点的 nodeId。错误文字一个字节都没变。
  • 为什么改:lint 规则 flow-region-shape-invalid(lint: flow-region-shape-invalid anchors the whole flow; point the finding at the region container at fault #29558)只能把问题挂在整个流程上;要定位到具体容器就得去解析报错句子,那是第二套判定写法,而且嵌套在别的容器里的 parallel 句子根本不带外层位置。现在读 err.path 即可。
  • 风险与回滚:只加数据不改判定:哪些流程被拒、拒收文字、HTTP 答复(仍是 400 VALIDATION_FAILED,错误不带 status)都不变;类继承 Error,读 err.message 或 instanceof Error 的调用方无感。回滚即还原本 PR。
  • 先看:packages/spec/src/automation/control-flow.zod.ts(新类与 containerPathOf:索引按原始列表取,不按过滤后的 graph.nodes)、packages/spec/src/automation/control-flow.test.ts(末尾 5 个新 pin)、.changeset/29719-flow-region-shape-error.md。
  • 两分钟验证:pnpm --filter @objectstack/spec exec vitest run src/automation/control-flow.test.ts,应见 56 个用例全绿;把 control-flow.zod.ts 换回 origin/main 版本再跑,新增 5 个用例全红。
  • 需要你做的:无,席位落地。

What changes

validateControlFlow (packages/spec/src/automation/control-flow.zod.ts) throws the new exported FlowRegionShapeError at all three of its throw sites. The class extends Error and adds two readonly fields:

  • path: readonly (string | number)[]: the key path from the flow root to the container node that owns the fault. It is a FlowGraph.path that collectFlowGraphs hands out, plus ['nodes', i], so a reader that already anchors on a graph's path can use it as is. Examples: ['nodes', 1] for a top-level container, ['nodes', 1, 'config', 'try', 'nodes', 0] for a container inside a try region, ['nodes', 1, 'config', 'branches', 1, 'nodes', 1] for one inside parallel branch 1.
  • nodeId: string: that container's id.

Name and precedent. FlowRegionShapeError, the seat's call under the veto window (claim 6594934995). Shape mirrored from ListViewGroupQueryError (src/ui/view-grouping-query.ts): an Error subclass with readonly data fields, this.name set to the class name, the message passed through unchanged, and path as a (string | number) key path. Like MigrationFloorError (src/migrations/chain.ts) it carries no ADR-0112 code/status. That is deliberate: the runtime's flowDefinitionRefusal (packages/runtime/src/domains/automation.ts) keeps a thrown error's own .status when it has one, so a declared status would overrule the door's 400 classification. Not mirrored: ListViewGroupQueryError's closed reason. The card asks for path and node id only, and a refusal vocabulary would be one more export to review.

The index is the raw list's. collectFlowGraphs drops a non-record member from the nodes it hands out, while FlowGraph.path keeps indexing the raw list. containerPathOf therefore reads the raw list back through graph.path and finds the node by identity (the walk filters and never copies), so a dropped member before the container does not renumber it. The lookup runs only on a refusal, so the accepting path does no extra work.

One judge, one spelling. No new validation path: the same loop, the same three conditions and the same sentences. The only edits are new Error(m) → new FlowRegionShapeError(path, id, m) and the docblock.

Throw sites

Site on origin/main 3eeb81d1 Refusal Before Now carries
control-flow.zod.ts:651 parallel 'ID': a parallel block needs at least 2 branches plain Error; the sentence names no enclosing scope path to the parallel node, at any depth; nodeId
control-flow.zod.ts:657 WHERE: invalid region — ZOD ISSUES (the slot's schema refuses it) plain Error; location in prose only path to the container that owns the slot; nodeId
control-flow.zod.ts:665 WHERE: ANALYSIS ERRORS (analyzeRegion: entry/exit/cycle/ids/edges) plain Error; location in prose only path to the container that owns the slot; nodeId
control-flow.zod.ts:532 findRegionEntry malformed control-flow region: … unchanged, still a plain Error not covered: see below

:532 is a separate judge, not on validateControlFlow's path (the PM assumption, measured). validateControlFlow never calls findRegionEntry. Its one production caller is the engine's runRegion in packages/services/service-automation/src/dag-traversal.ts:761, at run time, and it receives a bare region with no flow around it, so it has no flow path or container id to carry. A flow that reaches it registered already. This PR leaves it as it is.

Tests

control-flow.test.ts gains validateControlFlow throws FlowRegionShapeError with the container path and id. Every case asserts instanceof FlowRegionShapeError, instanceof Error, name, path, nodeId and the full message:

Case path nodeId Message pinned
invalid region: top-level try_catch with an unknown region key ['nodes', 1] tc literal try_catch 'tc' try: invalid region — + FlowRegionSchema's own issue messages
region analysis error: a two-entry loop body, inside parallel branch 1 ['nodes', 1, 'config', 'branches', 1, 'nodes', 1] sweep literal parallel 'fan' branch 1 → loop 'sweep' body: + analyzeRegion's errors (plus a literal region must be single-entry but has 2: x, y; lead)
parallel with 1 branch, top level ['nodes', 0] p literal, whole sentence
the nested case: a 1-branch parallel inside a try region (the draft-publish-verdict fixture shape) ['nodes', 1, 'config', 'try', 'nodes', 0] fan literal parallel 'fan': a parallel block needs at least 2 branches
raw index: null before the container in the list ['nodes', 2] p (not a message case)

The first four also assert one spelling: path minus its last two keys is a path that collectFlowGraphs(flow) hands out, and the second-to-last key is 'nodes'.

Red first. With control-flow.zod.ts checked out from origin/main, the five new cases fail (Tests 5 failed | 51 passed (56), lock VERDICT command-exit 1). Restored with git checkout HEAD --: blob hash equal to HEAD's, git diff HEAD empty.

Ablation of the raw index (scripts/ablation-replace.mjs, anchor hit 1 → 0, blob 0ac7eeaa → 370278a2): raw.indexOf(node) → graph.nodes.indexOf(node). Only the raw-index case fails (Tests 1 failed | 55 passed (56)). Restore checked by blob equal to HEAD and an empty git diff HEAD. The spec suite imports src/ directly, so no dist/ is involved.

Message parity, measured. A one-off probe (not committed) ran origin/main's validateControlFlow and this head's over six refused flows: the five cases above plus a multi-exit loop body. Result: byte-identical messages: 6/6.

The pinned sentence holds. packages/metadata-protocol/src/protocol.draft-publish-verdict.test.ts pins "Flow 'nested_region' would be refused at registration: parallel 'fan': a parallel block needs at least 2 branches". The @objectstack/metadata-protocol suite ran green on this head against a spec dist built from it (see Verification).

Acceptance notes

  • Changeset level: patch, not the dispatch's assumed minor. AGENTS.md Post-Task step 3: "The level follows the kind alone: a kind takes at least minor …, none takes patch". An exported error class is not authorable metadata, so Metadata-protocol: none and @objectstack/spec: patch. check-changeset-no-major on this body: see Verification. The control with minor is refused none-minor. Precedent: .changeset/26464-mcp-metadata-write-scope.md (Clause-②: yes (widening), none, spec patch).
  • Declaration map: check:generated reported it fresh (check:declaration-map ✓). Only api-surface/automation.json and export-origins/automation.json moved, one line each.
  • Consumer: lint: flow-region-shape-invalid anchors the whole flow; point the finding at the region container at fault #29558 (lint half) reads err.path when present, else keeps the flow as the anchor. packages/lint/** is untouched here.

Verification

All on head 78d8ed02, under os-verify-lock.

spec local suite + typecheck, metadata-protocol suite
  • Closure build pnpm --filter '@objectstack/metadata-protocol^...' run build: exit 0 (spec dist built from this head).
  • pnpm --filter @objectstack/spec test: Test Files 803 passed (803), Tests 23805 passed | 1 todo (23806), exit 0.
  • pnpm --filter @objectstack/spec typecheck: exit 0.
  • pnpm --filter @objectstack/metadata-protocol test: Test Files 310 passed | 4 skipped (314), Tests 22292 passed | 26 skipped (22318), exit 0. This includes protocol.draft-publish-verdict.test.ts and its pinned nested-parallel sentence.
  • Lock: VERDICT command-exit 0 · held the lock 843s.
  • Spec test:repo was not run locally (CI's Test Core owns it). The diff edits no repo-project test, and the derived list does not name it.
generated artifacts
  • pnpm --filter @objectstack/spec build && … check:generated: ✗ 2 of 14 artifact(s) stale (check:api-surface, check:export-origins).
  • check:generated --fix rewrote those two, one line each. The re-check printed all 14 ✓, check:declaration-map included. Lock VERDICT command-exit 0.
check-changeset-no-major with this body as the event
  • GITHUB_EVENT_NAME=pull_request node scripts/check-changeset-no-major.mjs --base origin/main --event EVENT: exit 0, ✓ LEVEL AXIS: … metadata-protocol none … a non-protocol change at patch.
  • Control (a local probe commit that was reset and never pushed: the changeset graded @objectstack/spec: minor, same body): exit 1, Check Changeset (level axis): metadata-protocol declares none while a changeset entry is graded minor or above.
derived gates (dispatch-gates --commands, 80 families)
  • 77 of 80 green on the first serial pass.
  • 3 exited 3 for missing prerequisites:
    • check-plugin-teardown-shape --self-test needed its pinned fixture commit 621a4876 in this shallow clone.
    • check:dual-build-cjs-loads and check:lean-entry-closure read built output of packages outside the closure.
  • After git fetch origin 621a4876… and a full pnpm turbo run build --concurrency=2 (Tasks: 118 successful, 118 total, lock VERDICT command-exit 0), all three exited 0.
  • dispatch-gates --ran: ✓ 80 derived famil(ies) accounted for — 80 run, 0 NOT-MEASURED.
  • CI families: see this PR's check-runs.

Generated by Claude Code

…the container path and node id

Each of validateControlFlow's three throw sites (invalid region, region
analysis error, a parallel with fewer than two branches) now throws the
exported FlowRegionShapeError. It carries the faulty container's key path,
spelled as collectFlowGraphs' FlowGraph.path plus ['nodes', i] over the raw
list, and its node id. The message is unchanged byte for byte.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufzj9yXiuW9h8YrpyLMy
…ShapeError; add its changeset

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufzj9yXiuW9h8YrpyLMy
@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 3, 2026
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/spec, touching 4 documentable anchor(s). ⚠️ 2 changed file(s) yielded no anchor (packages/spec/api-surface/automation.json, packages/spec/export-origins/automation.json), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

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

  • content/docs/ai/actions-as-tools.mdx (via nodeId (symbol, a field of class FlowRegionShapeError))
  • content/docs/automation/approvals.mdx (via nodeId (symbol, a field of class FlowRegionShapeError))
  • content/docs/automation/flows.mdx (via nodeId (symbol, a field of class FlowRegionShapeError))
  • content/docs/kernel/cluster.mdx (via nodeId (symbol, a field of class FlowRegionShapeError))

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

  • content/docs/releases/v17/17-0.mdx (via nodeId (symbol, a field of class FlowRegionShapeError))
  • content/docs/releases/v17/17-1.mdx (via nodeId (symbol, a field of class FlowRegionShapeError))

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
  • 2 changed file(s) yielded no anchor (packages/spec/api-surface/automation.json, packages/spec/export-origins/automation.json) — pages documenting those are invisible to this run
  • 1 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 61 of 218 client-bound route-ledger rows — the other 157 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 157: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 55 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 102 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 — 168 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 601832b1a667992e73d54bf11643849836a6f778 → packageMentionDocs.

Which tree this was computed on

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

node scripts/docs-audit/affected-docs.mjs --json 601832b1a667992e73d54bf11643849836a6f778

⚠️ 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 601832b1a667992e73d54bf11643849836a6f778 → 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:spec#3 · os-support-ai · session_01WGufzfgvGexKn9vLHsy89K

Contract-review-claim: session_01WGufzfgvGexKn9vLHsy89K · head 78d8ed0 · 2026-11-03T04:53Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:spec#3 · os-support-ai · session_01WGufzfgvGexKn9vLHsy89K

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 78d8ed02eeeeb32b7a5a71199d4cc2ddeb8b2a1e
Local-runs: none
Scope: packages/spec/src/automation/control-flow.zod.ts + packages/spec/src/automation/control-flow.test.ts, packages/spec/api-surface/automation.json, packages/spec/export-origins/automation.json, .changeset/29719-flow-region-shape-error.md, packages/services/service-automation/src/dag-traversal.ts, packages/services/service-automation/src/flow-definitions.ts, packages/services/service-automation/src/plugin.ts, packages/services/service-automation/src/thrown-cause-diagnostics.ts, packages/runtime/src/domains/automation.ts, packages/lint/src/validate-flow-region-shape.ts, packages/spec/src/ui/view-grouping-query.ts, packages/spec/src/migrations/chain.ts, packages/spec/src/automation/index.ts, packages/metadata-protocol/src/protocol.draft-publish-verdict.test.ts, scripts/check-changeset-no-major.mjs, AGENTS.md

Inputs read: card #29719 body and all four comments (triage 6594281149, the seat's claims 6594908365 and 6594934995, os-dev-report 6595772995; open_questions: []); PR #29789 body, its five-file list, and git diff 3eeb81d1..78d8ed02 (merge base measured, net diff of 5 files, +183/−5); the 42 check-runs on 78d8ed02 as listed at review time; the cited code at 78d8ed02 via git show — control-flow.zod.ts (FlowRegionShapeError :646, validateControlFlow :681, containerPathOf :732, findRegionEntry :529/:532, regionSlotsOf, FlowGraph :813, collectFlowGraphs :869), the only production caller of findRegionEntry (packages/services/service-automation/src/dag-traversal.ts:761, runRegion; the brief's packages/spec/src/automation/dag-traversal.ts does not exist at this head), the two production callers of validateControlFlow (flow-definitions.ts:220 in registerFlow, validate-flow-region-shape.ts:112 in the lint rule), the runtime door (flowDefinitionRefusal, automation.ts:2068), the boot-log renderer (describeThrownForLog), the two precedent classes, the pinned sentence (protocol.draft-publish-verdict.test.ts:658), the barrel (automation/index.ts:9 export *), packages/spec/tsconfig.json (target: ES2020), AGENTS.md Post-Task step 3 and § Touched packages/spec, and scripts/check-changeset-no-major.mjs (judgeLevel and its verdict glossary, ruling A). reviewFace on the PR's paths: face schema, hits packages/spec/src/automation/control-flow.zod.ts.

① Derived judgments

  • Public surface: one new export, FlowRegionShapeError (class), on @objectstack/spec/automation. Reaches the barrel through export * from './control-flow.zod' (index.ts:9). The two generated rows (api-surface/automation.json, export-origins/automation.json) are exactly the rows a class export lands in — measured against the precedent ListViewGroupQueryError, which appears in api-surface/ui.json and export-origins/ui.json and nowhere else under packages/spec/** outside src/. No declaration-map, docs or authorable-surface artifact moves. Right.
  • Accept set: unchanged. validateControlFlow's loop, its three predicates (a parallel with fewer than 2 branches, a slot.schema.safeParse refusal, analyzeRegion errors) and its three sentences are byte-identical in the diff; the only edits are new Error(m) → new FlowRegionShapeError(path, id, m) plus docblocks and the new helper, which is reached only after a refusal is decided. Nothing a flow author writes is accepted or refused differently. Right.
  • Throw type narrows from Error to a subclass that extends Error. err.message is unchanged; err.name becomes 'FlowRegionShapeError' (was 'Error'), so String(err) would change — but no reader on the tree prints it: the boot warn goes through describeThrownForLog, which emits { error: String(err.message) } and never name; the lint rule reads err.message; recordFlowRefusal reads code/message; flowDefinitionRefusal reads .status/.statusCode/.issues/.message, none of which the class adds, so the HTTP answer is still validationFailure(message, [{ field: '(body)', code: 'invalid_value', message }]) at VALIDATION_FAILED_STATUS. Under target: ES2020 an Error subclass needs no setPrototypeOf for instanceof to hold (the two precedents do none either). Right, and a benign widening for consumers.
  • path spelling: FlowGraph.path + ['nodes', i], i the RAW index. collectFlowGraphs builds path over the raw list (nodes.forEach((node, index)), hands out nodes as either the raw array or a filter of it (identity of members preserved), and visits slot.raw.nodes where slot.raw is cfg[key] or cfg[key][index] — the same objects containerPathOf reaches by walking graph.path from flow. So raw.indexOf(node) is the index FlowGraph.path would give that node, including after a dropped null sibling (the fifth test pins it at ['nodes', 2]). Each of the first four tests also asserts path.slice(0, -2) is a path collectFlowGraphs(flow) hands out — one spelling, as the card asks. Right. (Not reachable: indexOf returning -1 would need a member handed out that is not in the raw list, which the walk's filter cannot produce.)
  • No code/status on the class. ListViewGroupQueryError carries code: 'NOT_IMPLEMENTED'|'INVALID_QUERY' and status: 501|400; MigrationFloorError carries neither. Here neither is right: flowDefinitionRefusal's first branch returns a thrown error untouched when it declares .status, which would drop the fields[] entry and the VALIDATION_FAILED envelope — a wire change the card does not ask for — and ADR-0112 lets the door derive code from the status, so a thrown error without one is in vocabulary. Right to omit.
  • Test file. Five red-first cases, one per throw site plus the nested parallel (the draft-publish-verdict fixture shape) and the raw-index pin; each asserts instanceof FlowRegionShapeError, instanceof Error, name, path, nodeId and the full message. The pinned sentence parallel 'fan': a parallel block needs at least 2 branches is asserted literally and matches protocol.draft-publish-verdict.test.ts:658 and validate-flow-region-shape.test.ts:67. Right.
  • Consumer readiness. validate-flow-region-shape.ts:112 catches with err instanceof Error ? err.message : String(err) and still anchors on the flow; lint: flow-region-shape-invalid anchors the whole flow; point the finding at the region container at fault #29558 (the lint half) reads err.path next. The runtime's flowDefinitionRefusal docblock explicitly declined to parse the sentence for a location; it could now read err.path into its fields[] entry instead of (body). Out of this card's scope, noted as a follow-on, not a fix.

② Semver level

  • Changeset .changeset/29719-flow-region-shape-error.md: '@objectstack/spec': patch, Clause-②: yes (widening), Metadata-protocol: none; PR body carries the same two lines at line start. The changeset body states the new export, the unchanged message and the unchanged accept set.
  • Clause-②: yes (widening) — a new public export is a widening of the published surface and refuses nothing; the (widening) arm is the right one. Right.
  • Metadata-protocol: none — the axis is "the change to what a metadata author can write"; an Error subclass thrown by a validator is not a key, value or metadata type, and no authorable-surface/ or authorable-defaults/ shard moves. Right.
  • Level patch, not the card's expected minor: AGENTS.md Post-Task step 3 is explicit — "The level follows the kind alone: a kind takes at least minor …, none takes patch; a non-protocol change, widening or breaking, ships patch" — and check-changeset-no-major.mjs judgeLevel encodes it as ruling A: under none, minors.length ⇒ none-minor (exit 1), else none-clean. Its own comment names "a REST widening" as exactly the non-protocol Clause-②: yes change graded patch. Precedent .changeset/26464-mcp-metadata-write-scope.md (yes (widening), none, spec patch) confirms. The card's "spec minor" line predates measuring the rule; the rule governs. Check Changeset on this head: success. Right.

③ Boundary flags

  • Dev flag (1): patch with Metadata-protocol: none, not minor. Answered in ②: correct under the repo's own rules; minor would be refused none-minor. The card's declaration expectation is overruled by AGENTS.md step 3, which is the authority it cites. No escalation.
  • Dev flag (2): findRegionEntry's throw at :532 left a plain Error. Measured at this head: findRegionEntry has one production caller, runRegion in packages/services/service-automation/src/dag-traversal.ts:761, at run time, on a bare FlowRegionParsed with no flow around it (no FlowGraph.path, no container id to carry); validateControlFlow never calls it, and its own docblock (:669–:674) names that throw as the mid-run failure registration pre-empts. The card's "Wanted" is validateControlFlow's throws and asks for "a red-first pin per throw site (invalid region, region analysis error, a parallel with fewer than 2 branches, including the nested case)" — three sites, all converted. The boundary is right; converting :532 would invent a path the function cannot know.
  • Report deviation: no closed reason and no ADR-0112 code/status. Answered in ①: the card asks for path and node id only; a status would short-circuit flowDefinitionRefusal and change the wire. Right.
  • Report deviations: PR opened without assignees/review request; worktree kept. Process, not contract; nothing for this record.
  • open_questions: [] — none to answer.
  • Check-runs on 78d8ed02 at review time: completed and green — Check Changeset, Check PR Size, PR-body guards, Governed Surface Queue Guard, Lint · PM dispatch-gates, Lint · scoped · tooling self-tests, Type Check · source gates, Spec property liveness, Dogfood Regression Gate, Flag docs affected, Plan Test Core shards, Auto Label, filter; skipped by design — Build Docs, Dogfood Verify CLI, UI Published Artifacts, Temporal Conformance, opt-in harnesses; still in progress — Build Core, Build UI Deps, Test Core (1–8/8), Lint · ESLint, Lint · docs & code guards, Lint · repo & tooling gates, Lint · CI, release & engine gates, Lint · scoped · query-options erasure, Lint · scoped · slot lookup & corpus, Type Check · workspace, Type Check · consumer gates, Type Check · debt ledger, Live E2E UI. No failure seen. The dev's local runs (spec suite 803 files green, typecheck, metadata-protocol suite green with the pinned sentence, check:generated 14/14, dispatch-gates --ran 80/80) are the seat's claims, read and not re-run; the in-progress CI families are what will confirm them. This record does not wait for them.

④ Design judgment

packages/spec/src/automation/control-flow.zod.ts — holds.

Generated rows (api-surface/automation.json, export-origins/automation.json) — hold: one row each, alphabetically placed, origin src/automation/control-flow.zod.ts#FlowRegionShapeError (class).

Test file — holds: every throw site pinned red-first with path, nodeId, instanceof and the literal sentence; the spelling assertion ties path to collectFlowGraphs; the raw-index case pins the one design choice an ablation could flip.

Changeset — holds: level and both declaration lines match ②; body states the unchanged accept set and message.

Implemented-by: claude/project-thread-ee3j2b
Reviewed-by: session_01WGufzfgvGexKn9vLHsy89K

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:spec#3 · os-support-ai · session_01WGufzfgvGexKn9vLHsy89K

维护者速读

  • 改了什么:validateControlFlow 拒收流程时改抛新导出的 FlowRegionShapeError,带出错容器的 path 和 nodeId;拒收的判定、文字和 HTTP 答复都不变。
  • 为什么改:lint: flow-region-shape-invalid anchors the whole flow; point the finding at the region container at fault #29558 的 lint 规则要把问题挂到具体容器上,今天只能挂整个流程或去解析报错句子;本卡是它的 spec 半边。
  • 风险与回滚:只加数据不改判定;新类继承 Error,读 message 或 instanceof Error 的调用方无感。回滚即撤回本 PR。
  • 先看:packages/spec/src/automation/control-flow.zod.ts 的新类与 containerPathOf,再看 control-flow.test.ts 末尾 5 个 pin。
  • 两分钟验证:pnpm --filter @objectstack/spec exec vitest run src/automation/control-flow.test.ts,全绿。
  • 需要你做的:无,席位落地。

席位意见:一处新公开导出,接受集不动,路径与 collectFlowGraphs 的原始索引一致;patch 档按仓库规则成立(none 配 minor 会被 Check Changeset 拒);同意落地。

席位核对 — ACCEPT · domain:spec#3 · head 78d8ed02eeeeb32b7a5a71199d4cc2ddeb8b2a1e

  • Shape: one new exported class FlowRegionShapeError (path, nodeId) thrown at validateControlFlow's three throw sites, one path helper, five pins in control-flow.test.ts, the two generated export rows (api-surface/automation.json, export-origins/automation.json), one changeset. 5 files, +203 −5; no governed path.
  • Premise measured: on origin/main the three throws were bare Errors whose only location was the sentence; lint: flow-region-shape-invalid anchors the whole flow; point the finding at the region container at fault #29558's lint rule could anchor only on the whole flow (card body, lint: flow-region-shape-invalid anchors the whole flow; point the finding at the region container at fault #29558 amendment 6593285300).
  • Gates (check-runs at this head): 64 total, 55 success, 9 skipped, 0 red; mergeable_state: clean.
  • Contract review: record 6595881129, Served-tier: CONTRACT_REVIEW_TIER, this head, VERDICT PASS, no must-fix, no should-fix.
  • Declarations: Clause-②: yes (widening) (a new public export), Metadata-protocol: none (no authorable-surface row moves), @objectstack/spec patch. The order assumed minor; AGENTS.md Post-Task step 3 grades none at patch and check-changeset-no-major.mjs refuses none beside minor, so the dev's patch stands (the record's ② agrees; precedent .changeset/26464-…). Skills-docs: none with its reason: accepted.
  • Accepted deviation: findRegionEntry's throw (control-flow.zod.ts:532) is not converted. Its one production caller is runRegion at run time (service-automation/src/dag-traversal.ts:761), not validateControlFlow's path, and the card names only the three validation throws.
  • Carried: lint: flow-region-shape-invalid anchors the whole flow; point the finding at the region container at fault #29558 (lint reads err.path) is unblocked by this landing. A follow-on the record notes: the runtime flowDefinitionRefusal could read err.path into its fields[] entry instead of (body); not this card's surface.
  • Landing: ready + auto-merge.

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

1 participant