refactor(operator-trend): extract _build_resolution_trend payload assembly (T3-2 phase 8b, re-landed)#97
Merged
Conversation
…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].
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
Extracts the 1,676-line
payload.update({...})out of_build_resolution_trendintosrc/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
mainbut #95 merged into #94's now-orphaned branch instead ofmain. The net is on main; the extraction was not. This PR re-lands the identical extraction as a clean, non-stacked branch off currentmain(cherry-picked, verified) so it actually reaches main, now guarded by the merged net.How (verbatim relocation, byte-identical)
apply_chain[...]/summary_context[...]) and takes the 3 in-module summary renderers as injected callables (the established no-circular-import pattern).apply_chain[...]unpacks are removed; the 6 still fed to the topline-payload helper stay.Proof
tests/test_resolution_trend_golden_contract.py, merged in test(operator-trend): characterization net for _build_resolution_trend payload (T3-2 phase 8a) #94) stays byte-identical green against this branch.uv run pytest -q→ 2541 passed, 2 skippedruff check src/ tests/→ clean ·mypyon both files → cleandecision_memory_map→dict[str, dict]) is included.Stale branches
refactor/resolution-trend-extract-payloadandrefactor/resolution-trend-godfn-decompose(carrying the orphaned #95 merge) can be deleted.