Repository navigation
fix(zbugs-gpui): mark an issue viewed after the server confirms its changes - #186
Merged
Merged
Conversation
…hanges The zbugs GPUI end-to-end job failed once on #185 at the viewState check: `e2e online: passed`, then Postgres had the issue's viewed time before its modified time. zbugs' issue trigger stamps `modified` with the time the server's transaction for a change starts, after the client showed the change. The one-second view timer took its viewed time from the client's state, so when it fired before the server had applied the close, the server's stamp came later. The app marked the issue viewed again a second after the server confirmed it, but the run had already exited. The timer now waits until the server has confirmed the pending mutations before it takes the viewed time, as `max(now, modified)` of the confirmed issue. Amp-Thread-ID: https://ampcode.com/threads/T-5a01d9bf-e8fb-479a-8866-c293f3e230d5 Co-authored-by: tmm <tmm@tmm.dev>
tmm
added a commit
that referenced
this pull request
Nov 13, 2026
…hanges (#187) As in zbugs-gpui (#186): zbugs' issue trigger stamps `modified` with the start of the server's transaction for a change, after the app showed it. The one-second view timer took `now` from the app's state, so when it fired before the server had applied the change, the server's stamp came later and the issue stayed unread on the server until the app marked it again, a second after the confirmation. An app that quit in between, as e2e.sh's run does at a fixed time, left it unread. The timer now waits until the server has confirmed the mutations sent so far (`SyncThread::when_settled`), then marks the issue viewed at `max(now, modified)` of the confirmed issue. Amp-Thread-ID: https://ampcode.com/threads/T-5a01d9bf-e8fb-479a-8866-c293f3e230d5 Co-authored-by: Amp <amp@ampcode.com>
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.
The "zbugs GPUI app (macOS)" job failed once on #185 (run) at the viewState check:
e2e online: passed, then the row read…|f|f|0|internal, so Postgres had the issue'sviewedbefore itsmodified. A rerun passed.Cause. zbugs'
issue_set_last_modifiedtrigger stampsmodifiedwith the start of the server's transaction for a change (CURRENT_TIMESTAMP), which comes after the client showed the change. The one-second view timer took its viewed time from the client's state (max(now, modified)). When it fired before the server had applied the close, the server's stamp came later. The app re-marked the issue a second after the server confirmed it, but the run had already exited aftersettled. A timer still pending from an earlier change makes the window wider: it can fire just after the close.Fix. After its second, the timer waits for
when_pending_settledand only then takesmax(now, modified)from the confirmed issue. Offline,when_pending_settledreturns at once, so marking works as before.Checked on a Mac (macOS 27, same steps and DB check as CI's job, each run a fresh backend, online then offline):
issue.updatetransactionviewed − modified…|f|f|0|internal, as on #185)The delay was a temporary local patch to
apps/zbugs/api/index.ts, not part of this PR. It forces the timing the flaky CI run hit.cargo fmt --check, clippy with and withoute2e, andcargo testpass.