Skip to content

[Jobs] Default managed-jobs dashboard sort to Job ID#9978

Draft
claude[bot] wants to merge 1 commit into
masterfrom
dashboard-default-sort-job-id
Draft

[Jobs] Default managed-jobs dashboard sort to Job ID#9978
claude[bot] wants to merge 1 commit into
masterfrom
dashboard-default-sort-job-id

Conversation

@claude

@claude claude Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Summary

ManagedJobsTable's default sort is already Job ID descending — #9522 set the table's initial sortConfig to {key: 'id', direction: 'descending'} precisely because sorting by submitted_at is unstable: jobs submitted in the same second (or with a NULL submitted_at) get a non-deterministic secondary order across DB engines, so paging shows IDs out of order.

That left one loose end. The code that converts sortConfig into the API sort_by parameter still fell back to 'submitted_at':

const sortBy = sortConfig.key || 'submitted_at';

Since the initial sortConfig.key is 'id' and the table never clears it, this fallback is effectively unreachable today — so this PR is a consistency cleanup, not a change to the default view. It removes a latent footgun: any future code path that leaves sortConfig.key empty would silently revert the list to the unstable submitted_at ordering.

Change: in sky/dashboard/src/components/jobs.jsx, the sortBy fallback 'submitted_at''id', so it matches the table's actual default. (The default direction already resolves to descending, so newest still shows first.)

Not in scope

This does not change the value shown in the "Submitted" column. Jobs with no submitted_at (e.g. no-op jobs that never start) still render -; populating that value is a separate change (#9980).

Test plan

  • prettier --check passes on the changed file
  • Manual: in a running dashboard with several managed jobs including some with NULL submitted_at, the default list orders by Job ID descending and the NULL jobs sit in their correct ID position (not displaced). Confirmed the fallback line is not exercised by the normal UI flow — the table sends sort_by=id by default with or without this change.

The managed-jobs dashboard list defaulted its API sort to submitted_at,
which can be NULL for some jobs and produces an inconsistent default
order. Job ID is always populated, so use it as the default sort key.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MMCFx7eBmLpkAnZcL9sLU1
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