Skip to content

refactor(operator-trend): collapse remaining recovery-tier payload onto the data emitter (T3-2 phase 8d)#100

Merged
saagpatel merged 1 commit into
mainfrom
refactor/godfn-payload-sweep
Jun 20, 2026
Merged

refactor(operator-trend): collapse remaining recovery-tier payload onto the data emitter (T3-2 phase 8d)#100
saagpatel merged 1 commit into
mainfrom
refactor/godfn-payload-sweep

Conversation

@saagpatel

Copy link
Copy Markdown
Owner

What

The sweep that finishes the payload collapse. Converts all remaining A/B entries onto the generic emitter from #99: the payload contract becomes one _RESOLUTION_PAYLOAD_ENTRIES table of 316 (out_key, source_name, is_ternary) rows, the re-derivation preamble is deleted, and build_resolution_trend_payload drops from ~1,740 → 47 lines.

The result

operator_trend…rererestore payload fractal:
  ~1,676 lines of hand-cloned ternaries/subscripts
        ↓
  14-line emitter loop  +  316-row data table  +  4 explicit OTHER entries

Only the 4 genuinely-irregular entries stay explicit — the three summary-fn renderers (class_transition_health_summary, class_transition_resolution_summary, closure_forecast_hysteresis_summary) and the bare decision_memory_map. The 27 now-dead source unpacks are pruned; the 3 still referenced by the OTHER entries stay.

Faithfulness

Byte-identical by construction — the conformance proof verified every one of the 316 entries matches the emitter's two patterns (get-key included), so the table regenerates the identical expressions. The full ordered table is sourced from the original inline dict (#97), so output key ordering is preserved too.

Proof

  • Characterization net (tests/test_resolution_trend_golden_contract.py) → byte-identical green
  • uv run pytest -q2541 passed, 2 skipped
  • ruff check src/ tests/ → clean (no F841) · mypy → clean

Arc (T3-2 god-function decomposition)

phase PR effect
8a #94 characterization net (388-key golden)
8b #97 extract payload assembly → module; god-fn 1,852 → 157
8c #99 generic emitter + first 2 ladder tiers
8d this sweep the rest; payload module ~1,436 → 419 lines

After this, the payload assembly is a data table — the T3-2 fractal thesis, landed.

…to the data emitter (T3-2 phase 8d)

Sweeps the rest of the payload assembly onto the generic emitter from phase 8c:
all 316 primary_target-ternary / passthrough entries become one
_RESOLUTION_PAYLOAD_ENTRIES table (out_key, source_name, is_ternary), the
re-derivation preamble is deleted (the emitter resolves sources straight from
apply_chain), and build_resolution_trend_payload drops from ~1,740 to 47 lines.
Only the 4 genuinely-irregular entries stay explicit: the three summary-fn
renderers and the bare decision_memory_map.

The operator_trend...rererestore payload fractal -- ~1,676 lines of hand-cloned
ternaries -- is now a 14-line loop over an auditable data table. Byte-identical
by construction and proven by the characterization net.

Verify: net byte-identical; ruff + mypy clean; 2541 passed, 2 skipped.
@saagpatel saagpatel merged commit 621f95d into main Jun 20, 2026
2 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3b29bbb48e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 413 to +417
_emit_resolution_payload_entries(
payload,
primary_target=primary_target,
sources=sources,
entries=_RESET_REENTRY_REBUILD_TIER_ENTRIES,
entries=_RESOLUTION_PAYLOAD_ENTRIES,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve payload insertion order

Because the explicit payload.update() now runs before the generic emitter, the three summary keys and decision_memory_map are inserted before all 316 table-driven keys instead of staying in their previous in-place/end positions. The control-center artifacts serialize this nested payload with json.dumps(..., indent=2) without sort_keys in src/cli.py, so this no-op refactor will churn generated operator-control-center JSON ordering even when values are unchanged; the existing golden check misses this because it only compares key sets/values.

Useful? React with 👍 / 👎.

@saagpatel saagpatel deleted the refactor/godfn-payload-sweep branch June 20, 2026 11:51
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