Skip to content

fix(operator-trend): use any() for rererestore freshness signal flag (T3-2 phase 5b)#81

Merged
saagpatel merged 1 commit into
mainfrom
fix/operator-trend-rererestore-freshness-flag
Jun 20, 2026
Merged

fix(operator-trend): use any() for rererestore freshness signal flag (T3-2 phase 5b)#81
saagpatel merged 1 commit into
mainfrom
fix/operator-trend-rererestore-freshness-flag

Conversation

@saagpatel

Copy link
Copy Markdown
Owner

The drift

closure_forecast_reset_reentry_rebuild_reentry_restore_rererestore_freshness_for_target computed its has_fresh_aligned_recent_evidence flag differently from every sibling tier:

# rererestore (outlier)                              # all 6 siblings
freshness_status == "fresh"                          any(
and aligned_recent_event_count >= 2                      side(event) == current_side ...
                                                         for event in relevant_events[:2])

Every other freshness builder (reset_reentry, reset_reentry_rebuild, reacquisition, rebuild_reentry, rebuild_reentry_restore, rebuild_reentry_restore_rerestore) uses an any(...) existential over the first two recent events. rererestore was the lone outlier — a stricter count-threshold + global-freshness gate.

The flag is load-bearing: read 49 times in operator_resolution_trend.py, gating churn_status and persistence decisions.

The fix

Convert the flag to the sibling any(...) form over rererestore's own aligned predicate; drop the now-dead aligned_recent_event_count sum. The flag now fires on any recent aligned event like its siblings (previously: both of the first two and overall freshness "fresh").

Caught by the phase-4 net

The composer golden (#79) caught it: a 3-line diff (has_fresh_aligned_recent_evidence: false → true in 3 scenarios). No existing test pinned the old value — the path was uncharacterized, which is why the drift survived.

Verification

  • Full suite green (2539 passed, 2 skipped) — zero mirror-test breakage
  • mypy on edited source clean; ruff check src/ tests/ clean
  • Golden diff is the minimal 3-line behavior change

Note for collapse planning

This removes the clear aggregation outlier. A residual predicate difference remains across the freshness tiers (rebuild keys on signal_label != "neutral", rerestore on per-event freshness == "fresh"), so a full freshness-family collapse will still need a predicate-unification decision — tracked separately, not in scope here.

…(T3-2 phase 5b)

The rererestore freshness builder computed `has_fresh_aligned_recent_evidence` as
`freshness_status == "fresh" and aligned_recent_event_count >= 2` -- a count
threshold plus a global-freshness gate. Every one of its sibling freshness
builders (reset_reentry, reset_reentry_rebuild, reacquisition, rebuild_reentry,
rebuild_reentry_restore, rebuild_reentry_restore_rerestore) uses an `any(...)`
existential over the first two recent events instead. rererestore was the lone
outlier, and the flag is load-bearing (gates churn_status / persistence decisions
across 49 read sites).

Convert it to the sibling `any(...)` form over rererestore's own aligned predicate
and drop the now-dead aligned_recent_event_count sum(). The flag now fires on any
recent aligned event like its siblings (previously required both of the first two
AND overall freshness == "fresh").

Caught and pinned by the phase-4 composer golden: a 3-line diff (the flag flips
false -> true in 3 scenarios). No existing test pinned the old value -- the path
was uncharacterized, which is why the drift survived. Full suite 2539 passed,
ruff + mypy clean.
@saagpatel
saagpatel merged commit 3a51d4e into main Jun 20, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant