feat(cli): add --execution-timeout-seconds + --min-time-between-runs to template script (#54)

Expose TemplateScript.ExecutionTimeoutSeconds and MinTimeBetweenRuns (previously
settable only via Transport bundle import) on the CLI and Central UI authoring surfaces.

- Commons: add additive trailing optionals MinTimeBetweenRuns (TimeSpan?) and
  ExecutionTimeoutSeconds (int?) to Add/UpdateTemplateScriptCommand.
- ManagementActor: thread both new fields into the built TemplateScript on add/update.
- CLI template script add/update: new --min-time-between-runs (duration: ms/s/min,
  bare number = seconds, 0 = unset, mirroring DurationInput) and
  --execution-timeout-seconds (int) flags, with client-side duration validation.
- Central UI TemplateEdit: add an Execution timeout input (seconds) on the script
  trigger tab, mirroring the existing Min-time-between-runs control; null/0 = site default.
- Tests: TemplateScriptTimingTests pins the option surface + duration parsing; updated
  the stale 'no UI control' comment on the TemplateService round-trip test.
This commit is contained in:
Joseph Doherty
2026-06-19 03:14:10 -04:00
parent 5185486a3c
commit ae25b5a8d6
5 changed files with 162 additions and 18 deletions
@@ -505,14 +505,11 @@ public class TemplateServiceTests
[Fact]
public async Task UpdateScript_UiEditPath_PreservesExistingExecutionTimeoutSeconds()
{
// M2.5 (#9): ExecutionTimeoutSeconds has no authoring control in the UI.
// A UI-style update (proposed.ExecutionTimeoutSeconds == null) must NOT
// overwrite a timeout previously set via Transport import.
//
// The fix is in TemplateEdit.razor: it round-trips the loaded value, so
// proposed.ExecutionTimeoutSeconds will equal the existing value, not null.
// This test proves that when the round-trip is working, the service
// preserves the timeout end-to-end.
// #54: the UI now has an ExecutionTimeoutSeconds input, but it still loads
// (round-trips) the existing value into that input on edit, so leaving it
// untouched re-sends the same value rather than null. This test proves the
// service preserves the timeout end-to-end when the loaded value is re-sent
// — guarding the UI edit path against silently blanking a configured timeout.
var existing = new TemplateScript("OnStart", "return true;")
{
Id = 1,