Skip to content

refactor(adapters): migrate MQTT, Web and UI to commands and snapshots - #218

Draft
stritti wants to merge 9 commits into
refactor/controller-architecture-contractsfrom
refactor/adapter-command-snapshot-migration
Draft

stritti wants to merge 9 commits into
refactor/controller-architecture-contractsfrom
refactor/adapter-command-snapshot-migration

Conversation

@stritti

@stritti stritti commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Draft architecture migration

Incrementally migrates adapter boundaries to the Core-1 typed-command / immutable-snapshot architecture while preserving existing MQTT/Web contracts.

Target

  • inbound runtime mutations become typed ControllerCommand values
  • one Core-1 application handler owns controller-state mutation
  • outbound adapters consume SystemSnapshot value copies
  • provisioning/authentication secrets and calibration stay behind dedicated service boundaries
  • legacy hand-over queues are removed only after equivalent typed-path coverage exists

Dependencies integrated in this branch

Implemented in this draft

  • instance-based ControllerCommandHandler composed in main.cpp
  • complete typed runtime-command contract with validation and persistence boundaries
  • MQTT callback reduced to fixed-size byte hand-over; no controller mutation on AsyncTCP
  • MQTT runtime topics translated to ControllerCommand on the Core-1 loop
  • independent timer-start and timer-end updates without stale-state reconstruction
  • manual pump policy centralized in the application handler
  • sensor-mapping updates routed through the typed handler
  • non-runtime MQTT operations remain delegated to their existing specialized services
  • native regression coverage for dispatch, bounded processing, timer updates, manual-pump guard and sensor mapping
  • OpenSpec task/design state kept in sync

Verified so far

  • Native Tests: green
  • PlatformIO CI: green on the current functional slice
  • cppcheck/cpplint and repository linters: green; final clang-format cleanup is being verified on the latest head
  • no open inline review threads at the last review check

Still draft

  • route Web runtime mutations through the same handler
  • route local UI mutations through the same handler
  • publish/populate SystemSnapshot from the Core-1 owner
  • migrate MQTT/Web/OLED/TFT read paths to snapshots
  • remove remaining direct mutable Nodes.hpp access from migrated adapters
  • remove the legacy MqttCommandQueue after typed hand-over equivalence is complete

The PR intentionally remains a draft until these migration steps and their contract tests are complete.

@github-actions

github-actions Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

✅⚠️MegaLinter analysis: Success with warnings

Descriptor Linter Files Fixed Errors Max errors Warnings Elapsed time
✅ ACTION actionlint 8 0 0 0.61s
✅ BASH bash-exec 2 0 0 0.56s
✅ BASH shellcheck 2 0 0 0.55s
✅ BASH shfmt 2 0 0 0.01s
✅ C clang-format 1 0 0 0.04s
✅ C cppcheck 1 0 0 0.02s
✅ C cpplint 1 0 0 0.28s
✅ CPP clang-format 104 0 0 0.66s
✅ CPP cppcheck 104 0 0 5.73s
✅ CPP cpplint 104 0 0 7.19s
✅ EDITORCONFIG editorconfig-checker 293 0 0 0.6s
✅ JSON jsonlint 6 0 0 0.11s
✅ JSON v8r 6 0 0 4.63s
⚠️ MARKDOWN markdownlint 110 4 0 4.03s
✅ YAML yamllint 27 0 0 0.68s

Detailed Issues

⚠️ MARKDOWN / markdownlint - 4 errors
.opencode/skills/web-ui/SKILL.md:34 error MD028/no-blanks-blockquote Blank line inside blockquote
docs/superpowers/plans/2026-08-10-olimex-c6-local-ui-implementation.md:106:401 error MD013/line-length Line length [Expected: 400; Actual: 452]
docs/superpowers/plans/2026-08-16-norvi-button-calibration.md:7:401 error MD013/line-length Line length [Expected: 400; Actual: 412]
openspec/changes/controller-architecture-contracts/design.md:171:401 error MD013/line-length Line length [Expected: 400; Actual: 448]

Notices

⚠️ Your configuration references items that have been removed from MegaLinter and are ignored: MAKEFILE, MAKEFILE_CHECKMAKE, MARKDOWN_MARKDOWN_LINK_CHECK. See Removed linters to find their replacements.

See detailed reports in MegaLinter artifacts

Your project could benefit from a custom flavor, which would allow you to run only the linters you need, and thus improve runtime performances. (Skip this info by defining FLAVOR_SUGGESTIONS: false)

  • Documentation: Custom Flavors
  • Command: npx mega-linter-runner@10.1.0 --custom-flavor-setup --custom-flavor-linters ACTION_ACTIONLINT,BASH_EXEC,BASH_SHELLCHECK,BASH_SHFMT,C_CPPCHECK,C_CPPLINT,C_CLANG_FORMAT,CPP_CPPCHECK,CPP_CPPLINT,CPP_CLANG_FORMAT,EDITORCONFIG_EDITORCONFIG_CHECKER,JSON_JSONLINT,JSON_V8R,MARKDOWN_MARKDOWNLINT,YAML_YAMLLINT

MegaLinter is provided by OX Security
Show us your support by starring ⭐ the repository

@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Native Test Coverage

Metric Value
Line Coverage 48.2%
Branch Coverage 74.8%
Lines Hit/Total 392/814
Branches Hit/Total 178/238

Report from native unit tests (ASan + gcov).

@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Native Test Coverage

Metric Value
Line Coverage 48.2%
Branch Coverage 74.8%
Lines Hit/Total 392/814
Branches Hit/Total 178/238

Report from native unit tests (ASan + gcov).

4 similar comments
@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Native Test Coverage

Metric Value
Line Coverage 48.2%
Branch Coverage 74.8%
Lines Hit/Total 392/814
Branches Hit/Total 178/238

Report from native unit tests (ASan + gcov).

@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Native Test Coverage

Metric Value
Line Coverage 48.2%
Branch Coverage 74.8%
Lines Hit/Total 392/814
Branches Hit/Total 178/238

Report from native unit tests (ASan + gcov).

@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Native Test Coverage

Metric Value
Line Coverage 48.2%
Branch Coverage 74.8%
Lines Hit/Total 392/814
Branches Hit/Total 178/238

Report from native unit tests (ASan + gcov).

@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Native Test Coverage

Metric Value
Line Coverage 48.2%
Branch Coverage 74.8%
Lines Hit/Total 392/814
Branches Hit/Total 178/238

Report from native unit tests (ASan + gcov).

@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Native Test Coverage

Metric Value
Line Coverage 51.0%
Branch Coverage 75.4%
Lines Hit/Total 439/861
Branches Hit/Total 184/244

Report from native unit tests (ASan + gcov).

4 similar comments
@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Native Test Coverage

Metric Value
Line Coverage 51.0%
Branch Coverage 75.4%
Lines Hit/Total 439/861
Branches Hit/Total 184/244

Report from native unit tests (ASan + gcov).

@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Native Test Coverage

Metric Value
Line Coverage 51.0%
Branch Coverage 75.4%
Lines Hit/Total 439/861
Branches Hit/Total 184/244

Report from native unit tests (ASan + gcov).

@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Native Test Coverage

Metric Value
Line Coverage 51.0%
Branch Coverage 75.4%
Lines Hit/Total 439/861
Branches Hit/Total 184/244

Report from native unit tests (ASan + gcov).

@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Native Test Coverage

Metric Value
Line Coverage 51.0%
Branch Coverage 75.4%
Lines Hit/Total 439/861
Branches Hit/Total 184/244

Report from native unit tests (ASan + gcov).

@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Native Test Coverage

Metric Value
Line Coverage 51.5%
Branch Coverage 76.2%
Lines Hit/Total 443/861
Branches Hit/Total 186/244

Report from native unit tests (ASan + gcov).

@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Native Test Coverage

Metric Value
Line Coverage —%
Branch Coverage —%
Lines Hit/Total 0/0
Branches Hit/Total 0/0

Report from native unit tests (ASan + gcov).

@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Native Test Coverage

Metric Value
Line Coverage 51.0%
Branch Coverage 76.2%
Lines Hit/Total 443/868
Branches Hit/Total 186/244

Report from native unit tests (ASan + gcov).

@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Native Test Coverage

Metric Value
Line Coverage 51.8%
Branch Coverage 76.2%
Lines Hit/Total 450/868
Branches Hit/Total 186/244

Report from native unit tests (ASan + gcov).

@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Native Test Coverage

Metric Value
Line Coverage 51.7%
Branch Coverage 76.2%
Lines Hit/Total 447/865
Branches Hit/Total 186/244

Report from native unit tests (ASan + gcov).

2 similar comments
@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Native Test Coverage

Metric Value
Line Coverage 51.7%
Branch Coverage 76.2%
Lines Hit/Total 447/865
Branches Hit/Total 186/244

Report from native unit tests (ASan + gcov).

@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Native Test Coverage

Metric Value
Line Coverage 51.7%
Branch Coverage 76.2%
Lines Hit/Total 447/865
Branches Hit/Total 186/244

Report from native unit tests (ASan + gcov).

@stritti
stritti force-pushed the refactor/adapter-command-snapshot-migration branch from 5b4c852 to a22f57d Compare October 6, 2026 13:17
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Native Test Coverage

Metric Value
Line Coverage 52.9%
Branch Coverage 77.7%
Lines Hit/Total 467/883
Branches Hit/Total 202/260

Report from native unit tests (ASan + gcov).

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Native Test Coverage

Metric Value
Line Coverage 52.9%
Branch Coverage 77.7%
Lines Hit/Total 467/883
Branches Hit/Total 202/260

Report from native unit tests (ASan + gcov).

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Native Test Coverage

Metric Value
Line Coverage 52.9%
Branch Coverage 77.7%
Lines Hit/Total 467/883
Branches Hit/Total 202/260

Report from native unit tests (ASan + gcov).

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Native Test Coverage

Metric Value
Line Coverage 52.9%
Branch Coverage 77.7%
Lines Hit/Total 467/883
Branches Hit/Total 202/260

Report from native unit tests (ASan + gcov).

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Native Test Coverage

Metric Value
Line Coverage —%
Branch Coverage —%
Lines Hit/Total 0/0
Branches Hit/Total 0/0

Report from native unit tests (ASan + gcov).

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Native Test Coverage

Metric Value
Line Coverage 53.0%
Branch Coverage 77.7%
Lines Hit/Total 470/886
Branches Hit/Total 202/260

Report from native unit tests (ASan + gcov).

Co-authored-by: stritti <stritti@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

Native Test Coverage

Metric Value
Line Coverage 53.0%
Branch Coverage 77.7%
Lines Hit/Total 470/886
Branches Hit/Total 202/260

Report from native unit tests (ASan + gcov).

This branch has not been deployed

No deployments
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