Repository navigation
acquire capture: report incomplete verification and lldb exit after rejection; test no-write on disk - #54
Merged
Conversation
…jection - Track whether each candidate was checked against every salt. A candidate the deadline cut short is reported as an incomplete check (salts checked of total) instead of "no match among" the full inventory. - An unexpected lldb exit before the deadline stays the cause after an earlier rejection: exitedWithoutCapture now carries the rejected count as context instead of turning into noAcceptableCandidate. - Move the capture command's verify-then-write step into VerifiedPassphraseCapture so it can be tested, and test the no-write guarantee on the filesystem with a stand-in lldb: an absent output stays absent and an existing one keeps its contents with --overwrite, both on timeout and on lldb exit. Closes #48 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ed key - An incomplete check now throws from the verifier, so a following lldb exit cannot report it as a rejection. - Write the candidate that passed verification, not whatever the capture closure returned. - Scope the documented no-write guarantee to capture and verification failures. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…dWithoutCapture - A candidate the cursor skipped because the deadline passed now ends the capture with timedOutWithUncheckedCandidates, which the verified capture reports as an incomplete check rather than a mismatch. - Keep the payload-free exitedWithoutCapture case and add exitedAfterRejecting for an exit after rejections, with wording that does not assume why the candidates were rejected. - The no-write tests assert the specific error for each ending. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…out over a late exit - At the deadline, drain output that arrived while the last candidate was checked; complete reads there count as unchecked candidates. - Report an lldb exit only when it was observed before the deadline. - Changelog: mention unchecked candidates. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…utput before no-match - Record when lldb exits from Process.terminationHandler, so an exit during the last check before the deadline is still reported as the exit. - Give in-flight output a moment to reach the accumulator before a definitive no-acceptable-candidate verdict. - The late-read test has the stand-in lldb wait for the first check to start before printing the second read. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
bojieli
added a commit
that referenced
this pull request
Nov 24, 2026
Keeps both sides of the CaptureError and runSingleCapture changes from #54. An lldb exit during the attach phase is reported through #54's exitError. VerifiedPassphraseCaptureTests' stand-in lldb now reports the process stopped and waits for the post-check capture commands before printing reads, as real lldb does under the two-phase attach. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 24, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #48
Follow-ups from the #31 review. These change diagnostics and test coverage only. A wrong key is still never accepted, and nothing is written when capture fails.
Incomplete verification is no longer reported as a mismatch
DatabaseSaltInventory.saltVerification(for:shouldStop:)returns aSaltVerification(verified, checked, and total distinct salts).verifiedSaltCountis now a thin wrapper around it.main.swiftintoVerifiedPassphraseCapture.captureAndWrite, so it can be tested. When the deadline cuts a candidate's check short, the capture ends at once withCaptureVerificationError.incomplete("the timeout expired after checking k of N distinct database salts ... neither confirmed nor ruled out"). It is no longer counted as a rejection that later turns into "no match among N".CaptureError.timedOutWithUncheckedCandidates, which the CLI also reports as incomplete. This covers candidates queued in the same batch and complete reads that arrived while the last check was running.The lldb exit stays the cause after a rejection
exitedWithoutCapturekeeps its payload-free form. The newexitedAfterRejecting(rejectedCandidateCount:)is used when lldb exits before the deadline after earlier rejections. Its wording is neutral about why candidates were rejected, becausecapture(accept:)is a general API.Process.terminationHandler, so an exit during the last check, before the deadline, is still reported as the exit. An exit first seen after the deadline is reported as the timeout.No-write guarantee tested on the filesystem
VerifiedPassphraseCaptureTestsdrives the realrunSingleCaptureloop against a stand-in lldb, a shell script that printsmemory readhexdumps. It uses synthetic SQLCipher pages with a valid page-1 HMAC and a real temporary output:overwrite: true: the run fails with the expected error, an absent file and its folder stay absent, and an existing file keeps its bytes.runSingleCapturechanged fromprivateto internal so that tests can call it.Review
Five rounds of
codex review --base origin/main, the cap. No round reported a P0 or P1. I fixed every P2 and P3 from rounds 1 to 4. Round 5 left two P2s about pipe-timing edge cases, both diagnostic-only:exitedAfterRejectingand the buffered candidate is not counted as unchecked.Testing
swift test(scratch copy withoutGreenBubblesHistoryApp): all suites pass;GreenBubblesAcquireTests: 142 tests.swift format lint --strict,scripts/check-secret-hygiene.swift, andswift build --product greenbubbles-acquirepass.Needs manual check
SecretOutputWriteras the invoking user, and the privileged path is unchanged, soscripts/sudo-smoke-test-acquire.shwas not extended. Running it once is still a reasonable check that the write site moved cleanly.🤖 Generated with Claude Code