Skip to content

feat(intent-cases): markdown reporter, baseline diff, auto-discovery, deterministic m2v warmup - #60

Merged
JarbasAl merged 2 commits into
devfrom
feat/intent-case-reporter-md
May 14, 2026
Merged

JarbasAl merged 2 commits into
devfrom
feat/intent-case-reporter-md

Conversation

@JarbasAl

@JarbasAl JarbasAl commented May 14, 2026 •

Copy link
Copy Markdown
Member

Follow-up to #58. Adds the missing pieces needed to actually surface the intent-case accuracy data in a PR review without diving into action logs, and removes the last sleep-based race.

1. Markdown report (--ovoscope-accuracy-md=PATH)

Renders the per-(pipeline, lang, intent) pivot as Markdown with collapsible <details> sections. Drops directly into the gh-automations PR-comment workflow as a new 🎯 Intent-Case Accuracy section alongside the existing 🔌 Skill Tests / 🚌 Bus Coverage panels (matching PR: OpenVoiceOS/gh-automations#32).

Includes a Hardest utterances table (top-N by cross-pipeline pass rate) so reviewers can immediately see which phrasings need locale tuning. --ovoscope-accuracy-top-n controls the cut-off (default 10).

2. Structural baseline diff

Replaces the previous scalar overall_accuracy < baseline gate with a per-case structural diff:

  • Regressed — was-pass in baseline, now-fail
  • Recovered — was-fail in baseline, now-pass
  • Added / Removed — case lists that changed between runs

The PR comment lists regressed cases verbatim (pipeline / lang / intent / utterance) and the session fails if any regression is present. JSON output now carries a baseline_diff block for downstream tooling.

3. Auto-discovery via conftest

Skills can opt-in to intent-case tests with zero Python in their test module:

# test/end2end/conftest.py
ovoscope_intent_cases = dict(
    skill_id="my-skill.author",
    handlers={"WhoAreYou.intent": "MySkill.handle_who", ...},
)

A new pytest_configure walks loaded conftest modules and calls register_intent_case_tests() automatically. The explicit API stays supported.

4. Deterministic m2v warmup

Replaces the time.sleep(10) in _shared_minicroft with a bus-event wait: listen for padatious:register_intent until quiet for 0.5 s, then pad for the in-plugin 3 s handle_sync_intents debounce. Falls back to a sleep on any failure so the suite stays robust to FakeBus internals changing.

Tests

test/unittests/test_intent_cases.py — 7 unit tests covering the case-file loader, the summary roll-ups (incl. new by_utterance rollup), the structural baseline diff, and the Markdown emitter (sections, baseline diff section). Runs in <1 s, no MiniCroft required.

Test plan

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added CLI options --ovoscope-accuracy-md and --ovoscope-accuracy-top-n for enhanced accuracy reporting.
    • Improved accuracy reporting with Markdown output, baseline comparison, and "hardest utterances" ranking.
    • Added baseline diff detection to identify regressed and recovered cases.
    • Enhanced pytest auto-discovery for intent test cases.
  • Tests

    • Added comprehensive unit tests for intent case utilities and accuracy reporting functionality.

Review Change Stack

Three follow-up improvements to the intent-case test framework:

1. **Markdown report (--ovoscope-accuracy-md=PATH)**
   Render the per-(pipeline, lang, intent) pivot as Markdown with
   collapsible sections. Drops into the gh-automations PR-comment
   workflow as a new '🎯 Intent-Case Accuracy' section alongside the
   existing skill-tests and bus-coverage panels. Also surfaces a
   'Hardest utterances' table (top-N by cross-pipeline pass rate)
   so reviewers can see which phrasings need locale tuning.

2. **Structural baseline diff**
   Replace the scalar pass-rate baseline gate with a full diff:
   identifies which (pipeline, lang, intent, utterance) cases
   regressed (was-pass -> now-fail) vs recovered. The PR comment
   now lists the regressed cases verbatim, and the session fails
   if any regression is detected. JSON output includes a
   baseline_diff block for downstream tooling.

3. **Auto-discovery via conftest**
   Skills can now opt in to intent-case tests by declaring a single
   dict in test/end2end/conftest.py:

       ovoscope_intent_cases = dict(
           skill_id='my-skill.author',
           handlers={...},
       )

   The pytest plugin walks loaded conftest modules at configure
   time and calls register_intent_case_tests() automatically.
   The explicit API stays supported and unchanged.

Plus a deterministic m2v warm-up: instead of time.sleep(10), wait for
the burst of padatious:register_intent events to settle (quiet-window
heuristic) then pad for the 3 s in-plugin debounce. Falls back to a
sleep if the bus introspection fails for any reason.

7 new unit tests cover the loader, summary, baseline diff, and
markdown emitter — no live MiniCroft required, runs in <1 s.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented May 14, 2026 •

Copy link
Copy Markdown

Warning

Rate limit exceeded

@JarbasAl has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 43 minutes and 28 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: fd269f4a-9dc1-4af4-a7ec-f6e8fc5b1df4

📥 Commits

Reviewing files that changed from the base of the PR and between 1115c16 and 9182c06.

📒 Files selected for processing (1)
  • ovoscope/pytest_plugin.py
📝 Walkthrough

Walkthrough

This PR enhances intent test reliability and accuracy reporting. It introduces deterministic M2V sync waiting for warmup, adds pytest auto-discovery for intent case configurations, extends accuracy summary with per-utterance rollups, and generates baseline-aware Markdown reports that detect regressed/recovered test cases with hardest-utterance highlighting.

Changes

Intent Testing & Accuracy Reporting Enhancements

Layer / File(s) Summary
M2V Deterministic Sync Waiting
ovoscope/intent_cases.py
Adds _wait_for_m2v_sync helper that subscribes to intent registration events, emits mycroft.ready, and waits for event quieting within a timeout plus grace period. Integrates into _shared_minicroft to replace immediate sleep when m2v_warmup > 0, with fallback to basic sleep on error.
Pytest Auto-Discovery Integration
ovoscope/intent_cases.py, ovoscope/pytest_plugin.py
Introduces autodiscover_from_conftest to read ovoscope_intent_cases config from conftest namespaces and resolve relative cases_dir paths. Marks registered namespaces with _ovoscope_intent_cases_registered flag. Hooks pytest_configure to auto-discover and register intent case tests from imported conftest modules, catching discovery errors gracefully.
Per-Utterance Accuracy Rollups
ovoscope/pytest_plugin.py
Extends _accuracy_summary to track per-utterance statistics including total/pass counts and failing pipeline names per (lang, intent, utterance), enabling downstream hardest-utterance ranking and baseline regression analysis.
Baseline-Aware Accuracy Reporting
ovoscope/pytest_plugin.py
Adds --ovoscope-accuracy-md and --ovoscope-accuracy-top-n CLI options. Implements _baseline_diff to classify cases as regressed/recovered/added by comparing baseline and current results at case level, and _accuracy_markdown to render Markdown with summary tables, hardest-utterance sections, and optional baseline-diff regressions/recoveries.
Terminal Summary & Accuracy Gating
ovoscope/pytest_plugin.py
Extends pytest_terminal_summary to load baseline JSON, compute baseline diff, write JSON report with diff details, write Markdown report with baseline sections and hardest-utterance limiting, and update accuracy gate to fail on regressed cases or overall accuracy below threshold.
Unit Tests for Intent Cases & Accuracy Helpers
test/unittests/test_intent_cases.py
Adds unit tests for load_intent_cases discovery/parsing, _accuracy_summary rollup aggregation, _baseline_diff classification logic, and _accuracy_markdown rendering, including baseline-diff section validation.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

A rabbit hops through test cases with glee,
M2V syncs deterministically!
Baselines compared, regressions found—
Markdown reports leap all around. 🐰📊✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 52.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and comprehensively summarizes the four main features added: markdown reporter, baseline diff, auto-discovery, and deterministic m2v warmup. It is specific, clear, and reflects all primary changes in the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/intent-case-reporter-md

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

github-actions Bot commented May 14, 2026 •

Copy link
Copy Markdown
Contributor

Automated check summary ready. 📊

I've aggregated the results of the automated checks for this PR below.

🏷️ Release Preview

A detailed preview of the next release cycle. 🎬

Current: 0.16.0a1 → Next: 0.17.0a1

Signal Value
Label feature
PR title feat(intent-cases): markdown reporter, baseline diff, auto-discovery, deterministic m2v warmup
Bump minor

⚠️ No conventional commit prefix — alpha-only bump.
Suggested: fix: update the thing or feat: update the thing


🚀 Release Channel Compatibility

Predicted next version: 0.17.0a1

Channel Status Note Current Constraint
Stable ⚪ Not in channel -
Testing ✅ Compatible ovoscope>=0.7.2,<1.0.0
Alpha ✅ Compatible ovoscope>=0.13.1

📋 Repo Health

Evaluating the repository's overall condition. 📋

✅ All required files present.

Latest Version: 0.16.0a1

✅ ovoscope/version.py — Version file
✅ README.md — README
✅ LICENSE — License file
✅ pyproject.toml — pyproject.toml
⚠️ setup.py — setup.py
✅ CHANGELOG.md — Changelog
✅ ovoscope/version.py has valid version block markers

🔍 Lint

Analysis complete! Check out the details below. 📊

❌ ruff: issues found — see job log

⚖️ License Check

Ensuring our copyright headers are in tip-top shape. ✍️

✅ No license violations found (60 packages).

License distribution: 14× MIT, 14× MIT License, 7× Apache Software License, 7× Apache-2.0, 4× BSD-3-Clause, 2× ISC License (ISCL), 2× PSF-2.0, 2× Python Software Foundation License, +7 more

Full breakdown — 60 packages
Package Version License URL
annotated-doc 0.0.4 MIT link
annotated-types 0.7.0 MIT License link
anyio 4.13.0 MIT link
audioop-lts 0.2.2 PSF-2.0 link
build 1.5.0 MIT link
certifi 2026.4.22 Mozilla Public License 2.0 (MPL 2.0) link
charset-normalizer 3.4.7 MIT link
click 8.3.3 BSD-3-Clause link
combo_lock 0.3.1 Apache-2.0 link
fastapi 0.136.1 MIT link
filelock 3.29.0 MIT link
h11 0.16.0 MIT License link
idna 3.15 BSD-3-Clause link
importlib_metadata 9.0.0 Apache-2.0 link
json-database 0.10.1 MIT link
kthread 0.2.3 MIT License link
langcodes 3.5.1 MIT License link
markdown-it-py 4.2.0 MIT License link
mdurl 0.1.2 MIT License link
memory-tempfile 2.2.3 MIT License link
ovos-config 2.1.1 Apache-2.0 link
ovos-core 2.1.5a1 Apache-2.0 link
ovos-number-parser 0.5.1 Apache Software License link
ovos-plugin-manager 2.2.0 Apache-2.0 link
ovos-pydantic-models 0.1.1 Apache-2.0 link
ovos-solver-yes-no-plugin 0.2.8 MIT link
ovos-utils 0.8.5 Apache-2.0 link
ovos_bus_client 1.5.0 Apache Software License link
ovos_workshop 8.0.0 apache-2.0 link
ovoscope 0.16.0a1 Apache Software License link
packaging 26.2 Apache-2.0 OR BSD-2-Clause link
padacioso 1.0.0 apache-2.0 link
pexpect 4.9.0 ISC License (ISCL) link
ptyprocess 0.7.0 ISC License (ISCL) link
pydantic 2.13.4 MIT link
pydantic_core 2.46.4 MIT link
pyee 12.1.1 MIT License link
Pygments 2.20.0 BSD-2-Clause link
pyproject_hooks 1.2.0 MIT License link
python-dateutil 2.9.0.post0 Apache Software License; BSD License link
PyYAML 6.0.3 MIT License link
quebra-frases 0.3.7 Apache Software License link
RapidFuzz 3.14.5 MIT link
regex 2026.5.9 Apache-2.0 AND CNRI-Python link
requests 2.34.2 Apache Software License link
rich 13.9.4 MIT License link
rich-click 1.9.7 MIT License

Copyright (c) 2022 Phil Ewels

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
| link |
| simplematch | 1.4 | MIT License | link |
| six | 1.17.0 | MIT License | link |
| standard-aifc | 3.13.0 | Python Software Foundation License | link |
| standard-chunk | 3.13.0 | Python Software Foundation License | link |
| starlette | 1.0.0 | BSD-3-Clause | link |
| typing-inspection | 0.4.2 | MIT | link |
| typing_extensions | 4.15.0 | PSF-2.0 | link |
| unicode-rbnf | 2.4.0 | MIT License | |
| urllib3 | 2.7.0 | MIT | link |
| uvicorn | 0.47.0 | BSD-3-Clause | link |
| watchdog | 2.3.1 | Apache Software License | link |
| websocket-client | 1.9.0 | Apache Software License | link |
| zipp | 3.23.1 | MIT | link |

Policy: Apache 2.0 (universal donor). StrongCopyleft / NetworkCopyleft / WeakCopyleft / Other / Error categories fail. MPL allowed.

🔒 Security (pip-audit)

Ensuring our security logs are being captured. 🪵

✅ No known vulnerabilities found (68 packages scanned).

🔨 Build Tests

Checking the alignment of our build components. 📏

✅ All versions pass

Python Build Install Tests
3.10 ✅ ✅ ✅
3.11 ✅ ✅ ✅
3.12 ✅ ✅ ✅
3.13 ✅ ✅ ✅
3.14 ✅ ✅ ✅

📊 Coverage

Charting the progress of our testing efforts. 📉

❌ 54.4% total coverage

Files below 80% coverage (12 files)
File Coverage Missing lines
ovoscope/ocp.py 0.0% 83
ovoscope/pipeline.py 0.0% 95
ovoscope/version.py 0.0% 5
ovoscope/intent_cases.py 14.0% 141
ovoscope/cli.py 32.8% 162
ovoscope/e2e.py 35.3% 97
ovoscope/listener.py 38.9% 162
ovoscope/pytest_plugin.py 41.7% 221
ovoscope/media.py 57.9% 90
ovoscope/__init__.py 59.9% 291
ovoscope/audio.py 63.1% 111
ovoscope/coverage.py 63.3% 69

Full report: download the coverage-report artifact.


Your automated guardian for repository health 🛡️

@github-actions github-actions Bot added feature and removed feature labels May 14, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@ovoscope/intent_cases.py`:
- Around line 497-507: Remove the unreachable return of an undefined variable by
deleting the trailing "return created" statement; the function already returns
the result of register_intent_case_tests (referenced as
register_intent_case_tests(...)) so remove any reference to the undefined
variable created and keep the single return of register_intent_case_tests.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a91697ef-5323-4d0b-9a8b-ce73664ab522

📥 Commits

Reviewing files that changed from the base of the PR and between a4494d4 and 1115c16.

📒 Files selected for processing (3)
  • ovoscope/intent_cases.py
  • ovoscope/pytest_plugin.py
  • test/unittests/test_intent_cases.py

Comment thread ovoscope/intent_cases.py
Comment on lines +497 to 507
return register_intent_case_tests(
target_globals,
skill_id=cfg["skill_id"],
handlers=cfg["handlers"],
cases_dir=cases_dir,
pipelines=cfg.get("pipelines"),
ignore_messages=cfg.get("ignore_messages"),
timeout=cfg.get("timeout", 30),
m2v_warmup=cfg.get("m2v_warmup", 10.0),
)
return created

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Remove unreachable return statement with undefined variable.

Line 507 contains unreachable code that references an undefined variable created. The function already returns on line 497 via the register_intent_case_tests call. This unreachable statement should be removed.

🐛 Proposed fix
         timeout=cfg.get("timeout", 30),
         m2v_warmup=cfg.get("m2v_warmup", 10.0),
     )
-    return created
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
return register_intent_case_tests(
target_globals,
skill_id=cfg["skill_id"],
handlers=cfg["handlers"],
cases_dir=cases_dir,
pipelines=cfg.get("pipelines"),
ignore_messages=cfg.get("ignore_messages"),
timeout=cfg.get("timeout", 30),
m2v_warmup=cfg.get("m2v_warmup", 10.0),
)
return created
return register_intent_case_tests(
target_globals,
skill_id=cfg["skill_id"],
handlers=cfg["handlers"],
cases_dir=cases_dir,
pipelines=cfg.get("pipelines"),
ignore_messages=cfg.get("ignore_messages"),
timeout=cfg.get("timeout", 30),
m2v_warmup=cfg.get("m2v_warmup", 10.0),
)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@ovoscope/intent_cases.py` around lines 497 - 507, Remove the unreachable
return of an undefined variable by deleting the trailing "return created"
statement; the function already returns the result of register_intent_case_tests
(referenced as register_intent_case_tests(...)) so remove any reference to the
undefined variable created and keep the single return of
register_intent_case_tests.

The previous auto-discovery used pytest_configure to walk sys.modules
for conftest.py files — but pytest doesn't collect tests from
conftest.py, and conftests aren't loaded yet at pytest_configure time
either. Switched to a pytest_pycollect_makemodule hookwrapper that
fires once per candidate test module: if the module declares a
top-level 'ovoscope_intent_cases' dict, the helper injects the
generated TestCase classes into its namespace before pytest's standard
Python-class collector walks it.

Result: a skill's complete intent-case wiring is now this 3-line file:

    # test/end2end/test_intents.py
    ovoscope_intent_cases = dict(
        skill_id='my-skill.author',
        handlers={'WhoAreYou.intent': 'MySkill.handle_who', ...},
    )

Verified end-to-end:
  - 12 tests collected from a 3-line shim in 0.14s
  - TestM2V slice ran live (1 XPASS, 2 XFAIL matching the known
    m2v-misroutes-'who are you' divergence canary) in 36 s
  - Markdown / JSON / accuracy gate all fired correctly

Explicit register_intent_case_tests(globals(), ...) continues to work
unchanged.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@JarbasAl
JarbasAl merged commit e02b62d into dev May 14, 2026
13 checks passed
@JarbasAl
JarbasAl deleted the feat/intent-case-reporter-md branch May 14, 2026 23:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant