Skip to content

fix: keep the all-namespaces scope out of the recent namespaces - #548

Open
MichaelKlank wants to merge 1 commit into
nklmilojevic:mainfrom
MichaelKlank:fix/all-namespaces-recent
Open

MichaelKlank wants to merge 1 commit into
nklmilojevic:mainfrom
MichaelKlank:fix/all-namespaces-recent

Conversation

@MichaelKlank

@MichaelKlank MichaelKlank commented Sep 12, 2026

Copy link
Copy Markdown

What

note_recent_namespace guarded against <all> only, while its callers pass
the namespace as the user typed it. :pods all and :pods * were therefore
stored 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_ns and apply_resource_query all route through this one
function.

Test

the_all_namespaces_scope_is_not_a_recent_namespace drives it through
handle_key: pick a real namespace, then run :pods all, :pods * and
:pods <all>, and assert the active scope switched to all-namespaces while
none 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 check passes (fmt-check, clippy -D warnings, 1548 tests).

Note

No discussion linked — AGENTS.md exempts bug fixes.

@greptile-apps

greptile-apps Bot commented Sep 12, 2026

Copy link
Copy Markdown

Greptile Summary

This PR prevents all-namespace aliases from being stored as recent namespace selections.

  • Normalizes namespace input before updating recents.
  • Skips normalized all-namespace values while retaining deduplication and history bounds.
  • Adds coverage for all, *, and <all> through the user-facing command path.

Confidence Score: 5/5

The 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.

Important Files Changed

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 nklmilojevic left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. 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.
  2. Remove the new explanatory comments from both src/app/pickers.rs and src/app/tests.rs. The implementation and test are clear without them, and the implementation comment repeats the unsupported claim.
  3. 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.
@MichaelKlank
MichaelKlank force-pushed the fix/all-namespaces-recent branch from 18de50d to 47031a1 Compare September 13, 2026 12:24
@MichaelKlank

Copy link
Copy Markdown
Author

All three points done in 47031a1.

You are right about the picker, and I checked it rather than taking the correction on faith: filtered_namespaces only adds a recent when available.contains(r), so all and * never become picker rows. The claim was wrong and I should have traced that path before writing it as fact.

  1. Commit message and PR description now state only the supported effect: the values take slots in the bounded recent history (8 per context) and push real namespaces out of it. The picker claim is gone from both.
  2. Both new comments removed, in src/app/pickers.rs and src/app/tests.rs.
  3. Test kept, and its scope is now described as what it checks — the active scope and the stored recent history, not picker rows or selection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants