Skip to content

fix(service-automation): a flow write node's refusal is worded in the run's locale, as the record doors word it - #25929

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

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

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Leehom · project thread

Fixes #25809

Clause-②: no
Metadata-protocol: none

What changes

A refusal a flow's write node meets is now worded in the language of the person who started the run, as their own record save is.

The run already carries that language (AutomationContext.locale, seeded by the /actions door at packages/runtime/src/action-execution.ts and by the trigger door). resolveRunDataContext (packages/services/service-automation/src/runtime-identity.ts), the one place that maps a run to the ObjectQL context its data nodes pass, dropped it. It now carries locale on both runAs arms (RunDataContext.locale). The engine's existing translation hook (ObjectQL#validationMessageContext, bridged to the i18n service) does the rest: an authored rule's objects.OBJECT._validations.RULE.message, the built-in catalog, a DELETE_RESTRICTED sentence's labels. The translated text reaches the caller through the path the inner-refusal ruling added: the crud node's catch arm puts it on innerRefusal.message, and the four doors emit it in the FLOW_FAILED details.

No second translation path: nothing in service-automation translates anything. A run no person started (record-change, schedule, webhook) has no locale and keeps the authored text, as before.

Measurement — red first

packages/services/service-automation/src/flow-write-refusal-locale.integration.test.ts: a real kernel (ObjectQL + better-sqlite3), an object with an authored script rule, and a zh-CN bundle on the engine's i18n service. Each case first asserts the record door's own answer for the same write (ql.insert with locale: 'zh-CN' answers 金额不能为负数。).

  • At cb0a2fcf4 (origin/main) plus the test alone: 6 failed / 2 passed (8). create_record and update_record returned innerRefusal.message: "Amount must not be negative." under both runAs arms; delete_record returned This Account is still referenced by 1 Deal record(s) through “Account”. Delete or reassign them first. (English labels). The two passing cases are the no-locale controls.
  • With the fix (447414c4): 8 passed (8).

Every flow write node, with a verdict

Node Verdict
create_record Gap (measured red: authored rule message in English). Fixed.
update_record Same gap (measured red). Fixed.
delete_record Same gap on DELETE_RESTRICTED: the sentence named objects by their English labels (measured red). Fixed.
get_record Read. ObjectQL reads context.locale only for refusal wording (validation messages, delete restriction), so a read has nothing to word. Carries the locale; no behaviour change.
lookup expander (plugin.ts, setRecordExpander) Read through resolveRunDataContext; same as get_record.
approval / approval_revise (plugin-approvals) Not a flow-generic data write: they write through the approval service under its own context, not through resolveRunDataContext. Out of this card's file surface; not measured.
connector_action, http_*, notify, screen No ObjectQL write.

All four data nodes take their context from resolveRunDataContext (DATA_NODE_TYPES), so the fix is one place and cannot drift between node types.

Tests

  • New: flow-write-refusal-locale.integration.test.ts — 8 cases: create / update / delete under runAs: 'user' and 'system' in zh-CN, plus the no-locale control per arm.
  • Ablation, one per arm, with the fix committed (447414c4), via scripts/ablation-replace.mjs (anchor 1 → 0, blob moved; restore: blob == HEAD d5d8492ba58e, git diff HEAD empty). The subject is imported from source (./plugin.js), so no dist/ leg applies.
    • delete ...(locale ? { locale } : {}), (system arm): 3 failed / 5 passed — the three runAs: 'system' zh-CN cases.
    • delete if (locale) out.locale = locale; (user arm): 3 failed / 5 passed — the three runAs: 'user' zh-CN cases.
  • pnpm --filter @objectstack/service-automation test: Test Files 203 passed (203), Tests 2667 passed (2667).
  • pnpm --filter @objectstack/service-automation typecheck: exit 0 (incl. check:test-typecheck).
  • eslint --no-inline-config packages/services/service-automation: exit 0.

Gates (local subset)

node scripts/pm/dispatch-gates.mjs --commands at ba44680f4 derives 68 families for this diff (3 paths). All 68 ran with exit 0; --ran reconciliation: 68 derived, 68 run, 0 NOT-MEASURED, 0 UNRUN (exit 0).

  • Two families answered exit 3 on the first pass for shallow-clone prerequisites, the known pair: check-plugin-teardown-shape --self-test (re-run after fetching its fixture commit) and check:dual-build-cjs-loads (re-run after a full pnpm build, lock VERDICT exit 0). Both re-ran to exit 0.
  • The first 56 families ran at 447414c4 (the code at its final bytes, before the changeset commit); the 12 the changeset added to the derivation ran at ba44680f4.
  • Every family CI runs is CI's verdict on this PR's check-runs; none is re-run here. test:repo and the repo-wide pnpm lint are CI's.

Acceptance notes

  • AutomationContext.locale's docblock (packages/spec/src/contracts/automation-service.ts) lists its readers as the refusing end node and the screen executor; the data nodes are now a third reader. Not edited here: packages/spec/** is outside this claim's file surface. Carrier: none.
  • Hooks fired by a flow's write now see the starter's locale on their session, as the same user's record-door write already gives them. Presentation only: no security middleware keys on it.
  • The /actions door's half (ec.locale → AutomationContext.locale) and the details carriage (flowFailureDetails) were already on main and are unchanged; this PR pins the engine leg, where the gap was.

Generated by Claude Code

🤖 Generated with Claude Code

https://claude.ai/code/session_011W59GGh1a3YnDbRLcBJYxe

… run's locale — resolveRunDataContext carries AutomationContext.locale into the data context

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

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

2 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
  • 1 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 54 of 206 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 — 6 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 2a728ba2acf52c13d1918c2afca7b79bf391e1f5 → packageMentionDocs.

Which tree this was computed on

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

node scripts/docs-audit/affected-docs.mjs --json 2a728ba2acf52c13d1918c2afca7b79bf391e1f5

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

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

席位核对 · ACCEPT · domain:server seat 1 · os-project-manager · session_01R1q2xdtYgU6FKrZ7LgjPCC · 2026-10-26T04:34Z

Head ba44680f41, report 6408295095, claim 6407855000.

item reading
Shape draft, base main, Fixes #25809, Clause-②: no and Metadata-protocol: none line-initial, patch changeset.
Files (3, +231/−2) service-automation/src/runtime-identity.ts, one integration test, one changeset: inside the claim's surface (no runtime edit was needed). No packages/spec/**, so no contract review is owed. Not governed (check-governed-merges --pr 25929), 233 changed lines.
Fix resolveRunDataContext carries AutomationContext.locale into the run's data context on both runAs arms; the engine's existing translation hook words the refusal and innerRefusal.message carries it. One translation path, as ruled (triage 6399842990). Seat's own read: locale is presentation only — no security middleware keys on it — and is absent on a run no person started, which keeps the authored text.
Evidence red first: 6 failed / 2 passed at cb0a2fcf4f plus the test, 8/8 with the fix; per-arm ablation reds exactly that arm's three cases. Node verdicts: create_record, update_record, delete_record fixed; get_record and the lookup expander are reads, no change.
Gates dispatch-gates 68/68 exit 0, --ran 0 NOT-MEASURED; package suite 2,667/2,667; typecheck and eslint 0. CI at this act: in progress.
Landing ready + auto-merge through the relay once every check on this head is green or an expected skip.

Generated by Claude Code

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review October 26, 2026 04:52
@objectstack-fleet
objectstack-fleet Bot enabled auto-merge October 26, 2026 04:52
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Oct 26, 2026
Merged via the queue into main with commit de2b7e0 Oct 26, 2026
47 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-nkyzay branch October 26, 2026 05:16
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.

i18n(flows): a validation rule tripped by a flow's create_record answers in English — the record doors translate the same rule's message per locale

2 participants