Repository navigation
fix(ios): a close-up the phone couldn't save says so, instead of "Hold still" (B-20, on #191) #208
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
base: codex/public-assembly-20260930
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| import XCTest | ||
|
|
||
| /// B-20: a meter close-up the phone couldn't save read "Hold still", as if the homeowner's hand | ||
| /// had blurred it, and retaking with a steadier hand could never help. `-failCloseUpSave` makes | ||
| /// every close-up's save fail on a replay, through the real engine and `KeyframeStore.saveStill`. | ||
| final class CloseUpSaveFailureUITests: XCTestCase { | ||
| static let notSaved = "Your phone couldn't save that photo. Hold on the meter to try again." | ||
|
|
||
| override func setUp() { | ||
| continueAfterFailure = false | ||
| } | ||
|
|
||
| @MainActor | ||
| func testAPhotoThatDidNotSaveSaysSoAndCanBeSkipped() throws { | ||
| let app = XCUIApplication() | ||
| app.launchArguments = ["-replay", FullFlowUITests.fixture, "-sampleResult", "-failCloseUpSave"] | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Prompt To Fix With AIThis is a comment left during a code review.
Path: ios/HouseScanUITests/CloseUpSaveFailureUITests.swift
Line: 16
Comment:
**Save failures remain untested**
This test removes the JPEG before `saveStill`, so it checks the missing-photo case but not a disk-write failure or a photo that cannot be read back. Those paths are central to the new message, yet either could regress while this test still passes. Please add coverage for both, including that an unreadable photo is not counted as a capture.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Partly agree. The test drops the photo bytes before There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That distinction is fair. The hook exercises the same |
||
| app.launch() | ||
| let any = app.descendants(matching: .any) | ||
|
|
||
| XCTAssertTrue(any["screen.onboarding"].waitForExistence(timeout: 30)) | ||
| if app.buttons["action.onboardingSkip"].waitForExistence(timeout: 5) { app.buttons["action.onboardingSkip"].tap() } | ||
| XCTAssertTrue(app.buttons["action.finishOnboarding"].waitForExistence(timeout: 10)) | ||
| app.buttons["action.finishOnboarding"].tap() | ||
| XCTAssertTrue(app.buttons["action.markMeter"].waitForExistence(timeout: 20)) | ||
| app.buttons["action.markMeter"].tap() | ||
| XCTAssertTrue(any["screen.meterCloseUp"].waitForExistence(timeout: 15)) | ||
|
|
||
| // Under `-failCloseUpSave` the reason stays up 10 s rather than 2 before the gate's own | ||
| // "Move closer" replaces it, so this query can't miss it. | ||
| let saidNotSaved = any.matching(identifier: "closeUp.problem").matching(NSPredicate(format: "label == %@", Self.notSaved)).firstMatch | ||
| XCTAssertTrue(saidNotSaved.waitForExistence(timeout: 60), "a close-up that didn't save never said so") | ||
| snap(app, "meterCloseUp-photoNotSaved") | ||
|
|
||
| // The save failure counted as one failed attempt; the next one (another failed save, or | ||
| // `CloseUpGate.failAfter` without a photo) brings the way out. | ||
| let skip = app.buttons["action.skipCloseUp"] | ||
| XCTAssertTrue(skip.waitForExistence(timeout: 90), "no way past a close-up that can't be saved") | ||
| skip.tap() | ||
| XCTAssertTrue(any["screen.wallWalk"].waitForExistence(timeout: 15), "skipping the unsaved close-up didn't lead on to the walk") | ||
| } | ||
|
|
||
| @MainActor | ||
| private func snap(_ app: XCUIApplication, _ name: String) { | ||
| let shot = XCTAttachment(screenshot: app.screenshot()) | ||
| shot.name = name | ||
| shot.lifetime = .keepAlways | ||
| add(shot) | ||
| } | ||
| } | ||
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.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: SamGu-NRX/BaseScanning
Length of output: 11008
🏁 Script executed:
Repository: SamGu-NRX/BaseScanning
Length of output: 11105
🏁 Script executed:
Repository: SamGu-NRX/BaseScanning
Length of output: 11040
🏁 Script executed:
Repository: SamGu-NRX/BaseScanning
Length of output: 14929
🏁 Script executed:
Repository: SamGu-NRX/BaseScanning
Length of output: 24817
🏁 Script executed:
Repository: SamGu-NRX/BaseScanning
Length of output: 26230
🏁 Script executed:
Repository: SamGu-NRX/BaseScanning
Length of output: 15481
🏁 Script executed:
Repository: SamGu-NRX/BaseScanning
Length of output: 15477
🏁 Script executed:
Repository: SamGu-NRX/BaseScanning
Length of output: 20159
🏁 Script executed:
Repository: SamGu-NRX/BaseScanning
Length of output: 3705
🏁 Script executed:
Repository: SamGu-NRX/BaseScanning
Length of output: 30712
🏁 Script executed:
Repository: SamGu-NRX/BaseScanning
Length of output: 7104
🏁 Script executed:
Repository: SamGu-NRX/BaseScanning
Length of output: 40507
Reject an undecodable close-up during readback.
When
Data(contentsOf:)succeeds butImageWork.uprightThumbnail(jpeg:)returnsnil, the current tuple remains nonnil. The engine marks the photo as captured and sends the invalid bytes to the meter reader. The reader then requests.noNumberinstead of the contractually correct.photoNotSaved.Suggested fix
📝 Committable suggestion
🤖 Prompt for AI Agents