App: surface errors instead of swallowing them; fix battery-poll lifetime#2
Merged
Conversation
…time - Logging download: on decode failure keep board data (status .stopped) and warn the user to retry/clear instead of marking .failed and dropping it; surface queryActiveLoggers and clearLog failures rather than ignoring them. - Log session start: roll back partially-started loggers on failure; if some can't be stopped, stay .running for those and report a partial-rollback error. - Live-buffer CSV export: throw on write failure (was skipped silently); add an off-main-actor async wrapper; drop debug prints. - CSV export: support CorrectedCartesianFloat sessions; add CSVExporterTests. - DeviceViewModel: move battery polling into a BatteryPoller that cancels its task on deinit/reassignment (prevents a leaked polling task). - Controls: add motor duty (%) and pulse (ms) bindings. - Remove stray [Log]/[Export] debug prints. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
`\(value, default:)` is a LocalizedStringKey-only interpolation; it builds on newer local toolchains but not on the CI runner's Swift. Use `?? false`. Co-Authored-By: Claude Opus 4.8 (1M context) <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.
Summary
Robustness pass on the iOS app — stop silently dropping failures, fix a leaked background task, and harden CSV export.
Error handling
DownloadViewModel): on a per-record decode failure, keep the board data (status.stopped) and warn the user to retry Download or clear from Settings, instead of marking.failedand discarding it. Also surfacesqueryActiveLoggersandclearLogfailures rather than swallowing them withtry?.LogSessionViewModel): if starting a multi-sensor session fails partway, roll back the loggers that did start; any that can't be stopped stay.runningand the user gets a clear partial-rollback error.write(...)now throws on a file-write failure (previously skipped silently); added an off-main-actorwriteAsyncwrapper.Lifetime / resources
DeviceViewModel: battery polling moved into aBatteryPollerthat cancels its task ondeinitand on reassignment — prevents a leaked 60 s polling loop.Features / misc
CorrectedCartesianFloatsessions; newCSVExporterTests.[Log]/[Export]debug prints.Test plan
CSVExporterTestscovers corrected-cartesian export round-trip.swift build/swift teston the SwiftPM package, not the Xcode app), so these app changes should be verified in Xcode before merge.🤖 Generated with Claude Code