Skip to content

Workstream 3/completeness missing features#177

Merged
RonanB96 merged 9 commits intomainfrom
workstream-3/completeness-missing-features
Feb 26, 2026
Merged

Workstream 3/completeness missing features#177
RonanB96 merged 9 commits intomainfrom
workstream-3/completeness-missing-features

Conversation

@RonanB96
Copy link
Owner

This pull request introduces significant documentation, architectural, and configuration improvements to the bluetooth-sig-python project. The most important changes include the addition of a detailed decomposition plan for refactoring core classes, updates to implementation and contribution guidelines to reflect new module structures and best practices, enhancements to testing and coverage standards, and the addition of helpful development environment configuration files. The changes aim to improve maintainability, enforce consistency, and support the new modular architecture.

Architecture and Refactoring Documentation:

  • Added DECOMPOSITION_PLAN.md detailing the decomposition of "God classes" into smaller, composable modules, including execution order, new modules, and design principles. This serves as the authoritative reference for recent and ongoing architectural changes.

Contribution and Implementation Guidelines:

  • Updated .github/instructions/python-implementation.md and .github/instructions/bluetooth-gatt.instructions.md to reflect the new modular structure (e.g., templates/, pipeline/, core/), clarify that _python_type should not be set on new characteristics, and provide explicit patterns for characteristic and peripheral device implementation. [1] [2] [3]
  • Removed .github/ai-agent-characteristic-rules.md as these rules are now covered and superseded by the updated instructions and architectural documentation.

Testing and Coverage Improvements:

  • Increased the minimum test coverage threshold from 70% to 85% in the CI workflow and documented this in testing instructions. Added a section on test directory structure and benchmark testing. [1] [2]
  • Updated documentation instructions to require Sphinx cross-references to new core classes and added guidance on using Mermaid diagrams for architecture.

Development Environment Enhancements:

  • Added .vscode/launch.json and .vscode/settings.json for improved debugging and terminal tool configuration, supporting a smoother developer workflow. [1] [2]

Minor Documentation and Example Updates:

  • Updated README.md and example scripts to match the new API and value return conventions. [1] [2] [3] [4]
  • Cleaned up unused imports and improved reference examples in documentation.

These changes collectively modernize the codebase, clarify best practices for contributors, and ensure the project is well-structured for future development.

- Remove unused SIGTranslatorProtocol parameter from PeripheralDevice.__init__
  (encoding is handled directly by BaseCharacteristic.build_value())
- Update module and class docstrings to reflect actual architecture
- Add 29 tests covering init, add_characteristic, lifecycle,
  update_value, update_raw, get_current_value, fluent config, add_service
- MockPeripheralManager test backend for PeripheralManagerProtocol
- Update device __init__.py exports (PeripheralDevice)
Add structured decoding for 4 advertising data types that were
previously stored as raw bytes:

- IndoorPositioningData (AD 0x25) — flag-driven WGS84/local coords
- TransportDiscoveryData (AD 0x26) — multi-block transport discovery
- ThreeDInformationData (AD 0x3D) — 3D display sync flags
- ChannelMapUpdateIndication (AD 0x28) — channel map + instant

Each type follows the established codebase patterns:
- IntFlag for all bitfield bytes
- DataParser for all integer parsing (auto InsufficientDataError)
- msgspec.Struct frozen=True kw_only=True
- One file per type under types/advertising/
- Properties for boolean flag accessors (single source of truth)

Integration:
- ad_structures.py LocationAndSensingData fields typed (was bytes)
- pdu_parser.py calls .decode() instead of raw assignment
- __init__.py exports updated

Tests: 58 new tests across 4 test files covering decode, errors,
flag properties, and boundary conditions.
…ffer

- Add max_age_seconds parameter for configurable TTL eviction
- Add injectable clock parameter for deterministic testing
- Add BufferStats (frozen msgspec.Struct) with pending/completed/evicted
- Track group timestamps and evict stale groups on each ingest()
- Export BufferStats from stream __init__.py
- Add 10 new tests: 4 TTL eviction + 6 stats (15 total in file)
- All existing tests pass unchanged (backwards compatible)

Implements item 3.7 from rework.md
- tests/static_analysis/test_yaml_implementation_coverage.py: 3 orphan
  detection tests that fail if an implementation exists without a YAML
  UUID entry (gates PRs against real bugs)
- scripts/gatt_coverage_report.py: informational coverage report showing
  YAML vs implementation counts (41.4% chars, 43.1% services, 100% descs)
- Coverage gaps are reported by the script, not by tests — absence of an
  implementation is expected and should not gate PRs

Implements item 3.4 from rework.md
Add three new registries for profile and service discovery YAML data:

- PermittedCharacteristicsRegistry: loads ESS/UDS/IMDS permitted
  characteristics (31/39/7 entries respectively)
- ProfileLookupRegistry: normalises 23 non-LTV profile YAML files into
  21 lookup tables (bearer_technology, audio_codec_id, display_types, etc.)
- ServiceDiscoveryAttributeRegistry: loads 27 attribute_ids categories,
  attribute_id_offsets_for_strings, and 6 protocol parameters

New types: PermittedCharacteristicEntry, ProfileLookupEntry,
AttributeIdEntry, ProtocolParameterEntry (frozen msgspec.Structs).

All registries are lazy-loaded, thread-safe, and return defensive copies.
LTV structures (23 files) deferred for dedicated LTV codec framework.

42 new tests across 3 test files. All 5578 tests pass, lint clean.
- WS2.2: Reduce type:ignore from 18 to 11 (descriptor_utils cast, RangeDescriptorMixin Protocol)
- WS2.3: Replace 3 silent except-pass with logger.debug (query.py, advertising.py)
- WS4.2: Bump CI coverage threshold from 70% to 85% (actual: 87%)
- WS5.1: Fix misleading README code samples (parse_characteristic returns value directly)
- WS5.4: Remove emoji from all examples/tests, remove 2 stub functions from with_bleak_retry.py
- Format: ruff format fixes on prior commit files
@RonanB96 RonanB96 self-assigned this Feb 23, 2026
@RonanB96 RonanB96 force-pushed the workstream-3/completeness-missing-features branch from 8f8b005 to b362e69 Compare February 26, 2026 16:31
@RonanB96 RonanB96 merged commit 8a9405f into main Feb 26, 2026
11 checks passed
@RonanB96 RonanB96 deleted the workstream-3/completeness-missing-features branch February 26, 2026 17:05
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