Skip to content

fix(hyundai): end the device name at a control byte, record the validation gap - #182

Merged
abrignoni merged 1 commit into
mainfrom
fix/hyundai-control-bytes
Sep 3, 2026
Merged

fix(hyundai): end the device name at a control byte, record the validation gap#182
abrignoni merged 1 commit into
mainfrom
fix/hyundai-control-bytes

Conversation

@abrignoni

Copy link
Copy Markdown
Owner

What this changes

Follow-up to #181. Ends the wireless_dev_list.dat friendly-name capture at any control byte rather than stripping a fixed set from the ends, restores the docstrings explaining why _present_columns exists, and records in each artifact's notes that these were validated against an extraction that could not be shared.

For a new or changed artifact

  • Ran the tool against a real extraction and confirmed the row counts, not just that it imports.
  • Ran python admin/scripts/check_artifact_output.py <report folder> on that report and fixed or documented every finding.
  • Checked it against a second app data directory where the platform provides one (a second user, account, or container).
  • notes, description and sample_data say only what the data shows, and the numbers were re-derived from the finished run.

The first three are deliberately unticked — see below. No Hyundai extraction was available for this change; it was verified against synthetic fixtures only.

Anything reviewers should know

What was wrong. #181 stripped \x01-\x05 from the ends of the device friendly name. str.strip(chars) only reaches the ends and only covers the listed set, so two cases still put control bytes into the HTML report and the LAVA database:

  • a trailing byte outside that set survived — Trailing BEL\x07
  • an embedded byte survived anywhere — Embed\x02ded

The fix. The name capture now ends at any C0 control or DEL ([^\x00-\x1f\x7f]+), which makes the strip chain redundant and removes it. The record already delimits the friendly name the same way it delimits the MAC, so stopping at a control byte is consistent with how the rest of the record is parsed.

A judgment call worth a second opinion. This truncates at an embedded control byte — Embed\x02ded becomes Embed, not Embedded. Filtering instead of truncating is equally defensible. Truncation was chosen for consistency with the \x00-delimited parse, but if a genuine device name can carry an embedded control byte, the tail is silently lost. Nothing available here settles which behaviour matches the format, so this is the reviewer's call to overrule.

Validation gap. #181 was validated by its author against a single Hyundai/Kia head unit from an active case that could not be shared, so no fixture accompanies these artifacts. That is now stated in each artifact's notes, where an examiner reads it, rather than only in the PR thread. This is the route the test-data bot offers for an unshareable extraction.

How this was verified. Synthetic CH_/MC_ databases and a wireless_dev_list.dat built to the observed record shape, run through the plugin loader:

  • Trailing BEL\x07Trailing BEL, Embed\x02dedEmbed
  • Pixel 7, John's iPhone, José Galaxy (the latin-1 fallback path) unchanged
  • contacts from a database without phone_type still returned, with the column empty and a log line
  • a directory matching CH_*.db* skipped rather than fatal

Locally green: lint_changed (0 new warnings), check_claim_language, check_html_safety, check_report_local_paths, check_source_path, check_vendored, validate_sample_data, and the plugin-loader import test.

These are synthetic fixtures encoding an assumed format, not evidence from a real head unit. They guard against regressions; they do not confirm the format is right.

🤖 Generated with Claude Code

https://claude.ai/code/session_01WYbci6R9C5XJ14Sxorn2T2


Generated by Claude Code

…ation gap

Follow-up to #181, which fixed the multi-phone parsing and stripped trailing
\x01-\x05 from device friendly names. Three residual items:

- The name capture still admitted control bytes. `.strip()` of a fixed set
  only reaches the ends, so a trailing byte outside that set survived
  ("Trailing BEL\x07") and an embedded one survived anywhere ("Embed\x02ded"),
  both reaching the HTML report and LAVA. The record delimits the name the
  same way it delimits the MAC, so the capture now ends at any C0 control or
  DEL and the strip chain is redundant.
- Restore the docstrings on _present_columns. The helper looks like an
  indirection worth removing until you know a SELECT naming an absent column
  drops every row for that phone, which is the defect it exists to prevent.
- Record in notes that these artifacts were validated against one head unit
  from an extraction that could not be shared, so the absence of a committed
  fixture is visible where an examiner reads it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WYbci6R9C5XJ14Sxorn2T2
@abrignoni
abrignoni merged commit 13e656b into main Sep 3, 2026
10 checks passed
@abrignoni abrignoni mentioned this pull request Sep 3, 2026
4 tasks
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.

1 participant