Skip to content

fix: key resource caches by resource directory - #613

Merged
JarbasAl merged 1 commit into
devfrom
fix/res-dir-cache-key
Sep 8, 2026
Merged

JarbasAl merged 1 commit into
devfrom
fix/res-dir-cache-key

Conversation

@JarbasAl

@JarbasAl JarbasAl commented Sep 8, 2026

Copy link
Copy Markdown
Member

🤖 Auto-generated by Claude Fable 5.1 (claude-fable-5-1) via Claude Code — NOT human-reviewed. Verify before acting.

Three caches in OVOSSkill were keyed by language while the data behind them depends on the resource directory. load_lang kept one SkillResources per language, so once the constructor filled the entry for the skill's own language, assigning skill.res_dir or calling load_lang(root_directory=...) silently returned the object built for the original directory — the root_directory argument was honoured only on a cache miss. voc_list had the same defect one layer up, with a key of lang + voc_filename and no trace of res_dir. And the auto-discovery guard for .entity files 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_files receives the resources it should scan rather than looking them up by language. UniversalSkill._load_lang follows the same keying. Nothing shipped passes root_directory or reassigns res_dir after construction, so no consumer changes; the fifteen skill._lang_resources = dict() lines in test/unittests/skills/test_base.py existed 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/foo and /skills/foo/ are two keys and build two SkillResources. 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.

check before after
test_voc_match_after_res_dir_reassigned fail — voc_match("it is sunny outside", "condition") is False, old vocabulary still cached pass
test_load_lang_honours_root_directory (base and UniversalSkill) fail — [] instead of [['sunny']] pass
test_entity_files_registered_after_res_dir_reassigned fail — registrations are ['game', 'pet', 'unused'], the new directory's boardgame never registered pass
test_discovery_scans_the_resources_it_is_given fail — 'boardgame' not found in {'unused', 'pet', 'game'} pass
test_base.py without the manual cache clears 13 failed, 69 passed 82 passed

test/unittests on the merged tree: 705 passed, 2 failed. Both failures are pre-existing on a clean origin/dev worktree, 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) and test_abstract_app.py::TestApp::test_default_shutdown, which passes in isolation and fails in a full run.

@coderabbitai

coderabbitai Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

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.

@github-actions github-actions Bot added the fix label Sep 8, 2026
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

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 — stable

Ensuring 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
Resolved stack: channel-compat-stable artifact (constraints + pip freeze).

⚖️ License Check

Ensuring 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 Health

Ensuring the repo's joints are well-oiled (aka CI/CD). ⚙️

✅ All required files present.

Latest Version: 9.7.1a1

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

🔍 Lint

A detailed summary of the latest automation run. 📝

ruff: issues found — see job log

🔨 Build Tests

Construction site report: checking the structural integrity. 🏗️

✅ All versions pass

Python Build Install Tests
3.10
3.11
3.12
3.13
3.14

📡 Channel Compat — testing

Checking 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
Resolved stack: channel-compat-testing artifact (constraints + pip freeze).

🔒 Security (pip-audit)

Scanning for any 'unauthenticated' access points. 🕵️

✅ No known vulnerabilities found (72 packages scanned).


Keeping things running like clockwork 🕰️

@JarbasAl
JarbasAl force-pushed the fix/res-dir-cache-key branch from b704583 to 2ac2549 Compare September 8, 2026 11:45
@github-actions github-actions Bot added fix and removed fix labels Sep 8, 2026
@JarbasAl
JarbasAl force-pushed the fix/res-dir-cache-key branch 2 times, most recently from 6563d12 to 52df98c Compare September 8, 2026 18:36
@JarbasAl
JarbasAl force-pushed the fix/res-dir-cache-key branch from 52df98c to 4d17ba5 Compare September 8, 2026 19:38
@JarbasAl
JarbasAl marked this pull request as ready for review September 8, 2026 21:20
@JarbasAl
JarbasAl merged commit c91830e into dev Sep 8, 2026
13 checks passed
@JarbasAl
JarbasAl deleted the fix/res-dir-cache-key branch September 8, 2026 21:20
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