Skip to content

rewrite(phase4): mock.hpp batch C — wire RxSequenceGuard, StreamFaultTracker, RxWatchdog - #148

Merged
SoundMatt merged 1 commit into
rewrite/v3-from-c-rcpfrom
phase4/mock-c
Aug 22, 2026
Merged

SoundMatt merged 1 commit into
rewrite/v3-from-c-rcpfrom
phase4/mock-c

Conversation

@SoundMatt

Copy link
Copy Markdown
Owner

Part of the v3.0.0 ground-up rewrite (#129, ROADMAP.md Phase 17), branch rewrite/v3-from-c-rcp. Phase 4 batch C of a four-batch mock.hpp port, built on batch A (admission) and batch B (response suppression + regmap/discovery wiring).

This closes a gap flagged since Phase 2 (PR #134)

RxSequenceGuard, StreamFaultTracker, and RxWatchdog were all fully implemented in e2e.hpp but never called from any dispatch path anywhere in cpp-RCP — e2e.hpp's own header comment explicitly deferred this wiring to "Phase 4 (server/dispatch) scope, matching c-RCP's own mock.c wiring." That deferred work lands here.

Ported

  • Server::dispatch_e2e() (REQ-E2E-021/031/041, REQ-WDG-010).
  • seq_gate_admits() — the sequence-gate check (REQ-E2E-028/029), folded into single-member dispatch (multi-member AVTPDU frame splitting is batch D's job; this batch's guard logic is built at the single-member level so batch D can reuse the same guard instance).
  • check_watchdog_overflow()/stream_rx_blocked() (REQ-E2E-046).
  • Unconditional watchdog kick at the top of dispatch_e2e() (REQ-WDG-010).

Shape of the new E2E dispatch surface

One public Server::dispatch_e2e() entry point, not ten per-type siblings — ep_req_crc_enable is a per-endpoint, not per-endpoint-type, toggle, and c-RCP's own equivalent is likewise a single function. All 10 operational endpoint types get E2E support uniformly via the real ep_req_crc_enable register. EP0 gets none (no generic_configs[] row, matching c-RCP).

Deliberate scope boundaries (documented in-file)

  • REQ-E2E-045/029's full stream-wide safe-state actuation isn't implemented (no actuator exists in this file yet) — only the observable StreamStatus latch is. Pre-existing gap class, not new here.
  • check_watchdog_overflow() purges server::Endpoint's own store, not rcp::watchdog::Manager (architecturally mismatched to this mock).
  • No TSCF variant yet (plain dispatch() has no TSCF gate either).

No content bugs found versus c-RCP.

Verification

New dispatch_e2e() + 6 new TEST_CASEs (replay detection, stream-fault short-circuit, watchdog kick/overflow), integration-tested via mock.hpp's dispatch. mock.hpp: 1759→2162 lines. test_mock.cpp: 1561→1832 lines, 71→77 TEST_CASEs (632 assertions).

Full tree rebuilds clean (0 errors/warnings, verified with -Wall -Wextra), 58/58 ctest suites pass (100%) — independently re-verified from a fresh build.

…Tracker, RxWatchdog

Part of the v3.0.0 ground-up rewrite (cpp-RCP #129, ROADMAP.md Phase 17),
branch rewrite/v3-from-c-rcp. Phase 4 batch C of a four-batch mock.hpp
port, built on batch A (admission) and batch B (response suppression +
regmap/discovery wiring).

This closes the exact gap flagged during Phase 2 (PR #134, e2e.hpp's
own header comment): RxSequenceGuard, StreamFaultTracker, and
RxWatchdog were all fully implemented in e2e.hpp but never called from
any dispatch path anywhere in cpp-RCP -- e2e.hpp's own comment
explicitly deferred this wiring to "Phase 4 (server/dispatch) scope,
matching c-RCP's own mock.c wiring (frame_seq_gate_admits(),
dispatch_frame_e2e())." That deferred work lands here.

## Ported (c-RCP src/mock.c -> Server)

- rcp_mock_server_dispatch_e2e() (src/mock.c:1892-2038, REQ-E2E-021/
  031/041, REQ-WDG-010) -> new Server::dispatch_e2e().
- frame_seq_gate_admits() (src/mock.c:3038-3063, REQ-E2E-028/029) ->
  private Server::seq_gate_admits(), folded into single-member
  dispatch per this batch's scope (multi-member AVTPDU frame splitting
  is batch D's job; this batch's guard logic is built at the
  single-member level so batch D can reuse the same guard instance).
- rcp_mock_server_check_watchdog() (src/mock.c:991-1021, REQ-E2E-046)
  -> public Server::check_watchdog_overflow().
- rcp_mock_server_stream_status_rx_blocked() (src/mock.c:981-989) ->
  Server::stream_rx_blocked().
- Watchdog-kick call sites (REQ-WDG-010) -> unconditional
  rx_watchdog_kick() at the top of dispatch_e2e().

## Shape of the new E2E dispatch surface

One public Server::dispatch_e2e() entry point, not ten
dispatch_<type>_e2e() siblings. ep_req_crc_enable (TC18 Sec12.7.1) is a
per-endpoint, not per-endpoint-type, toggle, and c-RCP's own
rcp_mock_server_dispatch_e2e() is likewise a single function
parameterized by byte_bus_id, not duplicated per handler -- mirrors
dispatch()'s own established single-entry-point convention. All 10
operational endpoint types get E2E support uniformly via
regs_.generic_configs[].ep_req_crc_enable (the real register). EP0
gets none -- it has no generic_configs[] row, matching c-RCP's own
EP0 exclusion from admission entirely.

## New Server state

e2e::StreamFaultTracker stream_fault_tracker_;
std::array<e2e::RxSequenceGuard/RxWatchdog/StreamStatus, kMaxEntries=64>
keyed by resolved request_streams[] index (mirrors c-RCP's
srv->seq_tracker[]/srv->stream_status[]) -- all owned directly, matching
mock.hpp's existing convention over c-RCP's pointer/setter style.

## Deliberate scope boundaries (documented in-file, not TODO-stubbed --
none block correctness)

