Skip to content

List: sortable ordering (age / updated / size / priority) #77

Description

@mayfieldiv

Problem

The v1 PRD (#1, user story 10) calls for sortable ordering by size, age, last
updated, and priority. The Rust TUI has no user-facing sort: within a
Smart-status group PRs keep their pooled input order, and Grouping::None is
a flat list in that same order (src/app/grouping.rssmart_status_rows
"preserving input order within each tier"; grouped_rows only sorts group keys
alphabetically). There is no key to reorder PRs by any column.

Approach

Add a sort dimension applied to PRs within each group (and globally under
Grouping::None), independent of the grouping/tier order:

  • Sort keys: age (created), updated (last activity), size
    (additions+deletions, ideally code-only via the File Category breakdown
    when enrichment is present), and priority (Tier order).
  • A keybinding to cycle the active sort key, and one to flip direction, with the
    active sort surfaced in the status bar / a chip (mirror the Substring
    Filter
    chip pattern in src/view.rs).
  • Sorting composes with grouping: it orders members inside each group; tier/group
    ordering itself is unchanged. PRs still loading enrichment (no tier/size yet)
    sort last within their bucket rather than jumping around as data streams in.
  • Persist the default sort key/direction in config (ui block,
    src/config.rs), matching how grouping defaults are handled.

Keep the ordering a pure function over the visible-index list so it is
table-test friendly, consistent with src/app/grouping.rs.

Open Questions

  • Which keys? g is taken by the grouping cycle; s for sort-key cycle and S
    for direction is the obvious pairing, but confirm no conflict with existing
    bindings.
  • Should size use total churn or code-only churn by default? Code-only matches
    the PRD's "real change size vs. noise" intent (stories 21-23).

Acceptance Criteria

  • A keybinding cycles the sort key (age / updated / size / priority) and a
    modifier/second key flips direction.
  • The active sort key + direction is visible in the UI.
  • Sorting reorders PRs within each group and across the flat list, leaving
    group/tier ordering intact.
  • PRs without the data a sort key needs sort deterministically (last) rather
    than reordering as enrichment arrives.
  • Default sort persists via config.
  • Pure ordering function with table-driven tests covering each key, both
    directions, missing-data, and ties.

References

  • v1 PRD PRD: Legit — GitHub PR Triage TUI #1, user story 10 (and 21-23 for code-only size).
  • src/app/grouping.rs, src/config.rs (ui), src/view.rs (filter chip),
    CONTEXT.md — Smart-status, Tier, File Category.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestready-for-agentFully specified, ready for an AFK agent

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions