Skip to content

Add kubectl namespace flag generator tests (APP-3476)#255

Merged
lucieleblanc merged 1 commit into
mainfrom
app-3476/kubectl-namespace-tests
Apr 16, 2026
Merged

Add kubectl namespace flag generator tests (APP-3476)#255
lucieleblanc merged 1 commit into
mainfrom
app-3476/kubectl-namespace-tests

Conversation

@lucieleblanc
Copy link
Copy Markdown
Contributor

Description

Add tests for kubectl generator namespace forwarding with various token orderings.

These tests confirm that kubectl_script() correctly extracts and forwards the --namespace value regardless of where -n/--namespace appears in the token list:

  • Before the subcommand: kubectl -n kube-system get pods
  • After the subcommand: kubectl get -n kube-system pods
  • With multiple flags: kubectl --context staging -n project1 get pods
  • Using equals syntax: kubectl --namespace=kube-system get pods

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

  1. Legacy path: Used s.contains(token) to match options, which caused false positives (e.g., --no-headers matching -n). Fixed to use exact match.
  2. V2 path: deepest_matching_subcommand_signature didn't skip flags when searching for subcommands, so kubectl -n kube-system get never reached the get subcommand. 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.

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>
@linear
Copy link
Copy Markdown

linear Bot commented Apr 8, 2026

APP-3476 [kubectl] Fix -n/--namespace flag breaking subsequent resource completion

When flags like -n or --namespace come before the subcommand, subsequent resource completion falls back to file listing instead of querying the cluster.

Confirmed still repro'd — workaround is reordering flags. The kubectl_script() helper in command-signatures/src/generators/kubectl.rs already forwards --namespace from tokens, but the parser may not handle all token orderings correctly.

See GitHub #3929

@lucieleblanc lucieleblanc merged commit 57a98d3 into main Apr 16, 2026
3 checks passed
@lucieleblanc lucieleblanc deleted the app-3476/kubectl-namespace-tests branch April 16, 2026 18:50
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.

3 participants