Repository navigation
feat(history): complete dal delete and eviction consistency - #11
Merged
Merged
Conversation
- delete the row before its audio file so a failure in between can never leave a row referencing a missing file (ARCHITECTURE 7.7) - refuse to delete in-flight generations via ActiveGenerationError - defer and retry file removals the OS refuses (Windows file locks) - guarantee strictly increasing created_at so history and eviction order follow insertion order - enforce the 8.2 settings key set and add seed_settings for lazy seeding
Track T1.5 on branch arch/tts/t1.5 (Doing until the PR is merged), drop the finished T1.4/T1.5 rows from Remaining, and record the ordering, deletion, and settings decisions plus their downstream contracts for T1.6, T2.2, and T2.3.
Record PR #12 on branch fix/integration-rate-flake as the separate maintenance fix for the pre-existing stochastic duration-predictor flake.
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.
Task T1.5 from
docs/ARCHITECTURE.md§14.What was built
Completes the history DAL beyond the T0.4 skeleton: transactional delete-with-file, eviction ordering, and settings seeding, with the NFR-05 property tests the task's acceptance criteria call for.
RLock.ActiveGenerationError. §7.7's Must-not ("delete a row whose id is active") is binding, sodelete()now refuses aqueued/running/cancellingrow instead of relying on the caller.close(), so deletion stays real (§8.5).datetime.now()calls produced 3 distinct values on this machine), socreated_atis now emitted strictly increasing. History order (newest first) and eviction order (oldest first) follow insertion order rather than an arbitrary UUID tiebreaker.put_settingsrejects keys outside{defaultVoiceId, rate, volume}andget_settingsignores unknown stored keys, enforcing §8.2 in the DAL.seed_settings(default_voice_id)provides the §8.2 lazy seeding for T2.3 — the DAL cannot importvoices, so the caller supplies the voice id.evict_to_limit.Verification
pytest tests/unit— 103 passed (16 new intests/unit/test_dal_consistency.py), stable over 5 consecutive runsruff check src/tts tests— cleanruff format --check src/tts tests— 34 files already formattedmypy --strict src/tts— no issues in 22 source filespytest tests/integration— 5 passed, 1 failed (pre-existing, unrelated — see below)npm run lint,npm run typecheck,npm run test— clean, 34 vitest tests passgit diff --check— cleanNew tests cover: a forced row-delete failure (SQLite
RAISE(ABORT)trigger) leaving row and file intact; a forced file-delete failure leaving no dangling row and retrying the removal; retry after failure; refusal of active rows; eviction leaving no dangling rows; concurrent delete/eviction; the settings key set; and insertion ordering across a restart.Known issue (pre-existing, not from this PR)
tests/integration/test_piper_engine.py::test_rate_scales_duration_within_ten_percentis flaky — measured ratio 0.814–0.913 over 10 attempts against the [0.72, 0.88] band (6/10 pass). piper 1.8's duration predictor is stochastic. It comes from T1.2 and this PR does not touch that file; the fix is tracked as a separate maintenance PR so this task does not edit a file owned by another task (§16).Decisions
delete()raisingActiveGenerationErrorsupersedes T0.4's "active-row gating is the caller's job" note; §7.7's Must-not governs.active_ids(the merged T0.4 test pins this), so T1.6 must pass every in-flight id, not just the new one.Downstream contracts
evict_to_limit(active_ids).ActiveGenerationErrorfromdal.delete()and map it to 409GENERATION_BUSY, not 404.dal.seed_settings(default_voice_id)for lazy §8.2 seeding.Suggested merge
Squash merge with branch deletion.