Skip to content

fix(#127 review round 21): close four review findings, align release metadata with the H-only gate - #154

Merged
marcohost33-maker merged 4 commits into
fix/115-zweiskalen-car1from
claude/next-steps-zmsugb
Sep 14, 2026
Merged

fix(#127 review round 21): close four review findings, align release metadata with the H-only gate#154
marcohost33-maker merged 4 commits into
fix/115-zweiskalen-car1from
claude/next-steps-zmsugb

Conversation

@marcohost33-maker

@marcohost33-maker marcohost33-maker commented Sep 13, 2026

Copy link
Copy Markdown
Owner

Summary

Stacked on PR #127 (fix/115-zweiskalen-car1), four commits. Closes four of the nine unresolved review threads on #127 and aligns CITATION.cff / CHANGELOG.md with the Hermiticity contract that the cross-family review settled on 2026-09-12 (H-only, dissipation is diagnostic). Each finding was reproduced on e556c96 before the change and is pinned by a test that fails without it (tests/test_pr127_review_round21.py, 24 tests, measured pre-fix values in the docstrings).

thread on #127 finding change
relaxation.py:897 residual_model reported "car1_fallback_ar1" with 5/5 success=False (stationary run) availability read off FitResult.success first; family classified among successful fits only; new label "ar1_unavailable"
car1.py:205 estimate_car1_theta returned NaN at residual amplitude 1e-170 (4e-7 drift at 1e-150), switching the whitening on amplitude alone residuals normalised to unit maximum before anything squares them; degeneracy read off the maximum
relaxation.py:818 two bare np.linalg.eigvals solves inside the relaxation layer, after the spectral layer had certified a spectrum compute_relaxation_layer(eigenvalues=, spectrum_resolved=); diagnose() forwards SpectralResult.eigenvalues only when the zero-mode certificate is resolved; zero re-solves in the pipeline
relaxation.py:989 persisted report could not say which mode samples_per_fast_efolding describes (three-scale grid: the intermediate one) RelaxationResult.worst_resolved_rate / _blind_interval / _blind_start, additive, NaN-defaulted; docstring corrected
CITATION.cff:159 release metadata described the superseded max(coherent, dissipation) reference and called E3 open both records now state the coherent-component contract; the generator-relative reference never shipped
lindblad.py:213 round-off-only pure-gauge Q I Q^H is refused not changed (reply on the thread): the requested allowance is exactly the round-18 `deps

Three Codex rounds on this PR (all five threads resolved): 141badf gates the spectrum forwarding on the certificate verdict (an applicable-but-unresolved certificate yields NaN resolution metadata instead of a missed mode read off the rejected spectrum); e7e17d2 extends that gate to caller-supplied grids, which used to skip the spectral layer and launch a bare eigensolve; 4dd8c61 refuses spectrum_resolved=True without eigenvalues with a ValueError instead of re-solving.

Not touched here, on purpose: the CAR(1) likelihood / parameter-count trio (gls.py:194, gls.py:119, relaxation.py:637) is one modelling decision that moves anchors and is waiting on Marco per the 2026-09-07 status on #127; the non-normal zero-mode displacement (linalg.py:1054) is issue #117.

Scope

  • Bug fix (no new feature)
  • New diagnostic or layer (please link the motivating reference)
  • Performance / sparse-path / numerics improvement
  • Docs / examples / packaging only — partly: CITATION.cff, CHANGELOG.md, docs/explanation/layers-and-taxonomy.md
  • CI / workflow / security
  • Release / packaging / publish evidence

Verification

  • pytest -q passes locally: 1426 passed, 12 skipped (QuTiP not installed), exit 0 on 4dd8c61 (Python 3.11.15)
  • tests/test_anchors.py unchanged (byte-identical to main), 21 passed
  • ruff check src tests benchmarks exit 0; mypy src/liouscope exit 0
  • If touching MANIFEST_SCHEMA.json: n/a — the run-manifest contract is untouched; the new RelaxationResult fields are additive and defaulted
  • If new external dependency: none
  • If touching .github/workflows/: not touched
  • If touching claims/docs/release wording: the CITATION/CHANGELOG change removes a claim that contradicted the code; it adds no status claim
  • If touching branch protection / required checks: not touched
  • CI matrix test 3.10-3.14 + qutip-cross-check 3.11/3.12: 7/7 SUCCESS on 4dd8c61 (runs 34765925307 / 34765925315, 2026-09-13 15:32-15:42 UTC); mergeable_state = clean; all review threads resolved

Quality contract

  • This PR does not introduce unsupported production-ready, externally certified, PyPI-published, DOI/Zenodo-archived, or release-complete wording
  • This PR preserves the research / pre-clinical disclaimer
  • False-pass and rework risk considered: every new test was run against the pre-fix head and failed there (values in the docstrings); the amplitude-invariance tolerance is set at the estimator's measured round-off floor (7e-8 relative), not at a value that would also pass the pre-fix 4e-7 drift

Reproducibility note

Seed 1 with bootstrap_B=5 in the new tests; fixtures are the two- and three-qubit amplitude-damping generators already used by tests/test_relaxation_grid_scale.py and the stiff four-level jump network of tests/test_spectral_certificate.py. Existing CAR(1) estimates move only at the estimator's round-off floor (~1e-8 relative); no anchor moves. Numerics of accepted Hermiticity inputs are unchanged; the message text of the refusal grew by one sentence.

History note (AGENTS.md): new branch from the #127 head, no history rewritten, no force-push; the 2026-05-16 incident (unverified branch delete + GH-GC, ~20 files recovered from the backup triple) is why this stacks instead of amending. Merge into fix/115-zweiskalen-car1 as a merge commit, not a squash, so the head SHA stays reachable from #127.

Linked issues

Refs #127, #122, #115. Does not close an issue.

🤖 Generated with Claude Code

https://claude.ai/code/session_018JKJek43ESjfnQB79Hejxp

…elease metadata with the H-only gate

Four findings from the 2026-09-11/12 external review of PR #127, each
reproduced on e556c96 before the change and pinned by a test that fails
without it (tests/test_pr127_review_round21.py, 16 tests):

- residual_model claimed a whitening for runs in which no fit succeeded:
  availability is now read off FitResult.success first and the family is
  classified only among successful fits; new label "ar1_unavailable" for a
  uniform grid with no successful fit (measured: "car1_fallback_ar1" with
  5/5 success=False on rho_initial == rho_steady_state).
- estimate_car1_theta returned NaN when the residuals' raw sum of squares
  underflowed (NaN at amplitude 1e-170, 4e-7 drift at 1e-150), so the
  residual AMPLITUDE alone switched fit_gls_ar1 to the AR(1) fallback:
  residuals are normalised to unit maximum before anything squares them.
- the relaxation layer re-solved the spectrum with a bare np.linalg.eigvals
  twice per run: compute_relaxation_layer takes eigenvalues=, diagnose()
  forwards SpectralResult.eigenvalues, decay_rates/fastest_decay_rate/
  samples_per_fast_efolding accept the same keyword.
- the persisted report could not say which mode samples_per_fast_efolding
  described: RelaxationResult gains worst_resolved_rate,
  worst_resolved_blind_interval and worst_resolved_blind_start (additive,
  NaN-defaulted), the docstring of the scalar is corrected.

CITATION.cff and CHANGELOG.md described the superseded generator-relative
Hermiticity reference and called the dissipation question open; both now
record the settled coherent-component contract (cross-family review,
2026-09-12). The refusal message of both builders gains a hint to pass the
Hermitian part for a round-off-only pure-gauge H.

Verification (local, Python 3.11.15, no QuTiP): pytest -q 1419 passed,
12 skipped, exit 0; tests/test_anchors.py 21 passed (byte-identical);
ruff check exit 0; mypy src/liouscope exit 0.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018JKJek43ESjfnQB79Hejxp
@marcohost33-maker
marcohost33-maker marked this pull request as ready for review September 13, 2026 14:39
@marcohost33-maker marcohost33-maker added the agent:claude PR authored by Claude Code label Sep 13, 2026 — with Claude

@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: bb397ff096

ℹ️ 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 thread src/liouscope/_diagnostics.py Outdated
…tion layer

Codex review on PR #154: with the certified spectrum now forwarded
unconditionally, an applicable-but-unresolved zero-mode certificate (the
predicate under which the spectral layer withholds D1/D3/D4) still fed the
relaxation layer, whose resolution warning and the new worst_resolved_*
fields then named a specific missed mode read off the rejected candidate
spectrum. Measured on the stiff four-level network at fast rate 1e8:
worst_resolved_rate = 1e8, blind interval 0.127, start 0.0,
samples_per_fast_efolding = 7.9e-8, with D1 = NaN in the same report.

compute_relaxation_layer gains spectrum_resolved=; diagnose() derives it
from the same certificate predicate it already uses for D16 and forwards
the eigenvalues only when True. When False the layer derives nothing from
the spectrum: legacy window (the withheld gap already implies it), no
resolution guard, no warning, no eigensolve of its own, and the four
spectrum-derived fields are NaN. A direct caller who omits the gap gets
the flag from the same spectral-layer call.

Three tests added (diagnose path, no-eigensolve spy, direct-caller path).
pytest -q: 1422 passed, 12 skipped, exit 0; ruff 0; mypy 0; anchors
byte-identical.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018JKJek43ESjfnQB79Hejxp

@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: 141badf619

ℹ️ 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 thread src/liouscope/diagnostics/relaxation.py
…supplied grids too

Codex review on 141badf: a direct caller who supplies t_grid but neither
eigenvalues nor spectrum_resolved skipped the spectral-layer call, so the
resolution guard launched a bare eigensolve and, on the stiff unresolved
fixture, persisted worst_resolved_rate ~= 1e8 with an
UnderResolvedTransientWarning -- the missed mode the pipeline path had just
withheld.

spectrum_resolved is now bool | None. Whenever the caller supplies neither
a spectrum nor a verdict, the layer runs the spectral layer once (the same
call that already served the default window) and reads both the verdict and
the eigenvalues from it, for caller grids as well; passing eigenvalues alone
counts as the caller's assertion that they are trustworthy. Four tests
added: caller grid on the unresolved fixture (NaN fields, no warning, no
bare eigensolve beyond the certified solver's own), caller grid on a
healthy generator still names the mode, explicit eigenvalues are honoured.
Two spy tests corrected: a second spy wrapped the first and double-counted.

pytest -q: 1425 passed, 12 skipped, exit 0; ruff 0; mypy 0; anchors
byte-identical.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018JKJek43ESjfnQB79Hejxp

@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: e7e17d2b06

ℹ️ 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 thread src/liouscope/diagnostics/relaxation.py
Comment thread src/liouscope/diagnostics/relaxation.py
Comment thread src/liouscope/diagnostics/relaxation.py
…nvalues

Codex review on e7e17d2: a caller grid with an explicit spectrum_resolved=True
and no eigenvalues skipped the spectral layer, and the resolution guard ran
the bare eigensolve the contract exists to prevent -- 1e8 again on the stiff
unresolved fixture. True is an assertion about the eigenvalues the caller
passes; without them there is nothing it can be about, so the pair is now a
ValueError instead of a silent re-solve. Test added on a healthy and on the
stiff generator. pytest -q: 1426 passed, 12 skipped; ruff 0; mypy 0.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018JKJek43ESjfnQB79Hejxp
@marcohost33-maker
marcohost33-maker merged commit 2c5fcc0 into fix/115-zweiskalen-car1 Sep 14, 2026
7 checks passed
@marcohost33-maker
marcohost33-maker deleted the claude/next-steps-zmsugb branch September 14, 2026 04:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent:claude PR authored by Claude Code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants