Skip to content

feat(generate): ovoscope generate, golden rows drafted from a skill's .intent files - #224

Open
andlo wants to merge 1 commit into
OpenVoiceOS:devfrom
andlo:feat/golden-generate
Open

andlo wants to merge 1 commit into
OpenVoiceOS:devfrom
andlo:feat/golden-generate

Conversation

@andlo

@andlo andlo commented Sep 29, 2026

Copy link
Copy Markdown

What

A new subcommand, ovoscope generate, that drafts golden-utterance rows from a skill's own locale/<lang>/*.intent and *.entity files. ovoscope golden runs the rows as they are, so a skill without a hand-written golden file can still be tested.

ovoscope generate --skill ovos-skill-hello-world.openvoiceos --checkout . --lang en-us --out generated.jsonl
ovoscope golden --rows generated.jsonl --skill ovos-skill-hello-world.openvoiceos --checkout .

# the same sentences as editable intent-case files
ovoscope generate --skill my-skill.openvoiceos --format intent-cases --out test/end2end/cases

Why

Most skills ship no golden file, yet a sentence taken from a skill's own training data should always reach its own intent. When it doesn't, the install, the pipeline or the registration is broken. That makes the generated rows a smoke test for every skill: an intent that never registers, a sentence another skill or pipeline stage takes, a handler that crashes, or a line ending in a slot on ovos-padatious < 2 (OpenVoiceOS/ovos-padatious-pipeline-plugin#175).

Today this is done by hand. The drafted rows already in the fleet were copied word for word from the .intent files, e.g. hello-world's machine_generated rows. Two consumers need it automated: andlo/ovos-tui-client#44 (test the skills on a live install, compare stable and alpha) and andlo/ovos-klondike-mercantile#6 (test every skill in the store per release channel). A skill's own CI can use it as well.

How

Nothing re-implements the template grammar:

  • ovos_spec_tools.expand + inline_keywords expand each line (OVOS-INTENT-1). These are the calls ovos-workshop makes when it registers the intent.
  • ovos_utils.bracket_expansion.expand_slots fills the slots, one sample at a time. The slot-value product, which is the part that explodes, is only built for rows that are actually taken.
  • LocaleResources / find_lang_dir find entities and vocabularies, including in subfolders (weather keeps its intents under en-US/intents/) and whatever the case of the lang folder.

Slot values: a slot is filled from its .entity file, then --slot NAME=VALUE, then a small default table, first by declared type ({number:x}, {location:x}, ...) and then by slot name. A slot none of these fill is skipped and reported, not guessed. A guessed value would produce a false miss, not a finding.

Skipped, mirroring ovos-workshop 9.x: a template is skipped exactly when expand raises MalformedTemplate. That covers adjacent slots, an empty sample and a slot-only line, which is the condition _drop_malformed_samples uses. Expansion is eager on purpose: (on|) yields on before its empty sample, and OVOS drops the whole line. Also skipped: a slot-only sample ({x} from {x} [please], which expand accepts) and samples whose slots nothing fills. Every skip has a stable reason id.

Single-branch groups (word) are not skipped. ovos-spec-tools folds them to the bare word with a warning, and ovos-workshop registers them, so their rows are generated and the template is listed under warnings.

Cap: --max-per-intent (default 10) per intent and language. Templates take turns, so every line gives one row before any line gives a second, because the bugs this finds are per line. Entity values are spread evenly over the value set, and the same checkout always gives the same rows in the same order.

Generated is not golden: every row carries "source": "generated" and "machine_generated": true, plus template, source_file and slot_sources. load_golden_rows keeps these in GoldenRow.provenance, so reports can keep generated and hand-written rows apart. Padatious was trained on exactly these sentences, so a pass proves the intent is reachable, not that the skill understands other phrasings. --format intent-cases writes <lang>/<Intent>.intent.test files that open with a comment saying the same, and never overwrites an existing file without --force.

Exit codes: 0 rows written, 2 no rows (no .intent templates, or every one skipped), 3 an output file exists without --force. --report writes rows per intent, skips and warnings as JSON.

Tested

  • test/unittests/test_generate.py, 36 tests: every skip reason, single-branch warning, slot sources, subfolders and lang-folder case, cap and round-robin, determinism, round-trip through load_golden_rows and load_intent_cases, overwrite protection, CLI.
  • Generated for 11 real skills across all their languages (alerts, convert, date-time, hello-world, math-practice, parrot, personal, volume, weather, wikipedia, wordnet) in about 13 s.
  • Ran the generated rows through ovoscope golden: hello-world en-US 36/36 matched, convert en-US 20/20 matched.

Not in this PR

  • The golden scoreboard does not carry row provenance yet, so for now a report tells generated from golden by running the files separately. Adding source to RowResult and counting it in the scoreboard would be a small follow-up.
  • Default slot values exist for English only (numbers everywhere). Other languages report the slot as unfilled; --slot covers it, and each language is one dict entry.
  • build_engine_intents in golden.py globs *.intent non-recursively, so it misses skills that keep intents in subfolders (weather). This is unrelated to this change, but it came up while testing.

🤖 Generated with Claude Code

… .intent files

Most skills ship no golden file, but every skill that registers Padatious
intents already states what it was trained on. `ovoscope generate` reads a
checkout's locale/<lang>/*.intent and *.entity files and writes rows that
`ovoscope golden` runs, so any skill can be smoke-tested: an intent that
never registers, a sentence another skill or pipeline stage takes, a
handler that crashes.

Nothing re-implements the template grammar: ovos_spec_tools.expand and
inline_keywords expand each line, ovos_utils.bracket_expansion.expand_slots
fills the slots, LocaleResources finds entities and vocabularies (in
subfolders too, whatever the case of the lang folder). A slot is filled
from its .entity file, then --slot NAME=VALUE, then a small default table
by declared type and slot name; a slot nothing fills is skipped, not
guessed.

A template is skipped exactly when ovos-workshop 9.x drops it (expand
raises MalformedTemplate: adjacent slots, empty sample, slot-only line),
plus slot-only samples and unfilled slots, each with a stable reason id.
Single-branch groups are folded and registered by OVOS, so their rows are
generated and reported as warnings.

Rows load through load_golden_rows and carry source: generated and
machine_generated: true, plus template, source_file and slot_sources, so
reports keep generated and hand-written golden apart. --format
intent-cases writes <lang>/<Intent>.intent.test files with a generated
header and never overwrites without --force. Rows per intent are capped
(--max-per-intent, default 10); templates take turns so every line is
covered before any gets a second row, entity values are spread, and the
output is deterministic.

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

coderabbitai Bot commented Sep 29, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 583ef3a9-1ab3-4b8b-b694-983969c0c2d2


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.

This branch has not been deployed

No deployments
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