Conversation
Greptile SummarySummaryA credential request can continue after invalidation if invalidation occurs immediately after the request reserves the worker slot. This must be fixed before merging because a stale credential load, save, or delete can complete and report success. Confidence Score: 4/5Not safe to merge until credential invalidation reliably cancels requests admitted before it. A deterministic concurrent execution reproduced a request completing successfully after invalidation. Files Needing Attention: src-tauri/src/linux_credential_worker.rs needs an atomic boundary around worker admission and generation capture.
What T-Rex did
|
| { | ||
| return Err(WorkerError::Busy); | ||
| } | ||
| let generation = self.state.generation.load(Ordering::SeqCst); |
There was a problem hiding this comment.
Make invalidation admission atomic
The request reserves the worker slot at lines 167–174 but does not read the generation until this line. If invalidate() runs in between, this request captures the new generation, so the worker and caller checks both treat it as current. A credential load, save, or delete that should have been cancelled can therefore run and return success after invalidation.
Artifacts
- The compiled harness captured generation before running invalidation and observed cancellation, establishing the comparison case.
- The compiled harness ran invalidation after admission but before generation capture and observed worker progress and successful caller completion, confirming the defect.
- This is the complete authored Rust source compiled and run for both scheduling orders, with channels making the interleaving deterministic.
- The captured source locations show the worker checks, invalidation increment, admission CAS, generation capture, and caller completion check involved in the result.
- The native Cargo test attempt stopped because `gdk-sys` could not find `gdk-3.0.pc`, while the independently compiled focused harness still executed the requested ordering.
Ran code and verified through T-Rex
Prompt To Fix With AI
This is a comment left during a code review.
Path: src-tauri/src/linux_credential_worker.rs
Line: 175
Comment:
**Make invalidation admission atomic**
The request reserves the worker slot at lines 167–174 but does not read the generation until this line. If `invalidate()` runs in between, this request captures the new generation, so the worker and caller checks both treat it as current. A credential load, save, or delete that should have been cancelled can therefore run and return success after invalidation.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
Closes #724. Depends on #723. BlueZ 5.72 broadcasts AcquireNotify data; this defines a negotiated read-v1 transport with a peer-owned bounded mailbox instead. Preserves v1 framing and authentication, rejects competing reads and stale generations, supports ATT long-read offsets. Runtime integration follows.
Validation: frontend lint, 114+5 tests and build passed; Rust fmt passed; actual mailbox and worker source passed 8 tests and strict Clippy in an isolated harness. Full native local checks remain blocked by missing GTK/GLib development libraries. CI and independent latest-head review pending. No Bluetooth or input activated.