Skip to content

Commit e394100

Browse files
OVVO-Financialgithub-actions[bot]
authored andcommitted
Inspect R API update 8afda7ce27a1167c63f9c01df1de9521ed442b17
1 parent 3c2b753 commit e394100

225 files changed

Lines changed: 75368 additions & 1352 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

sync/last_live_r_parity_report.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,15 @@
33
- Plan: `sync/last_r_api_plan.json`
44
- R checkout: `upstream/NNS`
55
- Fresh cache requested: `False`
6-
- Skip install: `False`
7-
- Live R recompute: `True`
6+
- Skip install: `True`
7+
- Live R recompute: `False`
88

9-
## Result: live R parity diverged
9+
## Result: fresh cache required
1010

11-
Mapped parity tests recomputed every R value from the freshly installed live R NNS and the Python implementation did not match. Public Python behavior differs from live R at the recorded commit.
11+
The plan reports `requires_fresh_cache=true` (for example a `DESCRIPTION` version change). Re-run this workflow with `--fresh-cache` / `fresh_cache=true` to regenerate the parity cache from empty against live R.
1212

13-
Failing command: `/opt/hostedtoolcache/Python/3.11.15/x64/bin/python -m pytest -q -n 0 tests/parity/test_practical_examples.py tests/parity/test_r13_smoke.py`
14-
Exit status: `1`
13+
## Workflow step outcome
14+
15+
- `run_live_r_parity_for_changed_api.py` step outcome: `failure`
16+
- Fresh cache requested: `false`
17+
- DESCRIPTION changed: `true`

sync/last_r_api_inspection.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,26 @@
22

33
## Changed files
44

5-
- `R/ARMA.R`
5+
- `DESCRIPTION`
6+
- `NNS_13.1.tar.gz`
7+
- `NNS_13.1.zip`
68

79
## Affected Python modules
810

9-
- `src/nns/arma.py`
11+
- `pyproject.toml`
12+
- `tests/_r_cache.json`
13+
- `tools/NNS`
1014

1115
## Parity tests to run
1216

13-
- `tests/parity/test_practical_examples.py`
14-
- `tests/parity/test_r13_smoke.py`
17+
- `tests/parity`
1518

1619
## Cache scope
1720

18-
- `NNS.ARMA`
19-
- `NNS.ARMA.optim`
20-
- `NNS.VAR`
21+
- None mapped
2122

2223
## Required actions
2324

24-
- Fresh cache required: `False`
25+
- Fresh cache required: `True`
2526
- Export review required: `False`
2627
- Unmapped R files present: `False`

sync/last_r_api_plan.json

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
{
22
"changed_files": [
3-
"R/ARMA.R"
3+
"DESCRIPTION",
4+
"NNS_13.1.tar.gz",
5+
"NNS_13.1.zip"
46
],
57
"affected_python_modules": [
6-
"src/nns/arma.py"
8+
"pyproject.toml",
9+
"tests/_r_cache.json",
10+
"tools/NNS"
711
],
812
"parity_tests": [
9-
"tests/parity/test_practical_examples.py",
10-
"tests/parity/test_r13_smoke.py"
13+
"tests/parity"
1114
],
12-
"cache_scope": [
13-
"NNS.ARMA",
14-
"NNS.ARMA.optim",
15-
"NNS.VAR"
16-
],
17-
"requires_fresh_cache": false,
15+
"cache_scope": [],
16+
"requires_fresh_cache": true,
1817
"requires_export_review": false,
1918
"has_unmapped_r_files": false,
2019
"unmapped_r_files": [],

sync/nns_source.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
22
"r_repo": "OVVO-Financial/NNS",
3-
"r_commit": "905b8bbd42b3236bf88aba7f18df7a9a378dbd7b",
4-
"r_version": "13.0",
5-
"r_src_tree_hash": "654e411bd4e8caabfd57a1a4190eb1d97411e059",
3+
"r_commit": "8afda7ce27a1167c63f9c01df1de9521ed442b17",
4+
"r_version": "13.1",
5+
"r_src_tree_hash": "c8573263d230468f75b89cf739b95735151fac3a",
66
"core_repo": "OVVO-Financial/NNS-core",
77
"core_commit": "cfc25a3469df6460f9224fb976fcb58de9d58068",
88
"python_repo": "OVVO-Financial/NNS-python",
99
"python_commit": null,
1010
"vendored_core_path": "extern/NNS-core",
1111
"vendored_r_path": "tools/NNS",
12-
"vendored_r_tarball": "tools/NNS_13.0.tar.gz",
12+
"vendored_r_tarball": "tools/NNS_13.1.tar.gz",
1313
"r_cache_path": "tests/_r_cache.json",
1414
"notes": "NNS-python consumes accepted NNS-core snapshots for native code and verifies public Python behavior against live or cached R NNS."
1515
}

