Skip to content

docs(skills): teach how a subflow or map child flow name resolves from the calling package - #31805

Merged
os-zhuang merged 4 commits into
mainfrom
claude/project-thread-0gsua5
Nov 9, 2026
Merged

os-zhuang merged 4 commits into
mainfrom
claude/project-thread-0gsua5

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Steedos · project thread
Fixes #31741

Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:自动化技能文档的 subflow / map 两行补上子流程名的解析规则:软件包里的流程先找本包的流程,再找它声明依赖(加 sys)里唯一的持有者;否则运行到该节点时失败,并列出全部候选。另加一条 eval 用例,要求声明对子流程所在包的依赖。
  • 为什么改:引擎(ADR-0150 E1)已经按调用方软件包解析子流程名,但技能文档没说,AI 会写出能通过 os validate、一运行就失败的流程。
  • 风险与回滚:只改已发布的技能文本、一条 eval 和该文件的 token 上限(6527→6568,实测余额 41 token)。回滚即还原本 PR。
  • 先看:skills/objectstack-automation/SKILL.md 的 subflow 行;scripts/check-skills-token-ratchet.mjs 中该文件的上限行。
  • 两分钟验证:node scripts/check-skills-token-ratchet.mjs,预期该文件 6568 tokens、headroom 0、退出码 0。
  • 需要你做的:审阅并批准(Tier H,skills/**)。

What changes

  • skills/objectstack-automation/SKILL.md: the subflow row (58 -> 571 B) teaches how a bare config.flowName resolves from the calling flow's package and the three run-time refusals; the map row (160 -> 228 B) points at it and says a refused name fails the node at the first item.
  • skills/objectstack-automation/evals/flows-triggers-approvals.json: case id 20. The expected output declares dependencies: { 'acme.crm': … } on acme.billing; must_contain needs dependencies and 'acme.crm', must_not_contain rejects dependencies: {} and package-qualified names, so the undeclared form fails.
  • scripts/check-skills-token-ratchet.mjs: the file's row 6527 -> 6568, pinned at the measurement.
  • .changeset/31741-automation-subflow-name-resolution.md: '@objectstack/skills': patch.

Where each taught fact comes from (merged code on main):

  • Step order: packages/core/src/package-scoped-resolution.ts resolvePackageScopedHolders (step 1 own, step 2 closure, step 3 outside-closure; package-less callers through resolveEnvironmentWide), the closure being dependencies transitively plus every sys package. The automation plugin asks it through resolvePackageScopedName (packages/services/service-automation/src/plugin.ts flowNameResolver).
  • Reason codes, spelled as in PackageScopedRefusalReason: ambiguous-in-closure, ambiguous-in-environment, outside-closure.
  • Error code: none. engine.ts execute answers { success: false, error: refusal.message }; the subflow node rewrites it as subflow 'X' failed: …, the map node as map 'ID': item N (subflow 'X') failed: … and stops the batch. registerFlow refuses arming a name two packages hold (flowNameRefusal(name, null)), so it is never armed.
  • Run time only: no lint or save-door rule reads a subflow / map flowName against the closure.
  • Reachability of the two ambiguous-* reasons: install and package registration refuse a second package holder of a flow name (packages/objectql/src/bare-name-one-holder.ts), so only a clash older than that refusal reaches them (the E1 PR's red-line-2 tests build one by hand).

Token budget

Standing ruling, verbatim and untranslated: 「A:先削重复,余额按实测提高」 (ruling record 6513306068, letter B). Priced bytes 26108 -> 26272: the rows add 581 B, nine restatement cuts remove 417 B, and the remaining 164 B (41 tokens) move the ceiling 6527 -> 6568, pinned at the measurement. The cuts, each with its survivor:

  1. The screen row's "never hand-roll a button label or step counter into fields": the same cell's "Next / Submit and Step N of M are not authored".
  2. The script example's "function returns values → outputVariable → update_record persists" comment: the prose sentence above it.
  3. The "CEL values or literals" comment on script inputs: Valid-but-silently-wrong Add metamodel interfaces for ObjectQL/ObjectUI contract #1, which lists script inputs.* as a value slot.
  4. "Do not remove readonly instead": objectstack-data's readonly bullet ("not by removing readonly").
  5. The loop row's sample envelope: Add metamodel interfaces for ObjectQL/ObjectUI contract #1's { dialect: 'cel', source: '…' }.
  6. "never a reason to write code" in Integrations: the same paragraph's "Never a plugin" and "the app still writing none".
  7. References' "Read the source for exact field shapes; never rely on memory": references/_index.md ("Read them directly from node_modules").
  8. "hooks get ctx.api": the hook runAs paragraph ("that hook's ctx.api data operations").
  9. When to Use's "(auto-launched, screen, scheduled)" and "record-change": the Flow Types table and the frontmatter description.

Bundle readings (SKILL.md files, whole file): skills/objectstack-automation/SKILL.md 452 -> 447 lines, 26128 -> 26292 B; all published SKILL.md files 4601 -> 4596 lines.

Tests

Docs and eval only; no package code changes. node scripts/check-skills-token-ratchet.mjs exit 0 and --self-test exit 0.

Acceptance notes

  • Serial constraint: PR docs(skills): type-check more objectstack-automation examples with os:check #31791 edits this SKILL.md at other hunks (the notify block, the trigger section, the state-route line near L300); none overlaps the rows changed here, and the state-route line, pinned verbatim by packages/rest/src/meta-state-route-doc-spelling.test.ts, is neither touched nor counted as a cut. The two PRs share this file's token ceiling, so whichever lands second merges main and re-measures it.

Verification

Derived gates (dispatch-gates --commands, 64 families)
  • Full sweep at d53255d5: 64 derived, 64 run, every recorded exit 0; dispatch-gates --ran: 64 run, 0 NOT-MEASURED. check:dual-build-cjs-loads first exited 3 (prerequisite) and was re-run green after a full turbo run build (VERDICT command-exit 0).
  • After merging main (7 commits, none touching these files) at af704f79: the derivation is byte-identical; the ratchet families re-run on the new head: check-skills-token-ratchet and its --self-test, check:skill-docs, check-empty-changeset, check-changeset-no-major, all exit 0.
  • PR-body gates on this body: check-changeset-no-major, check-adr-0087-registration, check-closing-keyword-parity, check-partof-closing-keyword, all exit 0.

Generated by Claude Code

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

Copy link
Copy Markdown
Contributor Author

domain:skills#2 · zhuangjianguo · session_01QsR2jT34CXs5fCn3BDirZw

维护者速读

  • 改了什么:自动化技能 SKILL.md 的 subflow 和 map 两行写清了子流程名怎么解析。软件包里的流程先找本包的同名流程,再找它 dependencies 闭包(含 sys)里唯一的持有者。不属于任何包的流程先找环境里的,再找唯一持有它的包。都不满足时,os validate 会通过,但运行到该节点就失败,报错里列出全部候选。另加一条 eval(id 20),要求声明对子流程所在包的依赖。该文件的 token 上限从 6527 提到 6568。
  • 为什么改:引擎已经按调用方的软件包解析子流程名(ADR-0150 D3),技能却没写。AI 照着写,会写出校验通过、一运行就失败的流程。
  • 风险与回滚:只动技能文本、一条 eval、一个 ratchet 上限行和一个 changeset(@objectstack/skills patch)。不改任何包代码。回滚就是 revert 本 PR。
  • 先看:skills/objectstack-automation/SKILL.md 的 subflow 行;scripts/check-skills-token-ratchet.mjs 里这个文件的上限行。
  • 两分钟验证:运行 node scripts/check-skills-token-ratchet.mjs,预期这个文件 6568 / 6568,退出码 0。席位在这个 head 上复跑过,结果一致。
  • 需要你做的:批准并入队(Tier H,skills/**)。上限提高依据常设裁定 6513306068 字母 B:先删掉 9 处重复,余下 41 token 按实测提高。PR 正文逐条列出了删掉的句子和保留它的位置。
  • 席位意见:ACCEPT。席位对照引擎代码逐句核对了这两行,没有不准确的地方。

席位核对

Head-sha: af704f7900b0726f8613f8b9c0f04db17c4f1eb8

  1. Shape: draft, base main, Fixes #31741, Clause-②: no, Metadata-protocol: none. 4 files, +67/−17. Tier H by skills/**.
  2. Premise measured: on main, the subflow row says nothing about how a bare config.flowName resolves. The engine refuses an unresolvable name at run time: engine.ts execute (L6261) calls flowNameRefusal(flowName, flowCallerPackage(context)), and registerFlow (L4587) refuses to arm a name that two packages hold for a caller with no package.
  3. Code read: the seat checked each taught clause at this head.
    • The order "own, then the one holder in the closure plus sys" and the package-less order "environment, then the one package holder" follow the resolver steps.
    • "os validate passes": no lint or validate rule reads a flowName against the closure (grep finds nothing in packages/cli or packages/spec).
    • The message is subflow 'X' failed: … (subflow-node.ts L175), and the refusal message names every candidate.
    • "No code": execute returns { success: false, error } only, so carriedRefusalOfResult carries {}.
    • The map clause holds: one name and one caller give the same refusal on every item, and the batch stops at the first failing item (map-node.ts L269).
    • "An older clash, never armed": by the setFlowNameResolver docstring, the two ambiguous-* reasons are reachable only from a clash that predates the one-holder refusal, and registerFlow refuses that name rather than arm it.
    • Gates: the ratchet re-ran on this head and passed (6568 / 6568, exit 0). Two cut survivors were spot-checked and are present: objectstack-data L218–219 「not by removing readonly」, and references/_index.md L8 「from node_modules」. The dev's sweep was 64 derived, 64 run, all exit 0. K = 0.
  4. Accepted deviations: none. The ceiling raise follows ruling 6513306068 letter B, and the body quotes 「A:先削重复,余额按实测提高」 as required.
  5. Out of scope / Skills-docs: Metadata-protocol: none, so no Skills-docs: line is owed. Serial constraint: docs(skills): type-check more objectstack-automation examples with os:check #31791 shares this file's token ceiling at other hunks. Whichever of the two lands second merges main and re-measures the ceiling.
  6. Landing: Tier H. pm:awaiting-merge plus reviewers os-zhuang and hotlong. The PR stays draft until an authorized approval or a maintainer enqueue.

@objectstack-fleet objectstack-fleet Bot added the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Nov 9, 2026
@os-zhuang
os-zhuang marked this pull request as ready for review November 9, 2026 08:09
@os-zhuang
os-zhuang enabled auto-merge November 9, 2026 08:09
@os-zhuang
os-zhuang added this pull request to the merge queue Nov 9, 2026
Merged via the queue into main with commit ef194d7 Nov 9, 2026
50 checks passed
@os-zhuang
os-zhuang deleted the claude/project-thread-0gsua5 branch November 9, 2026 08:27
@objectstack-fleet objectstack-fleet Bot removed the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

2 participants