Quality and contract testing
VoiceStudio uses layered tests to protect the product promises shared by the backend, desktop renderer, mobile clients, local models, media tools, and release packages. The layers move from focused rules to real process and platform paths so changes fail before they become lost work, unsafe data, unusable setup, or a broken release. See backend API platform, Electron desktop, and mobile clients for the systems these tests protect.
Quality model
A product contract is a promise that another part of the product relies on. A narrow test checks one promise. A wider test checks that the promise still holds across a client, process, device, or release boundary.
This diagram shows how the test layers build confidence from local rules to a usable product release.
flowchart LR
A[Backend and client contracts] --> B[Integration and regression checks]
B --> C[Renderer and mobile user flows]
C --> D[Process, package, and platform smoke]
D --> E[Required release gate]
S[Security checks] --> E
Q[Advisory quality checks] -. separate signal .-> E
Required checks stop on broken behavior, unsafe data, or an unusable build. Some checks need a browser, native tool, model, or platform runner. Those checks run only where their evidence is meaningful. Advisory audio checks can report scan limits or bad input without claiming that every generated voice sounds good.
Test layers
Backend contracts
Backend tests protect the service rules used by desktop, mobile, workers, and other clients. They check request shape, state changes, output files, stream events, and error classes without needing private data or a large live model.
Batch and task checks protect the job life cycle. Inputs are bounded and validated. Progress and terminal state remain visible. Cancellation removes partial work and does not leave the queue or application shutdown waiting forever. Dubbing state also remains safe across memory and database boundaries: job paths cannot escape the job area, events keep a stable shape, process cleanup is repeatable, and saved language data survives later job updates. Async persistence runs away from the event loop, waits for its worker before cancellation cleanup, and does not recreate a job after a withdrawal tombstone.
Local model checks apply the same care to user-owned folders: discovery reports candidates without selecting one, model files must match the chosen engine, incomplete assets fail closed, and saved paths survive a real preferences reload. Local model state also protects the running engine. Re-saving the same unchanged model keeps a warm engine. A changed nested asset or an unreadable file forces a reload. A late load result cannot replace a newer user choice, and an over-large folder is not treated as unchanged.
The model manager has a separate preload contract. Preload is off unless its setting uses an accepted enabled value. It warms only the selected native engine and only when its checkpoint is already local. The normal load keeps speech recognition out of the main load unless the user opts in, records the checkpoint identity before native loading, and does not mistake a test sentinel or engine alias for a downloadable model.
The bundled OmniVoice GGUF engine has an additional runtime contract. Its executable and model pair must be real, pinned, and readable by the selected runtime. A failed probe falls back to the in-process engine instead of blocking generation. Reference audio is checked against the bundled decoder and converted only when needed. The optional resident server can reuse a loaded model, restart once after a process failure, and return to the per-request path when it cannot serve a request.
Portable voice bundles have the same contract focus. Inspection reads a bundle without changing the database or voice files. Import accepts supported bundle forms only after checking their manifest and content, preserves bounded design data, and does not treat a consent claim as verified without a qualifying recording. Legacy bundles remain readable with safe defaults.
The runtime database protects recovery across versions. Additive schema reconciliation restores missing columns when normal migration cannot run, preserves existing rows and legacy columns, and keeps the cloud-sync identity unique on both schema paths. An installed app can therefore open older data without silently accepting a state that later sync cannot resolve.
The backend also protects product recovery. A failed load can be retried. A generated file is usable before publication. A project or handoff either publishes its related state together or leaves no partial result. Backend error classes remain a shared contract with desktop guidance, so known failures point to useful help and unknown failures use a safe default.
Generated audio has a bounded output contract. Normal speech removes engine-only edge padding without changing explicit durations, while silent or overlong output fails instead of looking successful. A dubbing run publishes all requested speech only after every segment is valid, and a failed replacement keeps the previous track intact.
The archetype catalog has a separate contract for voice discovery and selection. Listing supports stable categories, filters, search, pagination, lookup, and clear missing-item results. Choosing an archetype is fast and repeatable: it stores the design recipe without loading the synthesis model, reuses only a compatible legacy sample, and does not rewrite an imported profile that happens to share a name. Preview requests share one render and keep that render alive when a caller goes away, so the next request can use the cached audio.
Generation also has a delivery contract. Streaming sends usable audio while later chunks still run, then saves the same take as the classic path. A failed chunk ends with a safe error event and publishes no file or history row. Engine language metadata must match the language checks used at synthesis time, so a picker cannot offer a language that the selected engine cannot produce.
Voice profile tests protect the split between profile data and rendered audio. A design profile can be saved without a loaded model, then render its sample when audio is first requested. Edits that change speech inputs invalidate old samples, while name-only changes preserve them. Clone extraction uses trusted speaker labels and matching reference text, and subtitle import keeps valid cues while rejecting malformed or costly input.
The capture stream keeps its audio boundary small and guarded. It rejects buffers that are too short to produce useful speech data, and its WebSocket path must apply the shared local-access policy before the handshake completes.
References: tests/test_dub_pipeline_state.py• L25-49 tests/test_dub_pipeline_state.py• L57-87 tests/test_dub_pipeline_state.py• L90-204 tests/test_dub_pipeline_state.py• L207-251 tests/test_model_manager_preload.py• L27-119 tests/test_model_manager_preload.py• L130-265 backend/…/test_local_model_paths.py• L32-149 backend/…/test_local_model_paths.py• L173-281 backend/…/test_personas_api.py• L101-273 backend/…/test_archetypes_api.py• L55-163 backend/…/test_archetypes_api.py• L166-223 backend/…/test_archetypes_api.py• L225-389 backend/…/test_capture_ws.py• L15-107 tests/test_generate_streaming.py• L227-453 tests/test_engine_language_options.py• L8-61 tests/test_profile_design_save_decouple.py• L74-205 tests/test_profile_unification.py• L63-207 tests/test_speaker_clone_purity.py• L51-157 tests/test_srt_parser.py• L158-185 tests/…/test_omnivoice_gguf.py• L37-247 tests/…/test_omnivoice_gguf.py• L281-337 tests/…/test_omnivoice_gguf_resident.py• L123-204 tests/…/test_omnivoice_gguf_resident.py• L216-386 tests/…/test_omnivoice_gguf_resident.py• L467-580
Desktop renderer contracts
The desktop renderer is the main user-facing client. Its tests protect the boundary between user actions, the renderer, the backend process, local files, account services, and update state.
The most important desktop promise is truthful state. A live backend that is busy must keep the workspace mounted. A failed or refused backend must give a clear recovery path. Setup must show real download and install progress, identify a stalled transfer, resume interrupted work, and keep a runtime unready until dependency and native checks pass. Packaged store builds must use their bundled runtime and must not silently replace an explicit data choice with an empty one.
The backend supervisor distinguishes a live but busy process from a crashed process. It probes often while the backend is starting or recovering, then uses a slower cadence after a healthy period. A missed health response marks a live process as unresponsive without killing it. A later healthy response restores the ready state. Startup retries transient operating-system launch failures, while repair is limited to a runtime owned by the app.
Runtime tests extend this contract across hardware and setup variants. CPU installs do not fetch GPU-only wheels. ROCm and legacy CUDA paths use the reviewed interpreter and package choices, then verify that the installed native stack works. Proxy settings are translated without changing explicit choices or exposing unrelated environment values. A runtime is not ready after a failed import, an interrupted install, or a stale dependency graph.
The renderer turns these states into safe user actions. Account views do not expose tokens or signed download links. Settings retry after a failed save by reading real state again. Media previews can be cancelled and retried. Lazy feature or player chunks can fail without taking down the surrounding shell. Update controls do not restart during active work without confirmation, and update cache cleanup removes stale downloads without deleting the base used for a later download.
The desktop bridge has a class-level trust contract. IPC handlers accept calls only from the trusted top-level app frame, and the site browser accepts only safe web URLs inside an isolated view. Filename handling keeps exports usable on Windows while preserving extensions and avoiding device names. These tests prevent a new channel or embedded page from gaining access because an older module used a local copy of the trust rule.
Generation tests protect the user-facing synthesis contract. One shared lifecycle keeps progress visible across views and survives a view unmount. A serial queue captures each request's text, engine, voice, and settings at request time. It cancels running work, drops stale queued work when a voice or transcript changes, and reports failures without duplicate global alerts. The request layer keeps engine capability checks, bounded input, streaming output metadata, cancellation, and a timeout that exceeds the backend's execution budget aligned.
The renderer API client turns backend responses into stable client errors. Known error codes become localized recovery guidance while the raw payload remains available for diagnostics. Network failures, authentication events, streamed error frames, API route prefixes, and audio URLs stay distinct so a proxy or backend failure does not look like a successful request. Unknown or malformed server topics do not become translation keys.
Account state adds a related trust boundary. The renderer receives a public account view without access tokens or signed avatar URLs. Disabled account features make no profile or keyring calls. A late profile response cannot restore a signed-out or replaced identity, and refresh broadcasts the current state to every live renderer. Sign-in options and profile names are checked before browser or account calls.
Main-process tests also cover headless operation, crash evidence, terminal command setup, atomic file replacement, distribution ownership, and platform diagnosis. These are desktop product contracts because a failure can lose a file, hide the cause of a crash, edit a shell profile without consent, or make a package claim an update path it does not own.
Diagnostic reporting has its own desktop contract. It stays off until the user gives diagnostic consent, remains separate from product analytics consent, and revokes old data when a kill switch or withdrawal is observed. When enabled, it sends classified failure facts rather than private prompts, paths, tokens, or raw stack detail. Offline records use bounded storage, survive a restart only within the current consent epoch, and recover an unclean exit without turning an orderly exit into a crash. Durable file tests also protect recovery when rename, read, delete, or directory-sync operations fail.
References: electron/…/backend-setup.test.ts• L133-200 electron/…/backend-setup.test.ts• L455-617 electron/…/backend-startup-failure.test.ts• L115-250 electron/…/backend-supervise.test.ts• L107-200 electron/…/runtime-project.test.ts• L341-415 electron/…/runtime-project.test.ts• L502-619 electron/…/runtime-torch-variant.test.ts• L109-157 electron/…/runtime-legacy-cuda.test.ts• L82-120 electron/…/proxy-env.test.ts• L9-165 electron/…/ipc-registry.test.ts• L167-218 electron/…/trusted-ipc.test.ts• L34-75 electron/…/site-browser.test.ts• L105-205 electron/…/portable-filename.test.ts• L5-45 electron/…/account-ipc.test.ts• L60-142 electron/…/account-ipc.test.ts• L144-231 electron/…/account-ipc.test.ts• L263-421 electron/…/use-generate.test.tsx• L78-201 electron/…/client.test.ts• L31-203 electron/…/generate.test.ts• L40-214 electron/…/generationFailureMessage.test.ts• L4-50 electron/…/diagnostics.test.ts• L91-333 electron/…/diagnostics.test.ts• L432-570 electron/…/diagnostics-storage.test.ts• L183-367 electron/…/diagnostics-storage.test.ts• L710-817 tests/test_export_history_access.py• L47-100
Mobile-client contracts
Mobile tests protect the promise that phone clients can use the same product rules as the backend and desktop. Android UI tests check that a voice clone moves through decode, transcription, and inference with usable progress, cancellation, retry, and no partial voice publication. They also check that a lifecycle interruption keeps the sample and draft needed for retry.
iOS tests exercise real loopback network boundaries and local model delivery. They protect pairing and session headers, redirect rejection, bounded downloads, cancellation, range resume, checksum verification, storage reservation, licence acceptance, active-use leases, and routing between phone, download, and computer work. Download callers must pass a storage budget, and multi-chunk responses must arrive without truncation. UI actions wait for controls to become hittable, so an animation cannot turn a valid flow into a timing failure.
The mobile contract is generated from shared sources. Committed API, model, design, token, string, and licence data must match their source inputs. Pinned bytes use stable line endings and complete manifests, and mobile model delivery accepts only approved asset URLs, revisions, checksums, sizes, runtimes, and licence terms. This keeps iOS and Android from silently drifting from the backend or desktop theme. The same checks keep native localization, language catalogues, network-security exceptions, and generated contributor data aligned across clients.
Native tests also protect their own test boundary. A helper process must report a port, collect output, and stop within a deadline. If a child hangs or a pipe stays open, the test reports bounded diagnostics instead of hanging the CI job. Mobile artifact uploads get one bounded retry after native verification, while a running main-branch build is not cancelled by a later push. UI test taps use a readiness wait instead of a timing-sensitive bare tap. These checks catch failures that a backend test cannot see when a native client reads the same response differently or handles a process, file, or CI boundary incorrectly.
References: mobile/…/PhoneCloneUiTest.kt• L44-214 mobile/…/BoundedDownloadTests.swift• L45-118 mobile/…/TestProcess.swift• L4-70 mobile/…/LocalInferenceTests.swift• L52-216 mobile/…/NetworkTests.swift• L72-129 tests/test_ios_uitest_taps.py• L104-145 tests/test_mobile_artifact_retry.py• L16-62 tests/test_mobile_contract.py• L29-169 tests/test_mobile_contract.py• L216-381 tests/test_mobile_contract.py• L565-677
Integration contracts
Integration tests check that two or more product parts agree at a boundary. They connect API data to client actions, model descriptions to real capability, media inputs to playable output, remote work to its worker, and release metadata to the artifact that users receive.
The main integration promises are:
- A model path contains the architecture and files claimed by its engine. A name or provenance string cannot disguise the wrong model.
- A client timeout covers the queue, model, generation, and sidecar work that it starts. Model-load progress may extend a live cold start within a fixed cap, but silence still reaches the original timeout.
- A worker receives the declared inputs and publishes a result only after integrity checks.
- A reconnect keeps the task and result state already owned by the worker.
- A workflow retry does not repeat completed work.
- A source language maps only to a supported dubbing language. Unknown input stays unknown.
- A GPU is usable only after real work passes. A failed probe keeps inference on a safe device path.
- A mobile or store artifact keeps one application identity across build, listing, and upload.
- A portable voice bundle keeps its manifest, design recipe, audio members, and consent state consistent from inspection through import.
- A crashed dub render keeps completed work private until publication, then reuses only segments whose text, settings, language, effects, watermark state, and model identity still match.
These checks prevent silent disagreement. Without them, a request may look successful while it uses the wrong model, waits on the wrong clock, loses a result during reconnect, stores audio that cannot play, maps speech to the wrong language, or uploads an artifact to the wrong product.
The dub recovery contract is strict because a recovered segment is already audio that may outlive the failed process. A crash leaves completed segments in a private journal, not in the visible track. The next run reuses them only when all synthesis inputs and the model fingerprint match. Bad or incomplete recovery data falls back to a fresh render, and cancellation or journal failure cannot publish partial speech or fail the whole dub.
Timing modes add a related cache contract. Natural-rate speech remains reusable for a later fit-only remix, while a cache made by a slot-squeezing mode must be regenerated before a natural-rate path uses it. Smart fitting records the plan that the exporter consumes, and invalid fit options fail before synthesis starts.
Hardware integration has the same truth requirement. A kernel mismatch, low free memory, legacy Pascal card, Windows ROCm driver choice, or Intel XPU memory-query failure must produce the remedy that matches the real cause. Setup, diagnostics, generation, sidecars, and the pinned Torch stack must agree, rather than sending a user to reinstall a working toolchain or claim that unsupported acceleration is ready.
References: backend/…/test_local_model_paths.py• L50-106 backend/…/test_personas_api.py• L128-189 tests/test_openai_voice_by_name_2617.py• L115-188 tests/test_generate_abort_budget.py• L30-75 tests/test_model_load_extends_generate_budget.py• L63-471 tests/test_worker_inputs.py• L183-347 tests/test_worker_transport.py• L814-934 tests/test_dub_language.py• L17-182 tests/test_dub_complete_audio.py• L97-337 tests/test_dub_crash_resume.py• L88-463 tests/test_smart_fit_generate.py• L169-423 tests/test_gpu_self_test.py• L43-133 tests/test_gpu_routing_caveats_1812.py• L37-164 tests/test_pascal_gpu_guidance.py• L66-237 tests/test_windows_rocm_driver_hip_4200.py• L29-103 tests/test_xpu_mem_get_info_shim.py• L77-170 tests/test_rocm_torch_pins_match_pyproject.py• L55-125 tests/…/test_omnivoice_gguf_resident.py• L216-339 tests/test_engine_language_options.py• L48-61
Operational smoke tests
Smoke tests check behavior across real process boundaries. They use a built renderer, a controlled or running backend, native media tools, packaged resources, and platform setup where needed. Their purpose is to show that a user can start the product and complete a high-risk action.
Renderer smokes use an offline server and a throwaway model cache. Electron UI tests launch the real app on macOS, Windows, and Linux. A three-shard crawler clicks every route button under several backend fault modes and fails on stuck spinners, disabled controls, silent errors, crashes, or console errors. Packaged smoke builds the unpacked release app and checks startup, the bundled CLI, native resources, relocation, platform limits, and macOS bundle validity.
Desktop UI smoke also treats network isolation as a product contract. Main-process Chromium and Node requests to outside hosts must be cancelled, renderer requests must surface as a run failure, and a run with no observed request must not pass because the request guard was lost. The same layer checks first-run setup, backend-down recovery, settings persistence after relaunch, file dialogs, bridge health, unexpected exits, and high-rate backend status updates.
The Python smoke matrix runs narrow service and CLI checks on supported macOS, Windows, and Linux hosts. Intel Mac remains an explicit remote-backend-only contract. The matrix also checks media-tool setup, credentials, model-download isolation, Windows process behavior, the isolated backend session, and the CLI on a newer supported Python. The CLI install smoke is now wired to the POSIX install legs and watches the files that can change its behavior. This exposes platform import, path, native runtime, and dependency failures that a Linux-only test run cannot show.
The release path is part of smoke coverage. It builds the web and desktop artifacts, packages an unpacked app for Linux and macOS, checks bundled native code and the public CLI, then starts the packaged app. Install triggers cover the installer scripts, lockfiles, packaging inputs, bundled payload, and runtime setup helpers. This catches failures that source tests cannot see because they affect copied resources, bundle layout, signing, or the release entry point. Container checks add the same guard to image publication: rolling tags stay on main pushes, release tags wait for a published release, architecture-specific images use their matching base, and registry write permission stays with publishing jobs.
References: electron/…/smoke-inventory.test.mjs• L11-83 electron/…/ui-crawler.mjs• L255-337 electron/…/desktop-harness.mjs• L235-285 electron/…/desktop-ui.test.mjs• L16-100 electron/…/desktop-ui.test.mjs• L102-403 electron/…/packaged-smoke.mjs• L1-80 .github/…/ci.yml• L455-489 .github/…/ci.yml• L498-633 .github/…/ci.yml• L829-976 tests/test_cli_install_smoke.py• L43-71 tests/test_install_smoke_workflow.py• L85-162 tests/test_docker_workflow.py• L39-242
Security boundaries
Security tests protect trust boundaries around the local service, desktop bridge, model downloads, archives, remote workers, native probes, and release workflows. They check that untrusted input cannot choose credentials, escape an allowed path, follow a private redirect, or turn a public error into a secret leak.
Model access requires an approved source, revision, licence state, and verified bytes. Local model discovery is bounded to the requested engine and path. Mobile downloads reject oversize bodies, redirects, missing credentials, bad checksums, and unsafe storage states. Desktop account and crash paths remove tokens, signed links, home paths, and private text before state reaches the renderer or disk. Portable bundle import bounds design data and verifies consent evidence instead of trusting manifest claims.
The gallery adds a signed, opt-in content boundary. No request occurs before consent. Stored manifests are verified again on load, preview bytes must match their digest, and archive members cannot escape the preview directory or introduce links. The use action stores a voice recipe and does not read a downloaded preview as reference audio. This keeps remote preview content separate from user voice data and model execution.
Public error text follows the same fail-closed rule. HTTP details must not expose caught exceptions or machine paths because the renderer shows them directly and bug reports can publish them. The shared scrubber removes home paths, credential-shaped values, secret query values, and provider keys. If redaction itself fails, it returns a safe redacted result instead of the original text.
Authorization has a class-level contract, not only a list of known routes. Every mutating HTTP route and every WebSocket route must expose an authorization dependency or a written allowlist decision. The route census checks that the route exists, the decision is still live, and the application middleware still rejects an unauthorized remote WebSocket. The capture stream adds a handler-level guard before accept() and closes a refused connection with policy code 1008, which protects live microphone audio from a local process that is not allowed to read it.
Diagnostic data follows the same fail-closed rule. Product analytics consent does not grant diagnostic consent. Kill switches and unreadable consent state clear pending data, stale grants cannot resume after a relaunch, and only sanitized records from the active consent epoch can leave the device. A failure keeps the grant of the operation that observed it, so a later opt-in cannot authorize an old task or a cancelled task.
The CI boundary is part of this protection. Change detection runs conservatively: a deleted, renamed, unknown, or unreadable file causes wider jobs to run rather than silently skipping a needed platform or security check. The required aggregate job accepts a skip only when the classifier proves that the changed files cannot affect that job. Python tests use isolated backend sessions and an offline model guard, while generated mobile files are checked against their source. Security analyzers run from exact version pins, and trusted workflow checks validate release, gallery, documentation, and commit policies from a base-controlled context. Workflow action references must use one full commit pin with a readable version label, and optional online resolution must distinguish a missing tag from a failed lookup.
References: backend/…/test_local_model_paths.py• L118-148 backend/…/test_personas_api.py• L175-225 backend/…/test_capture_ws.py• L41-107 tests/test_gallery_previews.py• L239-317 tests/test_gallery_previews.py• L383-495 tests/test_route_authorization_policy.py• L415-550 tests/test_route_authorization_policy.py• L574-650 mobile/…/BoundedDownloadTests.swift• L57-88 mobile/…/LocalInferenceTests.swift• L83-100 electron/…/account-ipc.test.ts• L60-142 electron/…/account-ipc.test.ts• L233-421 electron/…/diagnostics.test.ts• L135-294 electron/…/diagnostics.test.ts• L432-568 tests/test_diagnostic_reports.py• L320-406 tests/test_error_detail_scrubbing.py• L11-269 tests/test_scrub.py• L52-411 electron/…/ipc-registry.test.ts• L167-218 electron/…/trusted-ipc.test.ts• L34-75 tests/test_verify_action_pins.py• L38-93 tests/test_workflow_action_pins.py• L129-300 .github/…/ci.yml• L46-135 .github/…/ci.yml• L261-297
Repository and release contracts
Repository checks protect the change process that produces the product. They keep release notes readable and uniquely parseable, prevent placeholder, personal, or agent identities from entering the audit trail, and ensure automated contributor credits do not block a release when external lookup fails.
Release and distribution checks keep policy tied to the artifact being published. Docker tags wait for the correct release event and architecture-specific build. The gallery pin can move only forward along its trusted main branch. Documentation-only changes still reach the drift checker without gaining issue-write permission. Version tests keep the checkout, package metadata, backend fallback, and native app display aligned, so a stale installed cache cannot report an old release.
Dependency and workflow checks protect setup as part of release quality. The default install resolves to wheels on supported packaged hosts, vendored wheels remain pure and match the lock, and Windows ROCm uses one reviewed interpreter recipe. These checks prevent a green workflow from publishing the wrong image, stale dependency, missing documentation contract, or an install that starts a compiler on a user's machine.
References: tests/test_changelog_style.py• L79-369 tests/test_commit_identities.py• L72-423 tests/test_release_contributors.py• L54-255 tests/test_app_version.py• L11-180 tests/test_cpu_install.py• L42-120 tests/test_lock_wheel_only.py• L114-140 tests/test_vendored_wheels.py• L42-88 tests/test_windows_rocm_recipe_pin.py• L51-86 tests/test_docker_workflow.py• L39-242 tests/test_gallery_pin.py• L47-93 tests/test_docs_drift.py• L18-71
Regression protection
Regression tests preserve fixes for failures that are easy to reintroduce. Recent coverage keeps runtime setup, local model validation, hardware choice, account state, update state, lazy loading, media export, generation behavior, and mobile inference behavior visible.
The runtime is ready only after setup and fresh verification. Interrupted installs resume without evicting healthy wheels. Unsupported hardware remains actionable instead of pretending to work. CPU pinning preserves unrelated preferences and removes an override that could defeat the safe choice. Atomic file replacement keeps the previous export when disk space or a platform rename fails.
The backend keeps local model changes honest. An unchanged folder stays warm, but changed nested weights and unreadable files force a reload. A late result from an old folder cannot overwrite a newer selection. These rules prevent stale or unsafe assets from becoming the active model while avoiding needless reloads. Sidecars also keep cold-start progress visible without extending a silent job forever, and platform shims are installed before any model load that needs them.
The renderer keeps user work and user trust during failure. A signed-out or unavailable account makes no account call and shows no token. A failed setting save re-reads state. A failed player chunk keeps the shell and offers retry. A sound-effects or GPU status code is translated to a known message, while unknown server text is not shown as trusted guidance. Update checks coalesce duplicate actions, retry transient feed errors, and keep store-owned update rules separate from direct packages. Generation failures stay with the active request, queued work keeps its original inputs, and cancellation does not publish a partial take.
CI runs the backend and frontend results through one required aggregate gate. It keeps backend/tests/ in an isolated session, blocks silent model downloads, installs Electron dependencies from the lock file, checks the mobile generated files, and runs platform smoke jobs when their scope can be affected. Renderer, crawler, desktop UI, native package, and release smoke jobs add evidence from real app and package boundaries. Mobile artifact publication retries once without repeating native verification. This makes the test result evidence about the product path rather than only about a local module.
Regression coverage now keeps four easy-to-lose contracts visible. Diagnostic permission and durable recovery must remain independent from analytics and must not replay stale or private data. Dub recovery must not turn a partial render into accepted speech. Route policy must fail when a new state-changing route has no authorization decision, even if no named route list was updated. Generated mobile contracts, release metadata, and security tooling must stay aligned with their sources and exact policy versions. The current additions also protect GGUF binary and reference-audio preflight, resident-server fallback, streaming equivalence, profile-save decoupling, language catalogues, portable filenames, wheel-only setup, workflow action pins, dubbing state persistence, model preload scope, and account-state redaction.
References: backend/…/test_local_model_paths.py• L173-281 tests/test_dub_pipeline_state.py• L102-251 tests/test_model_manager_preload.py• L69-265 electron/…/runtime-project.test.ts• L789-929 electron/…/runtime-torch-variant.test.ts• L201-336 electron/…/runtime-legacy-cuda.test.ts• L196-297 electron/…/diagnostics.test.ts• L351-424 electron/…/diagnostics-storage.test.ts• L311-432 tests/test_diagnostic_reports.py• L479-669 tests/test_dub_crash_resume.py• L98-300 tests/test_route_authorization_policy.py• L291-367 electron/…/account-ipc.test.ts• L60-421 electron/…/account-settings.test.tsx• L58-118 electron/…/performance-settings.test.tsx• L25-75 electron/…/use-generate.test.tsx• L928-1217 tests/test_model_load_extends_generate_budget.py• L130-219 tests/test_omnivoice_sidecar_cold_start.py• L131-208 tests/test_mobile_contract.py• L318-677 tests/…/test_omnivoice_gguf.py• L617-747 tests/…/test_omnivoice_gguf.py• L892-1287 tests/…/test_omnivoice_gguf_resident.py• L259-716 tests/test_profile_design_save_decouple.py• L237-426 tests/test_profile_unification.py• L224-476 tests/test_portable_filename.py• L23-82 tests/test_lock_wheel_only.py• L114-140 tests/test_workflow_action_pins.py• L138-303
Verification flow
Use the smallest layer that can prove the changed contract. Add wider checks when the change crosses a process, client, media, security, platform, or release boundary:
- Run the focused backend, desktop, or mobile contract checks.
- Run integration checks when a route, model, worker, media format, workflow, or handoff changes.
- Run renderer, accessibility, localization, and crawler smoke checks when a user action or visible state changes.
- Run native setup, packaged runtime, store, and real transport checks before release or after platform, installer, worker, or package changes.
- Read security and advisory media-quality results as separate signals. A non-gating quality report is not proof that the product is safe or that generated speech sounds good.
| Changed area | Contract checks to add |
|---|---|
| API or stream | Route surface, response shape, terminal events, time budget, and client callers |
| Batch or job queue | Job state, ordering, cancellation, shutdown, progress, and partial-file cleanup |
| Renderer or desktop bridge | Unit checks, type/build checks, request guard, accessibility, and packaged smoke |
| Mobile schema or design source | Generated API, model catalogue, token, string, and mobile failure-state checks |
| Media, dubbing, or project handoff | Decode, timing, ownership, atomic publication, language mapping, and export checks |
| Model, installer, or runtime | Source host, revision, cache repair, licence, host support, and retry checks |
| Local model or hardware selection | Capability scope, current identity, path revalidation, real-work probe, and safe fallback |
| Packaging, container, or release channel | Distribution identity, signing, manifest, digest, tag, update feed, and store handoff checks |
| CI or security workflow | Change detection, required gate, secret, dependency, approval, and runner-isolation checks |
Change checklist
When these files or sections are changed, remember to consider these:
- When a model path or engine rule changes, keep file shape, architecture identity, discovery scope, saved preferences, weight fingerprints, reference-audio decoding, and download prevention aligned.
- When model preload changes, keep accepted setting values, selected-engine resolution, local-cache checks, licence checks, checkpoint pins, and normal load behavior aligned.
- When GGUF runtime or resident-server behavior changes, keep executable integrity, quant selection, timeout ownership, process restart, CLI fallback, self-test evidence, and unload behavior aligned.
- When runtime setup changes, keep readiness, interruption, repair ownership, host support, platform variants, download progress, native probes, proxy behavior, wheel sources, and CPU fallback aligned.
- When backend supervision changes, keep startup retries, live-process classification, active and calm probe cadence, remote session checks, recovery state, and renderer labels aligned.
- When dubbing job state changes, keep safe job paths, event shapes, process cleanup, in-memory and database hydration, language columns, withdrawal tombstones, worker-thread saves, and cancellation cleanup aligned.
- When desktop state crosses the main process bridge, keep token removal, signed-link conversion, error classes, retry state, trusted-frame checks, and renderer labels aligned.
- When account state or sign-in options change, keep feature switches, keyring access, identity generations, refresh broadcasts, profile validation, and signed-out state aligned.
- When a renderer chunk, player, setting, or generation flow changes, check the surrounding shell, activity counter, queue ownership, cancellation path, timeout, retry path, stream terminal events, and user-visible fallback together.
- When a mobile download or local model rule changes, keep size limits, redirects, credentials, ranges, checksums, storage reservations, licence state, leases, and caller budgets aligned.
- When a persona bundle changes, keep inspect-without-write behavior, manifest validation, design recipe limits, audio member rules, legacy defaults, and consent evidence aligned.
- When a profile design or clone flow changes, keep persistence, lazy sample creation, speech-input invalidation, reference transcript pairing, speaker-label trust, and remote access rules aligned.
- When an export history or filename rule changes, keep credential tiers, path redaction, traversal checks, Windows device-name repair, extension preservation, and desktop download names aligned.
- When update or distribution metadata changes, keep package identity, update owner, channel, feed artifact, cache cleanup, and restart behavior aligned.
- When a smoke or crawler changes, keep its runner, backend mode, offline cache, platform scope, packaged entry point, installed inputs, and fault assertions explicit.
- When CI scope or required jobs change, keep deletion and rename fail-safes, job dependencies, skip rules, shard coverage, generated-file checks, and the aggregate check name aligned.
- When archetype routes or gallery previews change, keep catalog search and pagination, deferred recipe selection, compatible legacy reuse, imported-profile protection, consent, manifest signatures, archive paths, preview digests, and cache completion aligned.
- When capture WebSockets change, keep the shared loopback or remote policy before
accept(), the refusal code, minimum audio buffer, and browser integration path aligned. - When diagnostic reporting changes, keep explicit consent, analytics separation, kill-switch revocation, consent epochs, redaction, bounded queues, crash markers, durable file publication, and backend/renderer failure ownership aligned.
- When dub rendering or resume changes, keep the recovery key, model fingerprint, private staging area, publication boundary, cancellation cleanup, and journal failure fallback aligned.
- When a mutating route or WebSocket changes, keep the live route census, dependency tree, allowlist reason, middleware policy, and handler-level policy aligned.
- When desktop IPC or embedded browsing changes, keep the shared top-level-frame gate, channel census, isolated session, URL scheme policy, permission denial, and external-open behavior aligned.
- When desktop UI smoke changes, keep main-process and renderer request guards, observed-request checks, setup fixtures, relaunch state, platform bridge facts, and status-burst coverage aligned.
- When generated mobile contracts or release policy changes, keep source manifests, generated bytes, line-ending pins, licence fingerprints, artifact retries, trusted workflow permissions, release-event conditions, and native localization parity aligned.
- When GPU or sidecar startup changes, keep diagnostics, setup guidance, generation errors, heartbeat credit, hard timeout, device-query shims, proxy environment, and the shared Torch pins aligned.
- When public errors or diagnostic scrubbing changes, keep renderer display, bug-report export, path redaction, query credential handling, fail-closed behavior, and helper imports aligned.
- When workflow actions or version sources change, keep full-SHA pins, version labels, one pin per action, checkout version, package version, backend fallback, and native display values aligned.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| A local model has missing files or the wrong architecture | The client loads the wrong model or starts an unsafe download | Engine-specific path validation and bounded discovery |
| A bundled executable is empty, corrupt, or has a changed digest | Generation reaches an opaque spawn error or uses unverified code | Binary preflight, manifest digest checks, and safe engine fallback |
| A non-WAV or unsupported reference reaches the GGUF CLI | Clone generation fails with an opaque decoder error | Format detection, bounded conversion, and transcript validation |
| A resident server dies twice or holds a different quant | A request hangs, uses stale weights, or blocks all generation | One restart, quant identity checks, timeout, and CLI fallback |
| A model changes in a nested file but its fingerprint looks unchanged | The engine keeps stale weights | Bounded fingerprints that force reloads for changed or unreadable assets |
| Preload checks an unselected engine or an uncached checkpoint | Startup performs unwanted licence or model work, or the first request stays slow | Selected-engine resolution, local-cache gate, and preload setting tests |
| A runtime is marked ready after an interrupted or failed native check | The app starts with missing or unsafe dependencies | Fresh runtime verification and readiness tests |
| A CPU or ROCm install resolves the wrong wheel set | Setup downloads unusable GPU packages or compiles a source package | Platform matrix, wheel-only lock checks, vendored-wheel checks, and native probes |
| A live but busy backend is reported as failed | A long job is interrupted by an error screen | Supervisor state tests and recovery probes |
| A dubbing job saves empty language data or recreates a withdrawn job | History hides finished tracks or cancelled work returns after deletion | Upsert preservation, database round-trip, tombstone, and worker-cancellation tests |
| A failed setting, account save, or profile preview leaves stale UI or audio state | The next action overwrites a value or sample the user did not choose | Re-read, version, and stale-render protection tests |
| A queued take uses a changed voice or transcript | The output does not match the user's current source | Request snapshots and stale-queue checks |
| A streamed chunk fails after earlier chunks were sent | The client accepts partial speech as a completed take | In-band error event with no done event, file, or history row |
| A mobile download follows a redirect or exceeds its byte limit | Credentials or disk space can be exposed to an unintended host | Redirect and bounded-stream tests |
| A native test process does not exit or its pipe is not drained | CI hangs until its job timeout | Deadline-based process waits, bounded stop, and output collection |
| A cancelled mobile clone publishes its partial voice | The user sees a voice that did not complete | Cancellation and atomic publication tests |
| A server returns an unknown error code or raw detail | The client shows unsafe or unusable guidance | Known-code translation with safe fallback and public-detail scrubbing |
| A gallery manifest, digest, or archive member is hostile | The client trusts altered audio or writes outside its cache | Opt-in fetch, signature and digest checks, and bounded archive extraction |
| A persona manifest claims consent without valid consent audio | An unverified voice is shown as verified | Bundle import validation and consent evidence checks |
| Update cleanup deletes the base cache or uses the wrong channel | A later update fails or a store build uses a forbidden path | Cache, distribution, and feed contract tests |
| CI skips a job after a rename, deletion, or classifier error | A platform or security regression reaches the merge gate | Conservative change detection and aggregate gate |
| A new mutating route or IPC channel has no trust decision | An unprotected state change reaches a release | Live route census, shared IPC gate, allowlist integrity, and middleware tests |
| A capture WebSocket accepts before its access guard runs | An unauthorized local process can stream microphone audio | Pre-handshake loopback checks and policy-violation close tests |
| Diagnostic consent is inferred from analytics or stale persisted state | Private or withdrawn data is collected after the user said no | Independent consent, epoch rotation, kill-switch, and purge tests |
| A diagnostic spool contains raw input or an old epoch | A crash report leaks private data or replays a revoked grant | Strict projection, bounded storage, same-epoch import, and redaction tests |
| A desktop request guard only records an outside request or sees no request | A network leak or broken guard passes smoke | Cancellation assertions and observed-request failure checks |
| A model-load heartbeat extends a silent or unrelated job | A hung worker survives until resources are exhausted | Per-worker heartbeats, stage filtering, and a hard extension cap |
| A GPU caveat uses the wrong hardware remedy | Users reinstall a working stack or miss a safe CPU/Vulkan path | Shared routing, setup, diagnostic, and localized guidance checks |
| A generated mobile, version, or release artifact drifts from its source | Native clients or published notes use stale contract data | Byte-for-byte generation checks, LF pins, and release preparation tests |
| A release image publishes on a tag before the release is approved | An unreviewed image receives a public version tag | Published-release trigger and explicit tag policy tests |
Key files
| File | Why to read it |
|---|---|
| backend/…/test_local_model_paths.py | Shows the local model file, engine, discovery, persistence, and reload contract. |
| tests/test_model_manager_preload.py | Shows preload scope, local-cache behavior, engine selection, and load identity. |
| tests/test_dub_pipeline_state.py | Shows dubbing job paths, events, process cleanup, database persistence, language repair, tombstones, and async cancellation. |
| backend/…/test_personas_api.py | Shows portable voice inspection, import, legacy compatibility, design data, and consent rules. |
| backend/…/test_archetypes_api.py | Shows catalog browsing, deferred recipe selection, preview caching, and profile collision rules. |
| tests/…/test_omnivoice_gguf.py | Shows bundled-engine integrity, fallback, reference-audio, language, and output contracts. |
| tests/…/test_omnivoice_gguf_resident.py | Shows resident-process reuse, restart, self-test, timeout, and unload behavior. |
| tests/test_generate_streaming.py | Shows incremental delivery, classic-output equivalence, safe errors, and timeout classes. |
| tests/test_profile_design_save_decouple.py | Shows model-free profile persistence and lazy audio materialization. |
| tests/test_profile_unification.py | Shows unified clone/design inputs, engine recipes, stale preview protection, and migration rules. |
| tests/test_speaker_clone_purity.py | Shows trusted speaker references, transcript refinement, and private API projection. |
| tests/test_srt_parser.py | Shows subtitle input tolerance, overlap handling, and linear-time parsing. |
| tests/test_db_schema_reconcile.py | Shows how legacy databases converge without losing rows or sync identity rules. |
| tests/test_dub_crash_resume.py | Shows dub staging, exact-input recovery, model-change invalidation, cancellation, and cleanup. |
| electron/…/runtime-project.test.ts | Shows runtime installation, repair, interruption, proxy use, verification, and host support. |
| electron/…/runtime-torch-variant.test.ts | Shows CPU, CUDA, ROCm, and Windows ARM selection. |
| electron/…/runtime-legacy-cuda.test.ts | Shows legacy NVIDIA handling and safe CPU fallback. |
| electron/…/account-ipc.test.ts | Shows account privacy, feature switches, stale identity protection, refresh broadcasts, and input validation. |
| electron/…/diagnostics.test.ts | Shows desktop diagnostic consent, revocation, strict data projection, delivery, and crash recovery. |
| electron/…/diagnostics-storage.test.ts | Shows durable diagnostic recovery when local file operations fail. |
| electron/…/ipc-registry.test.ts | Shows the repository-wide IPC registration and trust-gate census. |
| electron/…/trusted-ipc.test.ts | Shows trusted top-level frame and owner-window checks. |
| electron/…/site-browser.test.ts | Shows safe URL policy and isolated embedded browsing. |
| electron/…/portable-filename.test.ts | Shows cross-platform export filename rules. |
| electron/…/use-generate.test.tsx | Shows shared generation state, queue snapshots, cancellation, capability checks, and recovery. |
| electron/…/generationFailureMessage.test.ts | Shows the allowlisted mapping from backend failure topics to localized guidance. |
| mobile/…/PhoneCloneUiTest.kt | Shows Android clone progress, cancellation, interruption, and retry. |
| mobile/…/BoundedDownloadTests.swift | Shows iOS download limits, redirects, cancellation, storage budgets, and process-backed transport tests. |
| mobile/…/LocalInferenceTests.swift | Shows model delivery, verification, licence, storage, and local routing. |
| tests/test_mobile_contract.py | Shows source-to-generated API, model, licence, design, token, network, and native asset contracts. |
| tests/test_gallery_previews.py | Shows consent, signature verification, digest checks, safe archive extraction, and local fallback. |
| tests/test_route_authorization_policy.py | Shows the class-level authorization census for mutating routes, reads, and WebSockets. |
| tests/test_cli_install_smoke.py | Shows that the CLI install smoke is connected to the supported install legs. |
| tests/test_install_smoke_workflow.py | Shows how install-smoke triggers cover every installed input. |
| tests/test_lock_wheel_only.py | Shows the no-source-build contract for packaged setup. |
| tests/test_vendored_wheels.py | Shows offline integrity and content limits for vendored wheels. |
| tests/test_app_version.py | Shows version source precedence and cross-platform version lockstep. |
| tests/test_windows_rocm_recipe_pin.py | Shows one reviewed Windows ROCm interpreter contract. |
| tests/test_workflow_action_pins.py | Shows full-SHA workflow pinning and one-pin consistency. |
| tests/test_verify_action_pins.py | Shows safe tag and branch resolution for optional pin verification. |
| electron/…/desktop-ui.test.mjs | Shows real-app network isolation, first-run setup, route rendering, relaunch state, bridge checks, and status-burst resilience. |
| .github/…/ci.yml | Defines the required gate, change scope, isolated Python tests, renderer and desktop smokes, package checks, and cross-platform smoke matrix. |