Skip to content

Add repaired-R parity workflow, fixture tooling, and MReg refactor to support repaired R artifacts - #108

Closed
OVVO-Financial wants to merge 19 commits into
mainfrom
codex/complete-audit-safe-maximum-performance-regression
Closed

Add repaired-R parity workflow, fixture tooling, and MReg refactor to support repaired R artifacts#108
OVVO-Financial wants to merge 19 commits into
mainfrom
codex/complete-audit-safe-maximum-performance-regression

Conversation

@OVVO-Financial

@OVVO-Financial OVVO-Financial commented Jul 13, 2026

Copy link
Copy Markdown
Owner

Status

This PR is a draft parity-repair branch. It is not ready to merge.

Current scope

  • Adds repaired-R validation, fixture generation, verification, and import tooling.
  • Refactors multivariate regression internals into reusable model preparation and prediction paths.
  • Begins aligning Python NNS.reg and NNS.stack behavior with the repaired R implementation.

Current authoritative R reference

The workflow is temporarily pinned to merged R commit:

21be6d92d8ad23f0848191b094aded0dd6df8f74

A subsequent R estimator-alignment commit is still required before fixtures can become authoritative. Once that commit exists and passes R tests/checks, this PR must be repinned again.

Blocking parity work

  • R NNS.stack must expose the hidden Method 1 trace through options(NNS.stack.trace.env = ...).
  • Multivariate ALL candidate selection must use the same single-k estimator as final NNS.reg(..., n.best = "all").
  • Genuine univariate Method 1 must use direct univariate NNS.reg semantics.
  • Python Method 1 must move from fold-local best-k voting to complete pooled OOF candidate scoring with global early stopping and a separate ALL sentinel.
  • Exact R fixtures must be generated and imported from the final aligned R SHA.
  • Every existing parity failure must be classified and resolved; no category F may remain.
  • Pure-Python parity must reach zero failures before native optimization begins.

Changes made during audit

  • Converted the PR to draft.
  • Repinned the workflow from stale R commit 54c98418... to 21be6d92... as an interim merged reference.
  • Updated the R invariant script to consume the hidden trace environment rather than searching the public return object.
  • Removed committed raw pytest logs; future logs belong in CI artifacts.

Validation status

The current branch has not yet produced authoritative post-alignment R fixtures. Previous claims that R validation and fixture generation had completed were premature. The current 55 parity failures remain unresolved until executable fixtures from the final aligned R commit are imported.


Codex Task

@OVVO-Financial
OVVO-Financial marked this pull request as draft July 13, 2026 13:50

Copy link
Copy Markdown
Owner Author

I audited the current PR head (50aa92ed981846b9a6f320a5e333e8d5b866311f) against the latest merged R reference (21be6d92d8ad23f0848191b094aded0dd6df8f74). This PR is not parity-ready yet and has been converted to draft to prevent an accidental merge.

Blocking issues:

  1. The workflow is pinned to stale R SHA 54c98418c2a11499ebb1c456570d2b66c37eb817 and stale fixture namespace repaired_r_13_1_54c98418. The current R line is 21be6d92..., and a post-merge estimator-alignment commit is still required before any fixture generation.

  2. tests/parity/check_repaired_r_stack_invariants.R looks for a trace inside the public NNS.stack return value and sets NNS.stack.return.method1.trace = TRUE. The intended R design uses a hidden environment via options(NNS.stack.trace.env = trace_env). As written, the invariant workflow must fail even after trace support is added correctly.

  3. Python src/nns/stack.py still performs fold-local Method 1 selection: each fold searches its own candidate path, applies early stopping within the fold, picks a fold-specific best k, and then takes a mode across folds. The repaired R behavior pools complete OOF predictions by conceptual candidate, scores each candidate on identical coverage, applies early stopping globally, and always evaluates ALL separately.

  4. Python represents ALL as n_rows before fold RPM construction. That is not a stable conceptual candidate because fold RPM row counts vary. ALL must remain a distinct sentinel through CV and resolve to the full-data RPM count only for the public return/final fit.

  5. Python uses _mreg_predict_path for the entire candidate set including ALL. The repaired R requirement is bounded local path 1:floor(sqrt(n)) plus one true single-k ALL prediction, not an all-k path through the RPM.

  6. True one-column Method 1 is still forced through the multivariate preparation/search path. Repaired R must use direct univariate NNS.reg semantics because univariate n.best is not the same estimator family.

  7. The PR body states R validation and fixture generation were executed, but the repository contains only .gitkeep fixture namespaces and the 55 failures remain unresolved. The statement should be corrected until an actual workflow run and artifact import exist.

  8. Raw pytest-54c98418.txt and pytest-full.txt logs should not remain committed after structured classification is complete.

Required order of work:

  • finish and test the post-merge R NNS.stack alignment on top of 21be6d92...;
  • obtain the exact new R commit SHA;
  • repin workflow/importer/verifier/generator and create a new SHA-addressed fixture namespace;
  • fix the invariant script to consume NNS.stack.trace.env;
  • run the R workflow and import executable fixtures;
  • rewrite Python Method 1 to pooled complete-OOF candidate scoring with global early stopping and a separate ALL sentinel;
  • handle genuine univariate Method 1 directly;
  • classify all 55 failures with no category F remaining;
  • require pure-Python parity to reach zero failures before native acceleration.

Do not mark this PR ready until those gates pass.

Copy link
Copy Markdown
Owner Author

Parity work has continued on the PR branch.

New commits:

  • e90e0395ca849cd689df893cd8396ef0db7ed95c — added a standalone pooled-OOF Method 1 selector that enforces candidate-1 reference coverage, excludes partial/empty candidates, applies early stopping only to complete pooled scores, evaluates ALL separately, and preserves first-candidate tie behavior.
  • 506d18f901719d363b238675f7887bc5f2add36b — added focused invariants for complete coverage, empty-candidate rejection, global stopping, mandatory ALL eligibility, and deterministic tie selection.

This isolates and tests the repaired selection semantics before replacing the current fold-local implementation in src/nns/stack.py. The next step is to wire fold candidate generation into this selector, preserving ALL as a conceptual sentinel and handling true univariate Method 1 separately.

No parity-completion claim is being made yet: these commits have not produced an Actions run, and the final aligned R SHA/fixtures remain pending.

Copy link
Copy Markdown
Owner Author

Implemented the repaired Method 1 path on the PR branch.

Latest commits:

  • 7e0e5d02fdc5a0a098e9634cdb7acb682c31d38e — complete pooled-OOF Method 1 runtime: bounded local candidates, separate single-k ALL, complete coverage enforcement, global early stopping, pooled classification thresholding, direct univariate handling, and final production refit.
  • 5fb0f31262417bea1e3b8495973b68c4bc1d7313 — installs the repaired implementation for both top-level and direct nns.stack imports.
  • 1cf94e994594d8613c27b51b8e547431d3d61152 — updates pooled selector tests to the candidate-aware evaluator contract.

Current CI runs:

  • Native backend CI run 29258271320 is in progress across Python 3.11–3.14.
  • Repaired R parity run 29258271071 is in progress.

No green/parity claim until those runs complete and any failures are resolved.

@OVVO-Financial
OVVO-Financial deleted the codex/complete-audit-safe-maximum-performance-regression branch July 14, 2026 03:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant