Skip to content

EXC-2107 Show a code owner's files from a reviewer hover - #73

Merged
macintacos merged 26 commits into
split-code-owners-readfrom
EXC-2107/show-a-code-owners-files-from-a-reviewer-hover
Oct 29, 2026
Merged

macintacos merged 26 commits into
split-code-owners-readfrom
EXC-2107/show-a-code-owners-files-from-a-reviewer-hover

Conversation

@macintacos

@macintacos macintacos commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner

Part of: EXC-2107

Change Kind: new feature

What changed

On a pull request's Conversation tab, hovering or focusing a code-owner shield beside a PR reviewer opens a small card listing the changed files that code owner owns. The card opens from the shield rather than the name, so GitHub's own hovercard keeps the avatar and name, and the two never show at once: gh-prism waits 200 ms, longer than GitHub's card takes to close. Every gh-prism popup now draws one 1px edge instead of a border doubled by Primer's shadow ring.

A reviewer's files now include their teams' files, and a reviewer keeps their shield after they review:

  • Who reviews, and for which team. gh-prism reads the PR reviewers from page_data/review_requests, the source of GitHub's own React reviewer list, instead of page_data/merge_box. It names the team a review was on behalf of (onBehalfOfTeams) and the team a request was assigned from (delegatedFromTeam), wherever GitHub lets the viewer see that team. It also flags a code owner GitHub names no team for, and it lists comment-only reviews, which merge_box left out.
  • Teams a reviewer belongs to. Every reviewer takes each owning team whose members list them, whatever CODEOWNERS gives them directly, so a reviewer owns every changed file CODEOWNERS gives them or any owning team they reviewed for, were assigned from, or belong to, as far as GitHub shows the viewer. The members come from /orgs/<org>/teams/<slug>/members as JSON, the endpoint GitHub's team mentions read, once per team per visit. gh-prism reads members only when GitHub shows the viewer a team among the reviewers, so a viewer outside the organization sends no extra request.
  • One rule everywhere. The Conversation card, the filter menu's "Only files owned by…" section, and the gh-prism-owner filter that section sets all use the same ownership rule. Picking a reviewer keeps the files their card lists.
  • A shield for every code owner reviewer. GitHub shields only a pending code-owner request, so a code owner who reviews loses the shield. gh-prism now draws a matching shield beside each reviewer who owns a changed file where GitHub draws none: same octicon, colour, and spot, just before the status icon. It works in both of GitHub's Reviewers lists: the classic sidebar and the React list of GitHub's PR overview, and for an Enterprise Managed User, whose login has an _. If GitHub later draws its own shield in a row, gh-prism's gives way. A click on either shield does nothing; that stays free for the details modal planned on top of this PR.
  • The team behind an owner. When a team makes a reviewer an owner, the card says "Through @org/team", linked to the team's page. Tab from the shield moves into the card, so the link works from the keyboard, and Escape hands focus back to the shield.
  • When GitHub hides the team. If GitHub flags someone as a code owner but shows the viewer no team that owns a changed file, the card says so in one sentence instead of listing nothing.
  • The file sidebar's shield opens on hover. On Files changed, the code owners shield opens its popover after the pointer rests on it for 200 ms, and at once on keyboard focus, using the Conversation card's hover-intent code. Click still opens it and moves focus inside, and Escape closes it.

The code owners and PR reviewers are read once per visit, when a Reviewers list first shows.

A gh-prism-owner page waits only on the reads its filter needs: a team's filter on the code owners alone, a user's on the PR reviewers and their teams too. A read still out after 10 s counts as failed, so every file shows without the code owners, and only the user's own files without the reviewers.

What to test

  • On sandbox PR #1, in light and dark, rest the pointer on frontend's shield in the Reviewers sidebar. A card lists api/generated/client.ts and web/app.ts. Then hover the frontend name: GitHub's card opens and gh-prism's doesn't.
  • Compare the card with GitHub's hovercard in the screenshots below, and confirm it fits GitHub's look.
  • Confirm that GitHub's "… is a code owner" tooltip, which shows first, gives way cleanly to the card.
  • On Files changed, open a row's code owners popover, and hover the header's diffstat. Confirm each edge reads as one thin line that is still visible, in both themes.
  • On the same Files changed tab, rest the pointer on a file row's shield. Its popover opens without taking focus, and closes once the pointer leaves the shield and popover. Tab onto a shield: the popover opens, and Tab walks its links. Shift+Tab from its first link back to the shield keeps the same popover open. Click a shield: the popover stays open with focus inside, and Escape returns focus to the row. Focus a link in a hover-opened popover and move the pointer away: the popover closes and focus lands on the row.
  • Open the file-tree filter menu. "Only files owned by…" lists Me, @excessive-dev/frontend, and @excessive-dev/platform.
  • Open Files changed narrowed to frontend. It lists api/generated/client.ts and web/app.ts.

The sandbox has one account, which authored its pull requests, so it can't stage a team member's review or a user code owner. Check these on a pull request in your own organization, where a team owns files through CODEOWNERS:

  • A team member reviews. After a member of an owning team approves, they keep a shield in the Reviewers list. If GitHub drew none, gh-prism's matches GitHub's look beside the re-request and status icons. Hovering it lists that team's changed files and says "Through @org/team", linked.
  • A direct owner in an owning team. A reviewer CODEOWNERS names directly who also belongs to an owning team: their card counts both, saying "Directly and through @org/team", and picking them in the filter menu keeps both.
  • A reviewer who has reviewed still appears in the filter menu's "Only files owned by…" section. Picking them narrows Files changed to the files their card lists.
  • User code owners. Hover a user code owner's shield: one CODEOWNERS lists directly, and one who owns only through a team, whether assigned from it or just a member. Each card lists their files, and the team-derived one names the team.
  • GitHub's PR overview. If your Conversation tab shows GitHub's React reviewer list, with "+N more reviewers", repeat the checks above there. No account available here could open that list, so its selectors come from GitHub's bundle.

Screenshots

Captured by the live check on sandbox PR #1 with the built extension, at 1400 × 1000.

Light. First, GitHub's tooltip, just before the card opens. Then the card is open. Last, GitHub's own hovercard, from the name, for comparison.

Light: GitHub's code-owner tooltip on the frontend shield, before gh-prism's card opens

Light: gh-prism's card below the frontend shield, listing api/generated/client.ts and web/app.ts

Light: GitHub's own hovercard for the frontend team, opened from its name

Dark. The same three states, in the same order.

Dark: GitHub's code-owner tooltip on the frontend shield, before gh-prism's card opens

Dark: gh-prism's card below the frontend shield

Dark: GitHub's own hovercard for the frontend team

One edge. The code owners popover on Files changed, light then dark:

Light: the code owners popover, edged by the shadow's 1px ring alone

Dark: the code owners popover, edged by the shadow's 1px ring alone

The diffstat tip, light then dark:

Light: the diffstat tip, edged by the shadow's 1px ring alone

Dark: the diffstat tip, edged by the shadow's 1px ring alone

gh-prism's shield for a reviewed code owner. These were taken on the live nodejs/node#67056 Conversation tab, with GitHub's real styles. Its review_requests answer was edited in the browser to what a nodejs member would get, pimterry's approval being on behalf of nodejs/crypto, because GitHub shows that team only to members. Each pair shows the shield beside GitHub's approval check, then its card. GitHub draws its re-request icon only for viewers who can re-request, which this account can't do there.

Light: gh-prism's shield beside pimterry's approval check in the classic Reviewers sidebar

Light: the card from gh-prism's shield, "Through @nodejs/crypto" and six crypto files

Dark: gh-prism's shield beside pimterry's approval check

Dark: the card from gh-prism's shield, "Through @nodejs/crypto" and six crypto files

The file sidebar's shield, opened by hover on sandbox PR #1, light then dark:

Light: the code owners popover for client.ts, opened by resting the pointer on its shield

Dark: the code owners popover for client.ts, opened by hover

Known limits

  • A viewer outside the organization sees no team. GitHub hides every team, including its review requests, onBehalfOfTeams, the code-owner flag, and team member lists, from a viewer outside the organization. There, a reviewer who owns files only through a team gets no shield and no filter-menu entry. On src: make crypto backend checks explicit nodejs/node#67056, signed in outside nodejs, GitHub draws no shield, and gh-prism adds none.
  • Large teams. GitHub's members JSON lists only a large team's first members, so a member beyond that list isn't matched through membership. Their review on the team's behalf still matches.
  • When GitHub hides the team. A code owner GitHub flags without showing a team that owns a changed file gets the card's one-sentence note instead of files, and no filter-menu entry.
  • GitHub's PR overview list was built from GitHub's bundle, not captured: its featureStates.overview read UNAVAILABLE for every account and repository available here. Its test fixture is labelled as rebuilt.
  • Unobserved fields. delegatedFromTeam, isCodeOwnerFromDelegation, and onBehalfOfTeams are read from GitHub's bundle, not observed live, for the same reason as the overview list.
  • Comment-only reviews now count as PR reviewers, since review_requests lists them.

Notes for review

  • The trigger is the shield, not the name. The issue says "hovering a reviewer". GitHub already opens its own hovercard on the name and avatar, so a second card there would stack. The shield has only a tooltip, so gh-prism takes it over. A live check sampled every animation frame while the pointer moved from GitHub's open card onto the shield, and found no frame that showed both.
  • "Thinner" means one edge, not a narrower stroke. Primer's --shadow-floating-small already opens with a 1px ring, so a border beside it drew two edges, which read as about 2px in dark mode. The overlays now let the ring be their edge. The new card takes GitHub's hovercard edge instead: a 1px border and no shadow. The classic notice already drew a single edge, so it is unchanged on purpose.
  • The card opens below the shield, so while it is open it covers the next reviewer's row. To reach the next shield, move off the card first; it closes 150 ms later.
  • It rides the header visit. The card runs only where gh-prism finds the header's lines-changed counter, the same condition the diffstat has.
  • Chromium hands focus back mid-hide. Hiding a popover that holds focus returns focus to its shield before the hide ends, and that focus would reopen it. Escape, and a scroll while focus is inside, now move focus to the file's row first. Every other close of a popover holding focus, from hover-intent or from another shield's popover opening, hands focus to the row too, and the Conversation card hands it to its shield.
  • Focus across the tree's shadow root. The file sidebar's popover is in light DOM and its shield in the tree's shadow root, so the document's focusout names only the tree's host as where focus went. hover-intent waits for the focusin that follows to decide, so Shift+Tab back to the shield keeps the popover.
  • GitHub replacing the Reviewers sidebar. A replaced shield gets no pointerout, so once an open card's shield has left the page, the next pointer move outside the card closes it on the usual 150 ms delay.
  • This PR changes code from lower layers of the stack: utils/github/code-owners.ts, the owner section, and the owner filter. That was asked for here.

- Drop the border beside --shadow-floating-small, whose 1px ring
  already draws the edge, from the diffstat tip and owners popover
- Clear the owners popover's UA [popover] border with border: 0
- Record the one-edge rule in design/patterns.md
- REVIEWER_SHIELD matches the Conversation sidebar's
  button[id^="codeowner-"]; shieldOwner reads its owner token
- Capture the sandbox PR #1 Conversation sidebar as a fixture
- Record the Reviewers sidebar's facts in github-rules.md
Move place() and VIEWPORT_MARGIN from the owners popover into
ui/place.ts, so the reviewer files popup can place itself the same way.
- showReviewerFiles opens a hover card below a reviewer's code-owner
  shield, 200 ms after the pointer rests or at once on focus, listing
  the changed files that reviewer owns
- It takes GitHub's hovercard edge: 1px default border, no shadow
- Its sheet hides the shield's own tooltip while it is open
- Record the trigger and edge picks in design/
- The header visit wires showReviewerFiles, reading the code owners
  lazily on the first shield hover or focus, once per visit
- Cover it in the wiring tests and an e2e on the Conversation fixture
- Describe it in ARCHITECTURE.md, CONTEXT.md, and README.md
- Drop the popover's source, so Tab off a shield whose long list
  scrolls moves on instead of dropping focus to the body
- Memoise the code owners read inside showReviewerFiles
- Find the shield with reviewerShieldOf, the files-page finder idiom
- Keep an open popup when its own shield is re-entered or focused
- Return the popup's own dispose; add a --font-mono token
- Cover the late-read guard, focus-out, and Tab past a long list
- Use the glossary's terms and fix stale header-tab docs
@linear-code

linear-code Bot commented Oct 28, 2026

Copy link
Copy Markdown

EXC-2107

@macintacos
macintacos added this pull request to stack #68 October 28, 2026 17:09
Read the PR reviewers from page_data/review_requests, the source of
GitHub's React reviewer list, in place of merge_box. It answers signed
out, lists reviews that only commented, and names the team behind a
review (onBehalfOfTeams) or an assigned request (delegatedFromTeam)
where the viewer can see it, plus whether a request is a code owner's.

