Skip to content

Input editor: Advanced section, variables panel, and a render check - #8

Open
timurbazhirov wants to merge 2 commits into
mainfrom
claude/execution-unit-advanced-section
Open

Input editor: Advanced section, variables panel, and a render check#8
timurbazhirov wants to merge 2 commits into
mainfrom
claude/execution-unit-advanced-section

Conversation

@timurbazhirov

@timurbazhirov timurbazhirov commented Aug 17, 2026

Copy link
Copy Markdown
Member

Three changes to the execution-unit editor, from the SOF-8024 UX review (portion 4, items 1.3–1.5).

1. Execution order moves to Advanced

Opening a unit to edit its input file showed, first, a pointer to another unit: the Next selector sat above the Details and Input accordions, so the editor people open the dialog for started below the fold. It keeps its place in the form, at the end and collapsed, beside the accordions it now matches. The dialog opens on the template.

2. A render check that catches what nunjucks hides

The plan assumed the preview "silently renders {{ }} through". It is worse: templates go through nunjucks, which substitutes an unknown variable with the empty string. A typo does not fail and leaves nothing behind to notice — it drops a value out of the input file a simulation then runs with.

Unresolved variables are now named directly above the template, with line numbers and a nearest-name suggestion where one is close enough to be help rather than noise:

⚠ line 21: cutoffs.wavefunctionn — did you mean cutoffs.wavefunction?

Deliberately narrow, because a false warning on a valid template is worse than a missed one:

  • only {{ … }} output is checked, never {% if … %} conditions — testing whether an optional value is present is idiomatic, and these templates open with {% if subworkflowContext.MATERIAL_INDEX %};
  • {% raw %} bodies are skipped so job-runtime placeholders like {{ JOB_WORK_DIR }} are not reported as defects — blanked in place, so line numbers after them do not shift;
  • names the template binds itself ({% set %}, {% for %}, {% macro %}) are not expected in the context;
  • resolution stops at anything that is not plain data, so material.name is never called missing merely because Material is a class;
  • a dotted path stops at [, so input.perMaterial[subworkflowContext.MATERIAL_INDEX] contributes the container and the index separately.

3. A variables panel instead of a JSON dump

The side drawer showed the whole rendering context as a <pre> of JSON, in whatever shape it happened to be stored in. It now lists what a template can write, grouped by where each value came from — Important settings, From the material, Set at job runtime — with the current value beside each path, a search box, and a renders with: <material> · <application> line.

The grouping is not guesswork: wode builds the context as { ...providerName → data, ...externalContext } (ExecutionUnit.saveRenderingContext), so anything outside the external-context table came from a context provider — which is what the Settings tab edits. Hosts can correct or extend the labels via variableOriginOverrides.

Not built: insertion at the cursor. Clicking a row copies {{ path }} instead. cove's CodeMirror wrapper exposes no ref or EditorView, so there is nowhere to insert; appending to the end of the template would be worse than copying. An upstream cove change would be needed.

Warnings are reported in one place — above the template — not repeated in the panel.

Verified

  • All 40 tests pass, covering the parsing and resolution rules in src/utils/templateVariables.ts.
  • Run over every standata template — 184 across 55 workflows — with zero warnings raised, which is the result that matters: the check does not cry wolf on real templates.
  • Then against injected typos in a leaf, a root, a wrong provider, and an entirely absent name — each caught on the right line, with a suggestion only where one was genuinely close.
  • Exercised in the workflow-designer standalone demo against this build: panel groups correctly, search narrows, and typing a typo raises the warning live.

Notes

  • dist/ is rebuilt, as it is tracked in this repo.
  • prettier --check already fails on src/components/ExecutionUnit.tsx on main; left as-is rather than reformatting the file and burying the change.
  • Still open in portion 4: the full-height editor layout, and distinct colouring for {{ … }} spans (Jinja and namelist tokens already highlight).

Opening a unit to edit its input file showed, first, a pointer to another unit. `Next`
is a wiring detail — it says which unit runs after this one — and it sat above the
Details and Input accordions, so the editor everyone opens the dialog for started below
the fold.

It keeps its place in the form, at the end and collapsed, beside the Details and Input
accordions it now matches. The dialog opens on the input template.

`dist/` is rebuilt to match, as it is tracked here.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FFFpkKD3zHysJXgAbT2uYV
…ender empty

Templates render through nunjucks, which substitutes an unknown variable with the empty
string. A typo does not fail, and does not even leave `{{ }}` behind in the preview — it
quietly drops a value out of the input file the simulation then runs with. The only view
of the context was a `<pre>` of the whole thing as JSON, in whatever shape it happened
to be stored in.

The side drawer now lists what a template can write, grouped by where each value came
from — Important settings, from the material, set at job runtime — with the current
value beside it and a search box; clicking a row copies `{{ path }}`. Inserting at the
cursor needs the editor's EditorView, which cove's CodeMirror wrapper does not expose,
so copying is what this can honestly offer. Grouping is not guesswork: wode builds the
context as `{ ...providerName → data, ...externalContext }`, so anything outside the
external-context table came from a context provider.

Unresolved variables are reported above the template, with line numbers and a nearest-
name suggestion where one is close enough to be help rather than noise. Only `{{ … }}`
output is checked, never `{% if … %}` conditions — testing whether an optional value is
present is idiomatic, and these templates open by doing it. `{% raw %}` bodies are
skipped so job-runtime placeholders are not reported as defects, without shifting the
line numbers of anything after them.

Checked against every standata template — 184 of them, across 55 workflows — with zero
warnings raised, then against injected typos in a leaf, a root, a wrong provider and an
absent name, each caught on the right line.

Part of SOF-8024 portion 4, items 1.3 and 1.4.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FFFpkKD3zHysJXgAbT2uYV
@timurbazhirov timurbazhirov changed the title Move execution order into an Advanced section Input editor: Advanced section, variables panel, and a render check Aug 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants