Commit e67eae4
chore(saved-projects): drop redundant rank field; use JSON array order
The `rank: u32` field on each saved project was a sort key that just
reproduced the order of the JSON array — and the file is hand-edited
(no in-app writer yet), so reordering meant renumbering all the ranks.
Removing the field makes reordering a cut-and-paste of the `{ ... }`
block, and eliminates a class of accidental-tie / off-by-one mistakes
that's easy to introduce when inserting an entry into a numbered list.
Behavior change is one line: `load_projects_from` no longer calls
`sort_by_key(|p| p.rank)`. The picker UI (`projects_picker_menu_items`
in `workspace/view.rs`) already iterated the loaded vec in order with
no re-sorting, so removing the sort makes the vec's deserialization
order — i.e. JSON array order — the displayed order.
Backward compat is free: `serde_json` silently ignores unknown fields
by default, so existing `~/.warp-oss/projects.json` files with `rank`
keys continue to parse cleanly — the keys are just dropped on read.
No migration needed.
Renamed the `sorts_by_rank_ascending` test to `preserves_file_order`
with a flipped expectation that documents the new invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent b6bb8b6 commit e67eae4
2 files changed
Lines changed: 10 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
25 | 24 | | |
26 | 25 | | |
27 | 26 | | |
| |||
31 | 30 | | |
32 | 31 | | |
33 | 32 | | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
38 | 37 | | |
39 | 38 | | |
40 | 39 | | |
| |||
67 | 66 | | |
68 | 67 | | |
69 | 68 | | |
70 | | - | |
71 | 69 | | |
72 | 70 | | |
73 | 71 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
41 | | - | |
42 | | - | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
| 48 | + | |
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
59 | 58 | | |
60 | 59 | | |
61 | 60 | | |
| |||
68 | 67 | | |
69 | 68 | | |
70 | 69 | | |
71 | | - | |
72 | 70 | | |
73 | 71 | | |
74 | 72 | | |
| |||
124 | 122 | | |
125 | 123 | | |
126 | 124 | | |
127 | | - | |
| 125 | + | |
128 | 126 | | |
129 | 127 | | |
130 | 128 | | |
| |||
0 commit comments