Land release blocker fixes and workspace cleanup
Some checks failed
check / cargo check (macos-latest) (push) Has been cancelled
check / cargo check (ubuntu-22.04) (push) Has been cancelled
check / cargo check (windows-latest) (push) Has been cancelled
check / svelte build + lint (push) Has been cancelled

This commit is contained in:
2026-04-23 00:16:09 +01:00
parent d7363cc913
commit 9b0067b4c0
36 changed files with 1529 additions and 418 deletions

View File

@@ -4,6 +4,33 @@
**Path:** `crates/storage/src/migrations.rs:208-216`, `crates/storage/src/database.rs:61-89`, `:697-708`
**Source:** [2026-04-22 code review](../code-review-2026-04-22.md#c4--transcript-provenance-can-reference-deleted-profiles)
**Labels:** release-blocker, critical, data-integrity, storage
**Status:** RESOLVED (2026-04-22)
## Resolution
Chose the strict provenance path:
- Migration v9 rebuilds `transcripts` with
`profile_id REFERENCES profiles(id) ON DELETE RESTRICT`.
- Existing orphaned transcript `profile_id` values are reconciled onto
`DEFAULT_PROFILE_ID` during the copy into the rebuilt table.
- Because SQLite table renames rewrite dependent references, the
migration also rebuilds `segments`, recreates the transcript FTS
virtual table/triggers, and repopulates FTS from the rebuilt
transcript rows inside the same transaction.
Application-layer behaviour now matches the schema:
- `insert_transcript` rejects unknown `profile_id` values with a clear
storage error before attempting the insert.
- `delete_profile` returns a human-readable reassign-first error when
transcripts still reference that profile.
Regression tests:
- `migration_v9_reconciles_orphaned_transcript_profiles_and_adds_fk`
- `insert_transcript_rejects_unknown_profile_id`
- `delete_profile_rejects_when_transcripts_reference_it`
## Problem