Skip to content

Fold media-alert-origin tasks to done when their signal clears #324

@ooloth

Description

@ooloth

Current state

The CI/alert fold-back pass (#305) excludes AlertSource::Media tasks because the media StatusItem variants (MediaBlocked, MediaMissing, MediaHealth) have no corresponding branch in the present-set mapping, so a media-origin task can never be matched to a live signal. Treating an unmatchable task as "absent" would fold it immediately and incorrectly on every refresh, so the pass skips media origins entirely.

Ideal state

  • During the status fold-back pass, a non-terminal media-alert-origin task whose signal no longer appears in the fresh scan results automatically transitions to done, using the same debounce guard (signal absent from both this refresh and the prior cached report) as CI/Loki/GCP tasks.
  • The StatusItem → SignalIdentity mapping covers all three media variants (MediaBlocked, MediaMissing, MediaHealth), using the same key scheme already defined in the task-creation seed constructors in ui/tui/src/state/task_creation.rs.
  • The key format is canonical and lives in one place, referenced by both task creation and the present-set builder.
  • Media-backlog items (MediaBacklog) remain excluded — they represent a count aggregate, not a single-signal origin, and do not produce individual tasks.

Out of scope

Starting points

  • workflows/src/task_fold_back.rs — fold-back pass added in Fold CI/alert-origin tasks to done when their signal clears #305; the media guard lives here
  • ui/tui/src/state/task_creation.rs — media key format: "media/blocked/{source}/{title}", "media/missing/{source}/{title}/{air_date}"
  • domain/src/signal_identity.rsSignalIdentity::Alert { source, key } is the match target

QA plan

  1. With the private feature enabled, create a debug task seeded from a MediaBlocked signal. Resolve the underlying import error so the signal stops appearing. Trigger a status refresh twice. Expect the task transitions to done on the second refresh.
  2. Create a debug task seeded from a MediaMissing signal. Mark the item as available so the signal stops appearing. Trigger two refreshes. Expect done on the second.
  3. Create a debug task seeded from a MediaBlocked signal. Dispatch an agent session. Before the session finishes, trigger a refresh while the signal is still present. Expect no fold — task stays in its current status.
  4. Simulate a transient gap: a media signal disappears on one refresh but reappears on the next (e.g. a flaky availability check). Expect the task is not folded during the gap.

Done when

A non-terminal media-alert-origin task whose signal no longer appears in two consecutive status fetches automatically transitions to done, provided it has no active agent session.

Depends on

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions