Shopify / Shopify/liquid

Clarify if sort is stable in documentation

Open
#897 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Documentation
Dominant language
Ruby
Stars
11.9k
Forks
1.5k
Avg merge
17h 55m
Merged PRs (30d)
3

Description

The documentation for the sort array filter says

Sorts the elements of an array by a given attribute of an element in the array.

Is this sorting operation stable, i.e. does it maintain the original order of elements with the same attribute value? Such a guarantee is extremely useful, however it is not mentioned anywhere.

I have done some experimentation, and so far this seems to be the case. Is this an implementation detail or can this be assumed in general? Either way, it should be clarified in the documentation.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the documentation for the sort array filter and inspect the filter's implementation or existing behavior to determine whether equal attribute values preserve their original order. The work is done when the documentation clearly states whether sorting is stable, including whether that behavior is guaranteed generally or only an implementation detail.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
Half a day
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.