Skip to content

test: Python fixture parity for Linux-canonical equiv suite (#215) - #219

Merged
k-yoshimi merged 12 commits into
developfrom
feat/fixture-parity-215
Jun 8, 2026
Merged

test: Python fixture parity for Linux-canonical equiv suite (#215)#219
k-yoshimi merged 12 commits into
developfrom
feat/fixture-parity-215

Conversation

@k-yoshimi

@k-yoshimi k-yoshimi commented Jun 7, 2026

Copy link
Copy Markdown
Owner

Summary

Backfills four missing Python fixtures and renames a mislabelled fixture so the Linux-canonical equivalence suite covers every committed baseline that the wrapper can replay.

  • New fixtures: fp_jt60, ti_w, tr_m0904, wrx_jt60 (one each in python/{fp,ti,tr,wrx}lib/tests/fixtures/)
  • New test methods: test_jt60, test_ti_w, test_m0904, test_jt60 in each module's test_equivalence.py
  • Rename ti_iter01_params.pyti_min_params.py (filename was misleading; BASELINE_NAME was already ti_min) — 5 importers + 1 docstring xref updated
  • Register wrx_jt60 in test_run/test_definitions.conf (orphan baseline → driver-side wired)

Builds on the Linux-canonical equiv policy from PR #216.

Canonical Linux CI outcome (2026-06-08, run 27113686677)

Per spec §6.3 drift policy, 3 of the 4 new test methods failed at 1e-10 and are marked @pytest.mark.xfail(strict=True) with linked follow-up issues. The 4th new test PASSED. The rename PASSED.

Test Status Tracker
python/fplib/.../test_equivalence.py::test_jt60 XFAIL (1e-10 drift; PROFN2/PROFT2 plcomm gap) #222
python/tilib/.../test_equivalence.py::test_ti_w XFAIL (ti_get_state ierr=3 on W-impurity) #223
python/trlib/.../test_equivalence.py::test_m0904 XFAIL (AJRFT missing + env drift; §6.3 anticipated) #224
python/wrxlib/.../test_equivalence.py::test_jt60 ✅ PASSED
python/tilib/.../test_equivalence.py::test_ti_min (post-rename) ✅ PASSED

strict=True ensures the markers auto-fail (XPASS → CI red) once the root cause is fixed, forcing marker removal. Removal conditions are documented inline in each xfail's reason string.

How to verify on Linux CI

In the python-tests.yml pytest summary:

  • test_jt60 (wrx) and test_ti_min (ti, post-rename) → PASSED
  • test_jt60 (fp), test_ti_w, test_m0904 (tr) → XFAIL (not FAILED, not PASSED)
  • CI is green; the 3 known XFAILs do not fail the build.

Registry-correction note (§0 Erratum in spec)

Three fixtures required SCALARS-vs-ARRAYS corrections during implementation after auditing each module's *_param_registry.f90. Keys registered as array-only MUST live in ARRAYS, not SCALARS. Details in docs/superpowers/specs/2026-06-01-fixture-parity-backfill-design.md §0 + §0.1.

Out of scope (follow-up)

Spec

docs/superpowers/specs/2026-06-01-fixture-parity-backfill-design.md (committed at 00e18956; erratum at e91d03f7; post-CI xfail §0.1 at 4862d912).

Test plan

  • macOS local: existing tests still PASS / SKIP cleanly (no new failures) — verified at 182/13/1
  • git grep ti_iter01_params python/ returns zero — verified
  • wrx_jt60 appears in ./test_run/run_tests.sh --list — verified
  • Canonical Linux CI: 1 PASSED (wrx_jt60) + 1 PASSED (ti_min post-rename) + 3 XFAIL'd (fp_jt60, ti_w, tr_m0904)
  • Bugbot COMPLETED

Closes #215

🤖 Generated with Claude Code


Note

Low Risk
Changes are limited to test fixtures, equivalence wiring, and docs; no Fortran or runtime API changes. CI behavior shifts only by adding tracked xfails and one new passing equiv case.

Overview
Backfills Linux-canonical Layer 1 equivalence coverage for four baselines that had no Python replay fixtures (fp_jt60, ti_w, tr_m0904, wrx_jt60), plus a design spec with registry errata and post-CI notes.

Each new case adds a *_params.py namelist mirror and a test_equivalence method. ti_iter01_params.py is renamed to ti_min_params.py with imports updated in equivalence, sweep, and property tests. wrx_jt60 is added to test_run/test_definitions.conf for the Fortran driver list.

On canonical CI, wrx_jt60 and renamed test_ti_min pass; fp_jt60, ti_w, and tr_m0904 are @pytest.mark.xfail(strict=True) (#222#224) for wrapper/registry gaps, W-impurity calc failure, and stale/drifting TR baseline. Fixtures follow registry rules (e.g. array-only keys in ARRAYS, ti_w 2D MODEL_BND keys, wrx list-only arrays with TypeError guard).

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

k-yoshimi and others added 10 commits June 1, 2026 19:59
Spec for backfilling missing python/<mod>/tests/fixtures/<case>_params.py
so the Linux-canonical equivalence suite covers the full committed
baseline corpus, not just a hand-picked subset.

Scope locked across 3 Codex review passes:
- 4 new fixtures: fp_jt60, ti_w, tr_m0904, wrx_jt60
- Rename ti_iter01_params.py -> ti_min_params.py (5 importers)
- Register wrx_jt60 in test_run/test_definitions.conf
- eq_jt60 deferred to follow-up issue (eqjt60.gs never committed)

Builds on the Linux-canonical equiv policy (PR #216, 2026-05-26 spec).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Mirrors test_run/inputs/fp_jt60.in (&fp namelist) into Python so the
Linux-canonical equiv suite at test_run/baselines/fp_jt60/metrics.json
gains a fp_jt60 wired test alongside fp_dt1 and fp_iter01.

KNAMFP=' ' is no-op in the wrapper path and listed in UNREGISTERED_KEYS
for documentation only.

Spec: docs/superpowers/specs/2026-06-01-fixture-parity-backfill-design.md

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Code-quality review on commit 91cf233 found PROFN2/PROFT2/PMAX/MODELC
were placed in SCALARS but are not bare-scalar-registered in
fp/fp_param_registry.f90:

- PROFN2 / PROFT2: not in fp_param_registry at all (in plcomm) - move
  to UNREGISTERED_KEYS. Precedent: fp_iter01_params.py:73.
- PMAX:   array-only (registry L114-116, idx >= 1). Move to ARRAYS as
  {1: 20.0} per fp_iter01_params.py:57 - bare `PMAX=20.D0` is Fortran
  namelist scalar that sets PMAX(1)=20 only, NOT broadcast.
- MODELC: array-only (registry L149-151). Move to ARRAYS as {1: 4}
  per fp_iter01_params.py:61 - same scalar-broadcast Fortran rule.

Without this fix Layer 1 equivalence at 1e-10 would fail silently
(fp.set_param returning ierr but apply not checking) and physics would
drift on PMAX[2..NSMAX] / MODELC[2..NSMAX] defaults.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Mirrors test_run/inputs/ti_w.in into Python so the Linux-canonical equiv
suite at test_run/baselines/ti_w/metrics.json gains a wired test for the
W-impurity (NSMAX=3, NRMAX=20) transport case.

Uses the MATRIX_ARRAYS 2D-key pattern established by ti_ar_params.py for
MODEL_BND(1,3) and BND_VALUE(1,3).

Spec: docs/superpowers/specs/2026-06-01-fixture-parity-backfill-design.md

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Mirrors test_run/inputs/tr_m0904.in (MODELG=2 analytic geometry,
NSMAX=4, NTMAX=50) into Python so the Linux-canonical equiv suite at
test_run/baselines/tr_m0904/metrics.json gains a wired test.

MDNCLS and PNBCD appear in the namelist but have no CASE entry in
tr/tr_param_registry.f90 (pre-audit confirmed). They are listed in
UNREGISTERED_KEYS for documentation only.

KNOWN_ISSUE.md documents env-dependent drift on non-canonical builds;
canonical Linux CI is the anchor environment. If drift recurs on the
canonical runner a new issue will be filed before any xfail.

Spec: docs/superpowers/specs/2026-06-01-fixture-parity-backfill-design.md

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Mirrors test_run/inputs/wrx_jt60.in (33-key &wr namelist, MODELG=2,
NRAYMAX=2) into Python so the Linux-canonical equiv suite at
test_run/baselines/wrx_jt60/metrics.json gains a wired test alongside
wrx_iter01 and wrx_demo.

PROFN1/PROFN2/PROFT1/PROFT2 are array-only in wrx_param_registry.f90
(L113-125, IF idx > SIZE pattern). They are placed in ARRAYS as [v, v]
NSMAX=2 broadcast lists per wrx_iter01_params.py:45-48 precedent --
NOT in SCALARS where bare-name set_param would return ierr=1.

Fortran replicated-initializer (RFIN(1)=2*110.D3) is expanded inline as
list values. All ARRAYS entries are lists per wrxlib fixture convention;
a defensive isinstance check in apply() catches future dict-form mistakes
early (wrxlib's enumerate path iterates list values, not dict items).

KNAMWR is an output filename used only by the Fortran driver and is
documented in UNREGISTERED_KEYS but not applied via the wrapper.

Spec: docs/superpowers/specs/2026-06-01-fixture-parity-backfill-design.md

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The fixture file was named ti_iter01_params.py but its docstring (L8)
admits it actually mirrors ti_min.in, with BASELINE_NAME="ti_min" and
NTMAX=2. The misleading filename propagated to five test importers:

- test_equivalence.py (test_ti_min)
- test_property_boundary.py
- test_sweep.py (two imports)
- test_property_fanout.py

Rename closes the discrepancy with no behavioral change; the file's
SCALARS / ARRAYS / apply contents are unchanged. The docstring is
cleaned to drop the historical "named iter01 but mirrors ti_min"
notice.

Spec: docs/superpowers/specs/2026-06-01-fixture-parity-backfill-design.md

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The wrx_jt60 baseline at test_run/baselines/wrx_jt60/metrics.json
existed without a corresponding entry in test_definitions.conf, so
run_tests.sh never exercised it on the Fortran-driver side. Adding the
one-line registration enables `./run_tests.sh wrx_jt60` for baseline
regeneration workflows on Linux.

Spec: docs/superpowers/specs/2026-06-01-fixture-parity-backfill-design.md

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Codex pre-push review (MED) flagged that the `assert isinstance(arr, list)`
guard in wrx_jt60_params.apply() is stripped when Python runs under
`-O`, which would silently restore the dict-form misapply bug the
guard was added to prevent.

Replace the assert with an explicit `raise TypeError(...)` so the
check survives optimization flags. Behavior identical for list input;
dict input now reliably raises TypeError instead of conditionally
passing through.

Spec: docs/superpowers/specs/2026-06-01-fixture-parity-backfill-design.md

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…215)

Codex pre-push review (2026-06-02) flagged three spec-vs-code divergences
in the fixture-parity design doc. The §5 tables described the original
fixture layout; the as-shipped fixtures were corrected during
implementation after auditing each module's *_param_registry.f90.

Add a §0 Erratum summarizing the as-shipped content, with authoritative
commit references (5270916 for fp_jt60, 92da504 for tr_m0904, a3fa6ad
for wrx_jt60 confirmation). Original §5 tables preserved as historical
record.

The unifying pattern: any namelist key registered as array-only
(IF idx > SIZE; X(idx)=value) in the registry MUST live in ARRAYS not
SCALARS — bare-name set_param against an array-only registration
parses to idx=0 and silently returns ierr.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@k-yoshimi
k-yoshimi changed the base branch from master to develop June 7, 2026 06:46
@k-yoshimi

Copy link
Copy Markdown
Owner Author

Closing to re-trigger CI workflow (base was switched from master to develop after initial push, which did not re-fire pull_request workflow event). Reopening immediately.

k-yoshimi and others added 2 commits June 8, 2026 14:26
PR #219's canonical Linux CI run (27113686677, 2026-06-08) showed 3
failures at the 1e-10 equivalence layer. Per spec §6.3 drift policy
(\"do NOT revert; file new issue; mark @xfail(strict=True)\"), apply
xfail decorators with strict=True so:

1. CI is unblocked (3 known XFAILs do not fail the build)
2. When the root cause is fixed (registry extension, baseline regen,
   wrapper-path fix), the marker XPASSes → CI fails red → engineer
   removes the marker

Failure summary + linked follow-up issues:

- test_jt60 (fp): profile fields drift 0.5-51% — PROFN2/PROFT2 are
  plcomm scalars with no fp_param_registry CASE entry; wrapper can't
  reproduce the baseline. Tracked as #222.

- test_ti_w (ti): TilibRunError ierr=3 (TI_ERR_CALC_FAILED) on
  get_state. Likely KID_NS/ADAS-table coverage gap in wrapper path
  for W-impurity (Z=74). Tracked as #223.

- test_m0904 (tr): AJRFT missing + 309 mismatches. Pre-AJRFT
  baseline (#190 pattern) + env-dependent drift documented in
  KNOWN_ISSUE.md. Spec §6.3 explicitly anticipated this case.
  Tracked as #224.

CI env: gfortran 13.3.0 (Ubuntu 13.3.0-6ubuntu2~24.04.1).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
#215)

Canonical Linux CI on PR #219 (run 27113686677) revealed 3 of 4 new
test methods fail at 1e-10. Per spec §6.3 explicit drift policy, the
3 are now @pytest.mark.xfail(strict=True) pending root-cause fixes
tracked in #222 (fp_jt60 PROFN2/PROFT2 plcomm gap), #223 (ti_w
W-impurity wrapper path), #224 (tr_m0904 pre-AJRFT baseline + env
drift).

Add §0.1 to record the as-shipped CI outcome (1 PASSED + 3 XFAIL'd
+ 1 rename PASSED) so the spec doc and the merged code agree.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@k-yoshimi

Copy link
Copy Markdown
Owner Author

@cursor review

CI green after xfail+strict=True applied to 3 known canonical-Linux failures (commit 28b692b + 4862d91). Linked follow-ups: #222 #223 #224.

Outcome: 1 PASSED (wrx_jt60) + 1 PASSED (ti_min post-rename) + 3 XFAIL'd. Per spec §6.3 drift policy.

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 4862d91. Configure here.

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.

Python fixture parity for the 6-8 dead-baseline equivalence cases

1 participant