Commit graph

276 commits

Author SHA1 Message Date
torlando-tech
463383dc39 fix: update paths in installer, tests, and workflows for package rename
- Update install.sh to copy from src/ble_reticulum/
- Update test files with new source paths
- Update GitHub workflows for new package structure
- Remove temporary refactoring helper scripts

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 23:58:18 -05:00
torlando-tech
ca88c6b4c9 fix: restore RNS.Interfaces.Interface import for base class
The sed replacement was too aggressive - it replaced the import for
the base Interface class from the Reticulum package itself.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 23:38:21 -05:00
torlando-tech
2fbb9c3ad2 refactor: rename package from RNS.Interfaces to ble_reticulum
Fixes namespace collision with Reticulum's own RNS.Interfaces package.
When both packages were installed, the collision caused import issues
and prevented BLE discovery between devices.

Changes:
- Rename src/RNS/Interfaces/ to src/ble_reticulum/
- Update pyproject.toml package configuration
- Update all imports in source and test files

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 23:30:07 -05:00
torlando-tech
bbeb6c43e8 Merge branch 'main' of github-public:torlando-tech/ble-reticulum 2025-12-29 23:26:51 -05:00
Torlando
507d81a83e
Merge pull request #32 from torlando-tech/fix/identity-hash-double-hashing-v2
fix: remove double-hashing in _compute_identity_hash()
2025-12-29 23:00:52 -05:00
torlando-tech
942cbe05f1 test: add unit tests for _compute_identity_hash() fix
Adds 4 tests to verify the double-hashing bug is fixed:
- test_identity_hash_returns_hex_of_input: verifies correct hex output
- test_identity_hash_does_not_double_hash: proves fix differs from buggy code
- test_identity_hash_with_various_inputs: tests multiple byte patterns
- test_actual_bleinterface_implementation: verifies source code contains fix

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 22:43:37 -05:00
torlando-tech
0b946a804d fix: remove double-hashing in _compute_identity_hash()
The peer_identity parameter is already the identity hash received from
the BLE handshake. Calling RNS.Identity.full_hash() on it again produced
a completely different value, causing identity mismatch between peers.

