Skip to content

refactor(operator-trend): collapse hotspot selectors onto a parametrized base (T3-2 phase 6c)#84

Merged
saagpatel merged 1 commit into
mainfrom
refactor/operator-trend-collapse-hotspots
Jun 20, 2026
Merged

refactor(operator-trend): collapse hotspot selectors onto a parametrized base (T3-2 phase 6c)#84
saagpatel merged 1 commit into
mainfrom
refactor/operator-trend-collapse-hotspots

Conversation

@saagpatel

Copy link
Copy Markdown
Owner

What

Third structural collapse. The rebuild and rererestore hotspot selectors share one group/dedup/filter/sort algorithm differing only in the per-tier persistence/churn keys, the just-* mode token, and the holding/sustained status set. Extract _hotspots_base + a _HotspotsTierSpec; both public selectors become thin wrappers.

The two tiers had also drifted on defensive coercion — rebuild wrapped score/age/label in float()/int()/str(); rererestore was bare. Identical on real numeric data; the base unifies on rebuild's safer coercion (verified byte-identical).

−72 net lines.

Verified (three proofs)

  1. Differential test — real selectors vs. base+spec over the net's targets × all 9 modes → byte-identical for both tiers, before touching the file.
  2. Composer golden byte-identical to main — a correct collapse changes no output.
  3. Full suite green2539 passed, 2 skipped.

ruff + mypy clean. Public signatures unchanged, so callers (the summaries that read these keys, the apply-chain) are untouched.

Campaign progress

Three of four clean rebuild↔rererestore families collapsed: persistence (#82), churn (#83), hotspots (this). refresh_recovery remains — it's the genuinely complex one (intricate branching, implicit-concat reason strings, output-keys-that-are-also-vars), so it gets a dedicated careful pass rather than a rushed one.

…zed base (T3-2 phase 6c)

Third structural collapse: the rebuild and rererestore hotspot selectors share one
group/dedup/filter/sort algorithm differing only in the per-tier persistence/churn
keys, the just-* mode token, and the holding/sustained status set. Extract
_hotspots_base + a _HotspotsTierSpec; both public selectors become thin wrappers.

The two tiers had also drifted on defensive coercion (rebuild wrapped score/age/
label in float()/int()/str(); rererestore was bare) -- identical on real numeric
data. The base unifies on rebuild's safer coercion; verified byte-identical.

Public signatures unchanged -> callers (summaries that read these keys, apply-chain)
untouched. Net -72 lines.

Verified: differential test (real selectors vs base+spec over targets x all modes,
byte-identical both tiers) + composer golden byte-identical to main + full suite
(2539 passed). ruff + mypy clean.
@saagpatel saagpatel merged commit aff47a3 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