Repository navigation
feat(platform): check automations for problems as you edit them - #4521
Conversation
Every template, condition and transform body is now parsed (acorn, with periscopic scopes) through one enumeration of a document's expressions, which feeds the executors' ordering, the canvas edges, scope pruning and every validation rule. - A template ends at the "}}" that closes its expression, so "}}" inside a string, an object literal or an arrow body stays inside; every template that compiled before tokenizes identically (property-tested). - A node named in a comment, a string or through a shadowing local is no reference, edge or finding. - An agent's files mapping is data: it orders the run, skips the agent when its source is skipped, and is validated like the prompt. - Every issue carries at (an RFC 6901 pointer, the range in the string and its subject) and params named in the new CODE_META catalog; messages and hints are byte-identical. New warning: TEMPLATE_UNTERMINATED. - Syntax: acorn locates, the runner confirms a rejection; without a runner the parser's verdict stands. - The task run dialog loads its body on first open, so the parser stays out of the task pages; the entry budget forbids it in the preload set.
The analyzer gains two browser-safe layers the validation rules will read: what every value of a document holds, and which nodes run on every way a run can go. Nothing is reported from them yet. - Shapes are a JSON Schema subset: lookups that tell a missing field of an exact object from an undeclared one, unions, nullability, a definite incompatibility check and a TypeScript rendering. - Inputs, llm output schemas and connector output signatures become shapes; a guard test reads every signature the connector catalog ships. - Expressions are typed from the parsed code (members, literals, operators, common methods and globals), and every node's output is inferred in run order: transform return literals, llm schemas, the agent envelope, connector signatures, and child automations resolved like a run resolves them. - The flow model replays the executors' skip rules over every assignment of the when and tolerated-failure atoms, with reach, skip and root-cause facts; past 12 free atoms it falls back to the document's structure. A seeded parity test runs 200 generated documents through the executor for every assignment and matches each trace. - The subautomation reference parser and nesting limit now live in one browser-safe module that validation and the executor import.
Validation gains a fifth pass that types every value and walks every way
a run can go, so problems a run would hit surface before it starts.
- Warnings: fields the data cannot have, values of the wrong kind for a
connector, a called automation or forEach, optional values inside
text, unknown names, reads of nodes that may be skipped (or whose
tolerated failure resurfaces) in conditions and the output, nodes that
can never run, outputs that may be empty, constant conditions and
static loops, subautomation and test inputs, test effects and output
kinds, and a schedule trigger the inputs schema refuses.
- Errors, for runs that certainly fail at the node: forEach that is not
one list-valued template, an agent that iterates, and item/index where
nothing declares them (ITEM_WITHOUT_FOREACH is now an error in
templates, a warning in code).
- A subautomation is checked as the version a run calls (pinned, else
deployed, else latest), fetched once per validation.
- validate(doc, { detail }) also returns the per-node summary, the
possible paths and the types.
- Every shipped document validates without errors; its warnings are a
reviewed snapshot, and the flow model predicts the shipped tests' runs.
Each engine issue code now has a title, an explanation, a cause and a fix in the new automationIssues topic (en, de, fr, and Swiss German where the German spells ß or „…“), rendered by issueText from the issue's params: node ids read as the canvas names them, fields as the inspector labels them, lists as one quoted, locale-formatted list of at most six. A code the build does not know still reads as words. - The topic is its own file so the project page and the task dialog, which read automations, do not carry 27 KB of issue text. - A guard keeps one entry per code, no leftovers, and every sentence reading only its code's params, never a technical one. - The inspector gains labels for maxRepeats, onError, output, type, id and modelProvider. - SECRET_IN_DOCUMENT's kind is marked technical: it is English.
validate_automation now answers the per-node analysis and the inferred types beside its issues (a host can ask for less with detail; the MCP door always gets both), save_automation answers the warnings the saved version keeps and names them beside the errors when it refuses, and get_catalog gives each capability its output signature as a JSON Schema (outputSchema). get_docs gains a section on reading a validation result: an issue's at, params and related, the analysis, the types, and the guard idioms for reads of nodes that may be skipped.
The MCP endpoint page gains "Read a validation result": the fields of an issue, the analysis and the types, and that warnings never refuse a save. The automation concepts page gains "What Tale checks before a run", one subsection per family of checks (references, types, skipped and failed nodes, unreachable nodes, conditions and loops, iteration, called automations, tests), in en, de and fr.
The editor's Problems surface needs reusable parts, so @tale/ui gains them without any business logic: - IssueList and IssueDetail: a list of problems in the reader's words. With onActivate it is one tab stop (arrows, Home, End, Enter, Space); a row it cannot go to stays reachable and says why on the row. - IssueCountButton, IssueAnnouncer and formatIssueCounts: counts in words, and one polite announcement per settled check. - IssueSeverityIcon: one glyph and colour per severity, never colour alone. - FlowNodeIssueMarker with its frame class and accessible text. - Field issues and FieldIssueMessages: lines that describe the control, never alert, and mark it invalid only for an error. - IssueFocusProvider: go to a field by anchor, wait for it to mount, select the range and open what hides it. - EditorController.invalidReason: Save says why it is off, inline in a sheet. Strings live in a new issues namespace in en, de and fr.
Three component guides with live examples: listing problems and going to them (with the count button and announcer), marking flow nodes, and showing a field's problems with focus that selects the offending text and a Save that says why it is off. The manual register names the specs that own their behaviour.
ResponsiveDialogContent gains preventCloseAutoFocus, mirroring Dialog: a close that hands the reader on to another panel (a "go to" that opens a node's sheet and focuses a field there) must not pull focus back to the opener. The dialog guide names the prop on both.
The editor checks the document on screen as the author edits it, through an author-gated POST /api/app/automations/:name/validate that writes nothing: a draft a moment after the last keystroke, a stored version at once, cached by the document's hash. - The Problems button counts errors and warnings beside Save; the list opens under the canvas from lg up and in a sheet below, filters by level, and goes to a problem: the node opens, the field takes focus and the offending text is selected. - Node boxes carry their counts, fields their messages (descriptions, never alerts), and problems without a field of their own list at the top of the node's fields. - Save waits while errors stand and says why (a visible line on a phone); a failed check blocks nothing. - A save or deploy refused for errors lands in Problems on its first error, without a toast: refusals now nest their errors and warnings under data, where the app's fetch layer keeps them. automationErrorMessage no longer falls back to an error's raw message. Spec cards AUTO-R16 to AUTO-R18, manual boxes AUTO-F57 to F62, B12, B13 and A6 to A8, and a screenshot manifest entry for the panel.
The workflow editor page gains "Find and fix problems" in en, de and fr: the Problems button and its counts, the list under the canvas or in a panel, go to, field messages, Save waiting with its reason, warnings that never block, a failed check that still lets you save, and refusals that land in the list. The model picker's warning now names where it shows.
Design polish of the issue surfaces, measured in Chromium from the shipped CSS (light and dark; the page, a card, bg-muted and a row's hover/current fill): - The warning glyph is amber-700 in the light theme. amber-600 measured 2.91:1 on bg-muted and 2.99:1 on a row's fill, under the 3:1 a glyph needs when it alone tells a warning from an error by sight; amber-700 holds 4.58:1 to 5.03:1. Dark keeps amber-500 (7.09:1 to 9.27:1). - Chip and frame colours are shared constants (ISSUE_SEVERITY_CHIP_CLASS, ISSUE_SEVERITY_FRAME_CLASS). Chip text measures 4.98:1 to 6.32:1 light and 4.73:1 to 10.9:1 dark; frames 3.12:1 or more against the page and a card. A browser test now measures them, because axe gives up on a one-digit chip. - IssueList is a size container: under 32rem a row's code drops under its location (at 375px it squeezed a German title into about 100px), Go to is left out there, and every row is at least 36px tall. - IssueCountButton keeps its width while a check runs: the spinner takes the first count's glyph instead of adding "Checking…", so a check at every pause in typing no longer shifts the toolbar. With no counts it shows "Checking…" and its name no longer claims "No problems". The French label shortens to "Vérification…" to match "Aucun problème". - Field draws the design's Error state, the destructive border, on its control whenever it marks it invalid: an error among its issues, and its own error prop too (the cron, run-input and PII-pattern fields). - The count pop, chips and list fades run on the duration and out-quint ease tokens. The guides and the manual register say the same.
Design polish of the editor's Problems surfaces, checked through screenshots of the workbench in Chromium (en, de and fr; light and dark; 1280px with the dock, 900px dialog, 375px and 640x400 drawer, the phone node sheet): - The Problems sheet lays out one column with its own spacing. The tablet's dialog stacked its own gap on the filter's padding (28px against the phone's 12px), and the list overhung the filter by 4px. - The sheet's list and the inspector's "Problems in this node" sit in a Card instead of a hand-rolled bordered div. - The unpinned-model glyph on a node box takes the shared warning colour. - The editor's browser test runs axe's contrast check on the dock and the inspector, with an error and a warning, in light and dark. No page scrolls sideways at 375px or at 200 % zoom; the inline Save reason shows in the phone's node sheet.
Soundness fixes from the review of the static analysis, each held by a
test that runs the document as well as validating it:
- A `?.` read of a node that may be skipped, placed whole inside text
("Summary: {{ nodes.x.output?.summary }}"), gets MAYBE_NULL: the `?.`
gives undefined and text refuses it, so the run fails. The hint keeps
the path (nodes.x.output?.summary ?? '').
- A computed member the walk cannot name (nodes.x.output[input.k]) and a
member after parentheses that end the optional chain
((nodes.x.output?.a).b) are read as dereferences.
- An elseOf branch no longer blames its partner's failure: the branch is
skipped whenever the partner's when holds, so UNCAUGHT_FAILURE's
"drop onError: continue" was no fix. It is MAYBE_NULL with partner.
- The parser speaks ES2024, the language of the runtime's Node 22, not
acorn's newest: regular-expression modifiers, duplicate named groups
and `using` are EXPR_SYNTAX/CODE_SYNTAX again instead of failing the
run. A test ties the version to the Dockerfile's Node.
- OUTPUT_MAYBE_EMPTY leaves out reads that fail the run (they do not
empty it), and no flow finding assumes a when that does not parse can
skip its node (golden expr-syntax-when loses its warning).
- The corpus test installs each pack's triggers: the two GitHub packs
now record TRIGGER_INPUT_MISMATCH, the shipped defect of their
schedules, instead of certifying them clean.
Review fixes on the issue surfaces: - IssueCountButton with no problems no longer changes width at every pause in typing: "No problems" and "Checking…" share one grid cell, the idle one invisible, and only the glyph swaps. A browser test measures the width in en, de and fr. - IssueList with no rows says "Checking…" with a spinner while a check runs, instead of "No problems" beside a count button that claims nothing yet. - "Technical details" and "Learn more" are 24px targets that no longer overlap. - EditorActions keeps ⌘S/Ctrl+S from opening the browser's "Save page as" while the edits cannot be saved, and focuses Save so its reason shows (an inline reason already stands). - Field's own error line uses the destructive token like the issue lines under it: one red, and AA contrast in the dark theme.
- The states demo lists the one error and two warnings its count button shows. - The count button shows coloured icons beside plain counts, Go to sits under the code, and the button's width now holds as the guide says. - The announcer is keyed by a changed result, not by every finished check. - A dialog that closes on a chosen problem keeps focus on the field through preventCloseAutoFocus; onCloseAutoFocus runs after focus has already gone back to the opener.
Editor review fixes, each held by a test that fails without it:
- Opening Problems and every refused save or deploy start on All. A
filter left on Warnings hid the errors a refusal pointed at, and the
tablet sheet reopened on an empty list with focus left behind it.
- The sheet hands focus to the dialog when no row is on show.
- A draft's check is announced only when its counts change; the same
result at every pause in typing is no longer read out again.
- A refused deploy is said once: the alert names it, the announcer only
counts. With a draft on screen the alert is a localized sentence, not
the server's English.
- On a phone, "Show problems" beside the Save reason in the node sheet
closes the node and opens the list on its first error.
- A check that hangs fails after 15 seconds, so Save never waits on it.
- Types read as words in en, de and fr ("needs text, but … is a number
or null"), and a field line no longer repeats a key the sentence
names. An unknown issue code keeps the engine's English in Technical
details only.
- While a check runs with nothing found yet, the dock header and the
sheet say "Checking…" like the button.
- The unpinned-model note is a muted PinOff glyph, no second amber
triangle; the sheet title is semibold and "Problems in this node" is
an h4 at the size of its rows.
- MAYBE_NULL's explanation says placing a skipped node in text fails.
- Only a read in input, prompt, system, files, code or forEach skips a node; a read in when or repeatUntil runs the condition against null. The concepts page (en, de, fr) and get_docs said every read skips. - A skipped node's value placed inside text fails the run even through `?.`, which the concepts page and get_docs now say. - The Problems button shows coloured icons beside its counts, and on a phone it sits in the canvas toolbar; "Show problems" beside the Save reason in a node's sheet opens the list.
The release lane refused promotion on any warning the native import answered. The static analysis now reports warnings about a workflow's own logic (MAYBE_NULL, UNREACHABLE, TYPE_MISMATCH and 14 more), so a client release that deployed before would save its version and then be refused, although the editor and MCP promise that warnings never block deploying. Those analysis codes are advisory now: the deployment proceeds and the result lists them under importWarnings. Every other warning, one without a code included (SKILL_NOT_FOUND, LLM_MODEL_UNAVAILABLE, …), still stops the release as before. The config-releases guide (en, de, fr) says so.
The run-robustness branch (#4516) holds AUTO-R16–R22, AUTO-F58–F61, AUTO-B13–B14 and AUTO-A6, and the navigation fix (#4514) AUTO-F57 and AUTO-B12. This branch's cards and boxes move clear of both, so the three merge in any order: spec cards AUTO-R23–R25 (and the test titles that name them), boxes AUTO-F62–F67, AUTO-B15–B16 and AUTO-A7–A9. New boxes: AUTO-F68 goes from a phone's node sheet to the problems that hold Save, AUTO-A10 presses ⌘S with errors. The Problems register row names the review's fixes and their tests; the analysis rows no longer say the editor surface is not built.
authoringRefusal replaced a refusal's `data` with the detail keys it nests there (errors, warnings, hint, report) whenever one was present, so a host refusal that carried both a hint and data (a refused run input's schema problems, say) would lose its data. It now merges them. The authoring test also pins the top-level errors, warnings and hint that older readers of the door still read.
lib/mcp/tools.ts read the method names from lib/engine/api/dispatch.ts, which imports the whole engine: the Settings MCP page statically loaded the expression parser chunk (39.6 KB gzipped), the analysis and the schema validator to show a list of tool names. The names now live in a leaf, lib/engine/api/methods.ts, which dispatch re-exports. The purity test follows the inventory's imports and refuses acorn, ajv, yaml or periscopic among them.
The MCP authoring tools answer more than they did: validate_automation gives `analysis` and `types`, every issue `at`, `params` and `related`, save_automation its `warnings`, get_catalog each capability's `outputSchema`, and the analysis adds warning codes. Additive tool changes take a minor bump; 3.18.0 belongs to the run-robustness branch, so this one is 3.19.0. No REST operation changes.
The blank-automation wizard built its one-agent document inline, so the shipped-document corpus could not check what it saves. The scaffold is lib/automations/blank-document.ts now; the dialog calls it, and the corpus validates it bare and with every kind of equipment (no error, no warning).
The CLI bundles the engine's validate for configuration releases; the engine now parses with acorn, periscopic, zimmerframe and is-reference, so the CLI declares them with the platform's exact pins and its own install resolves them.
|
FINDINGS — independent API-only post-merge review of #4521 Repository: github.com/tale-project/tale. Base: 58cf146. Reviewed head: fe5d256. Merge: 7d212da.
These are source-derived findings, not claimed runtime reproductions. Fleet owns repair/revert routing; this comment authorizes no release or deployment.
Task TALE-1217 / 9fcfaa34-98fe-4fec-b1ee-9710d5b9ef3f artifacts: review.md, coverage.json, source.json (immutable ref-bound source and exact 404 gaps), files.json (both pages/all 196 files), complete.diff (complete changed-line patches), ci.json and evidence-receipt.json. |
What changes
Automations are checked for problems while you edit, with the same analyzer on save, deploy, the editor and MCP — and every problem says, in your language, what is wrong, why, with the actual values, and how to fix it.
One parser instead of regexes. Every
{{ }}template, condition and transform body is read with acorn (CSP-safe, noeval): one list of expressions feeds the run order of both executors, the canvas edges and every check. Comments, strings and local variables no longer raise false "unknown node" errors that blocked saves; a}}inside a string or object literal no longer ends a template early; an agent'sfilesfield now orders the run and is validated like its prompt. Templates that worked before produce exactly the same span.Types between steps. Each node's output gets a shape — from
inputs, anllm'soutputSchema, the 122 connector output signatures (all parsed, guarded), a transform's returned object literal, or a subautomation's own output (≤3 levels). References are checked against them (unknown field with "did you mean", type mismatch into connector inputs /forEach/ subautomation inputs).Flow analysis. One simulation of the executor's skip rules (parity-tested) gives each node
reachable,maySkipwith reasons,mayFail,failureHandling, and the list of possible paths. New checks: a value of a step that may be skipped or may have failed withonError: continueread without a fallback (MAYBE_NULL, uncaught failure paths), unreachable and unused steps, aforEachover a non-list,itemoutside an iteration, an agent asked to iterate, a trigger whose input the automation's inputs refuse, typed tests. Only certain runtime failures are errors (FOREACH_NOT_ARRAY,AGENT_ITERATION_UNSUPPORTED,ITEM_OUT_OF_SCOPE,ITEM_WITHOUT_FOREACHin templates); everything else warns, and a corpus test proves every shipped automation still saves and deploys.Every issue is located and explained. Issues carry a JSON-pointer location with a character range and structured
params; each of the 61 codes has a localized title, explanation, cause (with the concrete values) and fix in EN/DE/FR (+ de-CH), guarded so a new code can't ship untranslated. The English engine text stays the MCP/public message.In the editor. A Problems panel (dock on desktop, sheet on a phone) with counts, filters, "Go to" jumps to the node and field; markers on canvas nodes; errors under the field that has them; Save disabled with its reason while errors exist; drafts checked 400 ms after you stop typing through a new author-only
POST …/validateroute; a refused save or deploy now lists its issues instead of one generic sentence. Reusable pieces live in@tale/uiwith guides and demos:IssueList/IssueDetail,IssueCountButton/IssueAnnouncer,FlowNodeIssueMarker, and anissuesprop onField.Over MCP.
validate_automationaddsanalysisandtypes, save returns its warnings,get_cataloggains output schemas, so a coding agent can correct itself. Contract 3.19.0 (no REST operation changes). The CLI's configuration releases treat the 17 new analysis warnings as advisory.Spec rules
AUTO-R23–R25; docs EN/DE/FR (concepts, editor, MCP endpoint, config releases); manual boxesAUTO-F62–F68,AUTO-B15–B16,AUTO-A7–A10.Verification
@tale/uiissue components 50 browser + 418 unit.nodes.scroeinto a transform's code marks the field ("nodes.scroe names a node that doesn't exist"), rings the node red, counts 1 error and disables Save; the Problems panel offers "Did you mean "score"?" — in German "So behebst du es: Meintest du „score"?".backend:integrationon fresh Postgres, lanescheckAutomations,…DeadSchemaDropped,…ProjectVisibility,checkAutomationRunLifecycle,…TriggerDelivery,checkManagedAutomationConfiguration,checkTriggerPauseAfterFailures,checkMcp,checkRestDoor,checkRestMachineJourney,checkApprovalDecisionResume,checkAskAnswer: all checks pass (97 + 37).checkRestResourcesalone stops on a missingknowledge/embedding.jsonin a filtered run — identical onmain(58cf146), so an artefact of running it without the lane that writes that file; CI runs the full harness.Notes for review
nodesvariables).TRIGGER_INPUT_MISMATCH) and P4 fixes the packs.