Skip to content

Add a Robot 36 determinism guard for the SSTV line renderer - #169

Merged
magicbug merged 1 commit into
magicbug:mainfrom
g4dpz:test/robot36-determinism-guard
Oct 20, 2026
Merged

magicbug merged 1 commit into
magicbug:mainfrom
g4dpz:test/robot36-determinism-guard

Conversation

@g4dpz

@g4dpz g4dpz commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Hi Peter,

This is a follow-up to #166 and the quietest-of-5 allocation fix on main (7093fb9).

While looking at that area I noticed a gap in the renderer's test coverage. The exact-equality reuse test (Reusing_scratch_buffers_matches_a_fresh_buffer_per_line) deliberately excludes Robot 36, because Robot 36 is stateful across lines and keeps its own per-line arrays rather than reusing a shared scratch buffer. That left Robot 36 with no exact-equality guard at all, only the tolerance-based round-trip tests.

This change adds a test that renders the same Robot 36 signal twice, using two separate SstvLineRenderer instances, across all transmitted lines, and asserts the two full RGB buffers are byte-identical. That confirms the rendering is deterministic and leaks no state between renderer instances, which is the invariant we rely on for the reused-buffer path.

The change is test-only. No production code was touched, and the existing tests are unchanged.

Verification, local SSTV subset:

Passed! - Failed: 0, Passed: 179, Skipped: 0, Total: 179, Duration: 2 m 10 s - OscarWatch.Tests.dll (net10.0)

The new test on its own:

Passed! - Failed: 0, Passed: 1, Skipped: 0, Total: 1, Duration: 40 ms - OscarWatch.Tests.dll (net10.0)

Robot 36 is excluded from the stateless exact-equality reuse test because
it is stateful across lines (even lines carry R-Y, odd lines B-Y, paired
across line boundaries) and keeps its own per-line arrays rather than
reusing a shared scratch buffer. That left it without any exact-equality
guard, only the tolerance-based round-trip tests.

This adds a test that renders the same signal twice with two separate
renderers and asserts the two full RGB buffers are byte-identical,
confirming the rendering is deterministic and leaks no state between
renderer instances.
Copilot AI balanced review requested due to automatic review settings October 19, 2026 14:40

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused, test-only change matches its stated purpose and has no identified blocking issues.

No open issues 🎉

What changed in this PR

Adds an exact-equality determinism guard for Robot 36, complementing the existing SSTV renderer tests.

Changes:

  • Renders the same signal across all transmitted lines using two separate renderer instances.
  • Asserts byte-identical full RGB buffers without changing production code or existing tests.
File Description
OscarWatch.Tests/​Sstv/​SstvLineRendererAllocationTests.cs Adds the Robot 36 determinism test and explanatory documentation.

Review effort: Balanced

@magicbug
magicbug merged commit 5c6d06a into magicbug:main Oct 20, 2026
3 checks passed
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.

3 participants