Revalidate and harden configurable AI models folder - #153
Draft
Blackspirits wants to merge 1 commit into
Draft
Blackspirits wants to merge 1 commit into
Blackspirits wants to merge 1 commit into
Conversation
Blackspirits
commented
Sep 16, 2026
Blackspirits
left a comment
Owner
Author
There was a problem hiding this comment.
Final adversarial review on efb737cf63d4c8af61cf6bae15e0dea2ef17d6a1 after CI SubtitleEdit#299: no blocker found. Rechecked ModelsFolder absolute/fail-closed semantics, legacy-layout preservation, CrispASR cache/model environment precedence, runtime-vs-model separation, Piper runtime/catalog vs voice-model ownership, canceled Piper download cleanup, and current-tree model-owner coverage. All eight build warnings are outside the changed-file set. Upstream main is still exactly the audited base dda1fce8.... No merge/promotion performed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Current-main revalidation of #113 ("Port and harden configurable AI models folder"), originally derived from upstream SubtitleEdit#14029.
Upstream SubtitleEdit#14029 was closed without merge. The earlier audit PR #113 remains useful historical evidence, but its base
c77c4b428649ce7030e6cf218b4d7c384b955232is now 154 upstream commits behind the current tree. This PR reconstructs the audited model-root contract on the current upstream main instead of pretending that the old port is still current.Current upstream base:
dda1fce8f9d4a605b1b6732acc072c7109dc6323.Revalidation method
The #113 patch was replayed file-by-file against current main with an exact-context gate:
The resulting current-main diff is 68 files / +782 / -124.
Model-root contract preserved
The setting remains an optional root for downloaded/local AI model data, not a replacement for Subtitle Edit application data.
Speech-to-text
Covered current model owners include:
CrispASR native auto-downloads
When a custom root is selected, every audited CrispASR launch receives:
CRISPASR_MODELS_DIR=<ModelsFolder>/CrispASR/modelsCRISPASR_CACHE_DIR=<ModelsFolder>/CrispASR/modelsThis prevents native
--auto-downloadfrom escaping to~/.cache/crispasr.Legacy mode does not overwrite caller-provided environment variables, and cache reuse follows CrispASR's own precedence.
Text-to-speech
Covered current locally-owned model families include:
Piper's runtime executable and
PiperVoices.jsoncatalog deliberately remain in application data. Only voice model/config files use the selected models root.OCR / shared model consumers
Services whose models are owned by another service/server (Ollama, cloud APIs, etc.) remain out of scope.
New current-tree drift finding fixed
After #113's old base, Subtitle Edit added
TtsVoiceInstaller.The current per-voice Piper download path, after applying #113, correctly writes to:
<ModelsFolder>/TextToSpeech/Piper/modelsbut the newly added cancel/failure cleanup still deleted from
Piper.GetSetPiperFolder(), i.e. the runtime folder.With a custom models root that could leave partial
.onnx/.onnx.jsonfiles behind on the selected external model disk after a canceled download.This current revalidation fixes that by centralizing Piper voice cleanup paths on
Piper.GetSetModelsFolder().Regression coverage proves the cleanup paths resolve to the configured custom model root rather than the runtime folder.
Post-base owner audit
Model-related code added/changed since the #113 base was reviewed for new storage ownership:
No additional current-tree local model owner was found outside this patch.
Regression coverage
The current tree retains focused coverage for:
No production model is downloaded by these tests.
Scope / branch state
dda1fce8f9d4a605b1b6732acc072c7109dc6323efb737cf63d4c8af61cf6bae15e0dea2ef17d6a1Acceptance
AI assistance: ChatGPT was used to reconstruct #113 against current main, hunk-audit all upstream overlaps, audit new model-owning code, identify the post-#113 Piper cleanup drift, design its regression, and perform final coverage review.
Final CI
Authoritative run: SubtitleEdit#299 on
efb737cf63d4c8af61cf6bae15e0dea2ef17d6a1All 8 warnings are outside the #153 changed-file set.
Final drift gate
Upstream main was rechecked at
dda1fce8f9d4a605b1b6732acc072c7109dc6323, exactly the base used by this current-main reconstruction. No post-base drift exists to invalidate the owner/model-path audit.Final adversarial review was performed on this exact HEAD after CI; no blocker found.