refactor(operator-trend): data-driven payload emitter + collapse first 2 ladder tiers (T3-2 phase 8c)#99
Merged
Conversation
…ad keys; collapse first 2 ladder tiers (T3-2 phase 8c) Introduces _emit_resolution_payload_entries: a generic emitter that rebuilds the per-target/per-class recovery-tier payload keys from a (out_key, source_name, is_ternary) spec table. Ternary entries reproduce the primary_target override (primary_target.get(out_key sans 'primary_target_', value) if primary_target else value); plain entries pass through sources[source_name][out_key]. Converts the first two ladder tiers (reset_reentry + reset_reentry_rebuild, 71 contiguous A/B entries) to the table and prunes their now-dead source unpacks. Byte-identical by construction (every converted entry matched the emitter's two patterns, get-key included) and proven by the characterization net. The remaining ~245 A/B entries collapse the same way in the follow-up. Verify: net byte-identical; ruff + mypy clean; 2541 passed, 2 skipped. Net -304 lines.
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.
What
Introduces
_emit_resolution_payload_entries— a generic, data-driven emitter that rebuilds the recovery-tier payload keys from a(out_key, source_name, is_ternary)spec table — and converts the first two ladder tiers (reset_reentry+reset_reentry_rebuild, 71 contiguous entries) to it. This is the validate-the-mechanism PR; the remaining ~245 entries collapse the same way in the follow-up.The pattern
A conformance proof over all 320 payload entries found 316 are exactly two patterns, with only 4 OTHER (the 3 summary-fn calls + bare
decision_memory_map):primary_target.get(<out_key sans 'primary_target_'>, value) if primary_target else valuesources[source_name][out_key]So the load-bearing string contract becomes an auditable data table + a 14-line loop, instead of ~1,600 lines of hand-written ternaries.
Faithfulness
Byte-identical by construction — the conformance proof verified every converted entry matches the emitter's patterns (get-key included), so the emitter regenerates the identical expression. The 7 now-dead tier source-unpacks are pruned (computed precisely: they were referenced only by the moved entries; tier-3 bridges from different sources).
Proof
tests/test_resolution_trend_golden_contract.py) → byte-identical greenuv run pytest -q→ 2541 passed, 2 skippedruff check src/ tests/→ clean (no F841) ·mypy→ cleanNext
PR-B converts the remaining 5 ladder tiers + the early-region A/B entries and deletes the re-derivation preamble — the full ~1,300-line collapse, under this same green net.