Refactor ETag generation for oneliners API
Remove the per-user oneliner watermark, which was previously used to generate ETags for the `/api/oneliners` endpoint. The watermark was intended to track the last successful oneliner write for each user. The ETag generation has been refactored to use a deterministic FNV-1a hash. This hash is computed over a sorted list of tuples containing `(case_id, last_recording_at_ns, oneliner_mtime_ns)` for all visible cases. This approach ensures that the ETag changes whenever any listen-relevant file system modification occurs, such as a new recording, oneliner regeneration, soft-delete, undo, or upload-auto-reopen. This new method is more robust and avoids the complexity of managing per-user state. The `OnelinerWatermark` type alias and its associated logic have been removed from `AppState` and the relevant modules (`transcribe::worker`, `transcribe::recovery`, `routes::oneliners`, `main`). New integration tests have been added to verify that various delete operations (single delete, undo delete, bulk delete) correctly trigger an ETag update, ensuring cache invalidation.
This commit is contained in:
@@ -41,8 +41,12 @@ pub struct CaseMarker {
|
||||
/// updates. Drives the UI sort order (newest activity first).
|
||||
pub last_activity_at: String,
|
||||
/// `true` once this case has been seen in any `/api/oneliners`
|
||||
/// response. Reserved for future delete-propagation logic; today only
|
||||
/// useful for diagnostics.
|
||||
/// response or after a successful upload ACK. Drives two clean-up
|
||||
/// paths: [`CaseStore::reconcile_with_server_snapshot`] only removes
|
||||
/// synced markers the server no longer lists, and
|
||||
/// [`CaseStore::cleanup_stale`] only ages out synced markers. Pending
|
||||
/// (`= false`) markers guard unsent uploads and are never touched by
|
||||
/// either — losing one would silently erase a patient recording.
|
||||
pub synced_to_server: bool,
|
||||
/// `None` while transcription / oneliner generation is pending; set
|
||||
/// from the server snapshot when available.
|
||||
|
||||
Reference in New Issue
Block a user