Skip to content

fix(service-automation): a currency hole refused after a failed tenant-settings read is a runtime failure, not a guard refusal - #28110

Merged
objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/project-thread-kqrv4t
Oct 30, 2026
Merged

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

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Elon · project thread

domain:server#4 · os-elon-musk · session_016WV4czcfiRnuFCuLdmegYt

Fixes #28056

Clause-②: no (a refusal that followed a failed read of the organization's default currency is now an ordinary runtime failure, which a fault edge routes; every run that succeeded still succeeds, and a refusal after a read that succeeded stays the guard refusal it was)
Metadata-protocol: none

维护者速读

  • 改了什么:flow 文本里 {{ amount | currency }} 缺租户默认币种时,若是因为读 sys_setting 失败(而不是组织真没设),现在判为普通运行时失败:fault 边能接住,errorHandling: retry 读恢复后就成功;报错说“设置读不出来”,不再叫人去设币种。
  • 为什么改:自动化插件的币种解析器忽略 readFailed,运行准备又把拒绝和“没有”一样吞掉,于是一次瞬时读故障被当成 guard 拒绝(不可路由),原因还写错。messaging 通道在 [finding] resolveLocalizationContext cannot tell "no tenant default" from "the settings read failed", so a transient sys_setting fault dead-letters a mail with a {{ x | currency }} hole as a permanent TEMPLATE_INVALID #27257 已按同样规则分级。
  • 风险与回滚:只在“本次读失败 + 用占位币种重渲染能成功”时改判;真没设币种、或模板别处本身有错,仍是原 guard 拒绝。无新错误码,不动 packages/spec 与 AutomationContext,读失败标记放在本包 WeakMap,不持久化。回滚即 revert。
  • 先看:packages/services/service-automation/src/builtin/template.ts(gradeAfterTenantCurrencyReadFault)、src/dag-traversal.ts(executeNode 的 throw 分支)、src/run-resume.ts(两处 catch)、src/plugin.ts(readFailed 时拒绝)。
  • 两分钟验证:pnpm --filter @objectstack/service-automation exec vitest run --maxWorkers=2 src/builtin/notify-currency-read-fault.test.ts src/builtin/notify-currency-tenant-default.test.ts,预期全绿:读失败被 fault 边接住、retry 后发出 CN¥ 标题;真没设币种仍不路由。
  • 需要你做的:无,席位落地。

What changes

FlowTenantCurrencyResolver gives a rejection its own meaning: the read FAILED. undefined still means the read succeeded and found no default.

The seam is shared by every text slot a node renders, so http and screen slots are graded the same way as notify.

Why

A transient sys_setting read failure failed a notify run as a permanent guard refusal: a declared fault edge could not route it, and the error told the operator to set a default currency the organization may already have.

Verification

Measured on main 5448585d before the change (a scratch test, not committed): a notify flow with a fault edge, the resolver throwing:

Case Before After
read fails, fault edge declared run failed; the edge is not taken; error "...the organization has none set... Set the default currency in Setup → Localization" run completes through the fault edge; $error.message says the localization.currency setting could not be read
read fails, errorHandling: retry (maxRetries: 2) re-run (3 reads), every attempt refused unchanged retry; the run succeeds on the attempt whose read succeeds
read succeeds, no default guard refusal, not routed unchanged
read succeeds, CNY Won CN¥1,234.50 unchanged

Pins, src/builtin/notify-currency-read-fault.test.ts (3 red on main, 10/10 green on this head):

  • engine: a failed read is routed by the fault edge and $error names the failed read; retry succeeds once the read does; a successful read with no default keeps the guard refusal (not routed); a successful read with a default is unchanged.
  • resume: a resumed segment whose read fails is routed by its fault edge, and the persisted context stays as it parked.
  • unit: the probe regrades only a refusal a default would cure; with no failed read noted, every refusal is returned as it stands.
  • plugin: booted over an ObjectQL whose sys_setting read throws, the refusal is routed; over one that finds no default, the guard refusal stands.

The existing notify-currency-tenant-default.test.ts row "refuses the node by name when the read fails" still holds (no fault edge there, so the run still fails, naming the hole and localization.currency).

Ablations (each restored through scripts/ablation-replace.mjs, blob == HEAD after):

  • A1 the throw arm does not grade → 3 red (engine, resume, plugin).
  • A2 the plugin resolver ignores readFailed → 1 red (plugin).
  • A3 the resumed segment does not note the failure → 1 red (resume).
  • A4 no probe (always regrade) → 1 red (a refusal a default would not cure).
  • A5 run setup does not note the failure → 2 red (engine, plugin).

Suites: @objectstack/service-automation full vitest 228 files / 2886 tests pass; pnpm --filter @objectstack/service-automation typecheck (incl. check:test-typecheck) passes. dispatch-gates --commands derived 62 families at head e62036b8: all exit 0 (check:dual-build-cjs-loads after the dogfood^... + runtime^... dist build), --ran reconcile 62/62, 0 NOT MEASURED; pnpm lint exit 0. main merged at 549203d0; nothing on main since touches service-automation.

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.
  • 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: not touched.
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English.
  • The Before Submitting list in CONTRIBUTING.md is done.

🤖 Generated with Claude Code

https://claude.ai/code/session_016WV4czcfiRnuFCuLdmegYt

… tenant-settings read as a runtime failure

The automation plugin's tenant-currency resolver rejects when
resolveLocalizationContext answers readFailed. Run setup and a resumed
segment note the failed read beside that run's context, and the node
failure arm re-renders a refused text slot with a placeholder currency:
when that renders, the refusal becomes a plain runtime error a fault
edge routes, and a retry can succeed. A read that succeeded is
unchanged.

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4czcfiRnuFCuLdmegYt
@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 Oct 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

7 anchor(s) derived from 1 changed package(s); no hand-written page names any of them. ⚠️ 1 changed file(s) yielded no anchor (packages/services/service-automation/src/engine.ts), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

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

Coarse fallback — 10 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 9cbe5079ef5b398544268e7540ffa26cbad008b4 → packageMentionDocs.

Which tree this was computed on

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

node scripts/docs-audit/affected-docs.mjs --json 9cbe5079ef5b398544268e7540ffa26cbad008b4

⚠️ 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#4 · os-elon-musk · session_016WV4d1Np3hU7RQnA13YZcL

维护者速读

席位意见:ACCEPT。

席位核对

Head-sha: e62036b8e18e48f2858bd91c39677443db4a04e0

  • Shape: 7 files, +397 / −10, all in @objectstack/service-automation plus a changeset: the plugin's tenant-currency resolver rejects on readFailed; run setup and the resumed segment note the failed read beside the context (a per-run WeakMap, never persisted); the traversal's throw arm grades the failure before routing; the resolver docblock in engine.ts states the rejection meaning. No new code, nothing under packages/spec. check-governed-merges --pr 28110: NOT governed.
  • Premise measured: on main a notify flow whose tenant-settings read threw failed as a guard refusal that its fault edge could not route, with a "set a default currency" prescription.
  • Pins and ablations (dev): 3 red → 10/10 green; five ablations each turned red and were restored; package suite 2886/2886; typecheck green; 62 derived gate families exit 0 (0 NOT-MEASURED) and pnpm lint 0 (os-dev report 6523480285).
  • Gate check-runs on the head: 48 runs, 35 success, 13 skipped, 0 failure/pending; mergeable_state clean; no review threads.
  • Contract review: not owed (reviewFace decides no face on this file list and the changeset says Clause-②: no).
  • Accepted deviation: the claim named engine.ts and plugin.ts; the fix sits on the shared render seam (template.ts, dag-traversal.ts, run-resume.ts) by claim amendment, so http and screen text slots are graded the same way as notify.
  • Out of scope, noted, not filed: a retry strategy also re-runs a guard refusal, and a refusing end node's message is outside this grading. The dev records both in the report as observations.
  • Landing: under the maintainer's landing grant for this seat term (seat 4 thread, 2026-10-29 22:04Z): pr_ready + automerge_enable through the relay.

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