Skip to content

feat(tools): resolve NID names with a cached database only - #12876

Merged
oneandonlydean merged 2 commits into
boykopovar:mainfrom
StoneDC:b41/nid-offline
Nov 12, 2026
Merged

oneandonlydean merged 2 commits into
boykopovar:mainfrom
StoneDC:b41/nid-offline

Conversation

@StoneDC

@StoneDC StoneDC commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

What

Add nid_names.py --offline: read an existing cached database directly, reject a missing cache without creating directories, and keep symbol-to-NID calculation independent of the database. Direct read_db() prevents a cache disappearing between its file check and read from falling back to a download.

Integrate current main after #12494 merged and update both negative network guards to patch the downloader's actual urllib.request.urlopen entry point. Preserve main's bounded/atomic online downloader. The missing-cache and disappearing-cache tests now intercept the current network path.

The database can be stale or incomplete; offline mode does not establish firmware authority. No open prerequisite remains.

Tested

Exact tested head: 393ca873d723aaa4bea6377df62913d44fbcd657, including main ac94ac850371e12cde7048c3db59135e19a869c3.

Windows 11 / MinGW GCC 15.2 / CMake 4.3.1 / Python 3.14.3 and 3.12.14; WSL Ubuntu 26.04 / GCC 15.2 / CMake 4.2.3 / Python 3.14.4 and 3.12.16. Real CMake/Ninja Release configurations use ANYPS5_RELINKER_ONLY=ON, BUILD_TESTING=ON and each selected interpreter.

  • ctest --test-dir BUILD -R '^(tools_nid_offline|nid_database_cache|tools_nid_name_audit|test_script_registration)$' -V --output-on-failure --no-tests=error: all 4 registered groups pass in each of the four configurations; 68 unittest methods per configuration. Slowest selected group: 3.52 s. No CTest group is skipped.
  • No Python or CTest skips in any configuration.
  • On Windows and Linux Python 3.14, bypass offline mode in a temporary copy of the actual production module. Each of the two unchanged selected tests fails with AssertionError: network access from its urlopen guard. An independent harness prevents unmocked network access. The committed implementation passes.
  • Current-main conventions with the complete template, whitespace checks, Python 3.9 grammar and registered production-script checks pass.

No full product build, local macOS runtime, PS5/title run or GPU validation is claimed. Hosted results for the new head are reported separately after publication; earlier-head checks are not substituted.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 1835 CMakeLists.txt
PR 7642 CMakeLists.txt
PR 9508 CMakeLists.txt
PR 10193 CMakeLists.txt
PR 10897 CMakeLists.txt
PR 13928 CMakeLists.txt
PR 13929 CMakeLists.txt
PR 14212 CMakeLists.txt
PR 16632 CMakeLists.txt
PR 17654 CMakeLists.txt

@oneandonlydean oneandonlydean self-assigned this Oct 29, 2026

@malekaifa malekaifa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed exact head 5c674b7 against current main bb04a4f. Current-main merge-tree and git diff --check are clean. The new offline tests pass 3/3 on Windows Python 3.12 and WSL Python 3.12.3, and the existing NID suite passes 48/48 on both. The argument normalization is sound: name/symbol/from-file computation returns before DB access, an explicitly empty --nid lookup uses no DB, and real offline NID lookups use read_db directly so a cache disappearing after is_file cannot fall back to download. I also merged this head synthetically with live #12494; the tree is clean and preserves read_db for offline plus #12494's bounded urlopen downloader online. If #12494 lands first, please refresh the two offline network-guard mocks from urlretrieve to urlopen so they continue detecting accidental downloader entry; production integration itself is clean. Hosted eligibility, conventions, intake, labels, Ubuntu/Windows relinker, Windows and ASan are green; only generic macOS relinker jobs are queued. No blocking issue found.

@github-actions github-actions Bot added the build label Oct 29, 2026

@malekaifa malekaifa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed after #12494 merged. The two offline network guards still patch urlretrieve, but current main now downloads through urlopen(..., timeout=DOWNLOAD_TIMEOUT), so those guards no longer prove the offline path blocks network access. Please integrate current main, update both guards to patch urlopen, rerun test_nid_offline plus the existing NID suite, and re-request review. The production offline logic itself still looks structurally compatible; this request is about restoring the negative test coverage against the current download path.

@StoneDC

StoneDC commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor Author

Updated to 393ca873d723aaa4bea6377df62913d44fbcd657 with main ac94ac850371e12cde7048c3db59135e19a869c3.

Addressed the current-main review request: both offline network guards now patch urlopen, matching the downloader introduced by merged #12494. Integrated current main and retained its bounded/atomic online download path.

The missing-cache and cache-disappearing tests both execute. Bypassing offline mode in the actual production module makes each test fail at its urlopen guard (AssertionError: network access) on Windows and Linux, with a harness blocking unmocked networking.

Exact-head validation: Python 3.12 and 3.14 on Windows and Linux, 4/4 focused registered CTest groups passed in all four configurations, 68 unittest methods per configuration, slowest group 3.52 s. No Python or CTest skips in any configuration. Current-main conventions, whitespace, Python 3.9 grammar and script registration pass.

Final hosted results for this exact updated head are recorded below. This PR has now merged.

AI-assisted: yes.

Final hosted CI completion (verified 2026-11-13) for 393ca873d723aaa4bea6377df62913d44fbcd657: 10 executed checks passed, 5 jobs skipped, no pending or failing check.

Skipped jobs (not counted as passes): pipe-write, edge-watch, register-context, write-watch, linux.

The verified head was merged at 2026-11-12T16:08:45Z. This completion update changes no source and claims no new local runtime test.

@ycbuzi

ycbuzi commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

Tested 393ca873d7 merged into main, with the whole ctest suite on each machine below. Nothing fails that does not also fail on main on the same machine.

  • Linux: Debian 13 in ChromeOS's Linux environment on a Pentium Silver N6000 (4 cores, SSE4.2, no AVX), GCC 14.2.0, relinker-only build (-DANYPS5_RELINKER_ONLY=ON): run 1: 100% tests passed, 0 tests failed out of 865; run 2: 100% tests passed, 0 tests failed out of 865; run 3: 100% tests passed, 0 tests failed out of 865.

AI-assisted: yes (Claude Code); the runs are automated, this summary was written from their reports.

@malekaifa malekaifa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed exact head 393ca87. The prior blocker is resolved: both offline negative guards now intercept urlopen, matching the current downloader, and the offline path reads an existing cache directly instead of falling back to download. Local Windows Python 3.12 validation passed tools/tests/test_nid_offline.py (3/3) and the existing tools/tests/test_nid_names.py suite (63/63); git diff --check is clean. Hosted checks have no failures. Approved.

@oneandonlydean
oneandonlydean merged commit 049f360 into boykopovar:main Nov 12, 2026
16 of 17 checks passed
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.

4 participants