mirror of
https://github.com/okieselbach/AutopilotMonitor.git
synced 2026-10-24 20:53:06 +00:00
c2c02b929c
The form offered trigger, phase scope and emit mode unconditionally, which produced combinations that cannot do anything plus one silently wrong state: - A scope on a Phase Start / Phase End rule that names a concrete phase can only ever suppress the single firing — the phase IS the moment. Same for emit mode: a one-shot has no second result to dedup against. - Selecting "From a phase onwards" (or "Only during specific phases") and not filling the detail dropdown serialised to null, i.e. the rule ran everywhere while the form still read "From a phase onwards". supportsPhaseScope / supportsEmitMode now drive visibility; buildScopeFields nulls hidden-control state so a value from an earlier trigger choice cannot leak into the payload; validateScopeSelection rejects an unfilled scope mode on both create and save. Startup is the deliberate exception — a scope there defers the one-shot instead of suppressing it, so the scope control stays and only emit mode is hidden. One-shot triggers now state in-form when they collect. Sub-dropdown hints no longer claim "No selection = all phases" (they turn amber and name the required action instead). Tests: app/gather-rules/__tests__/gatherRuleFormLogic.test.ts (15) pins the applicability matrix, the payload nulling incl. the trigger-switch leak, the unfilled-scope rejection, and the JSON-mode scopeMode derivation. vitest 572/572; tsc silent. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>