fix: key resource caches by resource directory - #613
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks 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 |
Back again! I've just finished another round of automated checks. 🔄I've aggregated the results of the automated checks for this PR below. 📡 Channel Compat — stableEnsuring your contribution is moving forward. 🚀 🚧 Channel unresolvable with this checkout — the repo's dependency floors exceed what the channel pins (fleet finding; see the install log). Constraints: https://raw.githubusercontent.com/OpenVoiceOS/OpenVoiceOS/main/constraints-stable.txt ⚖️ License CheckEnsuring our license headers are up to date for 2024. 📅 ✅ No license violations found. Policy: Apache 2.0 (universal donor). StrongCopyleft / NetworkCopyleft / WeakCopyleft / Other / Error categories fail. MPL allowed. 📋 Repo HealthEnsuring the repo's joints are well-oiled (aka CI/CD). ⚙️ ✅ All required files present. Latest Version: ✅ 🔍 LintA detailed summary of the latest automation run. 📝 ❌ ruff: issues found — see job log 🔨 Build TestsConstruction site report: checking the structural integrity. 🏗️ ✅ All versions pass
📡 Channel Compat — testingChecking for any potential issues or concerns. 🔍 🚧 Channel unresolvable with this checkout — the repo's dependency floors exceed what the channel pins (fleet finding; see the install log). Constraints: https://raw.githubusercontent.com/OpenVoiceOS/OpenVoiceOS/main/constraints-testing.txt 🔒 Security (pip-audit)Scanning for any 'unauthenticated' access points. 🕵️ ✅ No known vulnerabilities found (72 packages scanned). Keeping things running like clockwork 🕰️ |
b704583 to
2ac2549
Compare
6563d12 to
52df98c
Compare
52df98c to
4d17ba5
Compare
Three caches in
OVOSSkillwere keyed by language while the data behind them depends on the resource directory.load_langkept oneSkillResourcesper language, so once the constructor filled the entry for the skill's own language, assigningskill.res_diror callingload_lang(root_directory=...)silently returned the object built for the original directory — theroot_directoryargument was honoured only on a cache miss.voc_listhad the same defect one layer up, with a key oflang + voc_filenameand no trace ofres_dir. And the auto-discovery guard for.entityfiles was a plain set of languages, so a skill pointed at a second directory hit the guard and never registered that directory's entity files at all.All three are now keyed by the directory the resources were built from, and
_auto_register_entity_filesreceives the resources it should scan rather than looking them up by language.UniversalSkill._load_langfollows the same keying. Nothing shipped passesroot_directoryor reassignsres_dirafter construction, so no consumer changes; the fifteenskill._lang_resources = dict()lines intest/unittests/skills/test_base.pyexisted purely as the workaround and are removed — without the fix, thirteen tests in that file go red once they are gone.Paths are used as given, not normalised:
/skills/fooand/skills/foo/are two keys and build twoSkillResources. That costs a duplicate load in the (unused) case where a caller mixes spellings, and it avoids guessing at symlink and case semantics for a value the caller controls.test_voc_match_after_res_dir_reassignedvoc_match("it is sunny outside", "condition")is False, old vocabulary still cachedtest_load_lang_honours_root_directory(base andUniversalSkill)[]instead of[['sunny']]test_entity_files_registered_after_res_dir_reassigned['game', 'pet', 'unused'], the new directory'sboardgamenever registeredtest_discovery_scans_the_resources_it_is_given'boardgame' not found in {'unused', 'pet', 'game'}test_base.pywithout the manual cache clearstest/unittestson the merged tree: 705 passed, 2 failed. Both failures are pre-existing on a cleanorigin/devworktree, which gives 700 passed, 2 failed with the same two:test_scheduler_delegation.py::test_a_delay_in_seconds_becomes_a_relative_timing(KeyError: 'owner', fixed by #608) andtest_abstract_app.py::TestApp::test_default_shutdown, which passes in isolation and fails in a full run.