Skip to content

feat(tooling): Add YAML-driven qualification harness.#168

Open
Charly-sketch wants to merge 5 commits into
mainfrom
feat/add-yaml-qualification
Open

feat(tooling): Add YAML-driven qualification harness.#168
Charly-sketch wants to merge 5 commits into
mainfrom
feat/add-yaml-qualification

Conversation

@Charly-sketch
Copy link
Copy Markdown
Contributor

@Charly-sketch Charly-sketch commented May 5, 2026

Closes #124
Closes #125

Summary

Add a fourth validation tier to the tooling: YAML-driven human-in-the-loop qualification sessions for checking that a real sensor reacts coherently to real-world perturbations.

Unlike unit tests and scripted hardware captures, qualification tests intentionally involve an operator (breathe on the sensor, warm the board, cover it, etc.) and compare the observed measurements against declarative per-phase assertions.

This PR introduces the generic Python harness, Makefile integration, session logging, and a first reference scenario for HTS221.

Changes

  • Added scripts/qualify.py, a YAML-driven qualification runner that:

    • loads tests/qualification/<driver>/qualify.yaml
    • flashes the paired qualify.ino
    • opens serial before OpenOCD reset
    • walks interactive human-guided phases
    • captures serial measurements during each phase
    • evaluates declarative assertions (min, max, delta_vs, delta_min, delta_max)
    • archives the full session under logs/qualification/
    • exits non-zero on any failed assertion or failed operator confirmation
  • Added PyYAML to requirements.txt

  • Added dynamic Makefile qualification integration:

    • make list-qualification
    • auto-generated make qualify-<driver> targets from tests/qualification/*
  • Added qualification documentation section to tests/TESTING.md

  • Added first end-to-end reference qualification scenario for HTS221:

    • tests/qualification/hts221/qualify.yaml
    • tests/qualification/hts221/qualify.ino
  • Added logs/qualification/.gitkeep for archived session outputs

  • Reused the existing flash/reset plumbing introduced by the recent tooling stack (flash-* / capture-* family)

Checklist

  • make lint passes (clang-format)
  • make build passes (PlatformIO)
  • make test-native passes (if native tests exist)
  • make test-hardware passes on a connected STeaMi (if hardware tests exist)
  • README updated (if adding/changing public API)
  • Examples added/updated (if applicable)
  • Commit messages follow conventional commits format

Adds a human-in-the-loop qualification test tier driven by YAML scenarios.

The runner:
- flashes a per-driver qualification sketch
- opens serial before reset (OpenOCD)
- walks interactive phases declared in YAML
- captures measurements per phase
- evaluates assertions (min, max, delta_vs, delta_min, delta_max)
- archives full session logs

Make integration:
- auto-generated `qualify-<driver>` targets
- `make list-qualification` for discovery

Includes a reference scenario for HTS221.

This introduces a fourth validation layer beyond unit/integration tests:
ensuring that sensors react coherently to real-world perturbations.

Closes #124
@Charly-sketch Charly-sketch requested a review from nedseb May 5, 2026 13:17
@github-actions github-actions Bot added the enhancement New feature or request label May 5, 2026
@nedseb nedseb requested a review from Copilot May 5, 2026 13:43
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a new “qualification” validation tier to the repo’s tooling: YAML-driven, human-in-the-loop sessions that flash a qualification sketch, capture serial measurements during operator-guided phases, evaluate declarative assertions, and archive a full session log under logs/qualification/.

Changes:

  • Introduces scripts/qualify.py to run interactive, YAML-defined qualification scenarios (capture + assertion evaluation + log archival).
  • Adds Makefile integration to discover scenarios under tests/qualification/* and expose list-qualification / qualify-<driver> targets.
  • Adds initial HTS221 reference scenario (qualify.yaml + qualify.ino) and updates testing documentation; adds PyYAML to Python constraints.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
tests/TESTING.md Documents the new qualification tier and how to run scenarios.
tests/qualification/hts221/qualify.yaml Defines an example HTS221 interactive qualification scenario with delta/min/max assertions.
tests/qualification/hts221/qualify.ino Streams machine-readable HTS221 measurements for the harness to capture.
scripts/qualify.py Implements the YAML-driven qualification runner (flash/reset/capture/assert/log).
requirements.txt Pins PyYAML for the new runner.
Makefile Auto-discovers qualification scenarios and generates qualify-<driver> targets.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/TESTING.md
Comment thread scripts/qualify.py
Comment thread scripts/qualify.py
Comment thread scripts/qualify.py
Comment thread scripts/qualify.py
Comment thread Makefile
Wrap phase names in brackets in all log records to avoid ambiguity
when phase names contain spaces.
Run OpenOCD with cwd=ROOT so relative config paths (interface/...,
target/...) resolve correctly regardless of invocation directory.

Use absolute path to .venv/bin/pio and run with cwd=ROOT so the
qualification runner works regardless of invocation location.

Emit clear error when <signal>_delta_vs is missing or invalid instead
of reporting a confusing 'None' reference phase.
Make qualify-<driver> depend on setup so the virtualenv and Python
dependencies (PyYAML, pyserial) are always available on fresh checkouts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(hts221): Add qualification YAML scenario and streamer sketch (level 3) tooling: Build the YAML-driven qualification-test harness (level 3)

3 participants