Skip to content

feat: remove unused address_to_bytes helper#218

Merged
bdraco merged 1 commit into
mainfrom
koan/drop-address-to-bytes
May 14, 2026
Merged

feat: remove unused address_to_bytes helper#218
bdraco merged 1 commit into
mainfrom
koan/drop-address-to-bytes

Conversation

@bluetoothbot
Copy link
Copy Markdown
Contributor

@bluetoothbot bluetoothbot commented May 14, 2026

What

Remove the unused address_to_bytes helper from the public API and drop its test.

Why

Issue #53 flagged that the function was unused inside the library and that its
test verified a buggy behavior: Struct(">L") packs only 4 bytes, so a 6-octet
MAC address gets silently truncated. Maintainer (@bdraco) confirmed on the
issue: "I can't seem to find any usage of it. I think we can drop it."

A grep across the local bluetooth-devices workspace (bleak-esphome,
thermopro-ble, habluetooth, dbus-fast, pySwitchbot) found no callers either —
only the bundled copy of this library itself.

How

  • Drop address_to_bytes and the L_PACK = Struct(">L") constant from
    src/bluetooth_data_tools/utils.py.
  • Remove the import and __all__ entry from src/bluetooth_data_tools/__init__.py.
  • Remove test_address_to_bytes from tests/test_utils.py.

This is a breaking change to the public API. Anyone still relying on the
old (buggy) 4-byte output should compute the bytes themselves, e.g.
mac_to_int(addr).to_bytes(6, "big"). The commit is marked feat!: so
semantic-release will pick it up as a major bump.

Testing

  • pytest tests/ --ignore=tests/benchmarks → 63 passed locally.

Closes #53

🤖 Generated with Claude Code


Quality Report

Changes: 3 files changed, 20 deletions(-)

Code scan: clean

Tests: failed ([Errno 13] Permission denied: 'pytest')

Branch hygiene: clean

Generated by Kōan post-mission quality pipeline

The function was unused inside the library and silently returned
only 4 bytes when packing a 6-byte MAC address, making the output
incorrect for any caller that relied on its name. The maintainer
confirmed in #53 that it can be dropped.

BREAKING CHANGE: address_to_bytes is no longer exported from
bluetooth_data_tools. Callers must compute the bytes themselves
(for example via int.to_bytes(6, "big") on mac_to_int(address)).

Closes #53

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented May 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (6c02b3b) to head (94a4b91).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #218   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            6         6           
  Lines          255       248    -7     
  Branches        38        37    -1     
=========================================
- Hits           255       248    -7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented May 14, 2026

Merging this PR will not alter performance

✅ 9 untouched benchmarks


Comparing koan/drop-address-to-bytes (94a4b91) with main (43b0aaa)

Open in CodSpeed

@bdraco bdraco changed the title feat!: remove unused address_to_bytes helper feat: remove unused address_to_bytes helper May 14, 2026
@bdraco
Copy link
Copy Markdown
Member

bdraco commented May 14, 2026

not marking as breaking as its likely dead in the wild and a major version bump would be worse

@bdraco bdraco marked this pull request as ready for review May 14, 2026 23:39
@bdraco bdraco merged commit a83a3ab into main May 14, 2026
48 checks passed
@bdraco bdraco deleted the koan/drop-address-to-bytes branch May 14, 2026 23:40
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.

What is address_to_bytes used for?

2 participants