Skip to content

[COMMS-930] "Autocompleter" should not be an option for sorting work package tables - #24459

Merged
judithroth merged 1 commit into
devfrom
bug/comms-930-autocompleter-should-not-be-an-option-for-sorting-work-package-tables
Jul 29, 2026
Merged

[COMMS-930] "Autocompleter" should not be an option for sorting work package tables#24459
judithroth merged 1 commit into
devfrom
bug/comms-930-autocompleter-should-not-be-an-option-for-sorting-work-package-tables

Conversation

@judithroth

Copy link
Copy Markdown
Contributor

This is a bug I found during work on "[COMMS-720] Rank exact identifier matches above fuzzy ones in work package searching and autocompleters" where I probably will add a new sort order which is also displayable: false and should not be rendered in the dropdown for sorting work package tables as well.

Ticket

https://community.openproject.org/wp/COMMS-930

What are you trying to accomplish?

Remove the "Autocompleter" option from work packages table automated sort dropdowns, because it is just a "updated_at desc" under the hood and all other options in that dropdown refer to columns or attributes.

Screenshots

BEFORE
Screenshot from 2026-07-27 10-42-30

AFTER
Screenshot from 2026-07-27 14-02-17
(different query)

What approach did you choose and why?

Remove all that are displayable: false from the dropdown list (displayable must therefore be exposed via the API). I decided against removing items with displayable: false from the API entirely, since there might be places in the future where we want to include them and also the ::Queries::WorkPackages::Selects::ManualSortingSelect was necessary for that dialog as well even though it is displayable: false (it is not used in the dropdown though but for the radio buttons)

Merge checklist

  • Added/updated tests
  • Added/updated documentation in Lookbook (patterns, previews, etc)
  • Tested major browsers (Chrome, Firefox, Edge, ...)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes internal/non-user-facing sort options (notably the “Autocomplete”/typeahead sort) from the Work Package table “Sort by” dropdown by exposing a displayable flag through the API and filtering the UI accordingly, while also migrating persisted queries away from the deprecated typeahead sort criterion.

Changes:

  • Expose displayable on the API v3 QuerySortBy representer (backed by column.displayable?).
  • Filter automatic sort dropdown options in the WP table configuration modal to only show displayable columns.
  • Add a migration (and specs) to replace persisted typeahead sort criteria with updated_at desc.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
db/migrate/20260727111530_migrate_typeahead_sort_criteria_to_updated_at.rb Migrates persisted typeahead sort criteria to updated_at desc while preserving other criteria.
lib/api/v3/queries/sort_bys/sort_by_decorator.rb Delegates displayable? from sort-by decorator to the underlying column.
lib/api/v3/queries/sort_bys/query_sort_by_representer.rb Adds displayable attribute to the QuerySortBy API payload.
frontend/src/app/features/hal/resources/query-sort-by-resource.ts Extends the HAL resource to include the displayable boolean property.
frontend/src/app/features/work-packages/components/wp-table/configuration-modal/tabs/sort-by-tab.component.ts Uses displayable to filter non-displayable sort columns from the modal’s dropdown options.
spec/lib/api/v3/queries/sort_bys/query_sort_by_representer_spec.rb Adds coverage for the new displayable attribute (true by default, false for typeahead).
spec/features/work_packages/table/configuration_modal/sort_by_spec.rb Feature spec ensuring “Autocomplete” is not offered as a sort option in the modal.
spec/migrations/migrate_typeahead_sort_criteria_to_updated_at_spec.rb Migration spec validating typeaheadupdated_at desc behavior and de-duplication.

…package tables

https://community.openproject.org/wp/COMMS-930

This is a bug I found during work on "[COMMS-720] Rank exact identifier
matches above fuzzy ones in work package searching and autocompleters"
where I probably will add a new sort order which is also `displayable:
false` and should not be rendered in the dropdown for sorting work package
tables as well.
@judithroth
judithroth force-pushed the bug/comms-930-autocompleter-should-not-be-an-option-for-sorting-work-package-tables branch from b8a3509 to 4df2c3b Compare July 27, 2026 13:49
@judithroth judithroth self-assigned this Jul 27, 2026
@github-actions

Copy link
Copy Markdown

Warning

Flaky specs

  • rspec ./spec/features/projects/creation_wizard/wizard_from_template_flow_spec.rb[1:1]
🤖 Ask Copilot to investigate

Copy the prompt below into a new comment on this PR to delegate the investigation to GitHub Copilot. It will look into the flakiness and open a separate pull request with you as reviewer.

@copilot The following spec(s) are flaky in CI (first seen on PR #24459, linked for reference only):

- `rspec ./spec/features/projects/creation_wizard/wizard_from_template_flow_spec.rb[1:1]`

Treat this as a standalone task, unrelated to PR #24459. Create a new branch from origin/dev and open a new pull request targeting dev — do not stack it on PR #24459 or reuse that branch.

Follow the playbook in docs/development/testing/handling-flaky-tests/README.md to find the root cause and fix the underlying race — do not skip, delete, or weaken the spec to make it pass; disabling is a last resort per the playbook, and only with a bug ticket. Verify the fix by running the spec(s) repeatedly (e.g. `script/bulk_run_rspec --run-count 10`).

If you cannot reproduce the flake or are not confident in a fix after reasonable investigation, do not fabricate a change or skip the spec to force CI green. Instead, leave the pull request in draft and document what you tried, the suspected cause, and any leads in its description, then assign @judithroth to take over.

Once the fix is verified, title the PR after the spec(s) it fixes, and use the PR description to explain the root cause, how the change resolves it, and the before/after results. Label the PR `flaky-spec`, assign @judithroth, and request a review from @judithroth.
On every commit, set @judithroth as the sole co-author with a `Co-authored-by:` trailer (use their GitHub no-reply email so it links to their account), so it is traceable who dispatched the fix.

@judithroth
judithroth marked this pull request as ready for review July 27, 2026 15:30
@judithroth
judithroth requested a review from a team July 27, 2026 15:30
@github-actions

Copy link
Copy Markdown

Caution

The provided work package version does not match the core version

Details:

Please make sure that:

  • The work package version OR your pull request target branch is correct

@brunopagno brunopagno left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All looking good 👍

@judithroth
judithroth merged commit c4c8c2d into dev Jul 29, 2026
19 checks passed
@judithroth
judithroth deleted the bug/comms-930-autocompleter-should-not-be-an-option-for-sorting-work-package-tables branch July 29, 2026 08:30
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 29, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants