From eeb9d2d1dfd38dd19fa641e6f733c917a3d1d005 Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 19 May 2026 03:18:04 +0530 Subject: feat: CVM relay stability fix + MCP relay integration tests Relay disconnect fix (cvm_server.c): - TLS read timeout reduced from 15s to 1s (short poll loop) - Ping timer fires every 30s independently of read activity - Consecutive timeout counter (65s) detects real disconnects - Handle relay close frames (opcode 0x08) explicitly - Result: 120s+ stable connection (previously ~37s disconnect cycle) MCP relay integration tests (17/17 pass via make test-cvm-mcp): - MCP initialize roundtrip via relay.primal.net - get_sessions returns session array - get_usage returns metric/price/step fields - Non-owner auth rejection (board silently drops) - Owner control request passes after rejection test Build fixes: - Remove display/font/axs15231b/qrcode deps (from display branch, not here) - Remove local_relay/relay_selector/sync_manager deps (from relay branch) - Add esp_timer to CMakeLists REQUIRES Host unit tests: 61/61 pass --- CHECKLIST-CVM-RELAY.md | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 CHECKLIST-CVM-RELAY.md (limited to 'CHECKLIST-CVM-RELAY.md') diff --git a/CHECKLIST-CVM-RELAY.md b/CHECKLIST-CVM-RELAY.md new file mode 100644 index 0000000..e7c512d --- /dev/null +++ b/CHECKLIST-CVM-RELAY.md @@ -0,0 +1,35 @@ +# CVM Relay Stability Checklist + +## Pre-flight +- [x] Create worktree `/home/c03rad0r/esp32-tollgate-cvm-relay` +- [x] Create branch `feature/cvm-relay-stability` from master +- [x] Document plan in PLAN-CVM-RELAY.md + +## Task 3: Fix Relay Disconnect +- [x] Modify `cvm_relay_task()` inner loop: 1s TLS read timeout +- [x] Decouple ping timer from read success +- [x] Add consecutive-timeout counter for real disconnect detection +- [x] Handle relay close frames (opcode 0x08) +- [x] `make test-unit` passes (61/61) +- [x] Build firmware +- [x] Lock Board B: `make lock-b PHASE="cvm-relay-stability"` +- [x] Verify Board B port: `esptool.py --port /dev/ttyACM1 chip_id` +- [x] Flash Board B via `make flash-b` +- [x] Monitor serial: confirm WS connected, no disconnect in 120s +- [ ] Unlock Board B (deferred — may need more testing) + +## Task 1: Test get_sessions & get_usage via Relay +- [x] Write `tests/integration/test-cvm-mcp-relay.mjs` +- [x] Test: `get_sessions` returns JSON array via relay (0 active sessions) +- [x] Test: `get_usage` returns metric/price/step fields via relay +- [x] Both tests PASS on Board B (via `make test-cvm-mcp`) + +## Task 2: Test Non-Owner Auth Rejection via Relay +- [x] Test: non-owner request gets no response (12s wait) +- [x] Test: owner control request succeeds after non-owner test +- [x] Both tests PASS on Board B (via `make test-cvm-mcp`) + +## Final +- [x] `make test-unit` — 61 tests pass +- [x] Commit: 3 commits on feature/cvm-relay-stability +- [ ] Push to remote (nostr git relay down — will retry later) -- cgit v1.2.3