CI doesn't stop new silent failures: unexplained try?, catches that drop the error, ignored statuses, sleeps on the main thread

Open
#607 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
52/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
cpp, github-actions, swift
Domain
ci-cd, testing-qa

Research direction

Start by reading the existing scripts/eq-mic-permission-audit.sh, scripts/audit-localization.sh, and the "Static audits" CI job, then inspect how make test runs checks. Add scripts/audit-error-handling.sh with a baseline and fixture tests under scripts/tests/, and extend the microphone audit to SpotiglassEQDriver/. Done means each of the six rules rejects new violations with a file, line, and rule message, the baseline cannot go stale, and CONTRIBUTING.md explains the rules.

Written by the indexing model from the issue text.

Description

enhancement priority:high status:queued

The issues from this audit (#593, #595, #596, #597, #598, #599, #602, #604) mostly come from a handful of patterns repeated across the app. Fixing each place won't stop the next one. I want CI to fail when a new one goes in, the same way eq-mic-permission-audit.sh and audit-localization.sh already guard their areas in the "Static audits" job.

What's on main today (counted on 02efbfc0)

  • 213 try? in Spotiglass/, about 20 with a reason next to them (Services 45, Browsing 45, Playback 38, Settings 19, Views 14, CommandPalette 14, Infrastructure 12, Utilities 11, Persistence 9). Several of these are the bugs above: try? cache.loadPinnedItems (#597), try? settingsStore.mutate (#597), try? connectPlayer (#598), (try? await libraryPlaylists(...)) ?? [] (#596).
  • 121 of 209 catch blocks neither log nor rethrow.
  • Ignored statuses: guard status == noErr else { return } with no log (PlaybackSessionViewModel+MacAudioOutput.swift:40-42), (void)AudioObjectSetPropertyData in the driver (SpotiglassEQPlugin.cpp:504-568, #605).
  • Thread.sleep and semaphore waits reachable from @MainActor (6 in the equalizer code, #604).
  • error.localizedDescription put straight into text the user sees (4: SpotiglassSettingsStore.swift:117, :522, EqualizerSettingsView.swift:80, :461).
  • The microphone audit only scans Spotiglass SpotiglassTests (eq-mic-permission-audit.sh:25-27), not SpotiglassEQDriver/, though EQRouter.cpp:15-19 says it covers that file.
  • No print/NSLog today, which is good; nothing keeps it that way.

Proposal
One new script, scripts/audit-error-handling.sh, run in "Static audits" and by make test, with a checked-in baseline (scripts/error-handling-baseline.json, like periphery-baseline.json) so today's sites don't block anyone but no new ones get in, and the baseline only shrinks:

  1. try? needs a reason comment on the same or previous line (// try?: best-effort cleanup, nothing depends on it).
  2. A catch must log (SpotiglassLog), rethrow, or hand the error to the shared failure path (the "one way to log and show errors" issue). An empty catch {} always fails.
  3. No print(, NSLog(, debugPrint( in app, helper or driver code (driver debug logging behind SPOTIGLASS_EQ_DEBUG is allowlisted).
  4. No Thread.sleep, usleep or DispatchSemaphore.wait in Spotiglass/ outside an allowlist.
  5. No localizedDescription assigned to a user-visible property (only inside SpotiglassLog calls).
  6. No (void) on an OSStatus-returning Core Audio call in SpotiglassEQDriver/, and no _ = AudioObject... in Swift.
    And: eq-mic-permission-audit.sh also scans SpotiglassEQDriver/ (with the two existing kAudioObjectPropertyScopeInput uses in SpotiglassEQPlugin.cpp reviewed and allowlisted by line content, not line number).

A test in scripts/tests/ feeds the script a small fixture for each rule and checks it fails, and that the baseline doesn't let a new site through.

Done means

  • scripts/audit-error-handling.sh exists, runs in CI "Static audits" and in make test, and fails on each of rules 1-6 for new code, with a one-line message naming the file, line and rule.
  • The baseline lists today's sites; fixing one removes it from the baseline (the script fails if a baseline entry no longer exists, so it can't go stale).
  • The mic audit covers the driver.
  • CONTRIBUTING.md has two lines on the rules and how to write the reason comment.
Dominant language
Swift
Stars
9
Forks
3
Avg merge
5h 37m
Merged PRs (30d)
111

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from isaaclins/wax

All issues in isaaclins/wax

Similar issues

More Swift issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.