Input editor: Advanced section, variables panel, and a render check - #8
Open
timurbazhirov wants to merge 2 commits into
Open
Input editor: Advanced section, variables panel, and a render check#8timurbazhirov wants to merge 2 commits into
timurbazhirov wants to merge 2 commits into
Conversation
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
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.
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
Nextselector 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:
Deliberately narrow, because a false warning on a valid template is worse than a missed one:
{{ … }}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;{% set %},{% for %},{% macro %}) are not expected in the context;material.nameis never called missing merely becauseMaterialis a class;[, soinput.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 arenders 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 viavariableOriginOverrides.Not built: insertion at the cursor. Clicking a row copies
{{ path }}instead. cove'sCodeMirrorwrapper exposes no ref orEditorView, 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
src/utils/templateVariables.ts.Notes
dist/is rebuilt, as it is tracked in this repo.prettier --checkalready fails onsrc/components/ExecutionUnit.tsxonmain; left as-is rather than reformatting the file and burying the change.{{ … }}spans (Jinja and namelist tokens already highlight).