test(kvm): prove tile stream ships only changed tiles (idle => zero) #83
Loading…
Reference in a new issue
No description provided.
Delete branch "verify/VA-79-tile-diff-changed-only"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Verify VA-79: desktop tile streaming sends only genuinely-changed tiles, so a static/idle screen settles to ~zero tiles per second after the initial full render.
Audit of vervain_agent_kvm::stream::capture_changed_tiles found the per-tile FNV-1a diff against the retained StreamState.tile_hashes is correct: an unchanged tile hashes identically and is skipped without re-encoding, the 33ms run_desktop interval only ships when the change set is non-empty, and cmd 6 Refresh maps to StreamState::invalidate which clears the hashes to re-ship the whole screen. The diff was effective, so no behaviour change was needed; this commit makes that behaviour mechanically enforced and field-measurable.
Extract the change-detection core into a pure diff_changed_tiles(state, &RawFrame, quality) so it can be exercised with synthetic frames in CI (the capture backends need a live X11 / Wayland / DXGI session). capture_changed_tiles keeps its signature and just calls capture_raw_frame then the new diff.
Add three unit tests (run by
cargo test --workspace --libin CI) that guard the acceptance criteria: an identical second frame ships zero tiles; a single changed pixel ships exactly the one tile containing it; and a Refresh (invalidate) re-ships every tile even when pixels are unchanged. A regression that re-ships unchanged tiles now fails CI.Instrument run_desktop to debug-log tiles-per-interval and bytes-per-interval when the change set is non-empty, so the idle/active tile counts can be measured on a live host (desktop-02): an idle screen produces no log lines, an active screen logs the real change volume.
#VA-79