-
Notifications
You must be signed in to change notification settings - Fork 0
fix(capture,summary): pad detector cried wolf on a healthy recording; timeout reported as a permissions error #180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
fmasi
wants to merge
2
commits into
main
Choose a base branch
from
fix/pad-false-positive
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
62 changes: 62 additions & 0 deletions
62
SwiftTests/TranscriberTests/SummaryErrorMessageTests.swift
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| import Testing | ||
| import Foundation | ||
| @testable import TranscriberCore | ||
|
|
||
| /// What the user is TOLD when a summary fails. | ||
| /// | ||
| /// This has been wrong twice in production. A `-1001` request timeout fell into a catch-all that | ||
| /// assumed any non-`SummaryError` was a file failure and reported "check disk space and | ||
| /// permissions" — sending two separate debugging sessions after a permissions problem that did not | ||
| /// exist (gotcha #66). A message that misdescribes the cause is worse than a vague one, because it | ||
| /// is actively followed. | ||
| @Suite struct SummaryErrorMessageTests { | ||
|
|
||
| // MARK: - Auth failures must be actionable and must not leak the credential | ||
|
|
||
| @Test func authFailureNamesTheApiKeyAndTheStatus() { | ||
| let message = SummaryError.authenticationFailed(status: 401).localizedDescription | ||
| #expect(message.contains("API key")) | ||
| #expect(message.contains("401")) | ||
| } | ||
|
|
||
| /// The response body is deliberately NOT included: some servers echo the offending credential | ||
| /// back, and this text reaches a notification that can be on screen during a shared meeting. | ||
| /// The same concern already sanitizes `invalidEndpoint`. | ||
| @Test func authFailureNeverEchoesAServerBody() { | ||
| let leaky = "Bearer sk-lm-SECRETVALUE is not authorized" | ||
| let message = SummaryError.authenticationFailed(status: 403).localizedDescription | ||
| #expect(!message.contains("SECRETVALUE")) | ||
| #expect(!message.contains(leaky)) | ||
| #expect(!message.lowercased().contains("bearer")) | ||
| } | ||
|
|
||
| @Test func forbiddenIsTreatedAsAnAuthFailureToo() { | ||
| #expect(SummaryError.authenticationFailed(status: 403).localizedDescription.contains("API key")) | ||
| } | ||
|
|
||
| // MARK: - The distinctions that were missing | ||
|
|
||
| /// Three different causes, three different instructions. Previously a timeout and an unreachable | ||
| /// server both produced the file-permissions message. | ||
| @Test func theThreeFailureKindsReadDifferently() { | ||
| let auth = SummaryError.authenticationFailed(status: 401).localizedDescription | ||
| let endpoint = SummaryError.invalidEndpoint("http://x").localizedDescription | ||
| let server = SummaryError.serverError(message: "model failed to load", code: nil).localizedDescription | ||
|
|
||
| #expect(auth != endpoint) | ||
| #expect(auth != server) | ||
| #expect(endpoint != server) | ||
| // And none of them blames the filesystem. | ||
| for m in [auth, endpoint, server] { | ||
| #expect(!m.lowercased().contains("disk space")) | ||
| } | ||
| } | ||
|
|
||
| /// The provider's own message survives for server-side faults — "model failed to load" is | ||
| /// exactly the kind of detail that makes a failure diagnosable (#134). | ||
| @Test func serverErrorForwardsTheProvidersOwnText() { | ||
| let message = SummaryError.serverError(message: "model failed to load", code: "500") | ||
| .localizedDescription | ||
| #expect(message.contains("model failed to load")) | ||
| } | ||
| } | ||
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The suite title says "What the user is TOLD when a summary fails" and the PR narrative is about the wrong message reaching the user — but the URLError paths added to
MeetingSummarizer.runSummary(.timedOut,.cannotConnectToHost/.cannotFindHost, and thedefaultfallback) have no tests here.Those three messages are the literal fix for bug #2. If
runSummary's catch order is later reshuffled, or a newSummaryErrorcase accidentally matches beforeURLError, the old misdirecting message can come back with nothing failing.Suggested additions — these can be async tests that call
runSummarywith a stubSummaryProviderthat throws the targetURLError:(
ThrowingProvideris a one-liner conforming toSummaryProviderthat just re-throws its stored error — no real network needed.)