ownerFilter now counts those teams, so the owner section lists a
reviewer who owns files only through a team they reviewed for, and the
owner filter narrows to the same files. The popup still matches the
shield's own token until it reads the PR reviewers too.
A reviewer GitHub flags as a code owner without naming the team, such
as a user requested by hand who owns files only through a team, matched
no file. Give each reviewer who owns nothing yet the owning teams whose
members list them, read from the JSON GitHub's team mentions use, once
per team per visit. It reads members only when GitHub shows the viewer
a team among the PR reviewers, so a viewer outside the organization
sends no extra request.
GitHub shields only a pending code owner request, so a code owner who
has reviewed loses the shield and the popup with it, and a user's
GitHub shield listed nothing when only a team made them an owner.

Find the rows of both Reviewers lists, the classic sidebar and the PR
overview's React list, and add a shield drawn as GitHub's beside each PR
reviewer who owns a changed file where GitHub draws none. The popup
opens from either shield, lists the files ownerFilter gives the reviewer
with the teams GitHub names for them, and names those teams, linked.
When GitHub marks a code owner but hides the team, it says so in one
sentence. The code owners and PR reviewers are read once per visit, when
a Reviewers list first shows.
Move when the Conversation popup opens and closes into
ui/hover-intent.ts, so the file sidebar's shield can open its popover
the same way. It follows triggers in the document and in any shadow
root handed to it, since a move between two nodes of one shadow root
never reaches the document.
The file sidebar's shield opens its popover 200 ms after the pointer
rests on it and at once on focus, through the Conversation popup's
hover intent, which now follows each tree's shadow root. A click still
opens it with focus inside and keeps it open; a click on a shield whose
popover a click opened still closes it.

Escape, and a scroll while focus is inside, now move focus to the row
before hiding the popover. Chromium hands focus back to the shield
mid-hide, and that focus would open the popover again. The hover intent
keeps a card shown in the same task, so the focus move right after it
can close it.
The Reviewers list's user link matched logins without `_`, so no
EMU reviewer got gh-prism's shield. It now takes the same LOGIN pattern
review_requests parsing accepts.
withMemberTeams gave member teams only to reviewers who owned no file
yet, so a reviewer with a direct CODEOWNERS line lost their teams'
files. It now adds every owning team that lists them and that GitHub
doesn't already name for them.

The read-once test now has one team owning several paths, so a read
per owner occurrence fails it.
An owner-filtered page waited on review_requests and every team's
members, none of which time out, even for a team token that needs only
the code owners. A team's filter now waits on the code owners alone, a
user's on both, and either read still out after 10 s counts as failed.
A scroll closed the Conversation card from inside, and the next open
closed it again through hover-intent, clearing the aria-describedby the
new card had just set on the same shield. The card's close is now
idempotent, and hover-intent leaves alone a card that has left the
document.
A detached trigger never gets a pointerout, so a Conversation card stayed
open after GitHub swapped the Reviewers sidebar under the pointer. Once
the open card's trigger has left the document, the next pointer move
outside the card closes it on the usual 150 ms delay, clearing the old
shield's aria-describedby.
The Conversation card opened at the end of the body with no source, so
Tab from a shield went on through the sidebar and closed it, leaving its
"Through @org/team" link mouse-only. It now opens with the shield as its
source, as the sidebar popover does, and a card that holds focus as it
closes hands focus back to the shield rather than the body.
Escape and a scroll moved focus to the row before hiding the popover,
but hover-intent's close and the swap to another shield's popover only
removed it, dropping focus held inside it to the body. Closing now
hands focus the popover held to the row in every case but a click.
The popover sits in light DOM and its shield in the tree's shadow root,
so the document's focusout names only the tree's host as where focus
went. hover-intent took that for leaving and closed the popover, and the
shield's focusin mounted a new one. Focus leaving a card for a shadow
host now waits for the focusin that follows to say where it landed.
The test named for the shield sitting beside GitHub's status icon
checked only its parent row, so an append or prepend still passed.
gh-prism's overview shield stayed when React later drew GitHub's own in
the same row, as on a re-requested review, so the row showed two. A row
that gains GitHub's shield now loses gh-prism's. The overview's GitHub
shield selector skips gh-prism's own, which takes the same label, so a
direct owner's shield isn't taken for GitHub's.
@macintacos
macintacos merged commit bc9277e into trunk Oct 29, 2026
5 of 6 checks passed
@macintacos
macintacos deleted the EXC-2107/show-a-code-owners-files-from-a-reviewer-hover branch October 29, 2026 00:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant