Skip to content

feat(daemon): add server-side sorting for ListRuns and ListIssues#384

Open
proboscis wants to merge 1 commit intomainfrom
issue/orch-385/run-20260201-104218
Open

feat(daemon): add server-side sorting for ListRuns and ListIssues#384
proboscis wants to merge 1 commit intomainfrom
issue/orch-385/run-20260201-104218

Conversation

@proboscis
Copy link
Owner

Summary

  • Add sort_by and sort_order parameters to ListRunsRequest and ListIssuesRequest in the protobuf API
  • Implement server-side sorting in the daemon's proto handler for both runs and issues
  • Regenerate Go and Python protobuf code

Issue Reference

Closes orch-385

Changes

Proto Changes (api/orch.proto)

  • Added SortOrder enum with SORT_ORDER_UNSPECIFIED, SORT_ORDER_ASC, SORT_ORDER_DESC
  • Added sort_by and sort_order fields to ListRunsRequest
  • Added sort_by and sort_order fields to ListIssuesRequest

Handler Changes (internal/daemon/proto_handler.go)

  • Added sortRuns() function supporting sort by: updated_at (default), started_at, issue_id, status
  • Added sortIssues() function supporting sort by: modified_at (default), id, title, status
  • Updated handleProtoListRuns() to call sortRuns() with request parameters
  • Updated handleProtoListIssues() to call sortIssues() with request parameters (replaces hardcoded ModifiedAt sort)

Verification

Build passes

$ go build ./...
# no errors

All daemon tests pass

$ go test -v ./internal/daemon/...
...
=== RUN   TestListRunsAPI
=== RUN   TestListRunsAPI/list_all_runs
=== RUN   TestListRunsAPI/filter_by_issue_id
=== RUN   TestListRunsAPI/filter_by_status
=== RUN   TestListRunsAPI/pagination
=== RUN   TestListRunsAPI/run_summary_has_URI
--- PASS: TestListRunsAPI (0.04s)
...
=== RUN   TestListIssuesAPI
=== RUN   TestListIssuesAPI/list_all_issues
=== RUN   TestListIssuesAPI/filter_by_status
=== RUN   TestListIssuesAPI/pagination
=== RUN   TestListIssuesAPI/issue_summary_has_URI
--- PASS: TestListIssuesAPI (0.04s)
...
PASS
ok      github.com/s22625/orch/internal/daemon  1.857s

Behavior

  • Default sort order is descending (SORT_ORDER_DESC) when unspecified
  • Default sort field is updated_at for runs and modified_at for issues
  • Clients can now request specific sorting from the daemon instead of sorting client-side

Add sort_by and sort_order parameters to ListRunsRequest and
ListIssuesRequest protobuf messages, enabling daemon-side sorting.

Runs can be sorted by: updated_at (default), started_at, issue_id, status
Issues can be sorted by: modified_at (default), id, title, status

Both support ascending and descending order (descending is default).

This removes the need for client-side sorting in TUI applications.
@proboscis proboscis force-pushed the issue/orch-385/run-20260201-104218 branch from 29c9e1a to 1f01510 Compare February 3, 2026 04:01
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