Skip to content

feat(workflow): block publish on fixed-mode template + config-lockable arg mode#599

Merged
yogasw merged 3 commits into
masterfrom
feat/argmode-fixed-template-guard
Jun 7, 2026
Merged

feat(workflow): block publish on fixed-mode template + config-lockable arg mode#599
yogasw merged 3 commits into
masterfrom
feat/argmode-fixed-template-guard

Conversation

@yogasw
Copy link
Copy Markdown
Owner

@yogasw yogasw commented Jun 7, 2026

What

Two related arg_modes improvements for the workflow editor.

1. Fixed-mode + {{...}} blocks publish

A field pinned to mode=fixed whose value contains a Go template silently never renders — it ships a broken URL / body / prompt to production. parse.Validate now emits this as an Error (was a Warning), so it gates publish across every path that promotes a draft:

  • UI Publish button (auto-disabled via validationErrorCount)
  • MCP workflow_publish (service.Publishparse.Validate)
  • internal publish helpers

Draft SaveDraft does not run Validate, so editing is never blocked. The editor also auto-switches a fixed field to expression the moment you type {{, so the common case never trips the gate.

2. New wick:"mode=fixed|expression" config tag

Schema-driven connector / channel op args (e.g. push_id, title, body) now render the Fixed ⇄ Expression toggle on every field kind (default fixed). A mode= tag greys the toggle out and locks it to that mode; the chosen mode still persists to arg_modes.

Tag UI
(none) toggle enabled, defaults to fixed
mode=fixed toggle greyed, locked fixed
mode=expression toggle greyed, locked expression

How

  • entity.Config.Mode reflected from the mode= tag (normalizeMode accepts only fixed/expression), exposed in args_schema.
  • SchemaForm / Field / ArgField honor mode + lockedMode; toggle now renders for all kinds (checkbox swaps to a text input in expression mode).
  • parse.validateArgModes returns Errors instead of Warnings.

Behavior

Action fixed + {{}}
Edit / SaveDraft allowed; typing {{ auto-flips to expression
Publish (UI) disabled — red node pin + validation chip
MCP workflow_publish blocked — validation error

Tests

  • Go: pkg/entity (mode tag), parse (argmodes block/allow), connectors, tools/agents — all green.
  • FE: npm run check (tsc + vite build) passes.

Notes

Pre-existing, out of scope: engine treats an absent arg_modes key as expression while the UI defaults to fixed; arg_modes is only written on toggle click. Same as every existing node field (url/body/prompt) — not a regression here. Can auto-seed arg_modes[key]="fixed" on first value change as a follow-up if desired.

yogasw added 3 commits June 7, 2026 16:35
…e arg mode

Two related arg_modes improvements for the workflow editor:

1. Fixed-mode + {{...}} now blocks publish. A field pinned to mode=fixed
   whose value contains a Go template silently never renders, shipping a
   broken URL/body/prompt. parse.Validate now emits this as an Error
   (was a Warning), so it gates publish across every path -- UI form, MCP
   workflow_publish, and helpers -- while draft SaveDraft (no Validate)
   stays editable. The editor also auto-switches a fixed field to
   expression the moment you type {{, so the common case never trips it.

2. New wick:"mode=fixed|expression" config tag. Schema-driven connector
   and channel op args now render the Fixed/Expression toggle on every
   field kind (default fixed). A mode= tag greys the toggle out and locks
   it to that mode; the chosen mode still persists to arg_modes.

Surfaces it end to end: entity.Config.Mode reflected from the tag,
exposed in args_schema, honored by SchemaForm/Field/ArgField.
Document the publish-blocker for fixed-mode fields with {{...}} templates,
the auto-switch-to-expression UX on canvas, and the new wick:"mode=fixed|expression"
config tag that locks the Fixed/Expression toggle in the workflow inspector.
@yogasw yogasw merged commit ba4ddf6 into master Jun 7, 2026
1 check passed
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.

1 participant