fix: keep the all-namespaces scope out of the recent namespaces - #548
MichaelKlank wants to merge 1 commit into
Conversation
Greptile SummaryThis PR prevents all-namespace aliases from being stored as recent namespace selections.
Confidence Score: 5/5The PR appears safe to merge, with the normalization fix covered through the user-facing command path. No actionable new issues or outstanding previous findings were identified.
|
| Filename | Overview |
|---|---|
| src/app/pickers.rs | Normalizes namespace aliases before recording recent namespace selections. |
| src/app/tests.rs | Verifies all accepted all-namespace spellings are excluded from recents. |
Reviews (2): Last reviewed commit: "fix: keep the all-namespaces scope out o..." | Re-trigger Greptile
nklmilojevic
left a comment
There was a problem hiding this comment.
The fix addresses a small defect in the recent namespace history, but the description and new code comment claim a user-visible failure that the code and test do not support.
filtered_namespaces includes a recent entry only when available.contains(r) is true. Recording all or * therefore does not, by itself, add the claimed broken rows to the namespace picker. The supported effect is that these values occupy slots in the bounded recent history and can remove real namespaces from that history.
Please make these changes:
- Correct the PR description and commit message to state the supported effect. Remove the claim that the picker offers entries that select nothing. If you believe that failure exists, provide exact reproduction steps and a test that checks the picker rows and selection result.
- Remove the new explanatory comments from both
src/app/pickers.rsandsrc/app/tests.rs. The implementation and test are clear without them, and the implementation comment repeats the unsupported claim. - Keep the regression test, but describe its scope correctly. It checks the active scope and stored recent history. It does not demonstrate a picker failure.
Please verify reported user-visible failures against the actual code path before stating them as facts. The history fix is reasonable, but its description must match the evidence.
`:<kind> all` and its `*`/`<all>` spellings reach `note_recent_namespace` as the literal the user typed, while the namespace itself is normalised to the empty string. The guard only rejected `<all>`, so `all` and `*` were stored as recent namespaces, taking slots in the bounded history and pushing real namespaces out of it. Normalising inside the guard covers every caller rather than the one path a report would name.
18de50d to
47031a1
Compare
|
All three points done in 47031a1. You are right about the picker, and I checked it rather than taking the correction on faith:
|
What
note_recent_namespaceguarded against<all>only, while its callers passthe namespace as the user typed it.
:pods alland:pods *were thereforestored as recent namespaces: they take slots in the bounded per-context history
(
MAX_RECENT_NAMESPACES, 8) and push real namespaces out of it.Normalising inside the guard covers every caller —
set_namespace,switch_kind_nsandapply_resource_queryall route through this onefunction.
Test
the_all_namespaces_scope_is_not_a_recent_namespacedrives it throughhandle_key: pick a real namespace, then run:pods all,:pods *and:pods <all>, and assert the active scope switched to all-namespaces whilenone of the three spellings was recorded as a recent namespace and the real one
still is. Scope of the test: the active scope and the stored recent history. It
fails on main and passes with the fix.
just checkpasses (fmt-check, clippy-D warnings, 1548 tests).Note
No discussion linked —
AGENTS.mdexempts bug fixes.