Skip to content

feat: sort scan tasks and runs by completion time - #337

Merged
klboke merged 9 commits into
mainfrom
feat/scan-completion-sorting
Sep 23, 2026
Merged

klboke merged 9 commits into
mainfrom
feat/scan-completion-sorting

Conversation

@klboke

@klboke klboke commented Sep 23, 2026 •

Copy link
Copy Markdown
Owner

Scan task and run lists currently use ascending IDs, so an older task that finishes later is buried and recent failures are harder to find. Add completion-time sorting to the Tasks and Overview (scan runs) views, defaulting to newest first, and show the task's finished timestamp. Click the Finished or Completed column header to toggle direction; arrow icons match the repository list, without a separate sort dropdown.

The API accepts sort=finished_at for tasks or sort=completed_at for runs with direction=asc|desc. Ordering uses completion time plus ID, with unfinished tasks last in either direction. Stateless timestamp/ID cursors work across pages and replicas without looking up the boundary record. Cursor parsing rejects timestamps outside the JDBC/database range with HTTP 400; date-binding overflow caused by a different JDBC connection timezone also maps to 400 without masking other database errors. Requests without sort retain ID-based pagination for compatibility.

Migration V55 adds timestamp/ID indexes for tasks and runs, including repository-scoped and status-filtered tasks. Task pages fetch completed and unfinished ranges separately in one read-only repeatable-read transaction. The default query avoids null-rank sorting and keeps repository visibility checks from becoming a full-history semijoin sort. MySQL creates indexes online; PostgreSQL creates them concurrently, with retry coverage for both backends.

Includes English/Chinese API documentation and coverage for out-of-order completions, ties, unfinished tasks, repository scopes, retries, invalid cursors, stale UI responses, and pagination resets. Pages remain live views across separate requests.

Validation:

  • Management, cursor, controller HTTP 400, and admin UI JavaScript tests.
  • Completion pagination contract on MySQL 8 and PostgreSQL 12; actual DAO query plans checked with 8,000 additional tasks and runs per backend, in both directions and repository scopes, including a sparse FAILED status filter.
  • Real MySQL regression with a UTC JVM and Asia/Shanghai JDBC connection; HTTP 400 mapping and unrelated-error preservation tests.
  • Upgrade, migration retry, and Flyway version parity checks.
  • Browser check of repository templates/styles/rendering with a local fixture: completion columns, default order, and switching to oldest first.
  • git diff --check.

Related to #329.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-23T12:58:19.098769Z d573ee3 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a4a5c07110

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@codecov

codecov Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.30%. Comparing base (7be463b) to head (d573ee3).

Additional details and impacted files
@@             Coverage Diff              @@
##               main     #337      +/-   ##
============================================
+ Coverage     86.27%   86.30%   +0.03%     
  Complexity     1448     1448              
============================================
  Files           800      802       +2     
  Lines         83699    83822     +123     
  Branches      14706    14742      +36     
============================================
+ Hits          72211    72344     +133     
+ Misses        11488    11478      -10     
Flag Coverage Δ
server-smoke-mysql 13.37% <3.52%> (-0.02%) ⬇️
server-smoke-postgresql 13.36% <3.52%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7234db3e6a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@klboke

klboke commented Sep 23, 2026

Copy link
Copy Markdown
Owner Author

@codex review

Please re-review the latest head after the connection-timezone and status-filter indexing fixes, including the expanded regression coverage. If no actionable findings remain, please state that explicitly.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: d62533e04f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@klboke
klboke merged commit ed2dac1 into main Sep 23, 2026
38 checks passed
@klboke
klboke deleted the feat/scan-completion-sorting branch September 23, 2026 13:10
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