Skip to content

CPLAT-11162: refs picker state filter (hide merged/closed by default) - #149

Merged
gavin-jeong merged 3 commits into
masterfrom
CPLAT-11162-refs-state-filter
Jul 31, 2026
Merged

CPLAT-11162: refs picker state filter (hide merged/closed by default)#149
gavin-jeong merged 3 commits into
masterfrom
CPLAT-11162-refs-state-filter

Conversation

@gavin-jeong

Copy link
Copy Markdown
Collaborator

JIRA: https://sendbird.atlassian.net/browse/CPLAT-11162

Problem

The ccx refs interactive picker listed every PR/Jira ref regardless of state, so merged/closed PRs and done Jira issues cluttered the view — the active work you care about was buried under completed items.

Fix

Add state-based filtering scoped to the refs picker only (the urls picker handles non-PR/Jira links too, where PR state is not the primary axis):

  • Default open-only filter: open/draft PRs and not-done Jira issues show; merged/closed/done refs are hidden. Unresolved refs stay visible until their status lands.
  • is:merged / is:closed / is:open narrow to that state.
  • is:all lifts the default hide without narrowing.
  • M toggle flips showAllRefs to reveal every ref.
  • pickerRefStatusMsg re-filters on resolve so a ref drops out as soon as its status lands as merged/closed.
  • Search hint footer advertises open merged closed scopes; action hint shows M:show all.

Tests

  • TestRefsFilterDefaultsToOpen — merged/closed drop out after resolve; unresolved stay
  • TestRefsFilterShowsAllWithToggle — M toggle reveals all
  • TestRefsFilterIsMergedNarrows / TestRefsFilterIsClosedNarrows — state narrowing
  • TestRefsFilterIsAllShowsEverythingis:all lifts filter
  • TestRefsFilterDoesNotApplyToUrls — urls picker unaffected

Test plan

  • go build ./...
  • go test ./internal/cli/ ./internal/tmux/ ./internal/session/

keyolk added 2 commits July 31, 2026 07:02
…lient's active window

CurrentWindowClaudes asked tmux for the client's active window
("#{session_name}|#{window_index}") and scanned only that window's panes
for Claude processes. A Claude session running in a background window of the
same client (common during a multi-window build) then matched sessions from
the foreground window instead of its own, so `ccx refs` surfaced unrelated
PRs or reported "no PR/Jira references found".

Walk this process's own PPID chain to the tmux pane that hosts it (reusing
the walkToPane/batchPPIDMap helpers MarkLiveSessions already uses) and pin
the window from that pane. The client-active window remains as a fallback
when the pane can't be determined (e.g. a wrapper re-parented the process
beyond tmux's view).

Extracted claudesInWindow/findPaneByPID so the window-selection logic is
testable without a live tmux.
The refs interactive picker listed every PR/Jira ref regardless of state, so
merged/closed PRs and done Jira issues cluttered the view. Add state-based
filtering scoped to the refs picker:

* Default open-only filter: open/draft PRs and not-done Jira issues show;
  merged/closed/done refs are hidden. Unresolved refs stay visible until
  their status lands.
* `is:merged` / `is:closed` / `is:open` narrow to that state; `is:all`
  lifts the default hide without narrowing.
* `M` toggle flips showAllRefs to reveal every ref.
* pickerRefStatusMsg re-filters on resolve so a ref drops out as soon as its
  status lands as merged/closed.
* Search hint footer advertises open/merged/closed scopes; action hint shows
  M:show all.

Tests cover the default filter, the M toggle, is:merged/is:closed/is:all
narrowing, and that the urls picker is unaffected.
@Kairo-Kim Kairo-Kim added the auto-review/approved Auto-approved by the Slack auto-reviewer bot label Jul 30, 2026

@jinsekim jinsekim left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

The refs picker's refStatusPlain calls session.RefStatusVariants to pick the
widest status form that fits the list pane. This function and its tests were
missing from the previous commit, so CI failed with 'undefined:
session.RefStatusVariants'.
@gavin-jeong
gavin-jeong merged commit e87600e into master Jul 31, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-review/approved Auto-approved by the Slack auto-reviewer bot

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants