fix(operator-trend): use any() for rererestore freshness signal flag (T3-2 phase 5b)#81
Merged
Conversation
…(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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The drift
closure_forecast_reset_reentry_rebuild_reentry_restore_rererestore_freshness_for_targetcomputed itshas_fresh_aligned_recent_evidenceflag differently from every sibling tier:Every other freshness builder (
reset_reentry,reset_reentry_rebuild,reacquisition,rebuild_reentry,rebuild_reentry_restore,rebuild_reentry_restore_rerestore) uses anany(...)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, gatingchurn_statusand persistence decisions.The fix
Convert the flag to the sibling
any(...)form over rererestore's own aligned predicate; drop the now-deadaligned_recent_event_countsum. 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 → truein 3 scenarios). No existing test pinned the old value — the path was uncharacterized, which is why the drift survived.Verification
2539 passed, 2 skipped) — zero mirror-test breakagemypyon edited source clean;ruff check src/ tests/cleanNote 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-eventfreshness == "fresh"), so a full freshness-family collapse will still need a predicate-unification decision — tracked separately, not in scope here.