Cover the source role with loopback wire-order tests - #115
Conversation
d9abea6 to
548df24
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Several tests can pass without fully verifying payload integrity or delayed permission leakage.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds loopback integration coverage for source-role streaming and connection gates.
Changes:
- Tests wire ordering and PCM framing.
- Covers time-sync gating and reconnect permission reset.
- Adds an in-test WebSocket server harness.
File summaries
| File | Description |
|---|---|
tests/test_source_role.cpp |
Adds source-role loopback integration tests. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 3
- Review effort level: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Audit every payload byte of every chunk against the write-side ramp, pin the end-to-end test's 25 ms chunk arithmetic explicitly instead of leaning on the config default, split the mid-stream validation probes into their own focused test with an accepting control, and outlast the failed-open retry window before the reconnect test's fresh command.
There was a problem hiding this comment.
🟡 Changes recommended
The tests do not reliably prove pre-command gating or server-time timestamp conversion.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 3
- Review effort level: Balanced
The fake server now runs its clock a known 500 ms ahead, so the ordering test asserts each chunk timestamp lands in the server domain (base + offset) rather than near the raw client stamp -- dropping the compute_server_time() conversion would now fail the test. Add an explicit quiet window past the failed-open retry interval before the start command so an erroneous unsolicited open surfaces, and correct the framing comment to describe the test's pinned 25 ms config rather than the 20 ms role default.
There was a problem hiding this comment.
🟡 Changes recommended
Duplicate-start coverage is nondeterministic, and new standard-library usages lack direct includes.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 2
- Review effort level: Balanced
| fake.send_source_command("start"); | ||
| pump_for(harness.client, 300); | ||
| EXPECT_EQ(fake.count_text_containing("client-stream/start"), 1U); |
| #include "source_task.h" | ||
| #include <ArduinoJson.h> | ||
| #include <gtest/gtest.h> | ||
| #include <ixwebsocket/IXWebSocket.h> |
Part 4/6 of the source@v1 stack (tracker: #95).
What it adds: loopback wire-order integration tests for the source role — a real client against an in-test WebSocket server, proving
client-stream/start→ typed+timestamped chunks →client-stream/endordering and every streaming gate (no start command, stale connection, no time sync, permission reset on reconnect).How it's used: tests only; no library changes.