Skip to content

fix(lint): flow-region-shape-invalid points at the region container at fault - #29821

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

objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/project-thread-n0hzwf

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Warren · project thread
Fixes #29558

Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:flow-region-shape-invalid 的发现不再只指向整个流程,而是指向引擎拒收时点名的那个区域容器(并行、循环、try_catch),路径与 where 都落到该节点。
  • 为什么改:作者只看到「这个流程有问题」,找不到是哪个容器形状不对;引擎现在随拒收抛出带路径和节点 id 的 FlowRegionShapeError,lint 直接读它。
  • 风险与回滚:只动发现的定位,消息原文一字未改;读不到该错误类型时退回整流程定位。回滚即 revert 本 PR。
  • 先看:packages/lint/src/validate-flow-region-shape.ts 的 containerAtFault(),其后是同目录测试文件里新增的三个容器用例。
  • 两分钟验证:pnpm --filter @objectstack/lint exec vitest run src/validate-flow-region-shape.test.ts,预期 10/10 通过。
  • 需要你做的:无,席位落地。

What changes

validateFlowRegionShape (packages/lint/src/validate-flow-region-shape.ts) now anchors its finding on the region container the engine's refusal names. Since #29719 (PR #29789), validateControlFlow throws the exported FlowRegionShapeError, carrying the container's nodeId and its path inside the flow. The new containerAtFault() reads both with one instanceof FlowRegionShapeError check:

  • path becomes the flow path plus the container path, in lint spelling: flows[1] + ['nodes', 1, 'config', 'try', 'nodes', 0] gives flows[1].nodes[1].config.try.nodes[0] (spellPath()).
  • where becomes flow 'NAME' › node 'ID'.
  • message is unchanged: still the engine's sentence behind the flow's name. Still one rule, one judge, one spelling: there is no second call and nothing parses the sentence.
  • Any other error the engine throws names no container, so the flow stays the anchor, as before. A flow the flow schema refuses is unchanged too: it was never judged, so no container exists.

One finding per flow, which is one finding per container. The engine throws once, at a flow's first malformed region, and the rule makes exactly the engine's call. Reporting further containers would need a second walk beside the engine's, which the card rules out. A flow with two malformed regions therefore still takes two fixes, as the rule's explanation already says.

Forced path-only pin moves, each limited to the asserted path (claim 6593246940, amendments 6593285300 and the one adding the dogfood file):

  • packages/cli/test/validate-flow-region-shape.test.ts: the assembled-artifact case's flows[1] → flows[1].nodes[1].
  • packages/metadata-protocol/src/runtime-authoring-gate.flow-region.test.ts: three cases move from flows[0] to the container.
  • packages/metadata-protocol/src/protocol.draft-publish-verdict.test.ts: the draft read's item-relative path '' → nodes.1.config.try.nodes.0.
  • packages/qa/dogfood/test/flow-region-malformed-publish.dogfood.test.ts: the draft read's "path":"" → "path":"nodes.1", its comment, and one docblock phrase.

A @objectstack/lint patch changeset carries the move.

Why

The card: an author reading flow-region-shape-invalid learned only that the flow was refused, not which parallel, loop or try_catch was malformed. The location now comes from the contract the spec half (#29719) added, not from the sentence.

Tests

  • packages/lint/src/validate-flow-region-shape.test.ts: three new cases under [#29558] (a top-level try_catch, a one-branch parallel nested in a try region, a loop inside the second branch of a parallel), plus the first case and the non-record-entry case moved to the container path. 10/10.

All at head ccbd58d4, each under scripts/pm/os-verify-lock.sh, verdict line quoted:

Test runs
  • pnpm --filter @objectstack/lint typecheck && pnpm --filter @objectstack/lint test: VERDICT command-exit 0; Test Files 192 passed (192), Tests 7945 passed (7945). The lint typecheck covers its tests (check:test-typecheck).
  • pnpm --filter @objectstack/lint exec vitest run --maxWorkers=2 src/validate-flow-region-shape.test.ts: VERDICT command-exit 0; Tests 10 passed (10).
  • pnpm --filter @objectstack/cli exec vitest run --project unit --maxWorkers=2 test/validate-flow-region-shape.test.ts: VERDICT command-exit 0; Tests 7 passed (7). authoring-rule-command-parity.test.ts is integration tier and unedited, so it is left to CI.
  • pnpm --filter @objectstack/metadata-protocol exec vitest run --maxWorkers=2 src/runtime-authoring-gate.flow-region.test.ts src/protocol.draft-publish-verdict.test.ts (after a lint build): VERDICT command-exit 0; Test Files 2 passed (2), Tests 57 passed (57).
  • pnpm --filter '@objectstack/dogfood^...' build && pnpm --filter @objectstack/dogfood exec vitest run --maxWorkers=2 test/flow-region-malformed-publish.dogfood.test.ts: VERDICT command-exit 0; Tests 3 passed (3).
Ablation (one, on the reader)

node scripts/ablation-replace.mjs replaced the reader's one line (the instanceof FlowRegionShapeError return) with return undefined;: anchor x1 to x0, blob 37494f85f3c3 to 122265b776ae. The rule's test file then went red, Tests 5 failed, 5 passed: the first case, the three [#29558] container cases and the non-record-entry case. Restored by the tool: blob after restore 37494f85f3c3 equals HEAD, git diff HEAD empty. The test imports the rule from source, so no build sits between the mutation and the run.

Acceptance notes

  • The resume commit (56820bac, cherry-picked as b9930969) missed one in-file pin, the non-record-entry case (flows[2] → flows[2].nodes[1]); fixed in its own commit.
  • The rule's os explain entry (rule-explanations.ts) says nothing about the location, so it was left alone.

Verification

  • node scripts/pm/dispatch-gates.mjs --commands at ccbd58d4 derived 63 families; all were run with exit codes recorded before any pipe; --ran reconciliation: 63 derived, 62 run, 1 NOT MEASURED, 0 unrun.
  • NOT MEASURED: pnpm check:dual-build-cjs-loads, reason: it reads built output of every package (PREREQUISITE NOT MET, exit 3, seven packages without dist/); CI's Lint & Repo Gates runs it.
  • node scripts/check-plugin-teardown-shape.mjs --self-test first exited 3 because its pinned fixture commit was outside this shallow clone; after fetching that commit it exited 0 (48 cases pass).
  • Every other derived family exited 0.

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic. (No packages/spec change.)
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint runs in CI.
  • 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: n/a.
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English.

Generated by Claude Code

… names (red until the refusal carries it)

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQwxbYhWa8iJ59Un7Uevvs
…onShapeError names

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQwxbWp3uyRGHgDR5oyquZ
…iner; lint changeset

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQwxbWp3uyRGHgDR5oyquZ
@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

5 anchor(s) derived from 1 changed package(s); no hand-written page names any of them, so this run has nothing to list — not a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run.

What this run could not see
  • the SDK route bridge reached 61 of 219 client-bound route-ledger rows — the other 158 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 158: 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; 103 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 — 4 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 5ac50e482a00ef82ee915cb7eb7c63e75438a28a → packageMentionDocs.

Which tree this was computed on

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

node scripts/docs-audit/affected-docs.mjs --json 5ac50e482a00ef82ee915cb7eb7c63e75438a28a

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#3 · os-warren · session_01JQwxbYyp6wSRcywGFK2L4A

维护者速读

  • 改了什么:lint 规则 flow-region-shape-invalid 的发现,从整个流程改为指向引擎拒收时点名的那个区域容器。例如 flows[1] 变成 flows[1].nodes[1].config.try.nodes[0],where 写作 flow 'x' › node 'id'。
  • 为什么改:作者原先只知道流程有问题,找不到是哪个容器。feat(spec): validateControlFlow throws FlowRegionShapeError carrying the container path and node id #29789 让引擎抛出带 path 和 nodeId 的 FlowRegionShapeError,lint 用一次 instanceof 读出来,不解析句子。
  • 风险与回滚:消息原文不变。其他错误仍以整个流程为锚。服务端草稿诊断里的路径随之由条目根 '' 移到容器(如 nodes.1)。回滚即 revert。
  • 先看:packages/lint/src/validate-flow-region-shape.ts 的 containerAtFault() 与 spellPath()。
  • 两分钟验证:pnpm --filter @objectstack/lint exec vitest run src/validate-flow-region-shape.test.ts,预期 10/10。
  • 需要你做的:无,席位落地。
  • 席位意见:只移动定位、不改判定。四处被迫跟着改的只有路径断言(认领 6593246940、修订 6593285300 与 dogfood 修订)。

席位核对

ACCEPT · domain:server#3 · head ccbd58d404215f811646c99056ca96cafdb7aff9 · 2026-11-03T06:36Z · seat review of record at TIER_DEFAULT. Not governed: check-governed-merges --pr 29821 reports NOT governed, 119 lines. There is no packages/spec path and no contract face, so no second agent.

  1. Shape: draft, base main, Fixes #29558, Clause-②: no, Metadata-protocol: none (the body and the changeset agree; @objectstack/lint patch). 7 files, +98/−21, all inside the claim, its amendment and the dogfood amendment. The seat read the diff:
    • containerAtFault(err) returns { nodeId, path } only for err instanceof FlowRegionShapeError, and undefined otherwise.
    • where and path take the container when there is one. message is built exactly as before.
  2. Premise measured: FlowRegionShapeError (packages/spec/src/automation/control-flow.zod.ts, feat(spec): validateControlFlow throws FlowRegionShapeError carrying the container path and node id #29789 eb05ea2f) carries readonly path and nodeId. The resume sha's reader was a placeholder that returned undefined, and the red-first pins are on the branch (b9930969).
  3. Gates on this head: check-runs pinned to ccbd58d4: 64 total, 55 success, 9 skipped, 0 failed. Dev on this head (os-dev-report 6596835011):
    • lint 7945/7945 and typecheck; the rule file 10/10; cli 7/7; metadata-protocol 57/57; the dogfood file 3/3; 5 ablations red;
    • 63 derived gates, 62 run green, check:dual-build-cjs-loads NOT MEASURED (it needs the full dist) and answered by CI.
  4. Prose checked against the diff: each changeset sentence holds against the diff:
    • "The location is read off the FlowRegionShapeError that validateControlFlow throws, never parsed from the sentence": the instanceof read.
    • "the message is unchanged": the message line is untouched.
    • "Any other error keeps the flow as the anchor": the undefined branch.
    • "the path was the item root and is now the container, for example nodes.1": the dogfood and protocol.draft-publish-verdict pins.
  5. Out of scope: none found. Skills-docs: not owed (Metadata-protocol: none).
  6. Landing: not governed and under 3000 lines ⇒ the seat lands it (pr_ready + automerge_enable). At MERGED: landing record on lint: flow-region-shape-invalid anchors the whole flow; point the finding at the region container at fault #29558 (closed by Fixes), pm:dispatched removed, card thread stood down.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 3, 2026 06:37
@objectstack-fleet
objectstack-fleet Bot enabled auto-merge November 3, 2026 06:37
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 3, 2026
Merged via the queue into main with commit 7a25b39 Nov 3, 2026
65 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-n0hzwf branch November 3, 2026 07:02
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: flow-region-shape-invalid anchors the whole flow; point the finding at the region container at fault

1 participant