Skip to content

v1.13.4 - DeviceResponseBuilder Dependency Cleanup (2025-12-09)

What Changed?

This release refactors the DeviceResponseBuilder class to eliminate circular dependencies with detection data structures. The from_event() method was removed and replaced with inline event serialization in detection code paths. This improves code architecture while maintaining identical output and backward compatibility with legacy builds.


What's New

Architecture: DeviceResponseBuilder Refactoring

What it does: Removes the stream_data.h dependency from DeviceResponseBuilder, eliminating circular dependencies between the response builder and detection data structures. Event serialization is now handled inline in detection processing code.

Why it matters: - Cleaner separation of concerns: DeviceResponseBuilder is now a pure response envelope builder - Reduced coupling between modules - Prepares foundation for future event_response.h unified event serialization (v1.13.2+)

Code changes: - Deleted DeviceResponseBuilder::from_event() method - Removed #include "stream_data.h" from header - Replaced with inline JsonDocument population in main.cpp and detection_buffer.cpp


Installation

Quick Start

# Get the release
git checkout vX.Y.Z

# Build
task build

# Upload
task upload

# Check it works
task monitor

What's Different from the Last Version?

✅ Added

  • Build configuration: build_src_filter excludes legacy modules (stream_formatter.cpp, response.cpp, runtime_config.cpp) in unified protocol builds
  • Source code guarding: ENABLE_DEVICE_RESPONSE guards protect legacy includes and initialization

🔧 Changed

  • DeviceResponseBuilder::from_event() removed (consolidated into inline serialization)
  • Event serialization moved from centralized method to inline JsonDocument building
  • stream_data.h include removed from device_response_builder.h

📐 Architecture Improvements

  • Circular dependency eliminated: DeviceResponseBuilder → stream_data.h
  • Module coupling reduced: DeviceResponseBuilder now response-focused only
  • Code prepared for future event_response.h consolidation

Is It Safe to Upgrade?

Backward Compatible: Yes

  • Output format remains identical (JSON Lines for unified protocol)
  • Legacy builds (ENABLE_DEVICE_RESPONSE=0) unaffected
  • Event serialization behavior unchanged
  • No API changes for end users

Tests Passed

  • ✅ Development build (ENABLE_DEVICE_RESPONSE=1): SUCCESS
  • RAM: 8.5% (27768 bytes / 327680 bytes)
  • Flash: 24.5% (321461 bytes / 1310720 bytes)
  • ✅ Production build (ENABLE_DEVICE_RESPONSE=0): SUCCESS
  • RAM: 6.9% (22760 bytes / 327680 bytes)
  • Flash: 23.4% (307037 bytes / 1310720 bytes)
  • ✅ Dependency validation: DeviceResponseBuilder zero stream_data.h deps
  • ✅ Pre-commit hooks: All checks passed

Release Details

  • Date: 2025-12-09
  • Version: v1.13.4
  • Scope: Internal architecture refactoring
  • Files Changed: 5 (device_response_builder.h/cpp, main.cpp, detection_buffer.cpp, platformio.ini)
  • Lines Added/Removed: +77/-107 (net -30 lines, code consolidation)

Next Steps

v1.13.5 (Planned): Event serialization consolidation via event_response.h

  • Extract inline event serialization into unified helper function
  • Reduce code duplication between main.cpp and detection_buffer.cpp
  • Maintain identical output with cleaner architecture