Repository navigation
feat(dashboard): Show the live GitHub change on Inbox rows and cards - #4162
Conversation
Co-Authored-By: BYK <[email protected]>
Co-Authored-By: BYK <[email protected]>
Co-Authored-By: BYK <[email protected]>
Co-Authored-By: BYK <[email protected]>
…-if-error Co-Authored-By: BYK <[email protected]>
…hub-objects Co-Authored-By: BYK <[email protected]>
Pull request cards read GitHub through the object cache with a 60 minute TTL. A page of cache misses loads in one GraphQL nodes query, keyed by the stored node id. Check run and check suite events refresh the cached entry. A push or a null mergeable marks merge state and checks as pending, and a debounced patch query fills only those fields. Drop the draft and size columns of junior_code_changes, which mirrored GitHub state. Co-Authored-By: BYK <[email protected]>
List surfaces read pull request size, draft state and status from the live card, with a skeleton until it resolves. A Conversation whose token moves reads its linked cards again. Co-Authored-By: BYK <[email protected]>
…-objects Co-Authored-By: BYK <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…st card read Rows from before Junior stored the id have none, and a migration cannot call GitHub. The batch skips them, and the card read of one stores its id, so later pages read it in the batch. Co-Authored-By: BYK <[email protected]>
…-if-error Co-Authored-By: BYK <[email protected]>
…into byk/cards-read-github-objects Co-Authored-By: BYK <[email protected]>
…ebhook The refresh merged the old issue into the cache and renewed its TTL, so the card kept showing a deleted or moved issue as open. Write the gone value instead, as a read of the issue would find. Co-Authored-By: BYK <[email protected]>
…-if-error Co-Authored-By: BYK <[email protected]>
…into byk/cards-read-github-objects Co-Authored-By: BYK <[email protected]> # Conflicts: # packages/junior-github/src/webhooks/object-cache.ts
This comment has been minimized.
This comment has been minimized.
… tests The archive test checked for a moment with no row. Its Conversation has an open ask, so once the feed drops it the ask brings its row back. The Code test checked the URL with item= before the Inbox drops it. Both now check what stays.
GitHub sends mergeable as null while it computes it. On the same head commit, the cached value now stays. A new head commit still resets it. Co-Authored-By: BYK <[email protected]>
A write that times out on the load lock drops the entry. The load that held the lock then stored its older value. Now the write leaves a mark, and a load that sees the mark change drops what it stored. Co-Authored-By: BYK <[email protected]>
…-if-error Co-Authored-By: BYK <[email protected]>
…into byk/cards-read-github-objects Co-Authored-By: BYK <[email protected]> # Conflicts: # packages/junior-dashboard/e2e/inbox/inbox-fixture.ts # packages/junior-dashboard/src/client/inbox/InboxPullRequests.tsx # packages/junior/src/api/code/overview.ts # packages/junior/src/api/schema/code.ts
…-if-error Co-Authored-By: BYK <[email protected]> # Conflicts: # packages/junior-github/src/webhooks/handler.ts
…into byk/cards-read-github-objects #4147 landed core migration 0170 first, so this branch's code change size drop is regenerated as 0171. Co-Authored-By: BYK <[email protected]>
A check event marked the checks of a cached pull request pending, but scheduled a patch only when the entry had a GraphQL node id. Entries without one kept pending checks until their TTL ended. The patch now names its pull request by the repository and number of its cache key, and reads with the same aliased query, 25 per query, and split-in-half retry as the page's card read. Webhooks schedule from the key alone, and the cached fields drop node_id. Patches saved with a nodeId still parse. Co-Authored-By: BYK <[email protected]>
| } | ||
| } | ||
| }, | ||
| }), |
There was a problem hiding this comment.
Patch splits stall the heartbeat
Medium Severity
Heartbeat patch queries now reuse loadInHalves with no canSplit budget and no request timeout. A GitHub error on a chunk of 25 recursively retries down to one pull request each, still inside this heartbeat. Page card reads bound that work to 20s and abort at 10s; patches do neither, so an outage can run a binary tree of GraphQL calls (on the order of a hundred) before daily reconcile continues. Failed patches do wait, but only after that storm.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit 414c536. Configure here.
#4148 landed as a squash commit with the same content that this branch already merged, so each conflict in its files keeps this branch's version. Conflict fix: InboxRow takes #4191's new rowActions options, and leaves out its `sizeShown` prop, which this branch removed. Co-Authored-By: BYK <[email protected]>
The provider state check read a second file of GitHub state copies that a cleanup would remove. Its last entries went with the size columns, so the check now reads only scripts/github-state-exceptions.json. Co-Authored-By: BYK <[email protected]>
| if (isOlderGitHubObject(current, { updated_at: node.updatedAt })) { | ||
| readAgain = | ||
| current.checks === "pending" || current.mergeable === "pending"; | ||
| return undefined; |
There was a problem hiding this comment.
SHA mismatch drops pending patches
Medium Severity
When the cached head SHA does not match the GraphQL read, writeHeadFacts skips the write and returns false, so the patch is treated as finished and expirePending does not run. Pending merge state and checks then stay on the 60-minute TTL. A newer updated_at in that situation correctly retries; a SHA mismatch does not.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 2f38eff. Configure here.
| {search.changes.map((change) => { | ||
| const reference: ComposerReference = { | ||
| draft: change.draft, | ||
| draft: listedDraft(listedOf(change.url)), |
There was a problem hiding this comment.
Snooze stores draft before the card
Medium Severity
The snooze pull request picker writes draft from listedDraft as soon as the row is selected. listedDraft is false until the live card arrives, and unlike the # menu this picker does not wait for listed.settled. A fast choice stores an open draft as a non-draft watch.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 2f38eff. Configure here.
|
57 screenshot changes — 57 changed · 0 added · 0 removed Review screenshots in Frameshift Show 12 more changed screenshots39 more changed screenshots in Frameshift. |
| // Webhooks refresh a changed issue, so the TTL bounds only a change that | ||
| // sends no webhook. | ||
| const OBJECT_CACHE_TTL_MS = 60_000; | ||
| const ISSUE_CACHE_TTL_MS = 60_000; |
There was a problem hiding this comment.
Why do we have a shorter issue cache?
There was a problem hiding this comment.
No strong reason. 60 s is the TTL #4148 set for every object, and this PR raised only pull requests to 60 min. Pull requests are what every dashboard surface now reads, and pull_request plus check_run/check_suite webhooks keep them fresh. Issues were out of scope here, so they kept the #4148 value.
Issues get issues webhooks too, so 60 min would fit them the same way, and it saves more there: an issue card has no batched read, so each miss is one REST call. The TTL then only bounds changes that send no webhook, as for pull requests. Want me to give issues the same 60 min TTL in this PR, or in a follow-up?
A deleted webhook that could not wait for a card read dropped the entry instead of writing it as gone, and the gone entry itself expired after a day. A late or redelivered edited webhook then wrote the issue back as live. The deleted webhook now also writes a gone mark in plugin state, which takes no lock, and keeps both the mark and the gone entry for the 3 days in which GitHub can redeliver a webhook. Other issue webhooks skip an issue with the mark. The slow card read tests move to their own file, so objects.test.ts stays under the file length limit. Co-Authored-By: BYK <[email protected]>
A pull request webhook with `mergeable: null` set checks and merge state to pending and scheduled a patch, even on the same head commit and base branch, such as for a label. Known check counts and conflict state then went away until the patch ran. On the same head and base, `mergeable: null` is now a missing field: known checks and a known merge state stay, and no patch runs. A new head or base, or a merge state that is not known yet, still turns both pending and patches. Co-Authored-By: BYK <[email protected]>
The webhook cache test still expected a label with mergeable null on the same head to turn the merge state pending. Co-Authored-By: BYK <[email protected]>
When the last patch attempt still found GitHub computing the merge state, it wrote the merge state as unknown with the 60-minute pull request TTL. The card then hid the merge state, and nothing asked GitHub again for an hour. The last attempt now keeps the merge state pending with the shared 15 s pending TTL, so the next read after that asks GitHub. Checks are written as before. Co-Authored-By: BYK <[email protected]>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
There are 4 total unresolved issues (including 3 from previous reviews).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 01d3e06. Configure here.
| return { | ||
| fields: { ...fields, checks: "pending", mergeable: "pending" }, | ||
| patch: true, | ||
| }; |
There was a problem hiding this comment.
Unchanged checks marked pending
Medium Severity
The new merge fallthrough always writes checks: "pending" together with mergeable, even when the head SHA did not change. Check counts belong to the head commit, so a base retarget or a same-head mergeable: null event (while mergeable is still unknown) hides known check counts until the next patch, which can wait on the heartbeat.
Reviewed by Cursor Bugbot for commit 01d3e06. Configure here.
There was a problem hiding this comment.
Fixed in 1ae4715c7 (#4204): only a new head SHA resets checks to pending now. A base retarget, or a same-head mergeable: null while the merge state is unknown, sets only mergeable to pending and patches it, so known check counts stay. A new test covers a base retarget that keeps the checks and patches the merge state.
Follows up #4162, which merged before these review fixes landed. **Page reads alone skip GitHub after a timeout.** A page that ran out of its 20 s card budget used to write a shared 30 s `:out-of-time` cache marker. Every read of those pull requests then skipped GitHub, so an Attach of an uncached pull request in that window returned "Object not found". Now `prefetch` can return an outcome per URL (`ObjectLinkPrefetchOutcome`, only `out_of_time` for now). Core hands it to that URL's `canView` and `resolve` on the same page as `ctx.prefetchOutcome`. Attach and other single reads get no outcome, so they ask GitHub. The shared marker is gone. The plugin API change is documented in `extend/build-a-plugin.md`. **Patch queries do not split.** A failed heartbeat patch query used to split in halves down to one pull request each, with no time limit. Now it waits whole for the next heartbeat, so a GitHub outage costs one query per chunk of 25. Only the page card read still splits, inside its budget, so `loadInHalves` moves next to it. **A patch of another head commit reads again soon.** When the patch read a head SHA other than the cached one, its pending merge state and checks stayed fresh for the full hour. Now that patch is dropped like one with no pull request in the answer, and its pending fields stay fresh for 15 s. **Only a new head resets checks.** Checks belong to the head commit, so a base retarget, or a same-head webhook with `mergeable: null` while the merge state is unknown, now marks only the merge state pending and patches it. Known check counts stay. **The snooze picker waits for the card.** An open pull request row in the snooze picker now waits for its live card before it can be picked, as the `#` menu does, so an open draft is no longer watched as a ready pull request. **Saved object rows have no Attach slot.** Since the live card replaces a saved row, the row also got the Attach slot. That moved its state chip, or showed an empty gap for a viewer who is not a participant. A saved object's row now has no slot, as before. A link that an Attach saved keeps its "Attached" chip, as on `main`. The attach journeys move to `conversation-object-attach.spec.ts` to keep both specs under the length limit. ### Snooze picker | | Desktop | Mobile | | --- | --- | --- | | Light |  |  | | Dark |  |  | ### Saved object row, with no Attach slot | | Desktop | Mobile | | --- | --- | --- | | Light |  |  | | Dark |  |  | <!-- junior-request-attribution:start --> via @BYK. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:agent%3A5705312f4aef43e90d54baa93d9f241a --> -- [View Session](https://junior-prod.sentry.dev/conversations/agent%3A5705312f4aef43e90d54baa93d9f241a) [[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3A5705312f4aef43e90d54baa93d9f241a/?project=4510944073809921) <!-- junior-session-footer:end --> --------- Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: BYK <[email protected]>
…reen (#4230) Since #4162, `/inbox?view=conversations` resolves the cards of every GitHub and Linear link in every row, even rows far off screen. `InboxList` asked for all of the list's links under one query key, in batches of 100. Each row summary then asked for its own links under a different key, so some links were read twice. The page made 3 `/api/objects` reads of 115 links and 11 requests in total. `resolvedObjects.tsx` now gives each link its own `["object-links", url]` query, so a link is read once for the page. The 60 s staleness and the `versions.ts` refresh still apply. Links that ask in the same task share one batched request. A new `useNearScreen` hook watches each Inbox row against its scroll parent with a 50% margin, and a row asks for its links only when it is on or near the screen. The page now makes one object read of 6 links and 9 requests in 2 serial rounds. The second round stays, because the links come from the feed's rows. Because the undo toast now shows sooner after an archive, the archive undo e2e tests pause the fake clock before the archive, so render time does not count against the 6 s undo timer. `ExpandedPin` moves to its own file to keep `InboxRow.tsx` under the file length limit. The list looks the same as on `main`: | | Light | Dark | | --- | --- | --- | | Desktop |  |  | | Mobile |  |  | <!-- junior-request-attribution:start --> via @BYK. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:agent%3A3a8462327ad477941f22607d29abb0ea --> -- [View Session](https://junior-prod.sentry.dev/conversations/agent%3A3a8462327ad477941f22607d29abb0ea) [[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3A3a8462327ad477941f22607d29abb0ea/?project=4510944073809921) <!-- junior-session-footer:end --> --------- Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: BYK <[email protected]>


Builds on #4148, which added the GitHub object cache and its webhook refresh.
GitHub is the source of truth for pull request state. The dashboard read the size, draft state, mergeable state and reviewers of a pull request from copies in Junior's tables. Those copies went stale: a push from someone else updated only part of them, and the preview webhook copied the old size, mergeable state and reviewers back in. Every surface now reads the pull request through object-link resolve, behind the cache from #4148.
Server
p<i>: repository(owner, name) { pullRequest(number) { … } }). The batching copies Craft's (getsentry/craft@02941cd,src/utils/changelog.ts):check_runandcheck_suiteevents refresh the cached entry, like thepull_requestandissuesrefresh in feat(github): Keep GitHub cards current from webhooks and through outages #4148. Commit statuses do not count. The GitHub plugin docs list the Check run subscription.mergeable: nullpayload, such as for a label, keeps a known merge state and known checks and schedules no patch. A merge state that is not known yet turns pending, with its checks. A patch query a few seconds later reads only those fields and writes them with the sameupdated_atguard. It names each pull request by the repository and number of its cache key, and uses the page read's aliased query, 25 per query, and split-in-half retry, so every entry gets its patch. Cached entries no longer keep the GraphQLnode_id. Pushes inside the 5 s debounce make one query. For now, the patch rides the plugin heartbeat.deletedissue webhook also writes a gone mark in plugin state, which takes no lock. The mark and the gone entry last 3 days, while GitHub can redeliver. A lateeditedoropenedwebhook then cannot bring the issue back, even when the delete could not wait for a card read.refreshGitHubPullRequestPreviewno longer copies the old size, mergeable state and reviewers.junior_code_changes.draft,additions,deletionsandchanged_files, and deletesscripts/github-state-baseline.json, which then has no entries, with its join-table check.provider-state:checkreads onlyscripts/github-state-exceptions.json.titlestays, because search reads it. Migration: core0171, after ref(github): Read pull request lifecycle from core code changes #4147's0170.Dashboard
#menu and reference chips, snooze, the person card, the Conversation list chips and the home card tags read the live card from one batched request. Rows show a skeleton until it resolves, and a draft moves into its group then.InboxItemSubjectPreviewreads the live card first, so after anyone's push it shows the live size, mergeable state and reviewers.#menu row of an open pull request can be inserted only once its card comes, so a draft goes in as a draft.Screenshots (mock data)
Code · Mine, after the cards resolve. The page looks the same, but the size and draft state now come from GitHub:
Code · Mine while the cards load (new state):
Inbox pull request row after someone else pushed (GitHub now has +312 −40 in 9 files). The row head shows the live size, and the preview shows the description, not a second copy of the size:
#menu: the draft row says "Draft" once its card comes, and Enter then inserts the draft chip. Before the card comes, Enter does nothing:via @BYK.
--
View Session [Sentry]