This caused "no reassembler for X" errors because the sending peer's
identity didn't match what the receiving peer computed.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 22:13:42 -05:00
Torlando
d475432cb0
fix(ble): Event-driven D-Bus monitoring to eliminate HCI errors on BCM43xx chips (#30)
* fix(ble): Increase D-Bus monitoring intervals to prevent HCI errors

The D-Bus monitoring threads were polling too frequently (0.5s and 30s),
causing HCI command collisions on BCM43xx single-radio chips. These chips
cannot handle concurrent BLE operations, and the frequent D-Bus activity
was interfering with scan/advertise cycles.

Changes:
- Increase D-Bus disconnect monitor interval from 0.5s to 5s
- Increase stale connection poll interval from 30s to 120s

This eliminates HCI errors (Opcode 0x2005/0x2006) while preserving
disconnect detection functionality with slightly higher latency.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

* refactor(ble): Convert D-Bus monitoring to event-driven approach

Replace polling-based D-Bus monitoring with true event-driven pattern:

1. D-Bus monitor thread:
   - Use asyncio.Event instead of periodic sleep
   - Store loop reference for thread-safe shutdown
   - Use call_soon_threadsafe to wake loop on stop

2. Stale poll thread:
   - Replace busy-wait loop (240 x 0.5s) with single Event.wait()
   - Increase interval from 120s to 300s (safety net only)
   - Immediate response to stop signal

Benefits:
- Zero CPU usage while waiting (no periodic wakeups)
- Immediate shutdown response (ms instead of 5s)
- Cleaner, simpler code
- Maintains disconnect detection via D-Bus signals

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

* test(ble): Add comprehensive unit tests for HCI error fixes

Add 26 new unit tests for the event-driven D-Bus monitoring fixes
that eliminated HCI errors on BCM43xx single-radio chips.

Test coverage:
- TestEventDrivenDBusMonitor: Tests asyncio.Event usage, immediate
  wake response, call_soon_threadsafe cross-thread signaling
- TestStalePollImprovements: Tests threading.Event.wait() usage,
  300s interval, immediate stop response
- TestStopShutdownBehavior: Tests stop() async signaling, RuntimeError
  handling, shutdown latency improvement
- TestIntegrationScenarios: Tests full lifecycle, multiple stop calls
- TestCodeVerification: Verifies actual source patterns match expected

All 26 tests pass without requiring pytest-asyncio plugin.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

* fix(tests): Use threading.RLock instead of asyncio.Lock in test fixtures

In Python 3.8/3.9, asyncio.Lock() requires a running event loop. When
test_hci_error_fixes.py runs first (alphabetically) and uses asyncio.run(),
it closes the event loop after each test. Subsequent test fixtures that
create asyncio.Lock() then fail with "no current event loop" errors.

Since these are mock fixtures that don't need async semantics, use
threading.RLock() instead.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

* fix(tests): Replace all asyncio.Lock() with threading.RLock() in test mocks

asyncio.Lock() requires a running event loop in Python 3.8/3.9. When
test files using asyncio.run() execute first, the event loop is closed,
causing subsequent test fixtures to fail when creating asyncio.Lock().

Fixed in:
- test_peripheral_disconnect_cleanup.py (mock_gatt_server fixture)
- test_bluez_state_cleanup.py (mock_driver fixture)
- test_ble_peer_interface.py (create_mock_peer_interface helper)
- conftest.py (create_mock_interface helper)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

---------

Co-authored-by: torlando-tech <torlando-tech@users.noreply.github.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 00:46:06 -05:00
Torlando
d8c76df20f
Merge pull request #29 from torlando-tech/fix/cleanup-stale-interface-memory-leak
fix(ble): Clean up address_to_identity in _cleanup_stale_interface()
2025-12-28 23:01:27 -05:00
torlando-tech
0c80f4f100 fix(ble): Clean up address_to_identity in _cleanup_stale_interface()
The _cleanup_stale_interface() method was cleaning up identity_to_address
but not the reverse mapping address_to_identity. This caused:
- Memory leak: stale entries accumulate over time
- Inconsistent state: bidirectional mappings become out of sync

This fix matches the cleanup pattern in _disconnected_callback() which
properly cleans up both directions of the mapping.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 23:47:17 -05:00
torlando-tech
254da2e0f4 fix(install): Use proper wheel filename for pre-built dbus_fast
pip extracts package metadata from the wheel filename, which must follow
PEP 427 format: {package}-{version}-{pythontag}-{abi}-{platform}.whl

The previous filename (dbus_fast-armv6l-$$.whl) caused pip to fail with
"Invalid wheel filename (wrong number of parts)" on 32-bit ARM systems.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 22:34:24 -05:00
torlando-tech
c262c1a5c2 feat(install): Add uv tool installation support
Detect and handle RNS installations via `uv tool install rns`:
- Add uv detection when python3 can import RNS (path contains /uv/tools/)
- Add shebang-based detection when system python3 differs from tool's python
- Install dependencies using `uv pip install --python`
- Handle uv Python path for setcap Bluetooth permissions

This fixes "Could not determine installation mode" errors for users
who install Reticulum with uv instead of pip/pipx.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 15:44:34 -05:00
Torlando
54ee4048e0
Merge pull request #25 from torlando-tech/release/v0.2.2
Some checks failed
Release / Validate Release (push) Has been cancelled
Release / Run Tests (push) Has been cancelled
Release / Run Tests-1 (push) Has been cancelled
Release / Run Tests-2 (push) Has been cancelled
Release / Run Tests-3 (push) Has been cancelled
Release / Build Release Artifacts (push) Has been cancelled
Release / Create GitHub Release (push) Has been cancelled
v0.2.2
Release v0.2.2
2025-12-17 23:58:31 -05:00
torlando-tech
bee68879af Merge main into release/v0.2.2
Resolved conflicts:
- BLEInterface.py, test_v2_2_mac_sorting.py, CLAUDE.md: Keep release
  (HW_MTU fix, pending_mtu, MAC rotation recovery/bypass, corrected tests)
- install.sh, README.md: Keep main (JustWorksRepairing auto-configuration)
- CHANGELOG.md: Consolidated detailed notes from main into [0.2.2] section
- Added FUNDING.yml from main

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-17 23:37:22 -05:00
torlando-tech
a1e3d47506 test(ble): Add MAC rotation bypass tests and fix existing test expectations
- Add TestMACRotationBypassesSorting class with 4 tests for the MAC rotation fix
- Fix MockInterface to properly mock RNS.Interfaces.Interface module
- Add get_config_obj() to MockInterface for BLEInterface initialization
- Fix inverted test expectations in test_sequential_mac_addresses and
  test_mac_sorting_with_multiple_peers (lower MAC initiates connection)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-11 12:33:06 -05:00
torlando-tech
564b2be07e fix(ble): Bypass MAC sorting after MAC rotation cleanup
After detecting MAC rotation and cleaning up the stale interface,
immediately add the peer to scored_peers and continue, bypassing
the MAC sorting check. This ensures reconnection always happens
after MAC rotation regardless of which device has the higher MAC.

Bug: After MAC rotation, peer interface wasn't recreated because
the code fell through to MAC sorting check which could skip the
peer if local MAC > peer MAC.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-11 12:22:47 -05:00
torlando-tech
f7bb63562a Merge pull request #28 from torlando-tech/fix/hw-mtu-and-mac-rotation
Fix/hw mtu and mac rotation
2025-11-26 18:04:48 -05:00
torlando-tech
0f14264b18 Revert "feat(install): Add JustWorksRepairing and GATT cache configuration"
This reverts commit 4f9df43033.
2025-11-26 18:00:22 -05:00
torlando-tech
4f9df43033 feat(install): Add JustWorksRepairing and GATT cache configuration
- Enable JustWorksRepairing = always for automatic BLE pairing
- Disable GATT caching (Cache = no) to prevent Service Changed
  subscription pairing prompts on Android 15+ devices
- Track config changes and only restart BlueZ when needed

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-26 17:52:52 -05:00
torlando-tech
64a4e2e43b Merge pull request #27 from torlando-tech/fix/hw-mtu-and-mac-rotation
fix(ble): Prevent data loss from peripheral reassembler race condition
2025-11-26 12:22:59 -05:00
torlando-tech
12eafcdffc fix(ble): Prevent data loss from peripheral reassembler race condition
Reorder operations in handle_peripheral_data() to create
fragmenter/reassembler BEFORE spawning peer interface. This
prevents data from being dropped during the brief window when
the interface exists but the reassembler doesn't.

Also adds unit tests to verify the fix and prevent regression.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-26 12:21:42 -05:00
torlando-tech
b0246e320b fix(ble): Prevent data loss from peripheral reassembler race condition
Reorder operations in handle_peripheral_data() to create
fragmenter/reassembler BEFORE spawning peer interface. This
prevents data from being dropped during the brief window when
the interface exists but the reassembler doesn't.

Also adds unit tests to verify the fix and prevent regression.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-26 12:21:42 -05:00
torlando-tech
4ed1f1d03a Merge pull request #26 from torlando-tech/fix/hw-mtu-and-race-conditions
Fix/hw mtu and race conditions
2025-11-25 18:29:38 -05:00
torlando-tech
2663764cf4 fix: Add MAC rotation recovery for stale interface cleanup
When a peer reconnects from a new MAC address (common with Android MAC
rotation, also possible on Linux after adapter reset), the old interface
state may become stale. This change adds:

1. _cleanup_stale_interface() method:
   - Detaches old interface
   - Cleans up identity mappings
   - Removes fragmenter/reassembler for old address
   - Clears pending MTU for old address

2. MAC rotation detection in _select_peers_to_connect():
   - If interface exists for identity but old address is not in peers
     (connection dead), clean up stale state and allow reconnection
   - If old connection still active, skip as before (no change)

This is defensive code that handles edge cases like:
- Android MAC rotation (~15 min intervals)
- Linux adapter reset while peer state is tracked
- Connection timeout without proper disconnect callback

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-25 18:23:43 -05:00
torlando-tech
2ff9ddc4f1 fix: HW_MTU instance attribute and MTU/identity race condition
Two critical fixes ported from Android testing:

1. HW_MTU instance attribute fix:
   - Base Interface.__init__() sets self.HW_MTU = None
   - BLEInterface.HW_MTU = 500 is a CLASS attribute, not instance
   - After super().__init__(), self.HW_MTU is None (instance shadows class)
   - BLEPeerInterface copies: self.HW_MTU = parent.HW_MTU (gets None)
   - When HW_MTU is None, Transport.py truncates packet.data incorrectly
   - Result: Link establishment fails with mismatched link_id
   - Fix: Explicitly set self.HW_MTU = BLEInterface.HW_MTU after super().__init__()

2. MTU/identity race condition fix:
   - MTU negotiation can complete before identity is received
   - Previously: Warning logged, fragmenter not created
   - Now: Store pending MTU, create fragmenter when identity arrives
   - Adds pending_mtu dict to track deferred MTU values
   - _device_connected_callback checks for pending MTU after storing identity

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-25 18:18:22 -05:00
torlando-tech
857c0b8145 chore: prepare v0.2.2 release
Update CHANGELOG.md with release notes for v0.2.2

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-15 22:45:47 -05:00
torlando-tech
05ac05d1c0 Merge pull request #14 from torlando-tech/fix/issue-13-justworksrepairing
Fix issue #13: Enable JustWorksRepairing in install.sh
2025-11-15 22:41:13 -05:00
torlando-tech
0874f8f153 Merge pull request #24 from torlando-tech/torlando-tech-patch-1
Rename 'ko-fi' to 'ko_fi' in FUNDING.yml
2025-11-15 21:25:32 -05:00
torlando-tech
9916c09251 Rename 'ko-fi' to 'ko_fi' in FUNDING.yml 2025-11-15 21:25:19 -05:00
torlando-tech
c197b483d0 Merge pull request #23 from torlando-tech/torlando-tech-patch-1
Add funding information for Ko-fi
2025-11-15 21:24:25 -05:00
torlando-tech
f7551225da Add funding information for Ko-fi 2025-11-15 21:24:09 -05:00
torlando-tech
d819008f05 Merge pull request #22 from torlando-tech/fix/remove-duplicate-deploy-workflow
fix: remove duplicate deploy workflow file
2025-11-15 21:16:34 -05:00
torlando-tech
58ef0a4bf8 fix: remove duplicate deploy workflow file
Removed .github/workflows/deploy.yaml which was a byte-for-byte duplicate
of deploy.yml. Both workflows were executing independently, causing:
- Duplicate deployments to Raspberry Pi devices
- Potential race conditions from concurrent SSH sessions
- Unnecessary resource usage

Kept deploy.yml as it uses the more standard extension in the GitHub
Actions ecosystem.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-15 21:14:59 -05:00
torlando-tech
c93fabb944 fix: remove duplicate deploy workflow file
Removed .github/workflows/deploy.yaml which was a byte-for-byte duplicate
of deploy.yml. Both workflows were executing independently, causing:
- Duplicate deployments to Raspberry Pi devices
- Potential race conditions from concurrent SSH sessions
- Unnecessary resource usage

Kept deploy.yml as it uses the more standard extension in the GitHub
Actions ecosystem.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-15 21:14:59 -05:00
torlando-tech
9514a6570a fix: enable JustWorksRepairing in install.sh to prevent pairing failures
Adds Step 5C to install.sh that automatically configures BlueZ's
JustWorksRepairing setting to "always" in /etc/bluetooth/main.conf.
This enables automatic pairing for peer-initiated BLE connections,
which is required for zero-touch mesh networking.

Changes:
- install.sh: Add Step 5C to configure JustWorksRepairing
  - Checks current setting and only modifies if needed
  - Handles both root and non-root execution
  - Restarts bluetooth service to apply changes
  - Container-friendly with non-fatal restart operations
- README.md: Document JustWorksRepairing in manual installation steps
- README.md: Add troubleshooting section for JustWorksRepairing warning

Fixes #13

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-15 21:06:57 -05:00
torlando-tech
3e3de053cb Merge pull request #12 from torlando-tech/fix/issue-11-pipx-dbus
docs: add pipx installation instructions and troubleshooting
2025-11-15 21:05:41 -05:00
torlando-tech
79a4c3179f Merge pull request #12 from torlando-tech/fix/issue-11-pipx-dbus
docs: add pipx installation instructions and troubleshooting
2025-11-15 21:05:41 -05:00
torlando-tech
0ead1fecb5 feat: add automated pipx support to install.sh
Enhances the installation script to automatically detect and handle
pipx installations of RNS, eliminating the need for manual dependency
injection in most cases.

Changes to install.sh:
- Add pipx detection logic that checks for RNS in pipx paths
- Verify pipx command availability and RNS listing
- Install build dependencies (build-essential, python3-dev, libdbus-dev)
  for Debian/Ubuntu and (base-devel, gobject-introspection) for Arch
- Implement automated pipx inject for all BLE dependencies
  (bleak, bluezero, dbus-python)
- Add progress messages for long-running dbus-python compilation
- Verify all dependencies after injection
- Use correct Python executable for setcap based on install mode

Changes to README.md:
- Update Option A description to mention pipx detection
- Add note to Option C that install.sh now handles pipx automatically
- Keep manual instructions for troubleshooting/fallback

Benefits:
- Consistent "one-command installation" experience for all users
- Reduces user errors from manual pipx injection
- Provides clear error messages with recovery instructions
- Maintains manual documentation as fallback

Related to #11

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-15 20:51:02 -05:00
torlando-tech
17445e97f3 feat: add automated pipx support to install.sh
Enhances the installation script to automatically detect and handle
pipx installations of RNS, eliminating the need for manual dependency
injection in most cases.

Changes to install.sh:
- Add pipx detection logic that checks for RNS in pipx paths
- Verify pipx command availability and RNS listing
- Install build dependencies (build-essential, python3-dev, libdbus-dev)
  for Debian/Ubuntu and (base-devel, gobject-introspection) for Arch
- Implement automated pipx inject for all BLE dependencies
  (bleak, bluezero, dbus-python)
- Add progress messages for long-running dbus-python compilation
- Verify all dependencies after injection
- Use correct Python executable for setcap based on install mode

Changes to README.md:
- Update Option A description to mention pipx detection
- Add note to Option C that install.sh now handles pipx automatically
- Keep manual instructions for troubleshooting/fallback

Benefits:
- Consistent "one-command installation" experience for all users
- Reduces user errors from manual pipx injection
- Provides clear error messages with recovery instructions
- Maintains manual documentation as fallback

Related to #11

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-15 20:51:02 -05:00
torlando-tech
15618df04b docs: add pipx installation instructions and troubleshooting
Fixes #11

When RNS is installed via pipx, the BLE interface cannot access
system-installed packages like python-dbus due to pipx's isolated
virtual environments. This commit adds comprehensive documentation
for pipx users.

Changes:
- Add new "Option C: pipx Installation" section with step-by-step
  instructions for installing BLE dependencies via pipx inject
- Include system dependency installation for both Arch and Debian/Ubuntu
- Document how to find and grant capabilities to pipx Python executable
- Add BlueZ experimental mode configuration steps
- Explain why pipx requires special handling
- Add troubleshooting entry for ModuleNotFoundError issues with pipx

The documented solution uses `pipx inject rns bleak==1.1.1 bluezero dbus-python`
to install BLE dependencies into the isolated RNS environment.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-15 20:50:33 -05:00
torlando-tech
6b980a6a14 docs: add pipx installation instructions and troubleshooting
Fixes #11

When RNS is installed via pipx, the BLE interface cannot access
system-installed packages like python-dbus due to pipx's isolated
virtual environments. This commit adds comprehensive documentation
for pipx users.

Changes:
- Add new "Option C: pipx Installation" section with step-by-step
  instructions for installing BLE dependencies via pipx inject
- Include system dependency installation for both Arch and Debian/Ubuntu
- Document how to find and grant capabilities to pipx Python executable
- Add BlueZ experimental mode configuration steps
- Explain why pipx requires special handling
- Add troubleshooting entry for ModuleNotFoundError issues with pipx

The documented solution uses `pipx inject rns bleak==1.1.1 bluezero dbus-python`
to install BLE dependencies into the isolated RNS environment.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-15 20:50:33 -05:00
torlando-tech
a8b47e465d Merge pull request #16 from torlando-tech/refactor/abstraction-layer
Refactor/abstraction layer
2025-11-15 20:40:16 -05:00
torlando-tech
09b69393a7 Merge pull request #16 from torlando-tech/refactor/abstraction-layer
Refactor/abstraction layer
2025-11-15 20:40:16 -05:00
torlando-tech
c32d23c1d4 fix(tests): Move mock_driver fixture to module level for shared access
Fixes integration test failures where TestRealWorldScenario tests
couldn't access the mock_driver fixture.

The mock_driver fixture was defined inside TestPeripheralDisconnectCleanup
class, making it unavailable to TestRealWorldScenario class. This caused
pytest fixture lookup errors:

- test_both_monitoring_mechanisms_detect_disconnect_idempotent
- test_polling_catches_missed_dbus_signal

Solution: Move mock_driver to module level (outside class) so all test
classes can access it as a shared fixture.

All integration tests now pass locally.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-15 20:26:04 -05:00
torlando-tech
adb5544bff fix(tests): Move mock_driver fixture to module level for shared access
Fixes integration test failures where TestRealWorldScenario tests
couldn't access the mock_driver fixture.

The mock_driver fixture was defined inside TestPeripheralDisconnectCleanup
class, making it unavailable to TestRealWorldScenario class. This caused
pytest fixture lookup errors:

- test_both_monitoring_mechanisms_detect_disconnect_idempotent
- test_polling_catches_missed_dbus_signal

Solution: Move mock_driver to module level (outside class) so all test
classes can access it as a shared fixture.

All integration tests now pass locally.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-15 20:26:04 -05:00
torlando-tech
71b68aba36 fix(ci): Skip BlueZ LE-only mode configuration in containers
Fixes installer failures in container environments due to missing sudo command.

The BlueZ LE-only mode configuration section was attempting to modify
/etc/bluetooth/main.conf using sudo, even in container environments where:
1. Bluetooth hardware is not available
2. sudo is often not installed (containers run as root)
3. BlueZ configuration is not applicable

Now detects container environments using is_container() and skips the
LE-only mode configuration entirely, consistent with the Bluetooth
adapter power state checks.

This prevents "sudo: command not found" errors in Debian/Ubuntu CI containers.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-15 20:17:37 -05:00
torlando-tech
b336b73396 fix(ci): Skip BlueZ LE-only mode configuration in containers
Fixes installer failures in container environments due to missing sudo command.

The BlueZ LE-only mode configuration section was attempting to modify
/etc/bluetooth/main.conf using sudo, even in container environments where:
1. Bluetooth hardware is not available
2. sudo is often not installed (containers run as root)
3. BlueZ configuration is not applicable

Now detects container environments using is_container() and skips the
LE-only mode configuration entirely, consistent with the Bluetooth
adapter power state checks.

This prevents "sudo: command not found" errors in Debian/Ubuntu CI containers.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-15 20:17:37 -05:00
torlando-tech
e9f20c27a8 fix(ci): Fix integration test failures and installer container detection
Fixes three CI failures identified in workflow run #19395416465:

1. **Missing threading import** (test_peripheral_disconnect_cleanup.py)
   - Added missing `import threading` to fix NameError during test setup
   - Tests use threading.RLock() but import was missing

2. **Timing race condition** (test_stale_connection_polling.py)
   - Increased sleep from 0.15s to 1.5s in test_polling_interval_30_seconds
   - Test expects 2 polling cycles at 0.6s each, was timing out in CI

3. **Container-aware Bluetooth checks** (install.sh)
   - Added is_container() helper to detect Docker/container environments
   - Skip Bluetooth adapter power checks in containers (no hardware access)
   - Prevents false failures from bluetoothctl crashes in CI environments

All changes are test/installer infrastructure only - no production code changes.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-15 20:05:17 -05:00
torlando-tech
c75747f535 fix(ci): Fix integration test failures and installer container detection
Fixes three CI failures identified in workflow run #19395416465:

1. **Missing threading import** (test_peripheral_disconnect_cleanup.py)
   - Added missing `import threading` to fix NameError during test setup
   - Tests use threading.RLock() but import was missing

2. **Timing race condition** (test_stale_connection_polling.py)
   - Increased sleep from 0.15s to 1.5s in test_polling_interval_30_seconds
   - Test expects 2 polling cycles at 0.6s each, was timing out in CI

3. **Container-aware Bluetooth checks** (install.sh)
   - Added is_container() helper to detect Docker/container environments
   - Skip Bluetooth adapter power checks in containers (no hardware access)
   - Prevents false failures from bluetoothctl crashes in CI environments

All changes are test/installer infrastructure only - no production code changes.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-15 20:05:17 -05:00
torlando-tech
3e41e66d46 Merge pull request #21 from torlando-tech/torlando-tech-patch-1
Update deploy.yaml workflow file
2025-11-15 19:55:13 -05:00