Skip to content

test(operator-trend): characterization net for _build_resolution_trend payload (T3-2 phase 8a)#94

Merged
saagpatel merged 1 commit into
mainfrom
refactor/resolution-trend-godfn-decompose
Jun 20, 2026
Merged

test(operator-trend): characterization net for _build_resolution_trend payload (T3-2 phase 8a)#94
saagpatel merged 1 commit into
mainfrom
refactor/resolution-trend-godfn-decompose

Conversation

@saagpatel

Copy link
Copy Markdown
Owner

What

Adds a characterization (golden) net pinning the exact 388-key payload that _build_resolution_trend assembles — its 1,676-line payload.update({...}) — across a 4-case input corpus.

Why

_build_resolution_trend is the last 1,852-line god-function in operator_resolution_trend.py. Its upstream stages (run-context, apply-chain, summary-context, topline-payload) are already extracted to operator_trend_* modules and independently tested; the only un-extracted bulk is the flat payload assembly. Before decomposing it (extract the assembly seam, then collapse the 8 per-tier blocks onto a parametrized base), we need a net that pins the assembled output — the sibling goldens pin only the lower-layer classifiers/composers, not the top-level wiring.

Corpus

case primary_target exercises
empty falsy IfExp false-branches + default structure
single_blocked_stale truthy IfExp true-branches + populated per-tier summaries/hotspots
multi_class_attention truthy hotspot grouping across classes
attention_no_history truthy attention without history depth

Non-degeneracy is guarded: 107 keys diverge empty-vs-populated, 163 non-default values in the populated case.

Safety

  • Enumerator-generated, never hand-authored; regenerate via uv run python tests/golden/enumerate_resolution_trend_contract.py.
  • Imports only the pure-computation module (no import-time DB/IO, same as the sibling enumerators); calls the function on in-memory synthetic inputs.
  • Pure test/golden addition — no production code touched.

Verification

  • uv run pytest -q → 2541 passed, 2 skipped
  • uv run ruff check src/ tests/ → clean
  • uv run mypy on the enumerator → clean

…rend assembled payload (T3-2 phase 8a)

Pins the exact 388-key payload _build_resolution_trend assembles (its
1,676-line payload.update) across a 4-case corpus exercising both the
falsy- and truthy-primary_target branches. Safety net for the upcoming
god-function decomposition: extracting the payload-assembly seam and
collapsing the per-tier blocks must reproduce this byte-for-byte.

Enumerator-generated (never hand-authored); regenerate via
  uv run python tests/golden/enumerate_resolution_trend_contract.py

@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: 8ebd0b05db

ℹ️ 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 +68 to +72
"snapshot": {
"items": {it["item_id"]: it for it in items},
"has_attention": any(it["lane"] in ("blocked", "urgent") for it in items),
"generated_at": generated_at,
}

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 Return history fixtures in the shape the parser reads

For the cases that are supposed to exercise stale/persisting history, these entries are passed to _build_resolution_trend as history, which immediately normalizes them through _snapshot_from_history; that helper reads operator_queue, operator_summary.counts, and top-level generated_at, not a nested snapshot object. As a result each stale_history row in this golden is treated as an empty run, so the contract does not actually pin the history-depth/persisting/reopened branches it claims to protect before the refactor.

Useful? React with 👍 / 👎.

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