Skip to content

fix(runtime): a declarative update action answers the validation warnings its write raised, and the console toast shows them - #38076

Merged
objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/project-thread-nyjctk
Nov 28, 2026
Merged

objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/project-thread-nyjctk

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Tesla · project thread

Fixes #37867
repo:objectstack#3 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU

Clause-②: yes (widening)
Metadata-protocol: none

维护者速读

  • 用户点「确认订单」这类改状态的按钮时,如果这次写入触发了警告型校验规则,现在会弹出一条警告样式的提示,规则作者写的话就在提示里,撤销按钮照样在;以前只弹成功提示。
  • 替用按钮改状态的应用解决:警告规则以前只在编辑表单里生效,最常用的按钮路径静默通过(HotCRM 订单超出框架合同额度就是实例)。
  • 写入本身不变,只是应答多带警告、提示换样式;如果有问题,最多是提示样式不对,可以直接撤回。
  • 无

What changes

  • packages/runtime/src/action-execution.ts: executeDeclarativeUpdateAction copies the warnings the data-plane update answered (protocol.updateData, the data door's own ValidateDataIssue elements) onto its result. DeclarativeUpdateResult gains an optional warnings, present only when the write raised an advisory rule hit, so a write that trips nothing answers byte-for-byte as before. Both action doors (REST POST /api/v1/actions/... and MCP run_action) go through this executor. The stale roll-up path (ERR_SUMMARY_RECOMPUTE) composes from the same written answer, so it carries them too.
  • ui/packages/core/src/actions/ActionRunner.ts: for an operation: 'update' action only, the runner reads the answer's warnings (distinct messages, in answer order). When there are any, the success toast takes the warning variant, with the messages as its description and the Undo affordance kept. This is one toast, the way a record save raises one (toastRecordSave). When the author turned the success toast off (toast.showOnSuccess: false, or a result dialog), the warning is still shown, in the rule's own words, so no new runner text is needed. ToastHandler options gain an optional description.
  • ui/packages/app-shell/src/hooks/useConsoleActionRuntime.tsx, ui/packages/app-shell/src/views/RecordDetailView.tsx: both console toast handlers used to send every non-error toast to toast.success. They now honour type: 'warning' and call toast.warning(message, { description, duration, action }) with the same Undo action.
  • Changeset: @objectstack/runtime, @object-ui/core, @object-ui/app-shell patch.

Not changed: packages/spec (the action answer has no zod declaration, it is the runtime's TS interface), locale packs (no new text), HotCRM (its confirm_sales_order and framework_quota_exceeded work as authored).

Tests

  • packages/runtime/src/action-declarative-update.test.ts, a new top-level describe in the shared harness. It puts a protocol slot in front of the caller-honouring rig. REST: the 200 answer carries the write's warnings, element for element, beside the record and the undo anchor. MCP run_action: the same write gives the same warnings. Control: a write that trips no rule has no warnings key. The file gains a module-top import '@objectstack/metadata' so the dispatcher's lazy load is paid at collection (check:test-source-alias).
  • ui/packages/core/src/actions/__tests__/ActionRunner.updateOperation.test.ts, a new describe through the real createServerActionHandler: one warning toast with the success message as title and the rule's words as description; repeated messages said once and distinct ones one per line; Undo kept on an undoable action; control with no warnings is a plain success toast with no description; success toast off still warns; reverse pin: a script action without operation never reads a warnings key.
  • ui/packages/app-shell/src/hooks/__tests__/useConsoleActionRuntime.undoLookupId-11122.test.tsx and ui/packages/app-shell/src/views/RecordDetailView.undoLookupId-11122.test.tsx, a new describe in each, down to sonner. On a grid row and on the record page, the update's warnings raise toast.warning once with the description and the Undo action, no success toast, and Undo restores the stored value. Both harnesses' route stubs gained an optional answer body. These two test files are a surface amendment to the claim, reported to the seat.

Acceptance notes

  • Premise measured on origin/main 815e882b before any edit. Through the real HttpDispatcher.handleActions → executeDeclarativeUpdateAction → callData, the protocol's updateData answered ["object","id","record","warnings"] and the action's 200 body carried warnings 0 times.
  • The same executor also drops the data door's notice (a hook's message for the person) and droppedFields. Out of scope here; the seat files them.
  • ToastHandler and the action answer each gain one optional member. Nothing is refused or narrowed.

Verification

  • Two-minute check: pnpm --dir ui exec vitest run packages/core/src/actions/__tests__/ActionRunner.updateOperation.test.ts shows 19 passed, 6 of them the new block.
  • Read first: executeDeclarativeUpdateAction's result block (action-execution.ts), then the success-toast arm of handlePostExecution (ActionRunner.ts).
Local readings at 40c5c82
  • New and edited suites: action-declarative-update.test.ts 37 passed; ActionRunner.updateOperation.test.ts 19 passed; useConsoleActionRuntime.undoLookupId-11122 6 passed; RecordDetailView.undoLookupId-11122 4 passed.
  • Full: pnpm --filter @objectstack/runtime test Test Files 655 passed, Tests 12316 passed, 25 skipped. ui vitest packages/core/src/actions: 58 files, 810 passed. app-shell useConsoleActionRuntime* + RecordDetailView*: 128 files, 1104 passed.
  • Typecheck exit 0: @objectstack/runtime (test layer 27 files / 183 errors held in the ledger, unchanged), @object-ui/core type-check, @object-ui/app-shell type-check.
  • Ablations through scripts/ablation-replace.mjs, each restore blob == HEAD: runtime warnings spread removed, 2 failed (REST, MCP); the runner's warnings read emptied, 6 failed (4 core, 2 hosts); each host's warning arm disabled, 1 failed each.
  • dispatch-gates --ran with recorded exit codes: 73 derived, 71 exit 0, 2 NOT MEASURED (exit 3: check-plugin-teardown-shape --self-test, fixture commit outside the shallow clone; check:dual-build-cjs-loads, needs a full pnpm build), 0 unrun. check:test-source-alias exit 0 at 40c5c82.
  • overlap-check.mjs VERDICT clean exit 0 against main and feat(spec)!: action locations say what an action acts on #37929, feat(spec)!: retire the ask_ai action type (ADR-0160 D7) #37924, fix(runtime)!: an action not bound to an object accepts no record #37896.

Generated by Claude Code

…ite raised

executeDeclarativeUpdateAction composed its answer from the written record and
dropped the advisory validation-rule hits the data-plane update answered, so a
button that performs the same write as a form save answered no warnings.

Claude-Session: https://claude.ai/code/session_01L9qiby3dfNfCgpXwPkB2Hf
Co-authored-by: Claude <noreply@anthropic.com>
…ts write raised

The runner reads the declarative-update answer's warnings and raises the
success toast on its warning variant with the rule's words as its
description; both console toast handlers learn the warning variant.

Claude-Session: https://claude.ai/code/session_01L9qiby3dfNfCgpXwPkB2Hf
Co-authored-by: Claude <noreply@anthropic.com>
…d row and the record page; changeset

Claude-Session: https://claude.ai/code/session_01L9qiby3dfNfCgpXwPkB2Hf
Co-authored-by: Claude <noreply@anthropic.com>
…he ask_ai retirement's hunk

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

github-actions Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

3 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 69 of 252 client-bound route-ledger rows — the other 183 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 183: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 124 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 — 30 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 93fa9118a3dc61473890eafc6bb170a6fc1c3042 → packageMentionDocs.

Which tree this was computed on

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

node scripts/docs-audit/affected-docs.mjs --json 93fa9118a3dc61473890eafc6bb170a6fc1c3042

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

…in the declarative-update harness

Claude-Session: https://claude.ai/code/session_01L9qiby3dfNfCgpXwPkB2Hf
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1
2026-11-28T02:41Z

Contract review

Served-tier: TIER_DEFAULT
Head-sha: 40c5c821495c1c02e2a7a4a96244fd1bc0ab1870
Local-runs: none

① Derived judgments

  • Face: declaration only. The diff has no packages/spec/src/** file and no governed path; the body and changeset carry Clause-②: yes (widening) and Metadata-protocol: none, so the review owed is this one, at TIER_DEFAULT.
  • Runtime: executeDeclarativeUpdateAction reads warnings off the data-plane update answer through writeAnswerWarnings (a non-empty array or undefined) and spreads it onto DeclarativeUpdateResult only when present. A write that trips no rule answers byte-for-byte as before. The stale roll-up path throws withEarnedAnswer(stale, { ...result }) after the spread, so it carries the same member. Both doors (REST action route, MCP run_action) go through this executor, and the runtime suite pins each, plus the no-warnings control.
  • Console: updateAnswerWarningLines is read only for isUpdateOperationAction, from readActionPayload(result.data), so a script action's own warnings key is never read as one (reverse pin in the suite). Distinct messages, in answer order.
  • Double-toast check: the action route goes through createServerActionHandler over the console's plain authenticated fetch (consoleServerAction.ts, apiActionDoor.ts), never the ObjectStack adapter's create/update, so the adapter's emitWriteWarning channel does not fire for an action write. The new runner toast is the only one.
  • Design point (the success toast off, or a result dialog): the warning still shows on its own, titled with the rule's own message and no runner text. Agreed. A warning is the rule author's demand on the person, not success copy, and showOnSuccess: false turns off the success message only; it matches the record-save path, which shows the warning whatever the form's own toast settings are. result.silent still suppresses both, which is right for a programmatic run.
  • Hosts: useConsoleActionRuntime.tsx and RecordDetailView.tsx now route type: 'warning' to toast.warning with the description and the same Undo action; both suites pin it down to sonner. The @object-ui/react hosts (ActionContext.tsx, useActionRunner.ts) pass the consumer's onToast through unchanged; 'warning' was already in the type union, and description is an optional addition a consumer may ignore.
  • Card A declarative update action drops validation warnings: Confirm Order over a framework quota shows only the success toast #37867: all three acceptance lines are delivered (the answer carries the data door's warnings in its own shape; the console shows them; a test covers a write that trips a severity: 'warning' rule). Fixes is right. The notice and droppedFields drops the dev found in the same executor are out of the card, and the seat files them.

② Semver level

patch for @objectstack/runtime and @object-ui/core: one optional member on the action answer and one optional member on the ToastHandler options, nothing refused or narrowed. The @object-ui/app-shell entry is on a private package and changes nothing published.

③ Boundary flags

  • The dev's surface amendment (the two app-shell host test files) is in the diff and reported to the seat; it pins the host arms and adds nothing to the contract.
  • SQL push-down: no query, id materialisation or in-app join is added; not applicable.
  • nit: info-severity hits also ride the warning variant. The data door answers them in the same warnings list and the record-save path shows them the same way, so this is consistent; no change asked.
  • nit: the ObjectQL fallback arm of callData answers no warnings, so an install without the protocol slot still shows only the success toast. The JSDoc on writeAnswerWarnings says so; it is the pre-existing shape of that arm, not a regression.

Implemented-by: claude/project-thread-nyjctk
Reviewed-by: session_01L9qibwSEecrzDjKjbk24r1

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1
2026-11-28T02:41Z

L1-a: ACCEPT at 40c5c821495c1c02e2a7a4a96244fd1bc0ab1870

  • Face: clean (l1-face.mjs): Fixes #37867 closes only this card, changeset entries for every published package touched, Clause-②: yes (widening) · Metadata-protocol: none. No dogfood battery is owed (no narrowing, no !).
  • Contract review: TIER_DEFAULT, PASS, in the record above at this head. Two nits, no change asked.
  • Card delivered whole: the action answer carries the data door's warnings, the console shows them on one warning-variant toast with Undo kept, and the runtime, runner and both host suites cover a write that trips a severity: 'warning' rule.
  • Design point: agreed. With the success toast off or a result dialog in its place, the warning still shows in the rule's own words.
  • No double toast: the action route goes over plain fetch, not the adapter's write path, so emitWriteWarning never fires for it.
  • CI at this head: every check-run completed green.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU

Landing · 2026-11-28T02:57Z · zone o3-ux (seat card thread)
Head-sha: 40c5c821495c1c02e2a7a4a96244fd1bc0ab1870

  • L1 ACCEPT 7232541526 at this head (L1-a). Contract review TIER_DEFAULT PASS 7232530062.
  • Claim 7231621693 (amendment 7232331687). Report 7232308070.
  • check-governed-merges.mjs --pr 38076: NOT governed, +442 / −9.
  • landing-k: by hand, git rev-list --first-parent --count $(git merge-base 40c5c821 origin/main)..origin/main = 13 < 15.
  • Checks at this head: 60 success, 12 skipped, 0 failed. mergeable_state clean.
  • Action: ready for review and auto-merge (queue).

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 28, 2026 02:57
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 28, 2026
Merged via the queue into main with commit 32dc5d8 Nov 28, 2026
73 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-nyjctk branch November 28, 2026 03:20
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.

A declarative update action drops validation warnings: Confirm Order over a framework quota shows only the success toast

2 participants