Add kubectl namespace flag generator tests (APP-3476)#255
Merged
Conversation
Add tests verifying that kubectl_script() correctly forwards the --namespace value regardless of where -n/--namespace appears in the token list (before subcommand, after subcommand, with other flags, equals syntax). These tests confirm the generators already handle all token orderings correctly - the actual fix for the completion engine is in warp-internal (see warpdotdev/warp-internal#24138). Resolves: APP-3476 See also: GitHub #3929 Co-Authored-By: Oz <oz-agent@warp.dev>
APP-3476 [kubectl] Fix -n/--namespace flag breaking subsequent resource completion
When flags like Confirmed still repro'd — workaround is reordering flags. The See GitHub #3929 |
acarl005
approved these changes
Apr 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add tests for kubectl generator namespace forwarding with various token orderings.
These tests confirm that
kubectl_script()correctly extracts and forwards the--namespacevalue regardless of where-n/--namespaceappears in the token list:kubectl -n kube-system get podskubectl get -n kube-system podskubectl --context staging -n project1 get podskubectl --namespace=kube-system get podsThe generators already handle all these orderings correctly — the actual completion engine fix is in warp-internal: https://github.com/warpdotdev/warp-internal/pull/24138
What the warp-internal PR fixes
The completion engine's subcommand lookup had two bugs:
s.contains(token)to match options, which caused false positives (e.g.,--no-headersmatching-n). Fixed to use exact match.deepest_matching_subcommand_signaturedidn't skip flags when searching for subcommands, sokubectl -n kube-system getnever reached thegetsubcommand. Fixed by adding flag-aware iteration.See: GitHub #3929
Conversation: https://staging.warp.dev/conversation/5f0b6b65-3d5f-44e2-9620-e0fee969057c
Run: https://oz.staging.warp.dev/runs/019d6e0c-0f31-74e9-8d56-646aa96f1f22
This PR was generated with Oz.