mirror of
https://github.com/debpalash/VoiceStudio.git
synced 2026-12-06 18:38:20 +00:00
* perf: speed up Electron startup, UI rendering, and backend engine/DB boot * chore: add changelog fragment for #4320 * perf: add SQLite indexes/pragmas, selective gzip, and immutable asset cache * fix: restore the omnivoice-gallery pin to main's commit The branch moved the submodule pointer back to 22e8e6da8, failing the forward-only pin check. * fix(db): create perf indexes after the additive reconcile so legacy DBs upgrade The history/list sort indexes sat in _BASE_SCHEMA, so a legacy generation_history without 'starred' aborted init_db's executescript with 'no such column: starred' before _migrate could add it. Move them to _ensure_perf_indexes(), run after _reconcile_additive_columns, skipping any index whose table/columns are absent. * fix(electron): load the voices sidebar eagerly so it precedes page content Lazy-loading VoicesSidebar made it mount after the page, so on first paint the clone page's full-card voice button was the first 'Language fixture' button and a click on it landed on the profile photo label (language-picker-smoke timeout). It also made the sidebar pop in late. Restore the eager import. * test(openai): drop the wire encoding when the SDK transport replays a decoded body TestClient already decompresses res.content, so replaying it with the gzip Content-Encoding header made httpx decode twice (incorrect header check) once /v1/models was compressed. Add a wire-level check that the compressed body is valid. * test(moss): resolve the lazy transformers __version__ before rebinding the module transformers is a lazy module whose __version__ only enters its __dict__ once read; the rebound copy lacked it when nothing had read it yet. * fix(electron): serve app:// static files from a single open handle Stat then read let the file change in between (CodeQL js/file-system-race). One FileHandle now provides the stat, the read and the stream, and the content-length of a buffered file comes from the bytes actually read. * feat(db): add alembic revision 0019 for the list sort indexes Schema changes go through alembic with a tested upgrade path. The revision creates the seven indexes IF NOT EXISTS, only where the table and columns exist; init_db's _ensure_perf_indexes stays for installs where alembic cannot run, and a test keeps the two lists equal. Also make the alembic fast-path test fail if alembic is imported. * fix(api): skip gzip for all media mounts and honour Accept-Encoding q-values /voice_audio and /demo_audio were compressed on the event loop, and gzip;q=0 was answered with gzip because Starlette matches the substring. Parse the header per RFC 9110 before delegating, and require compression in the /v1/models wire test. * fix(electron): start the backend after agent discovery, defer the dock, harden the palette - Spawn Python only once registerRepairAgents set VOICESTUDIO_LLM_AGENTS; window, tray and updater still overlap with it. - RepairAgentDock mounted at startup because Boolean(state) is always true; test runs. - Command palette: LazyBoundary closes on a failed chunk, Escape works while the chunk loads, the highlight follows the command id, and loading/error are not reported as no matches. - Tighten the app:// handle test to swap the path after the stat. * fix(engines): report omnivoice and kittentts ready only when they really import #4320 replaced their import check with a package-spec lookup, so an installed package with a missing dependency or broken native library showed as ready on /engines and /engines/{id}/health. Restore the real import (it is cached in sys.modules after the first success); the parallel probing is kept. No other backend used the spec-only pattern. * fix(engines): probe engine availability serially again The thread-pool probing in list_backends (tts and asr) and /engines raced the first imports of heavy, interdependent packages, so the active engine could be reported unavailable. Restore main's serial loops and pin it with a test.
Alembic migrations
Schema evolution lives here going forward. The legacy hand-rolled
_migrate() function in backend/core/db.py is kept for the next release
as a fallback, and can be retired once Alembic has run in production.
Workflow
From the repo root:
# Create a new migration
uv run alembic revision -m "add glossary table"
# Apply pending migrations
uv run alembic upgrade head
# Show current schema version
uv run alembic current
# Downgrade one step
uv run alembic downgrade -1
Conventions
- SQLite-safe:
env.pysetsrender_as_batch=True, soALTER TABLEemits a table-rewrite strategy that works on SQLite. - No autogeneration: this repo has no SQLAlchemy models; every migration is
written by hand using
op.execute(...)or typed helpers likeop.add_column,op.create_table, etc. - No destructive migrations without review: if a migration deletes a column or drops a table, the PR must be explicit about it.
Bootstrap note
On first run against an existing DB already at legacy PRAGMA user_version = 2,
stamp Alembic to a baseline before applying new migrations:
uv run alembic stamp head
This tells Alembic that the schema is up-to-date as of the baseline version.