tools: close oracle in vcmp16_opsel_probe, support argv in main, and guard results (VCMP16-PROBE-GUARDS) #561

Manually merged
github merged 1 commit from gh-pr/561/head into gh-pr/561/base 2026-11-26 09:08:41 +00:00
Owner

@⁠trigger337 on GitHub · 2026-11-24 08:13 UTC · original
trigger337:fix/vcmp16-opsel-probe-lifecycle-and-guards → main · +137 −9 · 2 files · 1 commits · merged 2026-11-24 09:26 UTC

What and why

tools/vcmp16_opsel_probe.py opened the hardware oracle without closing it in a finally block, accepted no argv argument in main(), and indexed oracle.run() directly without verifying whether the runner returned an empty, None, or short result list.

  1. CLI / main() invocation:

    • Accept optional argv in main(argv=None) and forward to ap.parse_args(argv).
  2. Oracle lifecycle:

    • Wrap the probe execution in a try ... finally: oracle.close() block so hardware resources / device state are cleaned up on all exit paths.
  3. Runner error guards:

    • Validate oracle.run() output: flag empty results, None results, or result lists shorter/longer than the expected word count as harness errors with exit code 2 instead of raising unhandled IndexError / TypeError.
  4. Unit test coverage:

    • Add MainAndOracleLifecycleTest in tests/test_vcmp16_opsel_probe.py covering rule mode, hardware success, mismatch, kernel rejection, empty/None/short result lists, and runner unavailability.

Claimed in the coordination issue as: VCMP16-PROBE-GUARDS (#14)

Standard library and synthetic unit tests only; no GPU or game files required.

AI-assisted: yes

**@⁠trigger337** on GitHub · 2026-11-24 08:13 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/561) `trigger337:fix/vcmp16-opsel-probe-lifecycle-and-guards` → `main` · +137 −9 · 2 files · 1 commits · merged 2026-11-24 09:26 UTC ### What and why `tools/vcmp16_opsel_probe.py` opened the hardware oracle without closing it in a `finally` block, accepted no `argv` argument in `main()`, and indexed `oracle.run()` directly without verifying whether the runner returned an empty, None, or short result list. 1. **CLI / `main()` invocation**: - Accept optional `argv` in `main(argv=None)` and forward to `ap.parse_args(argv)`. 2. **Oracle lifecycle**: - Wrap the probe execution in a `try ... finally: oracle.close()` block so hardware resources / device state are cleaned up on all exit paths. 3. **Runner error guards**: - Validate `oracle.run()` output: flag empty results, `None` results, or result lists shorter/longer than the expected word count as harness errors with exit code 2 instead of raising unhandled `IndexError` / `TypeError`. 4. **Unit test coverage**: - Add `MainAndOracleLifecycleTest` in `tests/test_vcmp16_opsel_probe.py` covering rule mode, hardware success, mismatch, kernel rejection, empty/None/short result lists, and runner unavailability. Claimed in the coordination issue as: VCMP16-PROBE-GUARDS (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14) Standard library and synthetic unit tests only; no GPU or game files required. AI-assisted: yes
tools/vcmp16_opsel_probe.py opened the hardware oracle without closing it in a
finally block, accepted no argv argument in main(), and indexed oracle.run() directly
without verifying whether the runner returned an empty, None, or short result list.

- Support optional argv in main(argv=None).
- Close oracle in a finally: block on exit.
- Guard oracle.run() output, reporting empty, None, or short result counts as harness
  errors with exit code 2.
- Add comprehensive MainAndOracleLifecycleTest covering rule mode, hardware success,
  mismatch, kernel rejection, empty/None/short result lists, and runner unavailability.

AI-assisted: yes
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:08:39 +00:00
github manually merged commit d95facb71b into gh-pr/561/base 2026-11-26 09:08:41 +00:00
Author
Owner

@⁠QemmHD on GitHub · 2026-11-24 09:26 UTC · original

Merging. Why merged: vcmp16_opsel_probe always closes the hardware oracle, accepts argv, and refuses empty, None or short results.
Why it's good: test_vcmp16_opsel_probe 7 -> 15 passed (8 of the new tests fail on main); clean on main 7430f59; consistency 565/0.

AI-assisted (Claude Code, Claude Opus 5.5).

**@⁠QemmHD** on GitHub · 2026-11-24 09:26 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/561#issuecomment-7127422997) Merging. Why merged: vcmp16_opsel_probe always closes the hardware oracle, accepts argv, and refuses empty, None or short results. Why it's good: test_vcmp16_opsel_probe 7 -> 15 passed (8 of the new tests fail on main); clean on main 7430f59; consistency 565/0. AI-assisted (Claude Code, Claude Opus 5.5).
This discussion has been locked. Commenting is limited to contributors.
No description provided.