- REQ-E2E-045/029's full stream-wide "broadcast safe state to every
  bound endpoint" actuation is not implemented (no SequencerTable-
  driving actuator exists in this file yet) -- only the observable
  StreamStatus latch is. Pre-existing gap class shared with batch A/B's
  own admission-reject overflow-safestate consequence, not new here.
- check_watchdog_overflow()'s purge targets server::Endpoint::
  watchdog_purge() (the pending/conditional store) rather than
  rcp::watchdog::Manager (RequestLedger-keyed, architecturally
  mismatched to this mock's admission storage).
- No TSCF variant of dispatch_e2e (c-RCP's dispatch_e2e_tscf, REQ-
  TIMED-012/013) -- out of scope since plain dispatch() has no TSCF
  timing gate either yet.

No content bugs found versus c-RCP. One test-fixture-only issue found
while writing coverage: GPIO's apply_gpio_write() masks writes by pin
direction (default all-input, TC18 Sec13.7.4.3) -- tests needed a
configure_gpio_all_outputs() fixture helper before asserting OR-write
effects; not a library bug.

## Verification

New Server::dispatch_e2e() + 6 new TEST_CASEs covering replay
detection, stream-fault short-circuit, and watchdog kick/overflow,
integration-tested via mock.hpp's dispatch (not re-testing e2e.hpp's
own already-unit-tested internals).

include/rcp/mock.hpp: 1759 -> 2162 lines. tests/test_mock.cpp: 1561 ->
1832 lines, 71 -> 77 TEST_CASEs (632 assertions). include/rcp/e2e.hpp:
header comment updated to record the closed deferral (primitives
unchanged). Full tree rebuilds clean (0 errors, 0 warnings, verified
with -Wall -Wextra), 58/58 ctest suites pass (100%) -- independently
re-verified from a fresh build, not just the porting agent's own
report.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: Matt <47545907+SoundMatt@users.noreply.github.com>
@SoundMatt
SoundMatt merged commit 5200d6b into rewrite/v3-from-c-rcp Aug 22, 2026
22 checks passed
@SoundMatt
SoundMatt deleted the phase4/mock-c branch August 22, 2026 07:18
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