fix(automation): flow string templates serialize object tokens readably, never [object Object] (#3450)#3470
Open
os-zhuang wants to merge 1 commit into
Open
fix(automation): flow string templates serialize object tokens readably, never [object Object] (#3450)#3470os-zhuang wants to merge 1 commit into
[object Object] (#3450)#3470os-zhuang wants to merge 1 commit into
Conversation
…ly, never [object Object] (#3450) A flow string field embedding an object-valued token — notably the engine's `$error` ({nodeId, message, ...}) in a fault handler's notify body — rendered as [object Object]: interpolateString's multi-token branch and notify-node both coerced via String(). - New shared stringifyForTemplate helper (builtin/template.ts): objects/arrays JSON-serialized (legible, still carries the message), primitives pass through, null/undefined → ''. - interpolateString embedded branch + notify-node title/body use it. Sole-token branch still returns the raw value (typed fields keep their type); {$error.message} still resolves to the message string. Split from #3425 (readonly-strip half shipped in #3465). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
📓 Docs Drift CheckThis PR changes 1 package(s): 6 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Closes #3450 (split from #3425; the readonly-strip half shipped in #3465).
A flow string field that embeds an object-valued token rendered as the useless
[object Object]. The most common trigger is a fault handler surfacing the engine's$error— set as an object{nodeId, message, output}(engine.ts:2585) — in anotifybody (message: 'Conversion failed: {$error}'), or any node writing an object token into a string field.Two coercion sites produced it:
interpolateString's multi-token branch didString(value)(builtin/template.ts).notify-nodedidString(interpolate(...))for title/body — a sole{$error}token resolves to the raw object, thenString()→[object Object].Fix
stringifyForTemplate(value)helper: objects/arrays →JSON.stringify(legible, still carries the message), primitives →String,null/undefined→''.interpolateString's embedded branch andnotify-node's title/body.fields: { count: '{n}' }stays a number), and{$error.message}still resolves to just the message string — the documented cleanest author form.Notes on scope
The originally-reported 16.1.0 symptom (a failed
create_record's own error as[object Object]) is already fixed on main —crud-nodesreturns(err as Error).message, and both objectui runs surfaces render readably (FlowRunsPanelvia a.messagehelper,FlowRunsPageviaJSON.stringify). This PR closes the remaining, demonstrable platform path: object tokens in flow string templates.Verification
template-object-token.test.ts(7 cases): embedded$error→ readable JSON (asserts not[object Object], contains the message);{$error.message}→ message string; sole token preserves the raw object; primitives unchanged; circular object doesn't throw.String()fails exactly the embedded-object test.@objectstack/service-automationsuite green (354 tests, incl. notify-node).🤖 Generated with Claude Code