feat: Add per-case dir oneliner locks
Introduces `OnelinerLocks` to serialize read-modify-write operations on
`oneliner.json`. This prevents race conditions between the manual
override API (`PUT /api/cases/{case_id}/oneliner`) and the transcription
worker's auto-regeneration process.
The manual override now acquires a lock specific to the `case_dir`
before writing. The transcription worker's `update_oneliner` function
also acquires the same lock around its post-LLM re-read-and-write
sequence. This ensures that a doctor's manual edit always takes
precedence, even if it arrives while an auto-regeneration is in
progress.
This change also includes:
- A new `routes::oneliner_override` module for the PUT handler.
- Validation for the oneliner text length and emptiness.
- Integration tests for the override functionality, covering happy path,
error conditions, early latching, race conditions, and parallel PUTs.
This commit is contained in:
@@ -521,9 +521,9 @@ impl DoctateApp {
|
||||
|
||||
let time_str = extract_hhmm(&marker.last_activity_at);
|
||||
let oneliner = match &marker.oneliner {
|
||||
Some(OnelinerState::Ready { text, .. } | OnelinerState::Manual { text, .. }) => {
|
||||
text.clone()
|
||||
}
|
||||
Some(
|
||||
OnelinerState::Ready { text, .. } | OnelinerState::Manual { text, .. },
|
||||
) => text.clone(),
|
||||
Some(OnelinerState::Empty { .. }) => "∅".to_owned(),
|
||||
Some(OnelinerState::Error { .. }) => "⚠".to_owned(),
|
||||
None => "⏳".to_owned(),
|
||||
|
||||
Reference in New Issue
Block a user