Skip to content

Bug: stale incidents persist when desired cell set is empty #4

@EmmanuelAlmonte

Description

@EmmanuelAlmonte

Summary

Stale incidents can persist when the planner outputs zero desired cells because pruning is skipped in that state.

Observed in

  • hooks/incidentSubscription/reconcile.ts:33
    • shouldPruneByCell becomes false when desiredCells.length === 0
  • hooks/incidentSubscription/useIncidentSubscriptionCore.ts:443
    • stale-by-cell pruning only runs when shouldPruneByCell is true

User Impact

Users can continue seeing old/irrelevant incidents ("ghost incidents") even after active desired coverage becomes empty (for example after map/location transitions), which makes the feed/map feel out of sync with current scope.

Repro (high level)

  1. Load incidents for an area.
  2. Transition to a state where planner returns zero desired cells.
  3. Observe that previously cached incidents can remain visible instead of being pruned for current scope.

Expected

When desired coverage is empty, incident state should still reconcile to current subscription scope and avoid persisting stale incidents.

Acceptance Criteria

  • Incidents that are no longer in scope are not retained indefinitely when desired cells are empty.
  • Reconcile behavior remains stable during transient planner states (no excessive flicker/churn).
  • Add/adjust tests around zero-desired-cell reconciliation to prevent regressions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions