Skip to content

fix(links): give every link in the app the link context menu - #266

Merged
nplez1 merged 5 commits into
nplez1/mainfrom
nplez1/Link-Context-Menu
Nov 1, 2026
Merged

nplez1 merged 5 commits into
nplez1/mainfrom
nplez1/Link-Context-Menu

Conversation

@nplez1

@nplez1 nplez1 commented Nov 1, 2026 •

Copy link
Copy Markdown
Owner

What was broken

The link context menu was mounted once at the app root and resolved its address from an a[href] or a
declared data-link-url. The mechanism worked — verified live over CDP — but coverage did not. An
earlier PR tagged ten surfaces; every other button-styled link declared nothing, so right-click
produced no menu at all. The Checks-panel PR id was the clearest case: a <button onClick> with no
address, right-clicking into nothing.

before:  <button type="button" onClick={onOpenReview}>{reviewNumberLabel}</button>
after:   <button type="button" data-link-url={review.url} onClick={onOpenReview}>…</button>

The fix

  • Resolution (AppLinkContextMenu.tsx): a non-web anchor no longer swallows the lookup, so a
    declaration on the row or button still resolves. The innermost claim wins — a declaration nested in
    an anchor beats the anchor, an anchor nested in a declaration beats the row — and a claim that is
    not a web address keeps the browser's own menu rather than borrowing the other's. Values are
    trimmed and must be absolute http(s).
  • Coverage: 60+ surfaces now declare the address they open. Checks-panel PR/MR id, folder-workspace
    PR row, Jira status row, transition controls and issue action rows, source-control branch row, issue
    panes, PR page and PR-files section header, GitHub/GitLab item dialogs, artifact open buttons, task
    page (GitHub/GitLab/Linear rows, tables, board cards), editor check panel, Linear and GitHub project
    views, new-workspace source chip, settings integration and doc links, update cards, onboarding,
    landing, first-launch banner, feature wall, feedback dialog.
  • Guard: config/ast-grep/rules/link-affordance-declares-url.yml fails the lint gate when an
    inline onClick calls one of the openers without declaring data-link-url. Its header states the
    gap it cannot close: a handler passed by reference (onClick={onOpenReview}) or a wrapper one call
    deep is invisible to it, so those still need a human.

Each link now offers the three rows the request named: Open in Orca Browser, Open in System
Browser
, Copy Link. The first appears only with an active workspace, which is the destination it
needs.

Deliberate exclusions

  • Dropdown menu rows — already a menu; a right-click would fight the open one.
  • System-browser-only links — OAuth and sign-in, App Store/APK/Android-guide installs, installer
    downloads, localhost port forwards (local-port-row, ssh-forwarded-port-row, ssh-ports-panel).
    These call openUrlInSystemBrowser on purpose and an in-app row would be wrong. Surfaces that call
    shell.openUrl instead (Linear API keys, Bitbucket credentials, the Jira credential guide) are
    not in this class: that bridge relays into the router and already honours the in-app preference,
    so the menu matching it is consistent.
  • Editable surfaces — the rich editor and composers keep the native cut/copy/paste menu.
  • ShareSkillsSettingsPane — "Manage in Skills" navigates in-app (openSkillsSharedLinks), it
    does not open a browser, so it carries no address.
  • "Open in Orca Browser" targets the active workspace's browser; the attribute carries a URL, not an
    owner.

Nits left here rather than fixed

  • The Jira transition "Open in Jira" button carries the address while pending disables it. Chromium
    does not dispatch contextmenu on a disabled form control, so the menu cannot open there; the
    attribute is inert rather than harmful.
  • The new rule cannot see a link opened through a handler passed by reference (onClick={onOpenReview},
    onClick={item.action}) or through a wrapper one call deep, so those sites were tagged by hand:
    ProjectRow, the Jira issue action rows (which now carry url through their action list), both
    artifact "open in browser" buttons, the PR-files section header, and the new-workspace source chip.
    The rule's header states that blind spot rather than implying coverage it does not have.

Verification

  • AppLinkContextMenu.test.tsx — 20 cases, including nested-claim precedence both ways, a mailto
    inside a declared row, a padded value, and non-web values.
  • New review-header.test.tsx pins the reported bug; header-icon-button.test.tsx and
    ProjectViewStates.test.tsx cover the two places an attribute is forwarded through a prop.
  • 22 further affected suites pass (71 + 75 + 30 + 23 cases) across the checks panel, issue panes,
    task page, editor, Jira workspace, PR files and project views.
  • pnpm tc:web clean, ast-grep scan --min-severity warning src clean, rule tests pass,
    check:code-quality:changed clean.
  • Live CDP check on the dev app: Settings → Privacy policy now right-clicks into
    Open in System Browser / Copy Link with no page errors.

Gates

The diff touches config/**, so gate 1 wants the full suite on this revision. Main was red when this
branch was first opened — six unit failures and a lint ratchet over its baseline — so #268 fixed those
first. On the rebased revision:

Unit gate @8e65a1e56b (clean): PASS — 142033 passed; 0 failed (0 allowlisted, 0 unexpected); 0 flaky re-run passed; 562 s
lint gate @8e65a1e56b: PASS — 44 green, 0 failing: 0 known red, 0 new; 44 steps

pnpm tc is clean, and check:code-quality:changed reports 0 new findings across 69 changed files.
The earlier gate-1 waiver is gone: it existed only because the base revision was red.

One lint red was this branch's own: the comment ratchet counts fork rationale in upstream-owned files,
and 17 lines were over its 6051 baseline — 11 from #268 and 6 from here. The one-liners that only
restated an attribute name are deleted; the DST rationale stays under two fork-comment-ok: markers,
recorded in LOCAL-PATCHES.md, because that reason has to sit next to the call site. The ratchet is
back at 6051/6051.

Reviewed by Opus 5.5, high: R1 (2 blocking fixed), delta clean on R2, comment-only delta clean on R4

Gate 2 detail: no BLOCKER was raised; the two blocking findings were SHOULD-FIX (surfaces opening a
link through a handler reference, and the rule over-claiming what it guards). Both fixed, plus the
round-1 MINORs and the two the delta re-check found partly done. A third delta round covered the
comment cleanup, which touched files inside the reviewed range: it found no code change, one doc-only
item (the LOCAL-PATCHES.md marker entry, added in a docs-only commit), and two nits recorded here:

  • If the DST fix is ever offered upstream, strip the two fork-comment-ok: markers from that patch.
  • Two of the deleted comments carried slightly more than their names: the darwin-only LC_ALL gate in
    the probe test, and what openSectionUrl means when unset.

The root link menu resolves its address from an `a[href]` or a declared
`data-link-url`, so a button-styled link that declared neither right-clicked
into nothing: the Checks-panel PR id, the folder-workspace PR row, the Jira
status row, task-page and project rows, and the settings doc links all had no
menu at all.

Fifty-one surfaces now declare the address they open, and resolution falls
through to a declaration when the anchor it sits in is an in-app route rather
than a web URL. A new ast-grep rule fails the lint gate when an inline onClick
opens a web link without declaring it, so the next link cannot miss the menu.
Round 1 (Opus, high) raised no blockers and two should-fix items.

Surfaces it caught, all of which open a web page through a handler reference
the new lint rule cannot see: the Jira issue action rows (`onClick={item.action}`),
the two artifact "open in browser" buttons (a wrapper one call deep), and the
PR files view's "Open files on GitHub" section header, whose address every
section shares. The new-workspace source chip had the same shape.

Its minor findings are fixed too: a non-web anchor the declaration wraps now
keeps the browser's own menu instead of borrowing the row's address, the rule
test exercises its self-closing branch and an href-less anchor, the rule's
header says which shapes it cannot see, the project view error address is
computed once, and the icon button and error state carry tests.
…pper

The delta re-check closed both should-fix findings and left two minor ones
partly done; both were one-hunk fixes, so they are here rather than in the PR
body. A declaration nested inside a web anchor now wins over the anchor, which
is what "the innermost claim is the most specific" has meant everywhere else.
The rule test drops a case that asserted nothing and gains the artifact wrapper
the rule's regex names.
The comment ratchet is red: 6068 added comment lines against a frozen 6051,
and 11 of those are mine from #268 while 6 are this branch's. LOCAL-PATCHES.md
forbids fork rationale above upstream code because it is conflict adjacency,
so the one-liners that only restate an attribute's name are gone, and the DST
rationale stays under a `fork-comment-ok:` marker — that reason cannot live in
the PR body, because the next reader of the call site is the one who needs it.
The delta round on the comment cleanup found the rule LOCAL-PATCHES.md states:
a marker is not added without a reason in the ledger. Both reasons are the
DST ambiguity and the printer/parser pairing, neither of which is visible in
the code the marker guards.
@nplez1
nplez1 force-pushed the nplez1/Link-Context-Menu branch from 5573a39 to 8e65a1e Compare November 1, 2026 10:53
@nplez1
nplez1 merged commit 2c6b888 into nplez1/main Nov 1, 2026
16 checks passed
@nplez1
nplez1 deleted the nplez1/Link-Context-Menu branch November 1, 2026 11:02
nplez1 added a commit that referenced this pull request Nov 1, 2026
Round 1 of the gate-2 review (Opus 5.5, high) returned BLOCKING against the
ledger entry, not the code: the deletion and the overlay rows were clean, but
the entry stated one invariant wrongly and left two recorded nowhere.

- The pick is display-only in Source Control only. In the Checks pane it is
  operational: HostedReviewActions gets the shown review and a mutation's
  refresh goes to the pick first. Scoped the bullet and stated the other half.
- Added the two invariants that lost their only guard: the shown-review switch
  effect (fires on a change rather than on mount, clears the previous review's
  rows, raises loading flags only for a pick) and the pick-first tab-entry and
  post-mutation refresh. Neither hook is rendered by any test under
  right-sidebar/**, which is why the ledger has to carry them.
- Corrected the refresh bullet's reason: refreshRequestKeyRef is per-request, so
  a switch never changes it and isCurrentRequest cannot see one — it is the
  result key that cannot tell a switch from this review's own head moving. Added
  the two test-pinned clauses (re-check the pick after the await and before
  claiming asyncResultKeyRef; compare pickedRequestKey as a local because
  isCurrentAsyncResult reads the ref).
- Added "a pick's read must not retractStalePRRefreshError", pinned at
  use-checks-panel-polling.test.tsx.
- Fixed the figures: the ratchet counts 118 of the deleted lines (the diff
  deletes 120; two are JSX comment continuation lines the line rule skips), and
  the baseline measured 6062 at #267's parent, not 6051 — #268's 11 were already
  in the tree and #266 removed them afterwards, which is the 6169 this branch
  carried.
- The two overlay rows named the cache key by position; they name
  use-workspace-review-selection.ts instead, so a prune or reorder cannot break
  the pointer.

Both ratchets still green (6051/6051, 0 stale; 664 focus reads). No code changed,
so the unit-gate verdict for e88b0f0 still stands and the review is not voided
by this commit (LOCAL-PATCHES.md only).
nplez1 added a commit that referenced this pull request Nov 1, 2026
…s reads

The lint gate was 42/44 on this branch, both reds from #267 and both entirely
inside src/renderer/src/components/right-sidebar/**:

- check-upstream-file-comments: 6180 against a 6051 baseline. #267 added 118
  comment lines across 12 files upstream owns. All 118 are removed rather than
  marked `fork-comment-ok`: each was prose above upstream's code explaining a
  fork decision, and the fork's own modules (workspace-review-selection.ts,
  use-workspace-review-selection.ts, WorkspaceReviewSwitcher.tsx) already state
  the same design without a hunk to resolve on every sync. Total is back to
  exactly 6051 with 0 stale entries, so no re-baseline was needed.

- check:focus-read-ratchet: three files at 1 read each. They are one transitive
  read, not three routing decisions: use-workspace-review-selection.ts builds
  its hosted-review cache key through getWorkspaceReferenceRuntimeVersion, which
  folds getProviderRuntimeContextKey(null) in — null is this app, not the focused
  host — and it reuses the sidebar card's key on purpose so a switch does not
  overwrite the branch's entry. The two panes then count because they call the
  hook. Recorded in config/focus-setting-read-baseline.fork.txt with the reason,
  the same shape as the 2026-10-16 use-linked-issue-pane-actions.ts row, rather
  than restructuring reviewed code to dodge a regex.

The invariants those comments guarded (display-only pick, the one
suppressedGitHubPR tombstone, row-not-slot unlink, renderable rows, the store as
the refresh switch test, no branch argument for a picked review) now live in
LOCAL-PATCHES.md § local(lint), next to #266's marker note.

Verified: check-upstream-file-comments and check:focus-read-ratchet green;
tc:web clean; the 9 test files covering the touched hooks and components pass.
nplez1 added a commit that referenced this pull request Nov 1, 2026
Round 1 of the gate-2 review (Opus 5.5, high) returned BLOCKING against the
ledger entry, not the code: the deletion and the overlay rows were clean, but
the entry stated one invariant wrongly and left two recorded nowhere.

- The pick is display-only in Source Control only. In the Checks pane it is
  operational: HostedReviewActions gets the shown review and a mutation's
  refresh goes to the pick first. Scoped the bullet and stated the other half.
- Added the two invariants that lost their only guard: the shown-review switch
  effect (fires on a change rather than on mount, clears the previous review's
  rows, raises loading flags only for a pick) and the pick-first tab-entry and
  post-mutation refresh. Neither hook is rendered by any test under
  right-sidebar/**, which is why the ledger has to carry them.
- Corrected the refresh bullet's reason: refreshRequestKeyRef is per-request, so
  a switch never changes it and isCurrentRequest cannot see one — it is the
  result key that cannot tell a switch from this review's own head moving. Added
  the two test-pinned clauses (re-check the pick after the await and before
  claiming asyncResultKeyRef; compare pickedRequestKey as a local because
  isCurrentAsyncResult reads the ref).
- Added "a pick's read must not retractStalePRRefreshError", pinned at
  use-checks-panel-polling.test.tsx.
- Fixed the figures: the ratchet counts 118 of the deleted lines (the diff
  deletes 120; two are JSX comment continuation lines the line rule skips), and
  the baseline measured 6062 at #267's parent, not 6051 — #268's 11 were already
  in the tree and #266 removed them afterwards, which is the 6169 this branch
  carried.
- The two overlay rows named the cache key by position; they name
  use-workspace-review-selection.ts instead, so a prune or reorder cannot break
  the pointer.

Both ratchets still green (6051/6051, 0 stale; 664 focus reads). No code changed,
so the unit-gate verdict for e88b0f0 still stands and the review is not voided
by this commit (LOCAL-PATCHES.md only).
nplez1 added a commit that referenced this pull request Nov 1, 2026
* fix(lint): remove #267's fork comments and record its transitive focus reads

The lint gate was 42/44 on this branch, both reds from #267 and both entirely
inside src/renderer/src/components/right-sidebar/**:

- check-upstream-file-comments: 6180 against a 6051 baseline. #267 added 118
  comment lines across 12 files upstream owns. All 118 are removed rather than
  marked `fork-comment-ok`: each was prose above upstream's code explaining a
  fork decision, and the fork's own modules (workspace-review-selection.ts,
  use-workspace-review-selection.ts, WorkspaceReviewSwitcher.tsx) already state
  the same design without a hunk to resolve on every sync. Total is back to
  exactly 6051 with 0 stale entries, so no re-baseline was needed.

- check:focus-read-ratchet: three files at 1 read each. They are one transitive
  read, not three routing decisions: use-workspace-review-selection.ts builds
  its hosted-review cache key through getWorkspaceReferenceRuntimeVersion, which
  folds getProviderRuntimeContextKey(null) in — null is this app, not the focused
  host — and it reuses the sidebar card's key on purpose so a switch does not
  overwrite the branch's entry. The two panes then count because they call the
  hook. Recorded in config/focus-setting-read-baseline.fork.txt with the reason,
  the same shape as the 2026-10-16 use-linked-issue-pane-actions.ts row, rather
  than restructuring reviewed code to dodge a regex.

The invariants those comments guarded (display-only pick, the one
suppressedGitHubPR tombstone, row-not-slot unlink, renderable rows, the store as
the refresh switch test, no branch argument for a picked review) now live in
LOCAL-PATCHES.md § local(lint), next to #266's marker note.

Verified: check-upstream-file-comments and check:focus-read-ratchet green;
tc:web clean; the 9 test files covering the touched hooks and components pass.

* local(lint): correct the #267 ledger entry the gate-2 review caught

Round 1 of the gate-2 review (Opus 5.5, high) returned BLOCKING against the
ledger entry, not the code: the deletion and the overlay rows were clean, but
the entry stated one invariant wrongly and left two recorded nowhere.

- The pick is display-only in Source Control only. In the Checks pane it is
  operational: HostedReviewActions gets the shown review and a mutation's
  refresh goes to the pick first. Scoped the bullet and stated the other half.
- Added the two invariants that lost their only guard: the shown-review switch
  effect (fires on a change rather than on mount, clears the previous review's
  rows, raises loading flags only for a pick) and the pick-first tab-entry and
  post-mutation refresh. Neither hook is rendered by any test under
  right-sidebar/**, which is why the ledger has to carry them.
- Corrected the refresh bullet's reason: refreshRequestKeyRef is per-request, so
  a switch never changes it and isCurrentRequest cannot see one — it is the
  result key that cannot tell a switch from this review's own head moving. Added
  the two test-pinned clauses (re-check the pick after the await and before
  claiming asyncResultKeyRef; compare pickedRequestKey as a local because
  isCurrentAsyncResult reads the ref).
- Added "a pick's read must not retractStalePRRefreshError", pinned at
  use-checks-panel-polling.test.tsx.
- Fixed the figures: the ratchet counts 118 of the deleted lines (the diff
  deletes 120; two are JSX comment continuation lines the line rule skips), and
  the baseline measured 6062 at #267's parent, not 6051 — #268's 11 were already
  in the tree and #266 removed them afterwards, which is the 6169 this branch
  carried.
- The two overlay rows named the cache key by position; they name
  use-workspace-review-selection.ts instead, so a prune or reorder cannot break
  the pointer.

Both ratchets still green (6051/6051, 0 stale; 664 focus reads). No code changed,
so the unit-gate verdict for e88b0f0 still stands and the review is not voided
by this commit (LOCAL-PATCHES.md only).

* local(lint): fix the two MINOR wording errors the delta re-check found

Round 2 (the R1..R2 delta re-check, Opus 5.5 high) resolved all seven round-1
findings and reported two MINOR wording errors in the bullet R2 added. Both are
one-hunk text fixes, so they are fixed here rather than listed in the PR body:

- The bullet title said the switch effect and the tab-entry refresh "are a pick's
  only re-reads". They are not: the switch effect reads nothing (it clears rows
  and sets flags), and a manual refresh and polling both read a pick. The title
  now names what the bullet actually guards, which is that neither hook is
  rendered by a test.
- The mount-guard reason was wrong. In an ordinary single-review workspace
  shownReviewKey is '' and the unguarded effect would clear rows that are already
  empty and raise no flags. The guard earns its place on a remount where the
  pick's cache entry is already warm: showsPickedReview resolves true on the
  first render, so the unguarded effect would clear rows and raise loading flags
  with no switch and no read in flight, and setChecksLoading/setCommentsLoading
  are otherwise written only by a manual refresh, so nothing would clear them.

Both ratchets still green. LOCAL-PATCHES.md only: no code changed, so the unit
gate verdict for e88b0f0 still stands for that revision, and this commit does
not void the review. No third review round: AGENTS.md requires the user's
approval for one, and these are the reviewer's own suggested fixes.
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