feat: add configurable preview job tag override in default tags settings

Merged
RU
8mo ago
+120-36

Summary

Add a new toggle in the "Default tags" superadmin settings that routes all preview jobs (script previews and flow previews) to a dedicated preview tag instead of their normal language-based tag.

Changes

  • Add preview_tags_override global setting (constant, static, load/hot-reload, instance config)
  • Add JobKind::is_preview() helper method
  • Override tag resolution in push_inner to use "preview" tag when setting is enabled
  • Override re-tagging path for FlowPreview jobs pulled by workers
  • Add toggle and preview tag row in the DefaultTagsInner.svelte UI component
  • Respects per-workspace suffix (preview-{workspace_id}) when both settings are enabled
  • User-provided explicit tags are never overridden

Test plan

  • Navigate to superadmin settings > Workers page > Manage tags drawer. Enable the "route preview jobs to dedicated preview tag" toggle and save. Verify a "preview" row appears in the tag list
  • Run a script preview and check the job's tag is "preview" (not the language tag)
  • Run a flow preview and check the job's tag is "preview" (not "flow")
  • Enable both "workspace specific" and "preview override" toggles — verify preview jobs get tag "preview-{workspace_id}"
  • Disable the toggle — verify preview jobs return to their normal language-based tags

Generated with Claude Code


Summary by cubic

Add a new superadmin toggle to route all preview jobs (script and flow) to a dedicated preview tag, so you can isolate preview traffic to specific workers. Supports per‑workspace suffix and hot‑reloads on change.

  • New Features
    • Global setting preview_tags_override (dynamic load/hot‑reload).
    • When enabled, preview jobs use preview instead of language/flow tags.
    • Respects per‑workspace tags: preview-{workspace_id} when that setting is on.
    • User‑provided explicit tags are never overridden.
    • UI: toggle in Superadmin → Workers → Default tags, plus a “preview” mapping row.
    • Backend: added JobKind::is_preview(), updated push/pull paths to apply the preview tag, and skip re‑tagging for FlowPreview when the override is on.