Add runtime safety guardrails #13

Closed
opened 2026-05-05 02:11:08 -04:00 by JackFrostbyte · 1 comment

Title:
Add runtime safety guardrails

Description:
Add safety checks before and during RGB writes to prevent unsafe operation.

Scope:

  • Validate mapping before the loop starts.
  • Refuse to run if expected devices/zones/LED counts mismatch.
  • Refuse to write to zones with empty usable LED lists.
  • Centralize the list of allowed animated logical zones.
  • Add clear error messages.

Acceptance criteria:

  • Controller refuses to run on unsafe mapping.
  • reserved_argb_6_led_zone is explicitly skipped.
  • Allowed animated zones are defined in one place.
Title: Add runtime safety guardrails Description: Add safety checks before and during RGB writes to prevent unsafe operation. Scope: - Validate mapping before the loop starts. - Refuse to run if expected devices/zones/LED counts mismatch. - Refuse to write to zones with empty usable LED lists. - Centralize the list of allowed animated logical zones. - Add clear error messages. Acceptance criteria: - Controller refuses to run on unsafe mapping. - `reserved_argb_6_led_zone` is explicitly skipped. - Allowed animated zones are defined in one place.
Author
Owner

Completed in PR for issue #13.

Implemented runtime safety guardrails for invalid or unsafe runtime options before OpenRGB hardware control begins.

Summary:

  • Added centralized runtime guardrail validation in runtime.py.
  • Kept CLI-side validation in main.py for clear argument errors.
  • Rejects invalid --cycles / --duration combinations.
  • Rejects non-positive --cycles.
  • Rejects non-positive, nan, or inf duration values.
  • Rejects non-positive, nan, or inf scheduler delay values.
  • Rejects delay min values greater than delay max values.
  • Preserves the existing reserved ARGB zone safety behavior.
  • Confirmed normal runtime still completes and restores active zones to dark blue.

Validation passed:

ruff format src/rgb_aura
ruff check src/rgb_aura scripts tests
rgb-aura --cycles 0
rgb-aura --duration 0
rgb-aura --duration nan
rgb-aura --duration inf
rgb-aura --primary-delay-min 0
rgb-aura --primary-delay-min 8 --primary-delay-max 2
rgb-aura --support-delay-min 0
rgb-aura --support-delay-min 8 --support-delay-max 2
PYTHONPATH=src python scripts/validate_device_mapping.py
rgb-aura --duration 10 --leave-dark-blue --seed 12345
Completed in PR for issue #13. Implemented runtime safety guardrails for invalid or unsafe runtime options before OpenRGB hardware control begins. Summary: - Added centralized runtime guardrail validation in `runtime.py`. - Kept CLI-side validation in `main.py` for clear argument errors. - Rejects invalid `--cycles` / `--duration` combinations. - Rejects non-positive `--cycles`. - Rejects non-positive, `nan`, or `inf` duration values. - Rejects non-positive, `nan`, or `inf` scheduler delay values. - Rejects delay min values greater than delay max values. - Preserves the existing reserved ARGB zone safety behavior. - Confirmed normal runtime still completes and restores active zones to dark blue. Validation passed: ```zsh ruff format src/rgb_aura ruff check src/rgb_aura scripts tests rgb-aura --cycles 0 rgb-aura --duration 0 rgb-aura --duration nan rgb-aura --duration inf rgb-aura --primary-delay-min 0 rgb-aura --primary-delay-min 8 --primary-delay-max 2 rgb-aura --support-delay-min 0 rgb-aura --support-delay-min 8 --support-delay-max 2 PYTHONPATH=src python scripts/validate_device_mapping.py rgb-aura --duration 10 --leave-dark-blue --seed 12345
Sign in to join this conversation.
No labels
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
JackFrostbyte/rgb-aura#13
No description provided.