Skip to content

fix: CLI now rejects invalid enum option values before contacting Unity#1880

Merged
hatayama merged 1 commit into
feature/pause-point-feedback-round3-integrationfrom
feat/cli-enum-value-validation
Jul 20, 2026
Merged

fix: CLI now rejects invalid enum option values before contacting Unity#1880
hatayama merged 1 commit into
feature/pause-point-feedback-round3-integrationfrom
feat/cli-enum-value-validation

Conversation

@hatayama

@hatayama hatayama commented Jul 20, 2026

Copy link
Copy Markdown
Owner

Summary

  • Invalid enum values on CLI options (e.g. --capture-mode bogus) are now rejected by the CLI itself, instead of being forwarded to Unity and showing up as an Editor Console error.

User Impact

  • Before: a typo'd or invalid string option value passed CLI-side parsing unchecked and reached Unity, where it failed with an error that also polluted the Unity Console log.
  • After: the CLI validates the value against the option's declared enum (case-insensitively, matching the C# side's behavior) and returns an argument error listing the valid values, before ever contacting Unity.

Changes

  • convertValue now routes string-typed options through a new convertStringValue, which checks the value against property.Enum case-insensitively and returns a descriptive argument error (including the valid value list) on mismatch. Options without a declared enum pass through unchanged.
  • Added table-driven tests covering: exact-case match, case-insensitive match, an invalid value, and a plain string property with no enum.

Verification

  • sh scripts/check-go-cli.sh: all packages pass, 0 lint issues.
  • go test (new tool_params_test.go): 4/4 new tests pass.
  • Manual: dist/darwin-arm64/uloop screenshot --capture-mode bogus against the running Unity Editor now returns a CLI-side INVALID_ARGUMENT error listing window, rendering as valid values, and dist/darwin-arm64/uloop get-logs --log-type error immediately after shows TotalCount: 0 — confirming no new Console error was produced in Unity.

This PR targets the feature/pause-point-feedback-round3-integration branch, not main/v3-beta, so repository CI workflows (filtered to [main, v3-beta]) will not fire here — that is expected. Verification above is local/manual for this PR; full CI runs on the final integration PR into v3-beta.

Review in cubic

convertValue passed string options straight through even when the
tool schema declared an enum, so a typo'd --capture-mode or similar
flag would forward an invalid value to Unity and show up as an Editor
Console error instead of a CLI-side argument error.

Match enum values case-insensitively, mirroring the C# side's
CaseInsensitiveStringEnumConverter, and reject anything outside the
list with the valid values included in the error.
@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@hatayama, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 24 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: bb656d3b-ffb5-4fd7-92c8-9b37362305c6

📥 Commits

Reviewing files that changed from the base of the PR and between 00bdf77 and fd960d6.

📒 Files selected for processing (2)
  • cli/project-runner/internal/projectrunner/tool_params.go
  • cli/project-runner/internal/projectrunner/tool_params_test.go
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/cli-enum-value-validation

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.

@hatayama
hatayama merged commit a13ac61 into feature/pause-point-feedback-round3-integration Jul 20, 2026
2 checks passed
@hatayama
hatayama deleted the feat/cli-enum-value-validation branch July 20, 2026 16:09
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