diff options
| author | Craig Jennings <c@cjennings.net> | 2026-06-06 16:09:30 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-06-06 16:09:30 -0500 |
| commit | 132496a6fbe5b1190d3b5cc585e940d12e3c92db (patch) | |
| tree | 2923408a17a2d38052a384e91c8b667c9ed1e283 /tests/test-pearl-output.el | |
| parent | 9564501efe2488b9136dc19a7a8d385b8b074b46 (diff) | |
| download | pearl-132496a6fbe5b1190d3b5cc585e940d12e3c92db.tar.gz pearl-132496a6fbe5b1190d3b5cc585e940d12e3c92db.zip | |
fix(views): order group sections by Linear's board order
A grouped view rendered its sections in first-appearance order: whatever order issues came back from the API. So the columns came out scrambled instead of following Linear's board order (Icebox, then In Progress, then Done). Org's own sort couldn't fix it either, since the buffer carried nothing to sort the sections on.
Group sections now order by a per-dimension key. workflowState orders by state type rank (triage, backlog, unstarted, started, completed, canceled), with the state's position breaking ties within a type, so it matches the board. priority orders Urgent down to None last. project, assignee, and cycle have no board order, so they sort alphabetically. One shared helper feeds both the render path and the interactive regroup, so they can't drift.
For the regroup to order without a refetch, the state position has to be in the buffer, so the issue drawer now carries LINEAR-STATE-POSITION (fetched alongside the name and type pearl already pulled). A buffer rendered before this change has no position field and falls back to ordering by type rank alone until its next fetch.
Diffstat (limited to 'tests/test-pearl-output.el')
| -rw-r--r-- | tests/test-pearl-output.el | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/tests/test-pearl-output.el b/tests/test-pearl-output.el index 55f7886..1035ff2 100644 --- a/tests/test-pearl-output.el +++ b/tests/test-pearl-output.el @@ -90,7 +90,7 @@ cookie cycling reaches Low regardless of the user's global `org-priority-lowest' (ert-deftest test-pearl-build-org-content-grouped-sections-and-startup () "A grouped view folds to show3levels, emits a level-2 group heading per group -in first-appearance order, and renders issues at level 3 under them." +in Linear board order (state type rank), and renders issues at level 3 under them." (let* ((issues '((:id "1" :identifier "SE-1" :title "One" :state (:name "Started" :type "started") :priority 0) (:id "2" :identifier "SE-2" :title "Two" @@ -104,14 +104,16 @@ in first-appearance order, and renders issues at level 3 under them." (should (string-match-p "^\\*\\* Backlog$" out)) ;; Issues live at level 3 under the group headings. (should (string-match-p "^\\*\\*\\* STARTED " out)) - ;; First-appearance order: SE-1 (Started) before SE-2 (Backlog). - (should (< (string-match "^\\*\\* Started$" out) - (string-match "^\\*\\* Backlog$" out))) - ;; The group heading carries no LINEAR-ID, so save/merge skip it. - (let ((started (string-match "^\\*\\* Started$" out)) + ;; Board order: Backlog (backlog-type) sorts before Started (started-type), + ;; regardless of which appeared first in the input. + (should (< (string-match "^\\*\\* Backlog$" out) + (string-match "^\\*\\* Started$" out))) + ;; The first group heading carries no LINEAR-ID, so save/merge skip it: it + ;; sits ahead of the first issue drawer. + (let ((first-group (string-match "^\\*\\* Backlog$" out)) (next-id (string-match "LINEAR-ID:" out))) - (should started) - (should (< started next-id))))) + (should first-group) + (should (< first-group next-id))))) (ert-deftest test-pearl-build-org-content-grouped-source-roundtrips () "A grouped view's source (with :group) reads back from the rendered header." |
