Repository navigation
feat(sdk) Variable enhancement - #76
Conversation
Validation: a variable reference in a nested property no longer leaves type, format or pattern errors; blank text is read as missing in nested objects too; the date, datetime and time validator reports values that are not dates or clocks; property names are matched as text, never as a regex; message matching is limited to the properties and required keywords, so a format "email" error is not read as the email property. Variables: the common-suggestion placeholder is anchored on the nodes.<id>. prefix; VariableDynamic offers the compatible types from one map and renders the picker toggle for string fields; the toggle keeps the typed value; chips carry the numbered label of same-name ancestors; a variant rule accepts a boolean value; VariableText keys with a counter instead of crypto.randomUUID(), which needs a secure context. Editor: the conditions editor is read-only when the editor is; an edge label edit is one undo step per focus session. Worker: isEqual and isNotEqual compare clocks like isBefore and isAfter. Docs: variablesTypes, the global namespace, where the picker is wired, the read-only settings modal, JSDoc for useNodeVariables, the changeset and the validation decision log.
|
Review follow-up: pushed Validation
Variables
Editor / worker
Docs
Tests: 18 new cases (validator, store placeholder, ancestors display, Left out on purpose (design decisions, tracked separately): backend mapping of |
# Conflicts: # DECISION-LOGS.md # apps/ai-studio/README.md # packages/mcp-server/scripts/smoke.ts
compareClocks returned false for both sides when a value started with
HH:mm but was not a clock ("10:30 standup"), so isEqual on such text
took the wrong branch. It now falls back to the plain comparison.
The docs sidebar gets the "Variables" entry that the new @category tag
on useNodeVariables requires; the sidebar parity check failed without it.
|
Follow-up on the two points raised against
|
…ped inputs DynamicTypedInput and DynamicTypedVariableOrInput no longer filter the suggestions they receive; the prop is now suggestionGroupsForType and the caller passes a list already narrowed to the field type. VariableDynamic gets that list from useNodeVariables(includeTypes), the conditions row narrows to the left operand's type itself. Removes the compatibleTypes prop and the double filtering.
The MessageOnError entry moved from #/properties/missingPreviousVariable to #/properties/customError; a 3.0 app whose custom errors use the old instancePath loses its panel message. Own major changeset with the migration step, and a section in the 4.0 upgrade guide.
The time picker saved HH:mm:00+00:00 only to pass JSON Schema format: 'time'; the suffix meant nothing. The value is now the bare clock, and node schemas declare picker-bound properties as type: 'date' / 'datetime' / 'time', which the SDK validator now checks inside nested objects as well (the demo trigger keeps them under timeSchedule). The worker compared date and datetime through new Date(text), so a set value against an upstream instant depended on the worker's zone. compareDateTime in execution-core reads a zone-less value from its digits with Date.UTC (the workflow zone, UTC for now), compares a bare time by clock and a bare date by day, and is covered under TZ=Europe/Warsaw because CI runs in UTC.
… the field's type
…variable
A VariableDynamic field whose stored reference no longer matches any
variable the node can reach fell back to a plain input showing the raw
{{nodes...}} text. It now stays in the picker, which labels the
reference "Missing variable" or "Missing node"; the pencil button
switches back to typing a value.
14ef41e to
3b4061a
Compare
Workflow Builder introduced variable support some time ago, allowing sidebar controls to use variables from previous nodes or global variables.
This PR enhances the feature with the missing logic to make variable usage more robust and flexible.
Main changes
Variables provided by nodes to downstream nodes can now depend on:
Nagranie.z.ekranu.2026-08-14.o.18.32.10.mov
Node variables store:
Previously, variables from previous nodes were calculated when the control was mounted. We traversed the graph and calculated their values at the same time - now we keep nodes variables in the store and only collect them:
New single variable control (previously used in conditions)
Nagranie.z.ekranu.2026-08-14.o.18.28.48.mov
It shows a date picker with
{}when date variables are available.Fixes
totalVariablesIt's worth noting that the majority of the changes are encapsulated in
packages/sdk/src/features/variables/. So while reviewing, we can identify what is used externally as a useful public API and note the core functions that could be valuable to expose.