Skip to content

refactor(operator-trend): extract _build_resolution_trend payload assembly (T3-2 phase 8b, re-landed)#97

Merged
saagpatel merged 2 commits into
mainfrom
refactor/godfn-payload-extract-relanded
Jun 20, 2026
Merged

refactor(operator-trend): extract _build_resolution_trend payload assembly (T3-2 phase 8b, re-landed)#97
saagpatel merged 2 commits into
mainfrom
refactor/godfn-payload-extract-relanded

Conversation

@saagpatel

Copy link
Copy Markdown
Owner

What

Extracts the 1,676-line payload.update({...}) out of _build_resolution_trend into src/operator_trend_resolution_payload.py (build_resolution_trend_payload). The god-function drops 1,852 → 157 lines.

Why this is a re-land

The original of this change (#95) was accidentally stacked on #94's branch; when both were squash-merged, #94 (the characterization net) landed on main but #95 merged into #94's now-orphaned branch instead of main. The net is on main; the extraction was not. This PR re-lands the identical extraction as a clean, non-stacked branch off current main (cherry-picked, verified) so it actually reaches main, now guarded by the merged net.

How (verbatim relocation, byte-identical)

  • The payload-assembly block moves byte-for-byte — only its container changed.
  • The helper re-derives its 31 locals from the same source assignments (apply_chain[...] / summary_context[...]) and takes the 3 in-module summary renderers as injected callables (the established no-circular-import pattern).
  • The 29 now-dead apply_chain[...] unpacks are removed; the 6 still fed to the topline-payload helper stay.

Proof

Stale branches refactor/resolution-trend-extract-payload and refactor/resolution-trend-godfn-decompose (carrying the orphaned #95 merge) can be deleted.

…embly to its own module (T3-2 phase 8b)

The 1,676-line payload.update({...}) that assembled the 320+ resolution-trend
payload keys moves verbatim into operator_trend_resolution_payload.build_resolution_trend_payload.
The god-function drops 1,852 -> 157 lines: it now reads as a clear pipeline
(run-context -> targets -> apply-chain -> summary-context -> topline payload ->
recovery-tier payload update). The helper re-derives its locals from the
apply-chain / summary-context dicts and takes the three in-module summary
renderers as injected callables (the established no-circular-import pattern;
matches the already-extracted run-context / apply-chain / summary-context /
topline-payload stages).

Pure relocation, proven byte-identical by the characterization net
(tests/test_resolution_trend_golden_contract.py) plus the full suite.

Verify: ruff clean; mypy clean on both files; 2541 passed, 2 skipped.
…r, dict]

Match the original god-function's annotation (review nit): _decision_memory_map
returns dict[str, dict] and _resolution_targets takes it as dict[str, dict]; the
extracted helper should not widen it to dict[str, Any].
@saagpatel saagpatel merged commit b9072a7 into main Jun 20, 2026
3 checks passed
@saagpatel saagpatel deleted the refactor/godfn-payload-extract-relanded 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