Skip to content

Pin parity to the updated R NNS 14.0, regenerate the R cache in the oracle's environment, and bump to 2.3.0 - #199

Merged
OVVO-Financial merged 5 commits into
mainfrom
claude/nns-r14-parity-fidelity-rgag0e
Nov 13, 2026
Merged

OVVO-Financial merged 5 commits into
mainfrom
claude/nns-r14-parity-fidelity-rgag0e

Conversation

@OVVO-Financial

@OVVO-Financial OVVO-Financial commented Nov 13, 2026 •

Copy link
Copy Markdown
Owner

Summary

The R repository rebuilt NNS_14.0.tar.gz on 13 November (9c8bd21; the same archive is still committed at de5d4fe). It's a speed pass that moves interpreted R loops into compiled code. On the pinned R 4.5.0 it changes no result, and the port stays bit-identical to R. No package code changes.

This PR re-pins the oracle, rebuilds the R cache from it, fixes two workflow problems found along the way, and bumps the package to 2.3.0.

Oracle update (2d90253)

  • Every cache shard regenerated from the new archive under R 4.5.0: 2,999 entries in 149 shards. None changed between the earlier 14.0 build (7b07a83) and this one.
  • 37 entries differ from the previous cache, all stale. Each one reproduces identically on both R builds, so they had been written by another R installation.
    • Two of them, NNS.diff on x^3 at 2 and on x^4 - 3x at −2, were what test_nns_diff_matches_r had been fitted to, by writing the powers as repeated multiplication.
    • R 4.5.0 evaluates x^n with libm pow. The test functions now do the same (and use R_cpow_n's repeated squaring for the complex step), and the port matches R exactly.
    • 3 orphaned entries that no test requests were dropped.
  • Live sweeps against the new build at exact equality (rtol = atol = 0), with and without the native extension: all 10,265 cases match in each mode. So do two new checks: 84 large multivariate NNS.reg predictions (every distance, n.best, tied coordinates) and 110 edge cases of the newly compiled paths.
  • Full suite passes cache-only: 3,232 tests with the native extension, 3,208 without. Ruff and mypy are clean.
  • Manifest and docs: sync/nns_source.json and docs/parity.md record the new commit and archive hash (754dad65…).
    • Three overlays mirror R C++ files that this update rewrote for speed (central_tendencies.cpp, NNS_dep.cpp, NNS_mreg_predict.cpp). They keep the source they were ported from and record the oracle they were verified against in a new verified_r_commit field. The provenance test checks that field.

Workflow fixes (9d818e6, re-applied in 48e03f7; labelled workflow-change-approved)

  1. inspect-r-api-update.yml now regenerates in the oracle's environment. It used setup-r's current release (R 4.6.2) with OpenBLAS on ubuntu-latest. That is why Regenerate R parity cache for NNS 14.0 #198's cache could not pass the exact parity tests. The job now:

    • runs on ubuntu-24.04;
    • installs CRAN's r-base-core/r-base-dev 4.5.0-3.2404.0 (held), selects the reference BLAS/LAPACK, and uses Ubuntu's r-cran-rcpp, r-cran-rcppparallel and r-cran-jsonlite;
    • stops unless R reports exactly that environment.

    It also regenerates tests/invariants' entries along with tests/parity's, so cache-only verification doesn't miss them, and records the source archive's hash in the manifest. The install and the environment check were exercised on a machine with that exact setup.

  2. r14-reproduction.yml is restored and protected. The baseline job removed it from main on Bump the version to 2.2.0 #194 because it wasn't on the protected list. It's back, pinned to 9c8bd21, and added to workflow-baseline.yml's list so unlabelled PRs keep it.

The baseline job reverted these when the PR opened (27b89cb). 48e03f7 puts them back now that the label is on, and the job skipped that push.

Version 2.3.0 (1c400f8)

pyproject.toml, nns.__version__, the README's current-version line and uv.lock all move to 2.3.0. scripts/check_version_consistency.py and uv lock --check pass.

Before merging

"Files changed" should show 23 files: the 16 above, the three workflow files and the four version files. If the workflow files are missing, the baseline revert is back in place.

After merging

  • Regenerate R parity cache for NNS 14.0 #198 (the R 4.6.2 regeneration) is superseded and can be closed.
  • Optionally, run Regenerate R parity cache (workflow_dispatch, r_commit 9c8bd21a77b377cb49d43fececc662d62b00a94e, r_version 14.0, NNS_14.0.tar.gz, NNS_14.0.zip). Its regenerated cache should then match the committed one.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Wws6NpuQ72C5sfEYVoVmGt

claude and others added 3 commits November 13, 2026 22:53
The R repository rebuilt NNS_14.0.tar.gz on 13 November (9c8bd21, the
same archive through de5d4fe): a speed pass that moved interpreted loops
into compiled code (NNS.copula, NNS.part, NNS.dep, classification
prediction, integer-degree LPM.VaR/UPM.VaR, NNS.meboot's rho targets,
dy.d_ stencils, a pruned neighbour search in multivariate NNS.reg).

Every cache shard was regenerated from the new archive under the pinned
R 4.5.0. None of the 2,999 cached results changed between the two 14.0
builds. 37 entries differ from the previous cache, and each reproduces
identically on the old (7b07a83) and the new build: they had been written
by another R installation. Two of them, NNS.diff on x^3 at 2 and on
x^4 - 3x at -2, were what test_nns_diff_matches_r had been fitted to, by
writing the powers as repeated multiplication. R 4.5.0 evaluates x^n with
libm pow, so the test functions now do the same (and R_cpow_n's repeated
squaring for the complex step); the port then matches R exactly.

Live sweeps at exact equality against the new build, with and without
the native extension: all 10,265 cases match in each mode, as do 84
large multivariate predictions and 110 edge cases of the newly compiled
paths. The full suite passes cache-only with and without the native
extension.

sync/nns_source.json records the new commit and archive hash. The three
overlays whose R sources were rewritten keep the source they were ported
from and record the oracle they were verified against
(verified_r_commit); the provenance test checks that instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Wws6NpuQ72C5sfEYVoVmGt
…eproduction

inspect-r-api-update.yml regenerated the cache under setup-r's current R
release (4.6.2 on 13 November) with OpenBLAS on ubuntu-latest, not under
the environment docs/parity.md pins, so its cache moved results by an ulp
or more and could not pass the port's exact parity tests (#198). The job
now runs on ubuntu-24.04 with CRAN's R 4.5.0 build (4.5.0-3.2404.0, held),
the reference BLAS and LAPACK selected, and Ubuntu's Rcpp, RcppParallel
and jsonlite, and stops unless R reports exactly that. It regenerates
tests/invariants' entries as well as tests/parity's, so cache-only
verification does not miss them, and records the source archive's hash
in the manifest along with the commit.

r14-reproduction.yml was removed from main by the baseline job on #194
because it was not on the protected list. It is restored, pinned to the
current oracle (9c8bd21, NNS_14.0.tar.gz sha256 754dad65...), and added
to the list so unlabelled pull requests keep it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Wws6NpuQ72C5sfEYVoVmGt
The workflow-baseline job reverted the three workflow files when this
pull request opened (27b89cb), before it had the workflow-change-approved
label. The label is on now, so this puts them back.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Wws6NpuQ72C5sfEYVoVmGt
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Wws6NpuQ72C5sfEYVoVmGt
@OVVO-Financial OVVO-Financial changed the title Pin parity to the updated R NNS 14.0 and regenerate the R cache in the oracle's environment Pin parity to the updated R NNS 14.0, regenerate the R cache in the oracle's environment, and bump to 2.3.0 Nov 13, 2026
@OVVO-Financial
OVVO-Financial merged commit ab7c6a1 into main Nov 13, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants