feat: mailbox frame delivery + Server.Snapshot() (ADR-002, v0.2.0)#2
Merged
Conversation
Add per-module mailbox slot with latest-wins semantics and Snapshot() method for compositor render-tick polling. Push and pull coexist naturally -- no mode negotiation, no wire protocol changes. Changes: - Frame.Sequence field: maps wire protocol sequence for change detection - moduleConn.storeLatest/loadLatest: mutex-guarded mailbox slot - Server.Snapshot(): returns map[uint64]*Frame of latest per-module frames - readFrameLoop stores every frame in mailbox before OnFrame callback - 8 new tests: basic, latest-wins, no-frames, multi-module, pull, concurrent, backward-compat, headerToFrame sequence mapping
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
Summary
Adds per-module mailbox slot and
Server.Snapshot()for compositor render tick pattern. Formalizes push-based delivery as first-class alongside existing pull model.Motivation: @AgentNemo00 (KiGo) uses push-based delivery. Research across 9 production compositors (Wayland, Android, Chrome, Flutter, PipeWire, DWM, macOS, Vulkan, X11) shows the universal pattern is MAILBOX — producers submit whenever ready, compositor samples latest.
Changes
Frame.Sequencefield (mapped from wire protocol header)sync.Mutex+*Frame, NOT channel — ADR-002)readFrameLoopstores every frame in mailbox before firing OnFrameServer.Snapshot()returns latest frame from each moduleWhat did NOT change
ADR
Test plan
go build ./...— PASSgo test ./... -count=3— all pass, no flakesgolangci-lint run --timeout=5m— 0 issues