Repository navigation
Conversation
devnull34
left a comment
There was a problem hiding this comment.
Verified via Tier 2 Free Cloud & clean-room review: Parsing JSON numbers independently of active locale prevents locale-dependent decimal point conversions (such as comma vs period) from corrupting configuration and telemetry parsers on localized systems.
tupacfan04
left a comment
There was a problem hiding this comment.
The product change is plausible: NumericLocale (runtime/src/shader_library.h:335-359) creates an explicit C LC_NUMERIC per document, uses _strtod_l/strtod_l, never changes the caller's locale, checks locale.handle, and frees it; the decimal, integer/exponent, negative-zero, overflow and stale-errno paths are unchanged. The regression test can skip the only case that matters, though.
test_json_numeric_locale() (runtime/test/shader_library_test.cpp:255-290) loops over C, French_France.1252, German_Germany.1252, fr_FR.UTF-8, de_DE.UTF-8 and increments comma_locales only when a selected locale's radix is ",". At the end:
if (!comma_locales)
std::puts("SKIP: no comma-decimal locale installed; C-locale checks passed");
return 0;There is no CHECK(comma_locales > 0). On a minimal Linux/macOS CI host without fr_FR.UTF-8/de_DE.UTF-8, the test passes while the actual regression (1.5/1.25e2 under a comma-decimal LC_NUMERIC) is unverified; the C-locale cases also pass on the old std::strtod implementation. Require at least one comma locale in the test environment (fail or a hard CI prerequisite), or create/use a guaranteed synthetic comma-decimal locale rather than silently skipping.
Secondary: the portable branch uses newlocale(LC_NUMERIC_MASK, ...)/strtod_l (:353-355), but the PR body says Linux/macOS builds were not run. On glibc, strtod_l is a GNU extension and may need _GNU_SOURCE/the right declaration; confirm with a Linux/macOS build before treating that path as validated. Synthetic/code-read only; no game files. AI-assisted (OpenCode).
|
Independent build + test: PASS AI-assisted (Claude Code). Windows 11 x64, MSVC 19.44.35220 (UCRT), Ninja RelWithDebInfo. GPU (not used): NVIDIA GeForce RTX 3080 driver 621.24 / 32.0.16.2124. Head
So the new test fails on Small note: |
|
Tested 0178ca6 on NVIDIA GeForce RTX 5070 Ti, driver 617.42, Windows 11 build 26300, VS 2022 Build Tools (MSVC 19.44), Windows SDK 10.0.26100, Vulkan SDK 1.4.363.0, RelWithDebInfo: pass. Built Synthetic inputs only, no game files. AI-assisted (Claude Code). |
|
Addressed the missing-coverage concern at af7c1c2. The numeric-locale regression is now a separate executable and CTest ( Windows 11, MSVC 19.44.35230, CMake/Ninja RelWithDebInfo: shader_library, shader_library_numeric_locale and mods pass 3/3. C and all four French/German locale spellings run. The final standalone test with the actual pre-fix header fails on its first French decimal (exit 1); a temporary C-only locale list fails the missing-coverage check (exit 1). For the portable API concern, the independent Debian/glibc and Windows review already compiled and exercised the unchanged production branch with an actual German locale, a failing parent control, and an eight-thread caller-locale check. The new standalone test was run here only on Windows; macOS remains untested. The PR body now also declares the include/test-registration conflict with #8358, alongside the existing #7738 conflict. Resolved combinations pass the locale regression, and #8358's SHA regression passes too. AI-assisted (Codex); CPU only, no game files. Available GPU: RTX 3070 / 610.88, not used. Final cleanup restores shader_library_test.cpp exactly to its base contents and clarifies one test comment. All three focused CTests pass again at af7c1c2; the controls exercised the same test logic before this comment-only cleanup. |
|
Tested af7c1c2 (merged onto main 867d922) on RTX 5070, NVIDIA 621.24, Windows 11 (build 26200), Vulkan validation layer on (
Ran the tests that belong to the test files this PR changes (ctest entries, or the test program directly when it is not registered), with no game files ( |
|
Tested Configured
Code read: one AI-assisted (Claude Code). Synthetic tests only, no game files. |
|
Tested
AI-assisted (Claude Code). |
|
Reviewed af7c1c2, code read only (not built, no MSVC or GPU here), AI-assisted: LGTM. The per-parse locale ( |
When host code selects a comma-decimal LC_NUMERIC, JsonReader rejects valid JSON such as
1.5or{"values":[1.5,-0.25]}. Its strtod call uses the ambient numeric locale, so it stops at the JSON decimal point and rejects the entire document, including shader indexes and mod manifests. The original C-locale behavior works.Use an explicit C numeric locale for each parse, shared by the document's numbers and released on every exit. The Windows path uses _strtod_l; Linux/macOS use strtod_l. This keeps the caller's process/thread locale intact, avoids allocating a locale for each number, and preserves the existing conversion and range-check behavior. The regression covers root and nested numbers, exponents, negative zero, array commas, malformed tokens, overflow, stale errno, and an unchanged caller locale.
Coordination: new RT item, not yet assigned a numbered ID in the board. Original claim: #8047 (comment) . Status carried to the new board: #8186 (comment) . AI-assisted (Codex).
Depends on: #7738 (merge conflict only, not a code prerequisite). Both change adjacent lines in the conversion/range check. Whichever lands second needs to retain this locale conversion and #7738's underflow-aware range check. I extracted that combined result and tested it successfully. This PR does not implement #7738's underflow fix.
Depends on: #8358 (merge conflicts only, not a code prerequisite). The locale headers and SHA feature guards meet at the same include insertion point, and both PRs register a test after shader_library. Keep both include blocks with their own closing #endif, and both test registrations. The combined locale and SHA tests pass locally.
Review follow-up at af7c1c2:
runtime/test/json_numeric_locale_test.cpp, registered separately asshader_library_numeric_locale. On Windows, absence of all comma-decimal locales now fails the test, including the Windows runtime CI job. On minimal POSIX installations it returns 77 and CTest reports a visible skip; it no longer appears as a passing regression inside the general shader-library test. The skip message names the locales to install. Production parsing is unchanged.shader_library_test json_numeric_locale_test mods_test.ctest --test-dir runtime/build-json-locale -R "^(shader_library|shader_library_numeric_locale|mods)$" --output-on-failure -V: 3/3 pass. The locale test exercises C plus all four French/German names in the source; mods passes 48 checks.git diff --checkpass. No game files or GPU execution. The full semantic run below is from the initial production commit; it was not repeated for this C++ test-only follow-up. The new test executable was run on Windows; its POSIX skip branch and macOS execution remain untested here.The existing independent Windows and Debian/glibc review tests the unchanged production code at 0178ca6 with an actual private German locale, a failing parent control, and eight threads retaining their caller locales. That provides POSIX
newlocale/strtod_levidence; it is not a claim that this new test executable has already run on POSIX.Initial production validation at 0178ca6, based on upstream main dde82f2:
cmake -S runtime -B runtime/build-json-locale -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfocmake --build runtime/build-json-locale --target shader_library_test mods_testctest --test-dir runtime/build-json-locale -R "^(shader_library|mods)$" --output-on-failure: 2/2 pass; mods has 48 checks. The JSON regression passes under C, French_France.1252, German_Germany.1252, fr_FR.UTF-8 and de_DE.UTF-8 on this Windows host. At that initial revision, missing comma-decimal coverage only printed a skip message inside a passing test; the follow-up above replaces that behavior.git merge-tree --write-treechecks are clean with shader_library: read a \u surrogate pair as one UTF-8 character #7737 at 8ffb32c, Runtime: reject malformed JSON number syntax before strtod #7962 at 8e93ec5, and runtime: reject unescaped control characters in JSON strings (RT-739) #8114 at 1360169. shader_library: keep JSON numbers that underflow #7738 at 93a80f7 has the one adjacent-line conflict described above. Both CPU suites pass with that conflict resolved to preserve both fixes, and also with the clean runtime: reject unescaped control characters in JSON strings (RT-739) #8114 combination (51 mod checks).python -m compileall -q make_game.py tools tests,python -I make_game.py --help, changed-file/reportscripts/check_no_game_data.py, andgit diff --check: pass.python -I scripts/run_semantic_tests.py tests/semantic: 447 files / 5,956 tests in 292 seconds; the same two known main failures, test_image_atomics_guard (47 failed subcases) and test_image_store_d16 (one stale cube-store expectation), covered by tests/semantic: three image test files red on main (stale after #4473 and #6805; LLVM_MC on Windows) #7284. No Python or translator source changed.Limits of the initial local run: Linux/macOS builds and game execution were not run here. The later independent Debian/glibc check is linked above; macOS remains untested. No floating-point from_chars dependency is reintroduced (the Apple libc++ limitation from #1596 still applies).
Final cleanup restores shader_library_test.cpp exactly to its base contents and clarifies one test comment. All three focused CTests pass again at af7c1c2; the controls exercised the same test logic before this comment-only cleanup.