Repository navigation
Fixes #36393: List tasks newest first by creation time - #36395
Conversation
The task list endpoints (/v1/tasks, /assigned, /visible, /owned, /created) paged by the generic (name, id) keyset, so the Inbox Triage queue and the notification bell showed the oldest tasks first. Task names are TASK-%05d strings compared as text, and the 2.0 migration numbered suggestions before thread tasks, so name order is not creation order even when reversed. The endpoints now page by a (createdAt, id) keyset, newest first, with an optional sortOrder=asc|desc. The order is opt-in on the ListFilter, so the search reindex keeps the name keyset its offset-seeded cursors rely on. A name cursor issued before this change returns 400 instead of a 500.
✅ PR checks passedThe linked issue has a description and all required Shipping project fields set. Thanks! |
testScopedListsReturnNewestFirst created unassigned tasks on an unowned table, so /assigned and /owned could pass on empty pages. File tasks assigned to user1 and by user1 on a user1-owned table in a fresh domain, list each endpoint as user1 scoped to that domain, and require every expected task on the page before checking the order.
- TaskListOrder takes the asc/desc param and derives the SQL direction; a previous page reuses the opposite order's operator and direction. - @TaskListOrder.BindPage supplies operator, directions and cursor to the createdAt keyset queries, so each takes four parameters. - asc/desc are defined once and reused by the endpoint annotations. - TaskDAO only adds the createdAt branch; main's listAfter/listBefore branches and name-ordered search SQL are left untouched. - Integration tests split into helpers, cursor built from a typed record.
Code Review ✅ Approved🔴 High risk · Changing all five task endpoints to creation-time ordering rejects pre-upgrade name cursors with 400, interrupting clients paging across deployment. Task list endpoints now page newest first by creation time using a VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
|
|
🤖 Backport to |
|
🤖 Backport to |
|
🤖 Backport to |
|
🤖 Backport to |
* fix(tasks): list tasks newest first by creation time The task list endpoints (/v1/tasks, /assigned, /visible, /owned, /created) paged by the generic (name, id) keyset, so the Inbox Triage queue and the notification bell showed the oldest tasks first. Task names are TASK-%05d strings compared as text, and the 2.0 migration numbered suggestions before thread tasks, so name order is not creation order even when reversed. The endpoints now page by a (createdAt, id) keyset, newest first, with an optional sortOrder=asc|desc. The order is opt-in on the ListFilter, so the search reindex keeps the name keyset its offset-seeded cursors rely on. A name cursor issued before this change returns 400 instead of a 500. * test(tasks): scoped list ordering checks this test's own tasks testScopedListsReturnNewestFirst created unassigned tasks on an unowned table, so /assigned and /owned could pass on empty pages. File tasks assigned to user1 and by user1 on a user1-owned table in a fresh domain, list each endpoint as user1 scoped to that domain, and require every expected task on the page before checking the order. * refactor(tasks): tighten task list ordering code - TaskListOrder takes the asc/desc param and derives the SQL direction; a previous page reuses the opposite order's operator and direction. - @TaskListOrder.BindPage supplies operator, directions and cursor to the createdAt keyset queries, so each takes four parameters. - asc/desc are defined once and reused by the endpoint annotations. - TaskDAO only adds the createdAt branch; main's listAfter/listBefore branches and name-ordered search SQL are left untouched. - Integration tests split into helpers, cursor built from a typed record. (cherry picked from commit af85654) Co-authored-by: Ram Narayan Balaji <[email protected]>
The task list endpoints now page by (createdAt, id), newest first (#36395). The user Tasks tab merges its assigned and created lists with a comparator that still assumed (name, id) ascending, so it showed the oldest tasks first and held back most of each page.
… and merge a user's tasks in that order (open-metadata#36439) * fix(ui): merge a user's tasks newest first, matching the task list order The task list endpoints now page by (createdAt, id), newest first (open-metadata#36395). The user Tasks tab merges its assigned and created lists with a comparator that still assumed (name, id) ascending, so it showed the oldest tasks first and held back most of each page. * feat(ui): sort the task list newest or oldest first Adds a Sort by menu (Newest first / Oldest first) beside the Inbox task filters. The choice is sent as the list endpoints' sortOrder, so the order holds across cursor pages, and the profile Tasks tab merges its assigned and created sources in the same order. * docs(decisions): record that the Inbox task list sorts only by creation time
…user's tasks in that order (#36439) (#36512) * fix(ui): merge a user's tasks newest first, matching the task list order The task list endpoints now page by (createdAt, id), newest first (#36395). The user Tasks tab merges its assigned and created lists with a comparator that still assumed (name, id) ascending, so it showed the oldest tasks first and held back most of each page. * feat(ui): sort the task list newest or oldest first Adds a Sort by menu (Newest first / Oldest first) beside the Inbox task filters. The choice is sent as the list endpoints' sortOrder, so the order holds across cursor pages, and the profile Tasks tab merges its assigned and created sources in the same order. * docs(decisions): record that the Inbox task list sorts only by creation time (cherry picked from commit bb41b64)



Describe your changes:
Fixes #36393
The Inbox Triage queue and the notification bell listed tasks oldest first. Every task list endpoint (
/v1/tasks,/assigned,/visible,/owned,/created) paged by the generic(name, id)keyset in ascending order. Sorting by name descending would not fix it:TASK-%05dstrings compared as text, soTASK-100000sorts beforeTASK-99999.The UI can't re-sort either, because it loads one cursor page at a time.
What changed:
(createdAt, id)keyset, newest first. They take an optionalsortOrder=asc|desc(defaultdesc), mirroring/dataAccessRequests.TaskListOrder. The order is set on theListFilterbyTaskListOrder.applyTo. Listings that don't set it keep the(name, id)keyset and name cursor. That includes the search reindex, whose offset-seeded cursors (getCursorAtOffset) depend on name order.TaskDAO. Two keyset queries are added: one for the plain path, and one for the free-text search (q) path that keeps that path's filter-first plan (IGNORE INDEXon MySQL,MATERIALIZEDCTE on Postgres). The bound is writtencreatedAt <op>= c AND (createdAt <op> c OR id <op> i)so it stays a range on the existingcreatedAtindex. A small Jdbi binder,@TaskListOrder.BindPage, supplies the operator, both sort directions and the cursor, so each query takes 4 parameters (the same pattern as@BindFQN). The change is purely additive: main'slistAfter/listBeforebranches and its name-ordered search SQL (listSearchAfter/listSearchBefore) are left as they are. Every list endpoint that setsqnow pages by creation time, so nothing in OSS or Collate (origin/main, checked) reaches that name-ordered search SQL any more. That makes it a candidate for a separate cleanup, not this PR.TaskRepository.getCursorValue(Task, ListFilter). EmitscreatedAtin the cursor's name slot only for creation-time listings.sortOrderalso returns 400.ADR:2026-10-28-task-lists-page-newest-first-by-creation-time.No UI change is needed. Triage, the notification bell,
useMyTasksand the entity-page task tabs pick up newest-first through the default.Type of change:
High-level design:
N/A — small change. The approach and the alternatives rejected are in
docs/decisions/2026-10-28-task-lists-page-newest-first-by-creation-time.md:Compatibility:
after/beforecursor gets 400 and must restart from the first page.task_mixin, Java SDK) don't depend on order.Tests:
Use cases covered
limit=1returns the same pages in the same order.sortOrder=ascreturns the exact reverse.q), which uses the search SQL path./created,/assigned,/visibleand/ownedeach return non-increasingcreatedAt.{"name":"TASK-00001",…}) andsortOrder=sidewaysreturn 400, not 500.Unit tests
TaskListOrderTest(new, 7 tests) covers parameter parsing, the opt-in check, first-page open bounds for both orders, the backward-page operator and direction, and rejection of name cursors.FeedDAOshas no unit test. Its change is SQL that needs a real database, and the ITs below exercise it on both engines.TaskListOrder46/46,FeedDAOs9/9,TaskResource5/5,TaskRepository2/3. The one uncovered line isgetCursorValue's name-cursor fallback, which only non-REST listings such as the search reindex reach.Backend integration tests
TaskResourceIT, new:testListPagesNewestFirstBothWays,testListSearchPagesNewestFirstBothWays,testScopedListsReturnNewestFirst,testListRejectsNameCursorAndUnknownSortOrder.Ran locally, lane
parallel:postgres-opensearchmysql-elasticsearchopenmetadata-service)make java_affectedRe-run on head 9b1d7d1 (main merged afterwards, no overlap with these files). All five ordering ITs pass on both engines (checked in the failsafe XML reports): the four new ones plus the existing
testListEndpointSearchPagesBothWays.Not run locally.
make java_affectedlists 71 IT classes. The remaining non-task classes (ontology, domain, glossary, table, user, …) were not run. I grepped every IT and Playwright helper that lists tasks for a first-element pick (get(0),getFirst(),findFirst(),data[0],limit=1). Every hit either filters by id/FQN first, asserts exactly one result, or reads the single open approval for an entity, so none depends on order. The incident ITs that listcategory=Incident&limit=100and filter for their own task get more robust: their new task is now on the first page.Playwright (UI) tests
Features/AIMode/InboxTasks,Features/AIMode/InboxTaskMatrix,Features/LandingPageWidgets/LandingPageMyTasks,Features/Tasks/TaskNavigation: 42 passed, in one run with no retries.Features/Glossary/GlossaryApprovalAfterMove,Features/Glossary/GlossaryAiGeneratedTerm,Features/Tasks,Pages/Tasks,Features/Tasks/TaskAllEntities,Features/EntitySuggestions,Features/DescriptionSuggestion: 76 passed.Manual testing performed
migrate --force) and the UI on Vite.aftercursor: next page.beforefrom page 2: back to page 1.sortOrder=asc: reversed.q=Smoke: newest first./created: newest first.Task list cursor 'TASK-00001' is not a creation-time cursor; list again from the first page.sortOrder=sideways: 400.TASK-00011, Consolidate swagger UI and make it accessible in secure mode #6) is at the top, followed in order down to the oldest (Create teams page similar to tags #1), as in the screenshot below.Not verified: the Postgres query plan at scale (100k+ tasks). The keyset bound is written to be sargable on the existing
createdAtindex, but I didn't run EXPLAIN against a large dataset.UI screen recording:
Not applicable: a backend-only bug fix with no UI code change. Screenshot of the Triage queue on this branch, newest first:
Checklist:
I have read the CONTRIBUTING document.
My PR title is
Fixes <issue-number>: <short explanation>My PR is linked to a GitHub issue via
Fixes #<issue-number>above.I have commented on my code, particularly in hard-to-understand areas.
For JSON Schema changes: I updated the migration scripts or explained why it is not needed. (No schema change.)
For a UI feature or feature task: as part of PR creation, I ran the PR build in Docker with sample data and embedded a verified GitHub-hosted recording plus build/health evidence above (or explained why this requirement is not applicable). (Not applicable, see above.)
I have added tests (unit / integration / Playwright as applicable) and listed them above.
Self-review: I reviewed the final diff against
REVIEW.md(thepr-checklistskill runs it) and fixed every 🔴 finding, or answered it on the line below.Decision check: adds
docs/decisions/2026-10-28-task-lists-page-newest-first-by-creation-time.md.I have added a test that covers the exact scenario we are fixing.
🤖 Generated with Claude Code


Confidence Score: 5/5
The PR appears safe to merge; no actionable issues remain.Summary
Task lists now page by
createdAtandid, newest first by default.No new actionable issues were found. The earlier scoped-test finding is fixed. As documented by
yan-3005, clients holding pre-upgrade cursors must restart from the first page. Tests were not run during this review.Reviews (3) · Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." · Reviewed by Greptile