fix(tools): read the EnvironmentNumber environment reader in env_reference #8995
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/8995"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by dantdmdarealguy on 2026-10-21T09:01:49Z.
What
docs/dev/ENVIRONMENT.mdis meant to list everyAPS5_*andANYPS5_*name the code reads, andtools/env_reference.pywith the env-reference rule ofcheck_conventions.pykeeps it complete. The Windows crash report readsAPS5_CRASH_STACK_BYTESthrough itsEnvironmentNumberhelper (core/libs/prx/libc/src/specifics/windows/CrashReport.cppL259-267, added by127ee82f0).env_reference.pydoes not know that reader, so the name has no row in ENVIRONMENT.md and neither check reports it. Only USAGE.md names it.env_reference.pynow recognizesEnvironmentNumber("<name>")as an integer reader, in its forms and in thegit greppattern thatcheck_conventions.pyuses. ENVIRONMENT.md gets theAPS5_CRASH_STACK_BYTESrow in the libc table, and its list of readers now includesEnvironmentNumber. The row's description follows the code: the value is decimal or0xhexadecimal, capped at 1048576 bytes, and 0 or unset prints nothing.test_env_reference.pygets anEnvironmentNumberread, expected as an integer with no default, and aMyEnvironmentNumber(...)call that must not count as a read.Tested
Windows 11 Pro, Intel Core i9-14900K, 128 GB RAM, NVIDIA GeForce RTX 5080 (driver 32.0.16.1742), WinLibs GCC 15.2.0, Release build with
BUILD_TESTING=ON.python tools/tests/test_env_reference.py: on unmodifiedmainwith the new test file,FAILED (failures=1),Items in the second set but not the first: 'APS5_CRASH_STACK_BYTES'. With this change:Ran 8 tests ... OK.python tools/env_reference.py --check: onmainthe output does not mentionAPS5_CRASH_STACK_BYTES. With the new row butmain'senv_reference.py, it reportsAPS5_CRASH_STACK_BYTES has a row in docs/dev/ENVIRONMENT.md but the code no longer reads it. With this change it reports no error about the name. Onmainand on this branch it still reportsAPS5_NO_WGI, which #8657 documents.ctest --test-dir build --output-on-failure --timeout 120 --parallel 2 -R "^(env_reference|conventions_env_reference|windows_crash_stack_words|windows_crash_without_stack_words|patched_libraries)$": 5/5 passed,357 patched libraries loaded, 0 failed.tests/windows_backtrace_report_tests.exe faultwas run withbuild/core/libs/libs/unpatchedonPATH:APS5_CRASH_STACK_BYTES=256and=0x100:stack words from rsp ... (APS5_CRASH_STACK_BYTES):followed by 8 rows of 4 words (256 bytes).=0and unset: no stack words.python tools/check_conventions.py --base origin/main:All conventions checks passed.python tools/check_test_registration.py build:1153 test executable(s), 0 built and not run as recorded, none new.python tools/pr_overlap.py --branch agent/envsweepreports no overlap with the PRs it could compare. It could not compare 14 PRs that change ENVIRONMENT.md and conflict withmain(#5431, #6186, #6636, #6879, #6924, #6946, #6947, #7484, #7604, #7642, #8077, #8246, #8484, #8971). None of their diffs mentionAPS5_CRASH_STACK_BYTES,EnvironmentNumberor the readers paragraph.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-21T09:45:58Z.
Linux data point for
103484d0be: WSL2 Ubuntu 24.04 (a virtualised kernel, not bare-metal Linux), Python 3.12, PR head alone (not merged ontomain),python3 -I -m unittest discover -s tools/tests -p test_env_reference.py.tools/env_reference.pyrestored to the merge-base (the PR's tests kept): 1 failure (test_reads_find_every_reader_form_and_ignore_other_names).Not tested: macOS, Windows, a merge onto current
main.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by harisibrar1 on 2026-10-21T14:08:26Z.
Review: APPROVED
Verified on Windows 11, Python 3.14, merged onto main
80565c594:python tools/tests/test_env_reference.py: 8 tests OK;python tools/tests/test_check_conventions_env_reference.py: 9 tests OK (merged and at the PR head).tools/env_reference.py:test_env_reference.pyfails (failures=1), so the new fixture lines catch the change.python tools/env_reference.py --checkon the merged tree: the only error is the existingAPS5_NO_WGI(#8657).APS5_CRASH_STACK_BYTESis detected and documented, and nothing else is newly reported.EnvironmentNumberhas one definition and one call site in core/ (CrashReport.cpp:259and:267); no other unrecognizedAPS5_*/ANYPS5_*reader turned up. The other matching calls are test-side setters.ns::EnvironmentNumber("...")and padded parentheses and rejectsMyEnvironmentNumber/EnvironmentNumberOr. Like the existing readers it does not see templated calls, calls split across lines or a second argument, which is fine for the single call site.strtoull(text, nullptr, 0)also parses a leading0as octal, soAPS5_CRASH_STACK_BYTES=0400means 256 bytes; the row could say "decimal, 0x hexadecimal or 0-prefixed octal".python tools/check_conventions.py: passes.Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.
Imported from boykopovar/AnyPS5. Originally posted by THEMANnt on 2026-10-23T14:52:13Z.
Review: APPROVED
Reviewed head
103484d0be3e359f2fe577af09b4bf59ca61b7eb.On Windows with Python 3.11.9, baseline, pristine PR and candidate each passed 8 env_reference tests and 9 conventions tests. Whitespace and conventions checks passed. The old-code/new-tests control failed the expected assertion for discovering
APS5_CRASH_STACK_BYTES.EnvironmentNumberis recognized as an integer reader. Its specific reader regex uses a word boundary to exclude names such asMyEnvironmentNumber; it is also included in the broader GREP prefilter. The documentation row matches the inspected Windows helper and stack-reporting caller, including default 0 and the 1 MiB cap.This was Python test execution and static source verification; the native crash handler was not built or executed. No actionable findings in the reviewed scope.