Land release blocker fixes and workspace cleanup
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user