Repository navigation
fix(webpush): do not push a repeated all_set for the same session - #10
Merged
Merged
Conversation
Store::push_with_prior returns, under the store lock, the state of the session's newest buffered event that has a state (stateless records such as 'dismissed' are skipped). commit() passes it in PushCtx and should_push drops an all_set whose prior is all_set. The event is still stored and shown; your_turn/allow are unaffected; no prior in the buffer pushes. Verified on macmini: cargo test -p nearpushd -> 215 passed, 0 failed (128+55+13+19); cargo build --release --locked -p nearpushd -> ok.
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
Kiro sends an
all_seton every turn end, so one session can produce severalall_setevents in a row, and each one became a Web Push.Fix
nearpushd does not push an
all_setwhen the same session's previous stateful event in the in-memory event buffer (buffer_size, the replay buffer) is alreadyall_set.Store::push_with_priorlooks up, under the same lock as the insert, the newest buffered event with the samesessionthat has a state. Stateless records (for exampledismissed) are skipped.commit()passes that state inPushCtx::prior_state;webpush::should_pushdropsall_setafterall_set. This is the only change to the push decision.workingand states hidden by the filter or never pushed.your_turnandalloware unaffected. No new config key.Design choices
sessionhave nothing to match on, so they are never deduplicated.all_setstill counts as the prior, so the firstall_setafter unpausing is skipped if the one before it, sent while paused, was alsoall_set. This follows rule (d): every state counts, pushed or not.Tests
New:
webpush::tests::repeated_all_set_is_not_pushedandstore::tests::push_with_prior_reports_the_sessions_last_stateful_event. Together they cover: consecutiveall_setsuppressed,your_turnin between allows the next one, a stateless event in between is skipped, no prior pushes, sessions do not affect each other, and every event is still stored.Run on macmini (fresh clone of this branch):
cargo test -p nearpushd: 215 passed, 0 failed (128 + 55 + 13 + 19)cargo build --release --locked -p nearpushd: ok