tools/NNS/.Rbuildignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
^.*\.Rproj$
2+
^\.Rproj\.user$
3+
^\.travis\.yml$
4+
^doc$
5+
^Meta$
6+
^\.github/
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Downstream sync contract
2+
3+
`OVVO-Financial/NNS` is the source of truth for the NNS implementation. It is
4+
the truth for **both** the native C++ layer under `src/**` and the R API
5+
behavior under `R/**`, `NAMESPACE`, and `DESCRIPTION`.
6+
7+
Downstream flow (a diamond, not a single chain):
8+
9+
```text
10+
OVVO-Financial/NNS (source of truth: R + C++ src/**)
11+
/ \
12+
src/** native truth R API behavior truth
13+
v v
14+
NNS-core (portable C++) (tested directly)
15+
\ |
16+
v v
17+
NNS-python <-------------+
18+
```
19+
20+
Two paths converge on `NNS-python`:
21+
22+
* **Native path:** `src/**` is the native C++ truth. It flows to `NNS-core`
23+
(the portable C++ layer), which in turn feeds `NNS-python`.
24+
* **API path:** `R/**`, `NAMESPACE`, and `DESCRIPTION` define the R API
25+
behavior truth, which is tested directly and flows straight to `NNS-python`
26+
for API and parity review.
27+
28+
`NNS-python` sits at the convergence of both paths and must satisfy both.
29+
30+
## Triggers
31+
32+
A push to `NNS-Beta-Version` dispatches downstream sync events based on changed files.
33+
34+
| Changed path | Downstream action |
35+
| ------------- | ----------------------------------------------------------------------------- |
36+
| `src/**` | Dispatch `nns-r-src-updated` to `OVVO-Financial/NNS-core` |
37+
| `R/**` | Dispatch `nns-r-api-or-version-updated` to `OVVO-Financial/NNS-python` |
38+
| `NAMESPACE` | Dispatch `nns-r-api-or-version-updated` to `OVVO-Financial/NNS-python` |
39+
| `DESCRIPTION` | Dispatch `nns-r-api-or-version-updated` and require downstream version review |
40+
41+
A `DESCRIPTION` version change means downstream Python must perform fresh live-R parity-cache regeneration.
42+
43+
## Required secret
44+
45+
`OVVO_SYNC_TOKEN` must be a token or GitHub App installation token with permission to call `repository_dispatch` on:
46+
47+
* `OVVO-Financial/NNS-core`
48+
* `OVVO-Financial/NNS-python`
49+
50+
The default `GITHUB_TOKEN` is intentionally not used for cross-repo dispatch, because it is scoped to this repository and cannot reliably trigger `repository_dispatch` on the downstream repositories.
51+
52+
## Payload
53+
54+
Dispatch payloads include:
55+
56+
* `r_repo`
57+
* `r_commit`
58+
* `r_ref`
59+
* `r_version`
60+
* `r_src_tree_hash`
61+
* `src_changed`
62+
* `r_api_changed`
63+
* `description_changed`
64+
* `changed_files`
65+
66+
## Expected downstream events
67+
68+
* `nns-r-src-updated` — received by `OVVO-Financial/NNS-core` when `src/**` changes.
69+
* `nns-r-api-or-version-updated` — received by `OVVO-Financial/NNS-python` when `R/**`, `NAMESPACE`, or `DESCRIPTION` changes.
70+
71+
## Rule
72+
73+
No downstream sync is complete until each downstream repository records the exact upstream R commit and verifies its own build and parity gates.

