Skip to content

fix(target): make --target flag case insensitive to match Tanka#56

Merged
julienduchesne merged 1 commit intomasterfrom
fix/target-case-insensitive
Feb 26, 2026
Merged

fix(target): make --target flag case insensitive to match Tanka#56
julienduchesne merged 1 commit intomasterfrom
fix/target-case-insensitive

Conversation

@julienduchesne
Copy link
Collaborator

Summary

  • Tanka's --target flag performs case-insensitive regex matching on kind/name, but rtk was using case-sensitive matching
  • Fixed both target filtering code paths to use RegexBuilder::new().case_insensitive(true):
    • extract_manifests() in util.rs (used by show, apply, diff, prune)
    • compile_target_patterns() in export.rs (used by export)
  • Added golden test target_filter_case_insensitive_env that uses --target "configmap/.*" (lowercase) to match ConfigMap resources

Test plan

  • Added golden test case reproducing the issue (configmap/.* filter against ConfigMap resources)
  • Verified test fails before fix (rtk exports nothing, tk exports the ConfigMap)
  • Verified all 33 golden fixture tests pass after fix
  • Verified all rtk unit tests pass

🤖 Generated with Claude Code

Tanka's --target flag performs case-insensitive regex matching on
kind/name, but rtk was using case-sensitive matching. This caused
filters like "configmap/.*" to not match "ConfigMap" resources.

Fix both target filtering code paths (extract_manifests in util.rs
for show/apply/diff/prune, and compile_target_patterns in export.rs
for export) to use RegexBuilder with case_insensitive(true).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link

Benchmark Results

Benchmark Test vs tk vs base
Diff cluster_scoped 53.76x faster equal
Diff configmap_unchanged 29.18x faster equal
Diff deployment_nested_changes 28.09x faster equal
Env List Single Inline Directory (--json) 46.17x faster equal
Env List Single Inline File (--json) 45.56x faster equal
Env List All Environments (--json) 88.0x faster equal
Eval Single Static Environment 14.56x faster equal
Eval Inline Environment File 22.67x faster equal
Eval Eval Expression - Deeply Nested Path 15.63x faster equal
Export (Full) Single Static Environment 5.56x faster equal
Export (Full) Single Inline Environment 14.5x faster equal
Export (Full) All Environments 11.16x faster equal
Export (Replace) Single Static Environment 5.22x faster equal
Export (Replace) Single Inline Environment 14.97x faster equal
Export (Replace) All Environments 19.81x faster equal
Tool Importers Count Single Lib Directory (Non-Recursive) 2.17x faster equal
Tool Importers Count Single Lib Directory (Recursive) 2.19x faster equal
Tool Importers Count Entire Lib Directory (Non-Recursive) 1.47x faster equal
Tool Importers Count Entire Lib Directory (Recursive) 1.16x faster equal
Tool Importers Global Lib File 2.79x faster equal
Tool Importers Single Env-Specific Lib File 1.68x faster equal
Tool Importers All Env-Specific Lib Files 6.71x faster equal
Tool Importers All Lib Files 6.82x faster equal
Tool Importers All Jsonnet Files 11.79x faster equal
Tool Imports Single Static Environment 3.54x faster equal
Tool Imports Single Inline Environment File 3.59x faster equal

Full results available in workflow artifacts.

Benchmark run on commit b9974f18a34b04090259673cb8b88c2640a7d4c6

@julienduchesne julienduchesne merged commit a3dcb5b into master Feb 26, 2026
22 checks passed
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.

1 participant