Dogfood edit signal follow-up: verdict parking, outcome-gated arming, inline quit flush (codex review of #202) - #208
Open
T0mSIlver wants to merge 1 commit into
Open
Conversation
…ches, quit flush, payload window, timer retain, shift-cmd-A) Codex (GPT-5.6) review findings on the post-commit edit watch, each verified against the code and fixed test-first (red on ab0fc83, green after; both runs via remote-build.sh dogfood — the suites are compile-gated, so the plain test verb would silently run none of them). 1. HIGH: supersede-before-attach lost the old watch's verdict. Arming dictation B while A's record write was in flight replaced the single watch slot; A's late attachRecord was token-rejected and A's record stayed indistinguishable from "never observed". Closed-but-unattached watches are now PARKED keyed by generation (bounded at 8; oldest evicted) until their attach arrives. The old regression test pinned the loss ("nothing is written for it") and was corrected, not weakened: its contamination assertion (B's gesture must not reach A's record) is retained and now strictly stronger — A's record holds a verdict B's close must not rewrite. red: DogfoodEditSignalTests.swift:514 ("nil") != ("Optional(.superseded)") 2. HIGH: the watcher armed on .failed and .copiedToClipboard commits, recording keys against an insertion that never happened and padding the clean denominator. writeDogfoodCaptureIfArmed now receives the overlay commit outcome and arms only on .succeeded; the record is still written. red: DogfoodCaptureWiringTests.swift:373 startCount ("1") != ("0") 3. HIGH: the willTerminate flush ran inside a Task spawned by the observer — the exact pattern its own comment says is not guaranteed to run at quit. The flush now runs inline in the main-queue observer body (MainActor.assumeIsolated); backend shutdown stays in the Task. registerLifecycleObservers is parameterized over a NotificationCenter with a #if DEBUG seam so the test posts the real notification privately. red: DogfoodCaptureWiringTests.swift:460 behavior nil when post returned 4. MEDIUM: clipboard-payload commits measured the watch window on the placeholder (2 s for a 100-word paste). The session now passes the payload-substituted commit copy for measurement only; the record keeps the placeholder-bearing text and bucketed counts — the payload never persists. red: DogfoodCaptureWiringTests.swift:421 ("[2.0 seconds]") != ("[15.0 seconds]") 5. MEDIUM: the window timer promoted weak self to strong BEFORE the injected sleep, retaining the watcher for the whole window and defeating the isolated-deinit cleanup. sleepFor is captured by value; self is promoted only after the sleep resumes. red: DogfoodEditSignalTests.swift:657 watcher still alive mid-window 6. LOW: shift-cmd-A was classified as select-all; the predicate now excludes .shift alongside .option/.control. red: DogfoodEditSignalTests.swift:207 XCTAssertNil failed: "selectAll" Proof: instrumented suite pre-fix: 15 failures / 0 unexpected (all six findings reproduced). Post-fix: 59 tests, 0 failures (DogfoodEditSignalTests 22, DogfoodCaptureWiringTests 23, store 11, redaction 3). Full non-instrumented build + unit suite: 2015 tests, 0 failures, 2 pre-existing env-gated skips (LLMPolishModelProbeTests).
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.
What
Follow-up to #202 (merged before its codex/GPT-5.6 review landed); fixes all six review findings on main. The feature is dogfood-only instrumentation, but every one of these corrupted the measurement it exists to produce.
attachRecordwas rejected and A read as "never observed". Closed-but-unattached watches now park keyed by generation (cap 8, oldest evicted) until their attach arrives. The old test at the previous line 491 pinned this bug — it was rewritten to assert the survival, with a comment saying exactly that (this is correcting a bug-pinning expectation, not weakening)..failedand.copiedToClipboardcommits, so Backspace in the target app recorded erasing an insertion that never happened, and phantomcleans inflated the denominator. The commit outcome is now passed through; the watch arms only on.succeeded(the record still writes, honestly behavior-free).Taskspawned at terminate — the exact non-guarantee its own comment warned about.flushForTermination()now runs inline in the main-queue notification callback (MainActor.assumeIsolated); only backend shutdown stays async. New seam (debugRegisterLifecycleObservers(on:)) lets the test post the real notification and assert the patch is on disk when the observer returns, with no await afterpost.isolated deinitcleanup. Promotion now happens after the sleep; a release test nils the last owner mid-window and asserts dealloc + monitor teardown..shiftexcluded; the two-gestures test extended.Proof
remote-build.sh dogfood, the instrumented lane — these suites are#if LOCALVOXTRAL_DOGFOODand compile out of the plain test lane):the patch must be on disk when the observer returns, finding 5:the window timer must not retain the watcher across its sleep.Executed 2015 tests, with 2 tests skipped and 0 failures; instrumented suite re-run green after rebasing onto current main (post-Remote listener: say WHY a connection was rejected, in the log and in Settings #200):Executed 59 tests, with 0 failures.DictationViewModel+Session.swiftis on the filter path list, so the lane will run; the change passes a new parameter on the capture call and does not alter what reaches the model.