Skip to content

fix: repository-wide correctness and contract hardening - #79

Merged
TheHiddenObserver merged 364 commits into
masterfrom
agent/code-review-fixes
Jul 24, 2026
Merged

fix: repository-wide correctness and contract hardening#79
TheHiddenObserver merged 364 commits into
masterfrom
agent/code-review-fixes

Conversation

@TheHiddenObserver

@TheHiddenObserver TheHiddenObserver commented Jul 11, 2026

Copy link
Copy Markdown
Owner

Summary

This PR completes the repository-wide review → reproduce → fix → test → re-review cycle for PR79, covering backend consistency, statistical contracts, NumPy/CuPy/Torch execution, validation infrastructure, documentation, and physical GPU evidence.

Final status

Ready to merge. All maintained validation gates passed.

Current head

  • PR head: 23c6fe9d87ba3ea4478a84e59765057a07ab6c0d
  • Final reviewed production head before documentation synchronization: c85750d63d4e6dbc9d988847566c20f5fa862e91
  • Exact-head GitHub Actions: Tests run #556 — success

Exact-head verification

Suite Result
static-contracts PASS
Canonical accuracy smoke PASS
Full CPU suite PASS — 1074 passed, 275 skipped, 0 failed
Python regression matrix 3.9 PASS
Python regression matrix 3.10 PASS
Python regression matrix 3.11 PASS
Python regression matrix 3.12 PASS
Maintained physical P100 GPU validation PASS — 33/33 executed checks

Final correctness changes

  1. Backend and inference correctness hardening across LinearRegression, CoxPH, Panel models, and GPU paths.
  2. Rank-deficient inference handling: fitted-space contracts remain validated while non-identifiable coefficient-space covariance/BSE checks are NOT_COMPARABLE.
  3. Delayed-entry CoxPH contract:
    • robust/cluster covariance + delayed entry + compute_inference=True → explicit NotImplementedError;
    • delayed entry + robust/cluster cov_type + compute_inference=False → estimation remains available without inference outputs.
  4. PR79 validation infrastructure:
    • strict JSON validation;
    • canonical evidence aggregation;
    • provenance/SHA validation;
    • Markdown rendering only from validated artifacts;
    • Python 3.9-compatible report output.

Documentation and artifact synchronization

  • Rewrote the English and Chinese CoxPH support matrix with the compute_inference dimension.
  • Updated the English and Chinese Panel pages with backend-preserving prediction, stable HAC time_index ordering, effective-rank df_resid, and rank-deficient NOT_COMPARABLE semantics.
  • Updated README, root/English/Chinese changelogs, bilingual release notes, and the auditable PR79 validation report.
  • Removed stale hard-coded results/pr79/final/final_accuracy_report.json and .md; a new full canonical report may be committed only after an exact-head full raw campaign is processed through the current aggregator and renderer.
  • Created follow-up Issue test: convert legacy GPU diagnostic scripts into maintained pytest coverage #83 for ignored legacy GPU diagnostic scripts.

Non-blocking follow-ups

Merge recommendation

Squash and merge.

@TheHiddenObserver TheHiddenObserver changed the title fix: harden backend contracts and statistical utilities fix: repository-wide correctness and contract hardening Jul 11, 2026
TheHiddenObserver and others added 29 commits July 12, 2026 10:57
TheHiddenObserver and others added 12 commits July 23, 2026 18:07
- _formula.py: _formula_predict() returns X as-is for non-formula
  (array) input, instead of np.asarray(X) which fails on CuPy/Torch.
  Caller (PooledOLS.predict) already does xp_asarray() downstream.
- run_accuracy.py: revert time_index workaround, clean fit_kwargs.
…ce guard

- run_accuracy.py: _require_finite_results accepts non_identifiable_fields;
  rank-deficient PooledOLS marks _bse/_tvalues/_pvalues/_conf_int as
  not_comparable instead of raising FloatingPointError.
- _cox.py: re-add self.compute_inference to entry+robust guard (reverted
  by merge from other agent).
…f BSE in validator

- Add 8 missing PR79 test files to git (were only local)
- Add aggregate_results.py and expected_accuracy_manifest.json
- Validator: skip _finite_array(stored BSE) for rank-deficient models
  where _rank_deficient=True flag is set by the accuracy runner
…uard

- emit_final_report.py: full renderer with ReportValidationError,
  load_json_strict, validate_aggregated_report, render_markdown,
  emit_report, argparse CLI (--config/--validated/--output-json/
  --output-markdown); SHA cross-check against embedded provenance
- numerical.py: guard all covariance/BSE branches with
  not rank_deficient in validate_least_squares_final_state
- CoxPHCV guard: add compute_inference check to entry+robust
  rejection (match CoxPH contract)
- Test fixes: entry+robust+compute_inference=True →
  NotImplementedError; entry+robust+compute_inference=False →
  fit succeeds with _bse/_conf_int None

Co-Authored-By: Claude <noreply@anthropic.com>
…e 3.10

Use Path.open('w', newline=...) + handle.write() instead.

Co-Authored-By: Claude <noreply@anthropic.com>
@TheHiddenObserver
TheHiddenObserver merged commit 4a7c7d6 into master Jul 24, 2026
6 checks passed
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.

2 participants