Skip to content

fix(config): Consistent FormatException handling for MultiOption - #158

Merged
christerswahn merged 2 commits into
mainfrom
new-better-command
Nov 24, 2026
Merged

christerswahn merged 2 commits into
mainfrom
new-better-command

Conversation

@christerswahn

@christerswahn christerswahn commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • New Features

    • Configuration options that accept multiple values now parse repeated command-line arguments individually, allowing values from separate occurrences to be combined.
    • Multi-value options support |-separated values; setting the separator to null keeps comma-containing values intact.
  • Bug Fixes

    • Invalid values in repeated arguments now produce consistent, clearer configuration errors that include the parser’s message.

@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

MultiOption now retains repeated command-line values as raw strings until value resolution. The shared resolution path parses each occurrence and converts parser FormatExceptions into resolution errors. Tests cover error consistency and separator behavior.

Changes: MultiOption parsing

Layer / File(s) Summary
Preserve repeated raw values
packages/config/lib/src/config/option_resolution_impl.dart
OptionResolutionImpl stores repeated raw strings and carries them through value and error copies.
Parse repeated values during resolution
packages/config/lib/src/config/options.dart, packages/config/test/config/configuration_type_test.dart
ConfigOptionBase routes repeated strings through _parseMultiStringValues. MultiOption parses each occurrence and combines the results. Tests cover parser errors, repeated arguments, separators, and values with no separator. Option-group documentation is templated and referenced by ConfigOptionBase.group.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant MultiOption
  participant OptionResolutionImpl
  participant ConfigOptionBase
  participant multiParser
  MultiOption->>OptionResolutionImpl: Store repeated raw strings
  ConfigOptionBase->>ConfigOptionBase: Route repeated strings to _parseMultiStringValues
  ConfigOptionBase->>multiParser: Parse each occurrence
  multiParser-->>ConfigOptionBase: Return parsed elements or FormatException
Loading

Suggested reviewers: nielsenko

Merge Risk: Minimal · up to bbb0e

MultiOption now parses repeated command-line values through the same resolution path as single values, so parser format errors are reported consistently. No concrete defect was found, and the tests cover the error and separator behavior.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: a fix that makes FormatException handling consistent for MultiOption in the config package. The raw summary shows MultiOption now parses repeated arguments per occurre…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: a fix that makes FormatException handling consistent for MultiOption in the config package. The raw summary shows MultiOption now parses repeated arguments per occurrence and reports parser FormatException errors in the same way as environment values, with new tests covering these cases. The title is specific and matches the changeset. It uses the conventional commit prefix, which is acceptable.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 01caa765-5fe6-4e2f-b382-55bbb6942069
Commits

Reviewing files that changed from the base of the PR and between ec88f95 and bbb0e55.

Files selected for processing: 3

  • packages/config/lib/src/config/option_resolution_impl.dart
  • packages/config/lib/src/config/options.dart
  • packages/config/test/config/configuration_type_test.dart

Included review availability: This review used your included allowance. 2 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 3 reviews per hour.

@christerswahn
christerswahn merged commit cf0b147 into main Nov 24, 2026
36 checks passed
@christerswahn
christerswahn deleted the new-better-command branch November 24, 2026 19:15
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