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

Closed
opened 2026-11-26 20:18:26 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/561
Author: @trigger337
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/24/2026
Merged by: @QemmHD

Base: main ← Head: fix/vcmp16-opsel-probe-lifecycle-and-guards


📝 Commits (1)

  • d95facb tools: close oracle in vcmp16_opsel_probe, support argv in main, and guard results

📊 Changes

2 files changed (+137 additions, -9 deletions)

View changed files

📝 tests/test_vcmp16_opsel_probe.py (+117 -0)
📝 tools/vcmp16_opsel_probe.py (+20 -9)

📄 Description

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://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7125854727)

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

AI-assisted: yes


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/561 **Author:** [@trigger337](https://github.com/trigger337) **Created:** 11/24/2026 **Status:** ✅ Merged **Merged:** 11/24/2026 **Merged by:** [@QemmHD](https://github.com/QemmHD) **Base:** `main` ← **Head:** `fix/vcmp16-opsel-probe-lifecycle-and-guards` --- ### 📝 Commits (1) - [`d95facb`](https://github.com/ubiquitarianism/leonida/commit/d95facb71b6fd4cbfe8ced45c07d0734a95bec1e) tools: close oracle in vcmp16_opsel_probe, support argv in main, and guard results ### 📊 Changes **2 files changed** (+137 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_vcmp16_opsel_probe.py` (+117 -0) 📝 `tools/vcmp16_opsel_probe.py` (+20 -9) </details> ### 📄 Description ### 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://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7125854727) Standard library and synthetic unit tests only; no GPU or game files required. AI-assisted: yes --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:18:26 +01:00
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#607
No description provided.