Skip to content

Unify renderer template parity coverage - #127

Merged
hallerite merged 8 commits into
mainfrom
codex/unified-template-parity
Aug 31, 2026
Merged

Unify renderer template parity coverage#127
hallerite merged 8 commits into
mainfrom
codex/unified-template-parity

Conversation

@hallerite

@hallerite hallerite commented Aug 12, 2026

Copy link
Copy Markdown
Member

Summary

  • replace duplicated renderer/model lists and bespoke parity modules with one declarative model catalog and shared scenario corpus
  • exercise every valid model × scenario × typed chat-template-kwarg combination against the Hugging Face or OpenAI Harmony reference
  • derive the shared, parser, build-helper, bridge, round-trip, and focused model suites from that same catalog
  • encode supported exclusions and sampled-token-stability deviations explicitly, including the Gemma 4 26B/31B disabled-thinking behavior
  • preserve focused Prime-Qwen parser/bridge regressions that are not template-parity checks

Why

Parity coverage had grown across several mostly-overlapping test modules and local model lists. Adding a renderer, checkpoint, scenario, or template kwarg required updating multiple places, while global skips made it difficult to see which cells were intentionally unsupported.

This change makes the coverage surface auditable in one place: models declare the suites they participate in, scenarios declare renderer-specific applicability, and every finite typed template kwarg is crossed with every valid scenario. New declared kwargs fail coverage until representative values are added.

Impact

There are no production renderer changes. The test suite gains broader, systematic template coverage while removing roughly 1,800 net lines of duplicated test setup and parity cases. Known renderer/template deviations remain covered by focused stability tests rather than hidden runtime skips.

Validation

  • uv run pytest tests/ -q: 7,675 passed, 63 skipped
  • restored Prime-Qwen regression slice: 4 passed
  • uv run ruff check .
  • uv run ruff format --check .
  • uv run ty check renderers: exits successfully with the existing 82-warning baseline
  • git diff --check origin/main...HEAD

Note

Unify renderer parity tests into catalog-driven test_parity.py with pluggable reference oracles

  • Introduces a shared catalog in parity.py (MODEL_CATALOG, models_for(suite)) that binds each model to a renderer and a reference oracle, driving parametrization across all test suites via conftest.py.
  • Refactors reference_rendering.py from a single render_reference into a pluggable oracle registry with adapters for HuggingFace apply_chat_template, DeepSeek V4's Python encoder, and OpenAI Harmony.
  • Adds the unified parity matrix in test_parity.py that compares renderer token IDs against the model-appropriate oracle across scenarios and kwarg combinations.
  • Removes per-model parity suites (e.g. test_deepseek_r1, test_llama_3, test_laguna_m1, deleted test_gpt_oss_harmony_parity.py) and replaces their static model lists with models_for(...) calls.
  • Risk: Consolidation changes which models run in each suite; any model missing from MODEL_CATALOG or misrouted in RENDERER_ORACLE_ROUTES will silently lose coverage. Review MODEL_CATALOG membership and oracle routing in parity.py and reference_rendering.py.

Macroscope summarized b858ccc.


Note

Low Risk
Test-only refactor with no production renderer changes; main risk is shifted parametrization coverage if a suite mapping is wrong.

Overview
Consolidates scattered render/token parity tests into tests/parity.py (single MODEL_CATALOG, shared SCENARIOS, KWARG_VALUES, and declarative exclusions) and tests/test_parity.py, which runs every valid model × scenario × typed template-kwarg cell against a model-aware reference oracle.

tests/reference_rendering.py now registers three oracles—Hugging Face Jinja (default), DeepSeek V4’s Python encoder, and Harmony for GPT-OSS—and routes by resolved renderer name, folding former test_gpt_oss_harmony_parity.py / HF-only assumptions into one path. conftest.py parametrizes tests from models_for(suite) (shared, plain-parser, build-helpers, etc.) instead of a monolithic list and drops autouse skips for GPT-OSS and Llama date nondeterminism (Llama uses pinned date_string in the catalog).

Large bespoke parity modules (test_render_ids.py, test_renderer_config_parity.py, Nemotron/Prime-Qwen/Laguna-S parity files, and similar) are removed or trimmed; bridge, roundtrip, tool-arg, and stability suites now read model lists from the same catalog. Docs (README, docs/renderer-config.md, pyproject.toml) point at test_parity.py. Prime-Qwen empty-think parse/bridge regressions move into test_parse_response.py.

Reviewed by Cursor Bugbot for commit b858ccc. Bugbot is set up for automated code reviews on this repo. Configure here.

@hallerite
hallerite marked this pull request as ready for review August 12, 2026 21:26
Comment thread tests/test_parity.py
Comment thread tests/parity.py
@macroscopeapp

macroscopeapp Bot commented Aug 12, 2026

Copy link
Copy Markdown

Approvability

Verdict: Approved at b858ccc

Macroscope's review found this PR approvable — This PR is confined to test harnesses, parity references, regression coverage, and documentation; no production renderer or customer request-path code changes. Its primary impact is how CI parametrizes and executes renderer tests, with no schema, deployment, security, billing, or authentication changes.

Notes:

  • Macroscope's correctness review did not run, so approvability was decided on eligibility alone.

You can add or adjust custom eligibility rules. Learn more.

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Aug 12, 2026
# Conflicts:
#	tests/conftest.py
#	tests/test_bridge.py
#	tests/test_disabled_thinking_stability.py
#	tests/test_renderer_config_parity.py
#	tests/test_roundtrip.py

@cursor cursor 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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit d427cf7. Configure here.

Comment thread tests/parity.py
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Aug 30, 2026
# Conflicts:
#	tests/conftest.py
#	tests/test_bridge.py
#	tests/test_render_ids.py
#	tests/test_renderer_config_parity.py
#	tests/test_roundtrip.py
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Aug 31, 2026
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Aug 31, 2026
@hallerite
hallerite merged commit 9b47901 into main Aug 31, 2026
11 checks passed
@hallerite
hallerite deleted the codex/unified-template-parity branch August 31, 2026 16:40
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