Workstream 3/completeness missing features#177
Merged
Conversation
- 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
8f8b005 to
b362e69
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
DECOMPOSITION_PLAN.mddetailing 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:
.github/instructions/python-implementation.mdand.github/instructions/bluetooth-gatt.instructions.mdto reflect the new modular structure (e.g.,templates/,pipeline/,core/), clarify that_python_typeshould not be set on new characteristics, and provide explicit patterns for characteristic and peripheral device implementation. [1] [2] [3].github/ai-agent-characteristic-rules.mdas these rules are now covered and superseded by the updated instructions and architectural documentation.Testing and Coverage Improvements:
Development Environment Enhancements:
.vscode/launch.jsonand.vscode/settings.jsonfor improved debugging and terminal tool configuration, supporting a smoother developer workflow. [1] [2]Minor Documentation and Example Updates:
README.mdand example scripts to match the new API and value return conventions. [1] [2] [3] [4]These changes collectively modernize the codebase, clarify best practices for contributors, and ensure the project is well-structured for future development.