Skip to content

Slim mqtt/client.py (~1500 lines) into a thin façade over helper modules #99

Description

@eman

Summary

Deferred follow-up from #95 (comprehensive repo evaluation, batch 6: architecture cleanup).

src/nwp500/mqtt/client.py is currently 1572 lines. It already delegates to several focused helper modules (mqtt/connection.py, mqtt/subscriptions.py, mqtt/control.py, mqtt/reconnection.py, mqtt/periodic.py, mqtt/command_queue.py, mqtt/state_tracker.py, mqtt/diagnostics.py), but NavienMqttClient itself has grown to carry a large amount of orchestration and convenience-method logic directly rather than acting as a thin façade.

Suggested approach

  • Audit client.py for logic that duplicates or could be pushed down into an existing helper module (e.g. connection lifecycle glue, event wiring, convenience wrappers around subscription/control methods).
  • Extract cohesive chunks into new or existing helper modules, leaving NavienMqttClient as a coordinator that wires helpers together and exposes the public API surface.
  • Keep the public API (methods/signatures on NavienMqttClient) stable unless a breaking change is explicitly justified and documented in CHANGELOG.rst per the project's no-backward-compat policy.

Acceptance criteria

  • mqtt/client.py meaningfully reduced in size (target: comparable to other helper modules, roughly a few hundred lines of coordination logic).
  • No behavior change; existing tests continue to pass.
  • ruff/mypy clean.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions