Skip to content

feat: v2.9.0 — Power Management Rebuild (§Phase 14 milestone 53) - #48

Merged
SoundMatt merged 1 commit into
mainfrom
feat/v2.9.0-power-management-rebuild
Jul 28, 2026
Merged

SoundMatt merged 1 commit into
mainfrom
feat/v2.9.0-power-management-rebuild

Conversation

@SoundMatt

Copy link
Copy Markdown
Owner

Summary

Implements ROADMAP.md milestone 53, "Power Management Rebuild (v2.9.0)", opening Phase 14. This is a REPLACE of rcp/powerstate.hpp per the Satellite Package Disposition table: the pre-replacement ad-hoc Active/Sleeping/BusOff model built on rcp.hpp's Zone/CommandType/Controller is discarded entirely, not adapted, following the OPEN Alliance TC18 Remote Control Protocol Specification v0.5.1_RC's actual power-mode behavior.

  • PowerMode gains the specification's actual four modes: Normal/StandBy/Sleep/Unpowered.
  • start_kind_on_exit fixes StandBy as always a hot start and Sleep as always a cold start (PowerManager::pending_start_kind()).
  • PowerManager::enter_standby/enter_sleep apply the three documented entry-refusal conditions in a fixed order: an unacknowledged wake-up event (queried directly from rcp::wakeup::WakeupEndpoint::wakeup_message_pending(), v2.7.0), a non-idle endpoint, and a non-empty response/ack queue — the latter two exposed as caller-supplied Hooks::endpoints_idle/Hooks::response_ack_queues_empty predicates rather than a direct rcp/regmap.hpp dependency, mirroring rcp/lifecycle.hpp's (v2.1.0) PlausibilityCheck pattern.
  • resume_from_standby implements StandBy's hot-start rule directly — no handshake, straight back to Normal.
  • begin_wake_from_sleep/note_wakeup_attempt_sent/acknowledge_wakeup implement the hot-start-from-Sleep handshake by directly driving WakeupEndpoint::wakeup_message_pending()/acknowledge_wakeup() in a repeat-until-echoed-or-limit loop, with Hooks::reenable_network_interface/Hooks::reenable_response_ack_queues covering the handshake's network-reenablement and queue-reenablement steps.
  • notify_power_removed/notify_power_restored model Unpowered as a hardware-driven, unconditional transition with no refusal path.

Nothing else in the tree depended on the old powerstate::Manager API (only its own test did), so no legacy shim was needed, same precedent as rcp/e2e.hpp's REPLACE at v2.6.0.

New coverage lives in tests/test_powerstate.cpp (REQ-PWR-001..014, entirely rewritten), traced in .fusa-reqs.json. Bumps kVersion/project version to 2.9.0. Updates ROADMAP.md with a Done (v2.9.0) summary for milestone 53.

Per the confidentiality constraint on the source specification, no spec text is reproduced anywhere in code/comments/this description — only cited by name.

Test plan

  • cmake --build build --parallel — full local build (AppleClang 21, C++17 and C++20) green, no new warnings under -Wall -Wextra -Wpedantic -Wshadow -Wnon-virtual-dtor -Wold-style-cast -Wcast-align -Wunused -Woverloaded-virtual
  • ctest --test-dir build --output-on-failure — all 59 test suites pass (including rcp_powerstate, 17 cases / 78 assertions)
  • cpp-rcp CLI target still builds (RELAY_BUILD_CLI=ON)
  • .fusa-reqs.json is valid JSON; REQ-PWR-001..014 traced 1:1 against tests/test_powerstate.cpp's fusa:test tags
  • CI (cross-platform build/test matrix, RELAY conformance gate, clang-tidy, coverage, cpp-FuSa checks) — awaiting green run on this PR

Replaces rcp/powerstate.hpp in full, per the Satellite Package
Disposition table's entry for this file: the pre-replacement ad-hoc
Active/Sleeping/BusOff model built on rcp.hpp's Zone/CommandType/
Controller is discarded, not adapted. Nothing else in the tree
depended on that old API (only this file's own test did), so no
legacy shim was needed, same as rcp/e2e.hpp's equivalent note at
v2.6.0.

- PowerMode gains the specification's actual four modes (Normal,
  StandBy, Sleep, Unpowered); start_kind_on_exit fixes StandBy as
  always a hot start and Sleep as always a cold start, exposed on
  PowerManager as pending_start_kind().
- PowerManager::enter_standby/enter_sleep apply the three documented
  entry-refusal conditions in a fixed order: an unacknowledged
  wake-up event (queried directly from
  rcp::wakeup::WakeupEndpoint::wakeup_message_pending()), a non-idle
  endpoint, and a non-empty response/ack queue — the latter two
  exposed as caller-supplied Hooks::endpoints_idle/
  Hooks::response_ack_queues_empty predicates rather than a direct
  rcp/regmap.hpp dependency, mirroring rcp/lifecycle.hpp's
  PlausibilityCheck pattern.
- resume_from_standby implements StandBy's hot-start rule directly
  (no handshake, straight back to Normal).
- begin_wake_from_sleep/note_wakeup_attempt_sent/acknowledge_wakeup
  implement the hot-start-from-Sleep handshake by directly driving
  WakeupEndpoint::wakeup_message_pending()/acknowledge_wakeup() in a
  repeat-until-echoed-or-limit loop (Config::wakeup_repeat_limit,
  default 8, this implementation's own choice), with
  Hooks::reenable_network_interface/
  Hooks::reenable_response_ack_queues covering the handshake's step 1
  and step 3.
- notify_power_removed/notify_power_restored model Unpowered as a
  hardware-driven, unconditional transition with no refusal path.

New coverage lives in tests/test_powerstate.cpp (REQ-PWR-001..014,
entirely rewritten), traced in .fusa-reqs.json. Bumps kVersion/project
version to 2.9.0. Updates ROADMAP.md with a Done (v2.9.0) summary for
milestone 53.

Signed-off-by: Matt <47545907+SoundMatt@users.noreply.github.com>
@SoundMatt
SoundMatt merged commit 9af4cee into main Jul 28, 2026
37 of 39 checks passed
@SoundMatt
SoundMatt deleted the feat/v2.9.0-power-management-rebuild branch July 28, 2026 22:12
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