tools/NNS/.github/workflows/ci.yml

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
name: R-CMD-check
2+
3+
on:
4+
push:
5+
branches: ["NNS-Beta-Version"]
6+
pull_request:
7+
branches: ["NNS-Beta-Version"]
8+
workflow_dispatch:
9+
10+
jobs:
11+
R-CMD-check:
12+
runs-on: ${{ matrix.config.os }}
13+
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
config:
18+
- {os: windows-latest, r: 'release'}
19+
- {os: windows-latest, r: 'devel'}
20+
- {os: ubuntu-latest, r: 'release'}
21+
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
22+
- {os: macos-latest, r: 'release'}
23+
24+
env:
25+
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
26+
_R_CHECK_FORCE_SUGGESTS_: false
27+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
28+
RGL_USE_NULL: true
29+
R_KEEP_PKG_SOURCE: yes
30+
31+
steps:
32+
- uses: actions/checkout@v4
33+
34+
- name: Install system libraries (Ubuntu)
35+
if: runner.os == 'Linux'
36+
run: |
37+
sudo apt-get update
38+
sudo apt-get install -y libgsl-dev libjpeg-turbo8-dev libpng-dev libtiff5-dev libfreetype6-dev libharfbuzz-dev libfribidi-dev xorg-dev
39+
40+
- name: Install dependencies on macOS
41+
if: runner.os == 'macOS'
42+
run: |
43+
brew update
44+
brew install xquartz fribidi gsl
45+
echo "PKG_CPPFLAGS=-I$(brew --prefix gsl)/include" >> "$GITHUB_ENV"
46+
echo "PKG_LIBS=-L$(brew --prefix gsl)/lib -lgsl -lgslcblas -lm" >> "$GITHUB_ENV"
47+
48+
- uses: r-lib/actions/setup-r@v2
49+
with:
50+
r-version: ${{ matrix.config.r }}
51+
52+
- uses: r-lib/actions/setup-r-dependencies@v2
53+
with:
54+
extra-packages: any::rcmdcheck
55+
needs: check
56+
57+
- name: Check
58+
uses: r-lib/actions/check-r-package@v2
59+
with:
60+
args: 'c("--no-manual", "--ignore-vignettes", "--no-build-vignettes")'
61+
error-on: '"error"'
62+
63+
ubsan-clang-docker:
64+
name: UBSAN clang
65+
runs-on: ubuntu-latest
66+
steps:
67+
- uses: actions/checkout@v4
68+
69+
- name: Run UBSAN check inside container
70+
run: |
71+
docker run --rm --platform linux/x86_64 \
72+
--cap-add=SYS_PTRACE \
73+
-e UBSAN_OPTIONS="print_stacktrace=1:halt_on_error=0" \
74+
-e RGL_USE_NULL=true \
75+
-v "${GITHUB_WORKSPACE}:/data" -w /data \
76+
rocker/r-devel-ubsan-clang bash -lc '
77+
set -euo pipefail
78+
79+
echo "::group::Update and Align System"
80+
apt-get update -y
81+
# This forces the image to sync its internal versions to avoid the libgbm1 conflict
82+
DEBIAN_FRONTEND=noninteractive apt-get dist-upgrade -y
83+
echo "::endgroup::"
84+
85+
echo "::group::Install system dependencies"
86+
# Removed libgl1-mesa-dev and libglu1-mesa-dev to avoid the Sid conflict
87+
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
88+
cmake libgsl-dev libcurl4-openssl-dev libssl-dev libxml2-dev \
89+
libjpeg-dev libpng-dev libtiff5-dev libfreetype6-dev \
90+
libharfbuzz-dev libfribidi-dev
91+
echo "::endgroup::"
92+
93+
echo "::group::Install R package dependencies"
94+
RD -q -e "install.packages(c(\"remotes\", \"rcmdcheck\", \"Rfast\", \"rgl\", \"recipes\"), repos=\"https://cloud.r-project.org\", Ncpus=2)"
95+
RD -q -e "remotes::install_deps(dependencies = TRUE, repos=\"https://cloud.r-project.org\")"
96+
echo "::endgroup::"
97+
98+
echo "::group::Run R CMD check with UBSAN"
99+
RD CMD check --no-manual --ignore-vignettes --no-build-vignettes . > ubsan_check.out 2> ubsan_check.err || true
100+
cat ubsan_check.err
101+
echo "::endgroup::"
102+
'
103+
104+
- name: Check for UBSAN errors
105+
run: |
106+
if grep -iE "(runtime error|sanitizer)" ubsan_check.err; then
107+
echo "::error::UBSAN detected runtime errors."
108+
exit 1
109+
fi
110+
111+
- name: Upload UBSAN logs
112+
if: always()
113+
uses: actions/upload-artifact@v4
114+
with:
115+
name: ubsan-logs
116+
path: |
117+
ubsan_check.out
118+
ubsan_check.err
119+
*.Rcheck/

0 commit comments

Comments
 (0)