Skip to content

fix: update Stuart-Landau runtime#1362

Open
neuron7xLab wants to merge 137 commits into
mainfrom
t2b-runtime-fix
Open

fix: update Stuart-Landau runtime#1362
neuron7xLab wants to merge 137 commits into
mainfrom
t2b-runtime-fix

Conversation

@neuron7xLab

Copy link
Copy Markdown
Owner

Updates Stuart-Landau runtime handling and adds regression tests for issue 1358.

@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: 90b6c79974

ℹ️ 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".

int_steps: int = _DEFAULT_INT_STEPS,
dt: float = _DEFAULT_DT,
seed: int = 42,
fail_closed: bool = False,

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 Propagate fail-closed mode to evidence callers

When the OOS evidence generator calls rolling_es_proximity at benchmarks/rolling_es_proximity_oos.py:185, it omits this new argument, so the default remains the exploratory behavior that converts every per-window ValueError/FloatingPointError into NaN before writing/scoring the artifact. In that evidence context, contract failures are still hidden unless the benchmark is updated to pass fail_closed=True or the default is made fail-closed for evidence paths.

Useful? React with 👍 / 👎.

f"INV-SL contract VIOLATED: K_low<K_high required, "
f"got K_low={K_low}, K_high={K_high}. Source: {source}."
)
if not isinstance(K_steps, int) or K_steps < 2:

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 Accept NumPy integer sweep parameters

This new strict isinstance(..., int) check rejects valid integral values produced by NumPy/pandas parameter grids, such as np.int64(6), even though the previous validation accepted them and range/linspace can use them after normal integer coercion. In experiment sweeps where K_steps or int_steps comes from np.arange/a DataFrame, fit_stuart_landau now fails before running with ValueError: integer K_steps≥2 required; use numbers.Integral or coerce safely instead.

Useful? React with 👍 / 👎.

@neuron7xLab

Copy link
Copy Markdown
Owner Author

Review verdict: REQUEST CHANGES — not mergeable as-is

Reviewed against issue #1358 + reproduced the failing required checks locally.

What's correct (confirmed)

  • P0-2 fitted-state sweep — genuinely fixed. fitted_z0 = (amplitude * np.exp(1j * phase)) is now passed to _hysteresis_sweep(..., z0=fitted_z0) (L278), so the sweep initializes from the analytic state A·exp(iθ), not seeded random noise.
  • μ-clamp audit (_estimate_growth_rate_audit, mu_clamped) and a fail-closed INV-SL guard on z0 shape/finiteness — good.
  • Own tests pass (12).

