Commit e65dfe8
Fix flaky query history reveal test via stable TreeItem ids
The query history tree data provider never set an id on its TreeItems, so
VS Code identified tree nodes by their label plus their position in the
list. When multiple history items share the same label, that positional
identity is ambiguous, so treeView.reveal could resolve to the wrong item
or fail outright ("Data tree node not found") when the list was re-sorted
or refreshed.
This mainly affects tests. The default label format includes the query
start time, so real query history labels are effectively unique and users
are unlikely to hit this (the only exception being a user who customises
the label format to something non-unique). In query-history-manager.test.ts
the label format is overridden to just the query name, producing identical
labels; this made the "should not change the selection" cases flaky,
reproducing locally around 50% of the time and disappearing entirely after
this change. Because the impact is effectively test-only, no changelog
entry is added.
Set a stable, unique id on each tree item so reveal resolves
deterministically regardless of duplicate labels or sort order. The id must
be unique per item: getQueryId is not sufficient on its own because a
multi-query run produces several local-query items that share the same
initialInfo.id, so for local queries we also include the per-result output
base name (VS Code de-duplicates nodes that share an id, which would
otherwise break reveal/selection for the colliding items).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: f0809f2f-2c92-4acf-8f51-468c5e79c14a1 parent cb12678 commit e65dfe8
1 file changed
Lines changed: 36 additions & 1 deletion
Lines changed: 36 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
20 | 39 | | |
21 | 40 | | |
22 | 41 | | |
| |||
54 | 73 | | |
55 | 74 | | |
56 | 75 | | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
57 | 92 | | |
58 | 93 | | |
59 | 94 | | |
| |||
0 commit comments