Skip to content

Keep colons inside quoted kubectl-style defaults out of option descriptions - #4702

Open
thomhurst wants to merge 1 commit into
mainfrom
issue-4696-wrapped-quoted-defaults
Open

Keep colons inside quoted kubectl-style defaults out of option descriptions#4702
thomhurst wants to merge 1 commit into
mainfrom
issue-4696-wrapped-quoted-defaults

Conversation

@thomhurst

Copy link
Copy Markdown
Owner

Summary

The automated minikube regeneration (#4676) shipped XML docs that open with fragments of the default value (v0.0.51@sha256:…': The base image…, //storage.googleapis.com/…]: Locations…, ///system': The KVM QEMU…). The review attributed this to wrapped (default "…") continuations, but the rows are single lines: KubectlOptionPattern captures the default with [^:\s]*, so a quoted default containing a colon is cut at that colon and the remainder of the value becomes the description.

  • KubectlOptionPattern now captures a single- or double-quoted default whole ('[^']*'|"[^"]*") before the unquoted [^:\s]* form, so the : that precedes the description is found after the closing quote.
  • Type inference is unchanged: quoted defaults already normalised to string; --nodes=1: still yields int?.
  • Regression Quoted_Kubectl_Style_Defaults_Containing_Colons_Stay_Out_Of_Descriptions uses the three real minikube rows plus --memory='' and --nodes=1 controls; it reproduces the exact garbled descriptions on the previous regex and passes now.

minikube derives from CobraCliScraper, so no minikube-specific code is involved; kubectl-style rows in any Cobra-derived scraper get the same fix. #4676 will be refreshed by the push-triggered regeneration once this merges.

Test plan

  • New regression fails on the previous regex (all three descriptions garbled) and passes with the fix.
  • Full OptionsGenerator test suite: 1344/1344.
  • dotnet format --verify-no-changes --severity warn on the two changed files.
  • CI generator suite and the next minikube regeneration.

Closes #4696

https://claude.ai/code/session_01MGEyXW2HYJpJ47tqnpjWMa

…of descriptions

KubectlOptionPattern captured the default value with [^:\s]*, so a quoted
default containing a colon ('gcr.io/k8s-minikube/kicbase:v0.0.51@sha256:...',
'[https://...]', 'qemu:///system') was cut at the first colon and the rest of
the value leaked into the option description. Capture single- or double-quoted
defaults whole before falling back to the unquoted form, and cover the three
minikube rows plus unquoted controls.

Closes #4696

Claude-Session: https://claude.ai/code/session_01MGEyXW2HYJpJ47tqnpjWMa
@coderabbitai

coderabbitai Bot commented Sep 6, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 4 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: bab22650-7180-4b91-8b3b-47704b2eaac8

📥 Commits

Reviewing files that changed from the base of the PR and between fe707c5 and d35a73d.

📒 Files selected for processing (2)
  • tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator.Tests/Scrapers/CobraCliScraperTests.cs
  • tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator/Scrapers/Cli/CobraCliScraper.cs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 6, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-06T07:28:15.886040Z d35a73d PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Review

This is a small, well-scoped fix: KubectlOptionPattern now captures single- or double-quoted default values whole ('[^']*'|"[^"]*"|[^:\s]*) before falling back to the previous unquoted capture, so a colon embedded inside a quoted default (e.g. gcr.io/k8s-minikube/kicbase:v0.0.51@sha256:...) is no longer mistaken for the separator before the description. The added test (Quoted_Kubectl_Style_Defaults_Containing_Colons_Stay_Out_Of_Descriptions) exercises exactly the minikube rows from issue #4696, plus an empty-quote case and an unquoted integer control, and checks both descriptions and resolved CSharpType for the affected options.

I traced a few edge cases an automated pass flagged, to check whether they're real regressions introduced by this diff:

  • Cross-line runaway match from an unterminated quote: the quoted alternatives are not newline-excluded, so in isolation they could span multiple lines. Not exploitable here though: MatchOptionRow is only ever called with single lines from section.Split(newline) (CobraCliScraper.cs around line 317-320), so there's never an embedded newline for the class to consume. Not an issue.
  • Quoted boolean defaults (like =true in quotes) failing the literal true/false comparison in NormalizeTypeHint: syntactically real, but Cobra/pflag only renders quoted defaults for string-typed flags; bool flag defaults are always printed unquoted. So a quoted boolean default should not occur in real Cobra/kubectl help output, and this is not a new gap introduced by this PR.
  • A quoted default containing its own quote character (e.g. an apostrophe inside the value) would still fail the whole option row and silently drop it, but the old single-alternative pattern had the same failure mode for that input, so it's a pre-existing limitation, not a regression.

None of these hold up as issues introduced by this change. The fix directly targets the reported bug, is minimal, and has direct test coverage. Nothing else in the diff stands out.

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.

Scrapers leave wrapped quoted default values in option descriptions (minikube BaseImage/IsoUrl/KvmQemuUri)

1 participant