Skip to content

refactor: deprecate the ovos_workshop.resource_files module#412

Merged
JarbasAl merged 1 commit into
feat/use-ovos-spec-toolsfrom
feat/deprecate-resource-files
May 22, 2026
Merged

refactor: deprecate the ovos_workshop.resource_files module#412
JarbasAl merged 1 commit into
feat/use-ovos-spec-toolsfrom
feat/deprecate-resource-files

Conversation

@JarbasAl
Copy link
Copy Markdown
Member

Stacked on #411 (base: feat/use-ovos-spec-tools). Part of the OVOS migration
onto ovos-spec-toolsOpenVoiceOS/architecture#7.

ovos_workshop.resource_files predates the OVOS formal specifications and is
overengineered. This deprecates the whole module — every class and
function — while leaving it fully functional for downstream (nothing removed,
no behaviour change).

What changed

  • All 16 public classes (ResourceType, ResourceFile + subclasses,
    SkillResources, CoreResources, UserResources, RegexExtractor) and 3
    functions (locate_base_directories, locate_lang_directories,
    find_resource) are deprecated — @deprecated log notice +
    DeprecationWarning + .. deprecated:: docstrings; the module docstring too.
  • Removal version computed from version.py (VERSION_MAJOR + 1).
  • Messages point downstream to the ovos-spec-tools replacements
    (LocaleResources, render/DialogRenderer, expand,
    closest_lang/standardize_lang); the legacy types with no spec
    replacement (.qml, .json, .list, .value, .rx, .word,
    .template) are flagged as legacy.

Visible downstream, silent internally

SkillResources is built per-skill, per-language — a naive @deprecated
__init__ would flood every skill startup. A _caller_is_internal() stack
check guards the warning: it fires for downstream callers, suppressed for
ovos_workshop's own internal use.

A deep rewire of OVOSSkill's resource-loading subsystem onto
ovos_spec_tools.LocaleResources is intentionally out of scope — this PR
marks the debt; migrating off it is follow-up work.

Verification

test_resource_files* + skill-keyword tests: 274 passed. skills/ suite: 144
passed — confirming internal skill startup emits no resource_files deprecation
noise.

🤖 Generated with Claude Code

Mark the entire resource_files module as deprecated. It predates the OVOS
formal specifications and is considered overengineered. Everything stays
fully functional for downstream consumers; nothing is removed.

All public names (ResourceType, ResourceFile and subclasses, SkillResources,
CoreResources, UserResources, RegexExtractor, locate_base_directories,
locate_lang_directories, find_resource) now carry the @deprecated decorator
plus an inner warnings.warn and a .. deprecated:: docstring notice.

Messages point downstream to the ovos-spec-tools replacements where they
exist (LocaleResources, render/DialogRenderer, expand, closest_lang/
standardize_lang); legacy types with no spec replacement (.qml, .json,
.list, .value, .rx, .word, .template) are flagged as not part of the OVOS
formal specifications.

To avoid the framework spamming deprecation warnings at itself (these
classes are built per-skill, per-language on hot paths), a _caller_is_internal
stack guard suppresses both the log notice and the DeprecationWarning when
the caller is ovos_workshop's own code; the warnings remain visible to
downstream callers.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 22, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 315bf3a3-3bb8-44fe-a2e5-8fcfb7508ff2

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/deprecate-resource-files

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.

@JarbasAl JarbasAl merged commit b735aff into feat/use-ovos-spec-tools May 22, 2026
2 checks passed
JarbasAl added a commit that referenced this pull request May 23, 2026
Restore partial back-compat for downstream skills that still call
`self.resources.load_*` / `render_dialog` etc.: `self.resources` is now
a deprecated property that returns a legacy SkillResources, with a
DeprecationWarning pointing callers at the high-level skill methods
(speak_dialog, register_intent_file, voc_match, ...) or at
ovos_spec_tools.LocaleResources for low-level access.

Workshop's own internal code goes through a private property,
`OVOSSkill._locale_resources`, which returns the LocaleResources built
by load_lang() — no functional change to the rewire, just a separate
public-vs-internal handle. The SkillResources construction inside the
deprecated property is silenced for workshop-internal callers by the
_caller_is_internal guard from #412.

Test assertions for `self.skill.resources` updated to check
`self.skill._locale_resources` (the internal handle) for LocaleResources.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant