Repository navigation
Test the history writes the quit-time flush depends on (#338) - #389
Merged
Merged
Conversation
-warn-long-function-bodies / -warn-long-expression-type-checking measure how long the compiler took, which varies with a CI runner's load; with every warning an error they made the build nondeterministic. They failed #384's merge-queue compile on a test that took 729 ms against the 500 ms limit, while the run beside it passed. Every remaining strict setting gives the same answer on every machine. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PR #357 serialised history writes and made the quit-time write merge a history not yet read in, but both lived in TranscriptsModel, in the app target, which has no unit-test target, so neither was covered. Move them, unchanged, into the engine as TranscriptWriter beside TranscriptStore, and test them under swift test: - an older list queued before the quit-time write never lands after it (fails with the pre-#357 detached writes); - the quit-time write merges the saved history when it hasn't been read in, this session's copy of an entry winning (fails without the merge). No behaviour change: the debounce and prepareForExit stay in the model. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
alexkroman
enabled auto-merge
November 25, 2026 03:04
Its writes moved to TranscriptWriter and its one read (the launch load) uses the initializer's parameter, so periphery flagged the property as assigned but never used. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Fixes #338.
All three bugs in the issue are fixed on
mainby #357, which went in without linking the issue:applicationWillTerminatecallsTranscriptsModel.prepareForExit(). That stops the recorder, whoseteardown()→writer.close()finalizes the.m4a, and saves the live transcript (Keep failed recordings in Library for retry, not deletion #363 also keeps a silent recording, as an untranscribed entry).flushHistory()cancels the pending debounced save and writes synchronously, merging in the saved history first if it hasn't been read yet.This PR
Points 2 and 3 had no tests, because the Mac app has no unit-test target. To make them testable, the serial write queue and the quit-time merge move unchanged from
TranscriptsModelinto the engine asTranscriptWriter:save(_:): queued.saveNow(_:mergingSaved:): synchronous, behind every queued write.It keeps the same queue label.
TranscriptsModelcalls it where it used the queue directly, andstoregoes back toprivate. Behavior is unchanged.New
TranscriptWriterTests:saveNow(newest). The newest is what's on disk, both immediately and 500 ms later.mergingSaved: falsewrites the list as-is.Both tests fail 3/3 against the pre-#357 behavior (detached writes, no merge) and pass 3/3 with it.
Verified:
swift testpasses.Sendableis checked, and thequeue.syncat quit can't deadlock.🤖 Generated with Claude Code