Skip to content

fix(doctor): resolve models/ from repo root, not config_path.parent - #144

Merged
BrettKinny merged 1 commit into
mainfrom
audit/dotty-doctor-models-path
Jun 5, 2026
Merged

BrettKinny merged 1 commit into
mainfrom
audit/dotty-doctor-models-path

Conversation

@BrettKinny

Copy link
Copy Markdown
Owner

Audit finding (HIGH, confirmed 2/3). Independent of #142/#143 — off main.

Bug

dotty_doctor's check_models_sensevoice / check_models_piper anchored root = config_path.parent. In a standard deploy the config is at <root>/data/.config.yaml, but models are bind-mounted from <root>/models/ (./models/... in docker-compose). So the checks looked under <root>/data/models/... and FALSE-FAILed a healthy install — make doctor exits non-zero on a correct standard deploy.

Fix

New _project_root(): if the config sits under a data/ dir, step up to the repo root; prefer whichever candidate actually contains models/, else fall back to the most likely root so the "missing" message still points at <root>/models (not <root>/data/models). Both model checks use it. The legacy root-level .config.yaml layout still resolves correctly.

Verified locally: the checks now resolve to <repo>/models/....

Tests

New tests/test_dotty_doctor_models.py: standard (data/) vs legacy layout, None config, missing-models path resolution, and end-to-end Piper + SenseVoice checks in the data/ layout (SenseVoice size floors monkeypatched small so no 200 MB fixture). Full tests/ suite passes; ruff clean.

No deploy: dotty_doctor.py is a diagnostic CLI, not bind-mounted into any container.

🤖 Generated with Claude Code

dotty_doctor's SenseVoice/Piper checks anchored `root = config_path.parent`.
In a standard deploy the config is at `<root>/data/.config.yaml` while models
are bind-mounted from `<root>/models/` (./models/... in docker-compose), so the
checks looked under `<root>/data/models/...` and FALSE-FAILed a healthy install
— `make doctor` exited non-zero on a correct standard deploy.

Add `_project_root()`: if config sits under a `data/` dir, step up to the repo
root; prefer whichever candidate actually contains `models/`, else fall back to
the most likely root so the "missing" message still points at `<root>/models`.
Both model checks now use it. Verified locally: the checks resolve to
`<repo>/models/...` (legacy root-config layout still works too).

Tests: new tests/test_dotty_doctor_models.py — standard vs legacy layout, None
config, missing-models path, and end-to-end Piper/SenseVoice checks in the
data/ layout (SenseVoice size floors monkeypatched small).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 5, 2026 09:30

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes scripts/dotty_doctor.py model-path checks so they correctly resolve models/ from the project root in the standard deployment layout where config lives at <root>/data/.config.yaml (instead of incorrectly looking under <root>/data/models/...). It adds targeted regression tests covering both standard and legacy layouts.

Changes:

  • Add _project_root() helper to resolve the correct base directory for models/ based on config_path.
  • Update check_models_sensevoice and check_models_piper to use _project_root() instead of config_path.parent.
  • Add new unit tests validating root resolution and end-to-end pass/fail behavior for both Piper and SenseVoice checks.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
scripts/dotty_doctor.py Introduces _project_root() and switches model checks to resolve models/ from the correct repo root in standard installs.
tests/test_dotty_doctor_models.py Adds regression tests for standard vs legacy config layouts and verifies model checks point at <root>/models/....

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@BrettKinny
BrettKinny merged commit 24550e4 into main Jun 5, 2026
10 checks passed
@BrettKinny
BrettKinny deleted the audit/dotty-doctor-models-path branch June 5, 2026 10:28
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.

2 participants