ps_oracle: exit 77 when the oracle becomes unavailable during run() (PS-ORACLE-UNAVAILABLE-EXIT) #917
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/917"
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 ubiquitarianism/leonida. Originally posted by TuroYT on 2026-11-24T15:10:51Z.
Claimed in the coordination issue as: PS-ORACLE-UNAVAILABLE-EXIT (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7135530775)
What was wrong
tools/ps_oracle.pydocuments exit code 77 for a missing tool.main()catchesUnavailableonly around theOracle(...)constructor (line 822). Theo.run(...)call in the next try block does not catch it.assemble()raisesUnavailablewhen no AMD clang is found (line 629), andrun_harness()raises it when vk_harness returns 77 (line 618). Both happen duringrun(), so the user gets a traceback and exit 1.Reproduction on origin/main, with the oracle constructor stubbed (no vk_harness build here) and PATH reduced:
What changed
main()gets a first handler on theo.run(...)try block:except Unavailable as e:printsps_oracle unavailable: {e}to stderr and returns 77. This is the same message the constructor handler already prints. TheValueError/KeyError/IndexError/TypeErrorandRuntimeErrorhandlers are unchanged.tests/test_ps_oracle.py(classCli):test_unavailable_during_run_is_77makesOracle.runraiseUnavailableand checks exit 77 and the exact stderr line.test_value_error_during_run_is_still_2checks that aValueErrorstill returns 2.Tested
ps_oracle unavailable: no AMD clang (...)on stderr, thenexit=77.python3 -I tests/test_ps_oracle.py Clion the fixed code:OK(5 tests).test_unavailable_during_run_is_77on the unfixedtools/ps_oracle.py(checked out from origin/main): ERROR with the sameps_oracle.Unavailable: no AMD clang (test)traceback.python3 -I tests/test_ps_oracle.py: 25 tests, OK, 2 skipped (hardware tests need LEONIDA_PS_ORACLE_BUILD).python3 -I tests/test_ps_helper_probe.py: 6 tests, OK, 1 skipped.python3 -m unittest discover -s tests/semantic -p test_export_valid_mask.py: 24 tests, OK.python3 -I tests/test_text_write_line_endings.py: 3 tests, OK.python3 -I scripts/check_no_game_data.py tools/ps_oracle.py tests/test_ps_oracle.py: no issues.python3 -m compileall -q tools tests: OK.git diff --check: clean.Not tested
run_harness(the test raisesUnavailablefromrun()directly, not throughsubprocess).--show-templateon RADV with a missing llvm-mc. That path is outsiderun()and was not changed.AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-24T17:39:33Z.
Review: APPROVED
LGTM. Measured on Windows 11, Python 3.14, against main
cf4c00cba:python -I tests/test_ps_oracle.py: mainRan 23, OK (skipped=2); this PR and a local merge into mainRan 25, OK (skipped=2).tools/ps_oracle.pyand this PR's tests,test_unavailable_during_run_is_77errors, becauseUnavailableescapesrun(). The new handler (tools/ps_oracle.py:836) sits before theValueError/RuntimeErrorones, and the otherUnavailablepaths already returned 77.AI-assisted: yes (Claude Code ran the checks; I read them).
Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T20:55:38Z.
#917 | head
9dde66b432(merged cleanly with main1bc055e6c2) |python -I tests/test_ps_oracle.py| red on main:FAILED (errors=1, skipped=2)(Cli.test_unavailable_during_run_is_77raised an uncaughtps_oracle.Unavailabletraceback fromo.run(...)instead of exiting77) | green on PR+main:25 ran, OK (skipped=2)(23/23CPU/CLI testsOK) | Windows 11 (10.0.26200.9974), Python 3.12.10 | AI-assisted: yesAudited
tools/ps_oracle.pyandtests/test_ps_oracle.pyon Windows 11, verifyingUnavailableraised duringo.run(lines, sets)prints a single-lineps_oracle unavailable: ...message to stderr and returns skip code77without a traceback whileValueErrorduringrun()continues to return2. Also verifiedtests/test_ci_registration.py(18 OK),tests/test_text_write_line_endings.py(3 OK), andscripts/check_no_game_data.py.Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-28T21:06:05Z.
I checked the real
vk_harnessexit path left open in the test notes. CachyOS, Raphael RDNA2 iGPU, RADV Mesa 26.3.1, Clang 23.1.5. A/B on merge base81bb974c1and merge1cd7ceba8(PR head9dde66b43). The relevant Python and harness sources on the base also match currentmainataa918e5d9.ps_oracle.py --template const --asm constant.s --size 1 1run returned0on both and read back the four float words for(1, 2, 3, 4)from patched ISA.vk_harnessexecutable and setVKH_COLOR_FORMAT=124:2(D16_UNORM) only whenVKH_BINARY_INwas present. The template call succeeded and the real draw call returned77on both. The base CLI exited1with anUnavailabletraceback. The PR CLI exited77with one stderr line,ps_oracle unavailable: unsupported: format 124 is not a color attachment.LEONIDA_AMD_CLANGto a nonexistent file after a successful template build also went from traceback/1to one stderr line/77.Synthetic shader only. AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-29T01:31:30Z.
Verified by OreoFR on macOS 27.2.1 (26B131), Apple M5, APFS (case-insensitive), Python 3.12.16, main
53b77df14: red 1 error (Cli.test_unavailable_during_run_is_77) / green 25 OK.9dde66b43,python -I tests/test_ps_oracle.pyfrom the repository root.Cli.test_unavailable_during_run_is_77: an uncaughtps_oracle.Unavailableescapes instead of exit code 77. MEASURED, failing test(s) alone 3 runs, 3/3 fail.git merge --no-ffof this PR, no conflict): 25 run, OK, 2 skips. MEASURED, the same test(s) alone 3/3 pass.OnHardware.test_other_target_formatsandOnHardware.test_patched_code_runs_as_the_pixel_shaderon both sides ("set LEONIDA_PS_ORACLE_BUILD to a runtime build and select an AMD GPU"), still skipped on macOS.Red = main + only the test files from this PR (
git checkout pr-917 -- tests/test_ps_oracle.py); green = main + the merged PR. When green runs more tests than red, it is because the merge keeps tests main added since the PR branched.AI-assisted: Claude Code (Claude Opus 5.5).
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-29T01:36:11Z.
Merged after OreoFR's red/green check (check) (macOS 27.2.1, Apple M5, Python 3.12) and a local re-check here. Merged after local re-verification: this PR merged onto
maina908ad77ewithout conflict, and its test file(s) (tests/test_ps_oracle.py) pass there. Earlier today the same tests failed onmainwithout the PR (red/green) and a bundle with other open PRs showed no new failures.check_no_game_data.pyis clean. Windows 11, Python 3.14; no GPU needed for these tests.AI-assisted (Claude Code, Claude Opus 5.5), merged for MoonEyes.