Blockers — required checks, each reproduced locally

  1. commit-acceptor-validation.claude/commit_acceptors/t2b-runtime-audit.yaml is missing 6 required fields: signal_artifact, rollback_command, rollback_verification_command, memory_update_type, ledger_path, report_path.
  2. python-qualitycore/physics/stuart_landau_es.py is not black-formatted (black --check → "would reformat").
  3. code-hygiene-gate — new god-function fit_stuart_landau (>80 LOC). It cannot be baselined alongside this runtime change: the recalibration meta-gate (feat(meta-gate): recalibration-aware monotonicity — close the metric/policy conflation #1340) rejects a baseline total growing in the same PR as a runtime edit (anti-laundering). → decompose fit_stuart_landau into <80-LOC helpers (fitted-state extraction / growth-rate audit / sweep call).

Scope gap vs #1358

  1. P0-1 (demote INV-T2b) is UNADDRESSED. .claude/physics/INVARIANTS.yaml is untouched; INV-T2b is still active at L200. P0 physics claim-boundary debt: T2b demotion, fitted-state sweep, clamp audit #1358 P0-1 explicitly requires demoting the REJECTED H1 (leads_rate 0.906, p 0.765, REJECT H1) to REJECTED_DO_NOT_PROMOTE / a rejected-hypothesis ledger, keeping INV-SL1/SL2 as universal bounds. Either close it here, or explicitly scope this PR to P0-2/P0-3 and open a follow-up.

Validation layer (in progress)

Running tools/mutation_probe.py (merged in #1361) on core/physics/stuart_landau_es.py against the full T2b test surface — measuring whether the tests actually catch behaviour changes. Gate per the work-axis: <90% kill-rate on claim-critical physics ⇒ survivors become required follow-ups. Result will be appended.

Recommendation: fix 1–3 (mechanical), decide P0-1 scope, re-run CI. The physics direction (fitted-state sweep, μ audit, fail-closed) is sound.

@neuron7xLab

Copy link
Copy Markdown
Owner Author

Validation result — mutation_probe on core/physics/stuart_landau_es.py

Against the T2b test surface (test_T2b_runtime_audit.py + test_T2b_stuart_landau_es.py):

kill-rate 47.1% (49/104), 55 survivors — below the 90% claim-critical-physics gate.

Honest decomposition: 48/55 survivors are intconst/binop/boolconst (numerical tuning constants — the tests verify qualitative invariants, not exact numerics, so most are equivalent). The 7 boolop/compare survivors are real, actionable behaviour gaps — and they cluster in exactly the fail-closed validation this PR cares about:

line guard gap
L138 mu_clip_mass < 0 or not isfinite Or→And survives — negative-but-finite not rejected by a test
L189 not isfinite(K_low) or not isfinite(K_high) single-side-non-finite rejection untested
L199 not int(K_steps) or K_steps < 2 untested per-branch
L204 not int(int_steps) or int_steps < 1 untested per-branch
L209 not isfinite(dt) or dt <= 0 untested per-branch
L402 not isfinite(z0.real) or not isfinite(z0.imag) the NEW z0 fail-closed guard this PR adds is under-tested — Or→And survives (one component inf, other finite, not exercised)
L596 es_proximity > es_threshold explosive-classification boundary not pinned

Per the work-axis, these 7 become required follow-ups before this claim-critical module merges. Most important: L402 — the fail-closed INV-SL guard you added needs a test that feeds z0 with one non-finite component and asserts it raises (currently Or→And is behaviourally invisible to the suite). Add per-component boundary cases for the validation guards, then the kill-rate on the logic operators goes to 100% (the constant survivors are acceptable for physics).

Probing the sibling claim-critical modules next: core/cross_asset_kuramoto/invariants.py, core/kuramoto/second_order.py.

Copy link
Copy Markdown
Owner Author

Debt-closure status for #1358 / #1362:

Runtime/code debt resolved on latest head 80c9de27bcb36f4026bba3c55d1cd8815ba6d230.

Green evidence on the same head:

  • Check Epistemic Drift
  • Physics Invariants
  • Import Architecture Gate
  • Physics Reliability Gate
  • Architecture Debt Ratchet
  • Architectural Connectome Gate
  • Readiness Gate
  • Commit Acceptor Gate
  • Wheel Contract Gate
  • Forbidden Torch JIT Gate
  • Physics Kernel Gate
  • Fail-Closed Guardians
  • Code Hygiene Gate
  • Physics Contracts

PR Gate breakdown:

  • repo-policy: success
  • secrets-supply-chain: success
  • go-workspace-integrity: success
  • dependency-review: success
  • rust-accel-gate: success
  • python-quality: success, including lint/type gate on changed Python files
  • frontend-gate: success
  • constraints-lock-sync: success
  • python-fast-shard matrix: cancelled

No failing pytest node id, lint error, type error, security finding, physics violation, or artifact was produced by the cancelled PR Gate run. This remaining debt is tracked separately as #1363: PR Gate fast-shard cancellation without failing test evidence.

Verdict: #1362 runtime fix is validated by specialized gates; aggregate merge readiness is blocked only by cancelled PR Gate execution lane, not by an observed runtime-code failure.

@neuron7xLab neuron7xLab enabled auto-merge (squash) June 25, 2026 21:52
neuron7xLab and others added 30 commits June 27, 2026 15:51
- python-quality: black-format core/physics/stuart_landau_es.py and
  scripts/check_invariant_registry_schema.py (left black-dirty by concurrent edits).
- clamp registry realigned to post-black line numbers (193/198/354/404).
- component-test-router: map .github/workflows/pr-gate.yml to artifact_freshness
  component so the secrets-exclude edit is a routed (not unmapped-required) surface.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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