Repository navigation
fix(golden): a machine-drafted row that names no real resource is a miss - #215
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID:
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. Comment |
Automated check summary ready. 📊I've aggregated the results of the automated checks for this PR below. 🔍 LintAnalysis complete! Check out the details below. 📊 ❌ ruff: issues found in 74 file(s) — see job log 🔒 Security (pip-audit)Cybersecurity sweep: checking for vulnerabilities. 🕸️ ✅ No known vulnerabilities found (133 packages scanned). ⚖️ License CheckChecking for any potential legal hurdles. 🚧 ✅ No license violations found. Policy: Apache 2.0 (universal donor). StrongCopyleft / NetworkCopyleft / WeakCopyleft / Other / Error categories fail. MPL allowed. 🏷️ Release PreviewEnsuring the 'Thanks' section includes your name! 🤝 Current:
🚀 Release Channel Compatibility Predicted next version:
📋 Repo HealthEnsuring the repository remains in peak condition. 🏔️ ✅ All required files present. Latest Version: ✅ 📊 CoverageA deep dive into the sea of test results. 🌊 Files below 80% coverage (16 files)
Full report: download the 🔨 Build TestsThe build report has been filed and is ready. 📁 ✅ All versions pass
Keeping the code clean, one PR at a time ✨ |
4b2e029 to
8fd442c
Compare
47de895 to
4356d49
Compare
4356d49 to
9bb6273
Compare
A skill repository's own golden runner turned any mismatch on a machine_generated row into an expected failure. A wrong name is not a coverage gap: the shared runner now checks the name against the resources the skill ships for that row's locale, and a name nobody ships stays a miss that says which name is missing. The resource names come from the tree the skill READS, its res_dir, and from the language directory with every directory below it. OVOS-INTENT-2 §2 says a loader resolves a resource by searching the language directory and all its subdirectories, recursively, which ovos-workshop find_resource implements with rglob. A flat read named none of those files, so the skill's own nested resource read as a name nobody ships: a correct row accused. Over the locale trees checked out here, 13 skills had no name at all under the flat read, ovos-skill-date-time, ovos-skill-alerts and ovos-skill-color-picker among them. A label the run itself fired counts as real, for its own locale alone, because an Adapt intent built in code ships no resource file. T-3735, T-5750, T-5864. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
9bb6273 to
b4848c8
Compare
The rule
A skill repository's own golden runner turns any mismatch on a
machine_generatedrow into an expected failure, with the reason"coverage-gap (machine-drafted, pending native validation)". On
ovos-skill-fallback-unknown#69 that made nine kab and oc-FR rows green while
they named dotted pre-rename dialogs the skill had never shipped. A wrong
name is not a coverage gap.
The shared runner now separates the two. Every machine-drafted miss is
checked against the resources the skill ships for that row's locale,
locale/<lang>/<name>.intent|.dialog|.voc, read as written.gap, it leavesthe scored total, and the scoreboard counts it under
coverage_gapwiththe row in
gaps.stays a miss, and its failure entry says which name the locale does not
ship.
A label the run itself fired counts as real, because an Adapt intent built
in code ships no resource file.
What changed since the review
The review of the first cut recorded SHIP-WITH-FIXES with three defects.
Each one is fixed here, and each fix has a test that fails without it.
run_goldentestedtotal == 0alone, and the scoreboard takes the gaps out ofscoredaswell as the skips. Two loaded rows and two gaps printed "ALL SKIPPED: 0
row(s) loaded, every one needs_manual, nothing measured", exited 4, and
returned above the
COVERAGE GAPlines. The all-gaps case now prints thegap lines, prints an
ALL GAPSline, and exits 6. Exit 4 keeps itsmeaning, and a control asserts it.
locale_resourcesglobbed<checkout>/**/locale/<lang>/*, so any other skill's file under thecheckout answered for this skill. A run in a repository that holds a
.venvread every installed skill's locale tree, which reopens the maskthis rule exists to close. The search is bound to
<root>/locale/<lang>and
<root>/<package>/locale/<lang>, andassert_root_dirsupplies theroot.
run_rowsaccumulated onefired_labelsset over every locale, so an intent that fired in en-USproved the name existed for pt-PT as well. The labels are kept per lang.
Rebase on #214
#214 landed first. This branch is rebased onto
dev. Both sides rewroterun_rowsandscoreboard, and the merged result keeps #214's per-localeprocess path, its
worker_timeoutbound and thepipeline/presetarguments of
scoreboard, with this PR's gap filter on the scored rows.Under
--per-locale-processthe coverage-gap pass runs inside each child,one locale per child, so the labels are per locale there by construction.
That is now stated in the code, and a test asserts that
gapandreasonsurvive the worker's JSON result file, because a silent drop would read as a
run with no gaps at all.
Evidence
python -m pytest -q test/unittests/test_golden_minicroft.py: 43 passed.total == 0branch fails the all-gaps test; the unbounded glob fails the two scoping
tests; a pooled label set fails the two locale tests.
docs/cli.mdrecords the rule, the tree bound and exit code 6.Round 2: the bound reads
res_dir, notroot_dirreviewer-b's SHIP-WITH-FIXES at
47de895found that the bound read the wrongdirectory. ovos-workshop
ovos_workshop/skills/ovos.py:162setsself.res_dir = resources_dir or self.root_dir, and every resource loaderreads
res_dir:load_lang,load_dialog_files,load_vocab_files,load_regex_filesandfind_resource. A skill built withresources_dir=keeps its locale tree where
root_dirdoes not hold it, so the bound found noname at all and the skill's OWN resource read as a name nobody ships. That
fails a run that should pass, which is worse than the sibling hole it
replaced.
assert_res_dirnow supplies the tree, andrun_rowsreads it. A skill thatsets nothing keeps
res_dir == root_dir, so the common case is the behaviourthis branch already had.
The decision on a
resources_diroutside the checkout: it is refused. Itgets the same two checks as the root, exit code 3 with the path in the
message. The names in such a tree cannot be shown to be this checkout's own
source, and reading them lets a gold row that names a resource this checkout
does not ship pass, which is T-3140 from a new direction. A refusal is loud;
the alternative is silent.
A declared
resources_diralso settles the package question: the skill saidwhere its resources live, which is stronger than any inference from the
module's path, so that directory alone is the bound.
own_package's NAME arm is kept, and its docstring now says why it isunreachable today: the arm needs a caller that passes a root ABOVE the class
module's directory, and no production caller does, because ovos-workshop
derives
root_dirfrom that module. It is the narrowing answer, so losing itwidens the bound.
Round 2 evidence
python -m pytest -q test/unittests/test_golden_minicroft.py: 69 passed.test/unittests/: 788 passed, 38 skipped, 3 failed. The threeare
test_golden.py::TestEntryPointResolutionand twoTestRunGoldenSuitecases; they fail the same way on the unmodified47de895tree in this venv, which has no template-engine pluginsinstalled. CI has them.
skill_root = rootin place of theassert_res_dircall failsboth new
run_rowstests, the gap case and the control.TestTheBoundFollowsResDirdrives the whole chain throughrun_rowson areal MiniCroft, with a fixture skill that passes
resources_dir. Its twotrees each hold a name the other does not:
hellounderres_diris acoverage gap,
root_onlyunderroot_dirstays a miss. The bound movedrather than grew.
TestResDirIsCheckedLikeRootDircovers the refusals: outside the checkout,and under each of
site-packages,dist-packages,.venvandvenv.Round 3: the language directory is walked recursively
reviewer-b's SHIP-WITH-FIXES at
4356d49found that the bound read the rightTREE at the wrong DEPTH. OVOS-INTENT-2 §2:
ovos_workshop.resource_files.find_resourceimplements that withsorted(directory.rglob(res_name)).locale_resourcesused a flatfolder.iterdir(), so a resource atlocale/<lang>/dialog/x.dialogwas nevernamed: the coverage-gap pass found no gap, and a machine-drafted row on the
skill's OWN resource read "en-US ships no resource named x: the row names one
that does not exist, which is a defect in the row". A correct row accused, and
a run that should pass failing.
The walk is now
folder.rglob("*"), files only. Theis_file()guard is notdecoration: under
iterdira DIRECTORY namedtrap.dialogwas counted as aresource, and a test pins that it is not.
Not a widening. The same clause forbids two files with one extension sharing a
base name anywhere in one language tree, so collapsing every depth into one
name set loses nothing, and a name no tree holds is still a miss.
Round 3 evidence
python -m pytest -q test/unittests/test_golden_minicroft.py: 74 passed,145s. Round 2 measured 69 on this file, so the 5 new tests are the whole
delta and nothing went red.
rglobput back toiterdiron the merged tree: 3 of the 5 fail,with the review's own sentence,
AssertionError: False is not true : en-US ships no resource named 'nested': the row names one that does not exist.The two that pass are the premise (ovos-workshop finds the file) and the miss
control, which is the right shape. The file was restored from a copy taken
before the edit, and
git diffafterwards shows only this round's work.review-ovoscope-215-4356d49.nested_locale_cell.py, re-run unchanged on thishead:
locale_resources -> ['hello', 'nested']and the row readsmatched=False gap=True,coverage-gap (machine-drafted, pending native validation). It read['hello']andgap=Falseat4356d49.TestTheLangDirectoryIsWalkedRecursivelydrivesrun_rowson a realMiniCroft with a fixture skill whose
nested.dialogsits two directoriesbelow
locale/en-US. It asserts the premise through ovos-workshop first, soa fixture the loader cannot read would fail loudly rather than prove nothing.
gain names under the recursive read and 13 had no name at all before it,
ovos-skill-alerts,ovos-skill-audio-recording,ovos-skill-boot-finished,ovos-skill-color-picker,ovos-skill-date-time,ovos-skill-dictation,ovos-skill-weatherandovos-skill-hello-worldamong them. The reviewcounted 127 trees, 38 and 28 by its own sweep; the numbers differ because the
sweeps differ, and the direction and the named skills agree.
docs/cli.mdnow says the runner reads the lang directory and everydirectory below it.
E741 Ambiguous variable name: 'l'in the test fileas added against
dev. They came from rounds 1 and 2 of this pull request,not from dev and not from round 3 (ruff counts 5 at the merge base, 9 at
4356d49and 9 at the round-3 tree, and no round-3 line adds one). They arethis pull request's own, so they are fixed rather than excused: the six lines
in the two all-gaps tests bind
ln, the file reads 5 again, and the file wasre-run afterwards for the same
74 passed.🤖 Generated with Claude Code