Skip to content

refactor(operator-trend): absorb reset_reentry tier into the recovery base (T3-2 phase 6e)#86

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

refactor(operator-trend): absorb reset_reentry tier into the recovery base (T3-2 phase 6e)#86
saagpatel merged 1 commit into
mainfrom
refactor/operator-trend-collapse-recovery-tiers

Conversation

@saagpatel

Copy link
Copy Markdown
Owner

What

The recovery base (#85) already serves the rebuild + rererestore refresh-recovery tiers. This absorbs a third tier — the shallower reset_reentry recovery — onto the same _recovery_for_target_base.

closure_forecast_reset_reentry_refresh_recovery_for_target (258 lines) is a structural clone of the base algorithm: same signature, same control flow, differing only in its per-tier reset/freshness keys, its rebuild-tier status vocabulary (rebuilding-/rebuilt-/pending-…-rebuild), reason prose, and output keys. Add _RESET_REENTRY_RECOVERY_SPEC; the function becomes a thin wrapper.

−200 net lines.

How the spec was derived (and proven)

A paired structural AST traversal walks the base and the real function in lockstep. Wherever the base reads spec.X, the aligned node in the real function is recorded as that field's value. The traversal completing at all is the proof of structural identity — every other node aligns exactly. Then the composer golden is byte-identical to main and the full suite passes.

Scope note

The reset_refresh recovery tier is not absorbed — it takes target_class_key instead of ordered_events, so it's a genuinely different shape, not a clone. Shallower tiers need a per-tier clone check, not a blanket spec-add; this PR does that check and absorbs only the one that qualifies.

Verification

  • Paired-traversal structural identity (whole input space)
  • Composer golden byte-identical to main; full suite 2539 passed
  • ruff + mypy clean; public signature unchanged

… base (T3-2 phase 6e)

The recovery base (#85) parametrized the rebuild + rererestore refresh-recovery
tiers. The shallower reset_reentry tier is a structural clone of that same
algorithm (same signature, same control flow; it only differs in its per-tier
reset/freshness keys, its rebuild-tier status vocabulary, reason prose, and output
keys). Add a _RESET_REENTRY_RECOVERY_SPEC and make
closure_forecast_reset_reentry_refresh_recovery_for_target a thin wrapper -- a third
tier on one base.

The spec was extracted by a paired structural AST traversal of base-vs-tier (which
also proves structural identity: the traversal aligns every node, recording the
literal wherever the base reads spec.X). Public signature unchanged. Net -200 lines.

Note: the reset_refresh recovery tier is NOT absorbed -- it takes target_class_key
instead of ordered_events, so it is a genuinely different shape, not a clone.

Verified: paired-traversal structural identity + composer golden byte-identical to
main + full suite (2539 passed). ruff + mypy clean.
@saagpatel saagpatel merged commit b69bd82 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