Skip to content

elm327: leave a trace when we swallow an exception (#20) - #69

Open
ThinkOffApp wants to merge 1 commit into
mainfrom
fix/elm327-silent-swallows
Open

ThinkOffApp wants to merge 1 commit into
mainfrom
fix/elm327-silent-swallows

Conversation

@ThinkOffApp

Copy link
Copy Markdown
Owner

Fixes #20 (hermes's review, 31 Aug).

Four bare except Exception: with no logging. The handlers are right to continue — an OBD dongle vanishing mid-drive is normal, not an error — but with nothing recorded, a decoder bug and a missing dongle look identical in the field.

The sharp ones

The two decode sites: a decoder raising makes a reading disappear from the dashboard with no sign anything went wrong. Same shape as the other faults found today — a failure that is indistinguishable from normal operation.

site what was hidden
close os.close on a vanished fd
decode pid 0x.. basic PID decoder raised → reading silently dropped
decode ext pid 0x.. extended decoder raised → tile stays blank
scan_supported_quiet capability scan failed → falls back to every PID, so the sweep looks merely unlucky

Deduped on purpose

"Dongles vanish as a rule" means a plain log would flood the journal on exactly the drive you are trying to diagnose. First occurrence of each (site, exception type) prints, then only the 10th / 100th / 1000th.

Behaviour is unchanged — every site still swallows and returns exactly what it returned before.

stderr, never stdout

This module's CLI prints JSON; a stray line would corrupt it. A test asserts that, because it is the kind of thing a later edit breaks silently.

Tests

tests/test_elm327_traces.py, 6 cases: first occurrence reported with type and message, repeats summarised rather than printed, the x10 milestone still surfaces, distinct sites and exception types tracked separately, nothing on stdout, and all four call sites still present.

Suite failure on this branch is test_dash_loop's missing pytest — pre-existing on main, fixed separately in #64.

Not verified on the car

Logic verified in tests; the car is unreachable, so no field trace has actually been captured from a real dongle.

🤖 Generated with Claude Code

hermes's review, 31 Aug: four bare `except Exception:` with no logging.

The handlers are right to continue - an OBD dongle vanishing mid-drive is
normal, not an error - but with nothing recorded, a decoder bug and a missing
dongle look identical in the field. The two decode sites are the sharp ones:
a decoder raising makes a reading disappear from the dash with no sign that
anything went wrong, which is the same shape as the other faults found today.

_swallowed(site, exc) now records all four:
  close                  os.close on a vanished fd
  decode pid 0x..        basic PID decoder raised -> reading dropped
  decode ext pid 0x..    extended decoder raised -> tile stays blank
  scan_supported_quiet   capability scan failed -> falls back to every PID,
                         so the sweep looks merely unlucky

Deduped deliberately. "Dongles vanish as a rule" means a plain log would
flood the journal on exactly the drive being diagnosed, so the first
occurrence of each (site, exception type) prints and then only the 10th,
100th and 1000th. Behaviour is unchanged: every site still swallows and
returns what it returned before.

Writes to stderr, never stdout - this module's CLI prints JSON and a stray
line would corrupt it. A test asserts that, because it is the kind of thing a
later edit breaks silently.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Sep 18, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
carwatch-dev Ready Ready Preview Sep 18, 2026 5:05pm UTC

Request Review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 18, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-18T17:07:19.488030Z fa9a21f PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

elm327.py swallows errors with bare except Exception (4 sites)

2 participants