Clear displayed_etag on etag-less full refresh#85
Open
balloob wants to merge 1 commit into
Open
Conversation
An etag-less full upload (or auto-complete) changes the panel pixels but left displayed_etag at its previous value, since it was only assigned inside the `hasNewEtag && newEtag != 0` guard. A later partial update (0x76) from another client whose oldEtag happened to match that stale value would pass the mismatch check and diff against the wrong, outdated base image, causing silent visual corruption. On a successful refresh with no valid etag, clear displayed_etag to 0 (invalid/unknown) so any subsequent partial gets a clean ETAG mismatch and falls back to a full upload. Behavior when a real etag is supplied is unchanged. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012g2e8mr132vcizx92WsgiR
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem (MJ-17)
handleDirectWriteEndinsrc/display_service.cppcommitsdisplayed_etagonly inside ahasNewEtag && newEtag != 0guard. An etag-less full upload (or an auto-complete END with no etag payload) changes the panel pixels but leavesdisplayed_etagat its previous value.The partial-update path (
0x76) validates with:So a later partial from another client whose
oldEtaghappens to equal the now-staledisplayed_etagpasses this check and diffs against the wrong, outdated base image — silent visual corruption.Fix
On a successful refresh where no valid etag was supplied, clear
displayed_etagto0(invalid/unknown) instead of leaving a stale value.0is never a legitimatedisplayed_etagmatch (a partial witholdEtag == 0is already rejected), so the next partial gets a clean ETAG mismatch and correctly falls back to a full upload. No bogus etag is invented; a later client simply re-uploads in full.Behavior when a real etag IS supplied is unchanged, as is the partial-refresh commit path (
displayed_etag = partialCtx.new_etagon success).State transitions
displayed_etag = 0.0x76) arrives with anyoldEtag→oldEtag != displayed_etag (0)→ clean ETAG mismatch NACK.Previously step 1 left the old etag in place, so step 2 could false-match and diff against stale pixels.
Verification
Builds pass:
pio run -e nrf52840custom— SUCCESSpio run -e esp32-s3-N16R8— SUCCESS🤖 Generated with Claude Code
https://claude.ai/code/session_012g2e8mr132vcizx92WsgiR