Skip to content

Conversation

@phm07
Copy link
Contributor

@phm07 phm07 commented Apr 3, 2025

See #845 for a description of the error

While parsing the config's FlagSet, if the parser reached a flag that was not a config option, it would terminate early and return an unknown flag error. Since the error was ignored silently, this behavior was not apparent to the user.

This PR fixes this behavior by using the ParseErrorsWhitelist to allow unknown flags in the config's FlagSet. This also means we can now return any other parsing errors properly instead of ignoring them.

Fixes #845

@phm07 phm07 added the bug label Apr 3, 2025
@phm07 phm07 self-assigned this Apr 3, 2025
@phm07 phm07 requested a review from a team as a code owner April 3, 2025 09:42
@codecov
Copy link

codecov bot commented Apr 3, 2025

Codecov Report

Attention: Patch coverage is 62.50000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 70.11%. Comparing base (69fdaf0) to head (aed999d).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
internal/state/config/config.go 62.50% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1025      +/-   ##
==========================================
- Coverage   70.18%   70.11%   -0.07%     
==========================================
  Files         246      246              
  Lines       10815    10820       +5     
==========================================
- Hits         7590     7586       -4     
- Misses       2547     2553       +6     
- Partials      678      681       +3     
Flag Coverage Δ
e2e 46.82% <62.50%> (-0.09%) ⬇️
unit 63.59% <62.50%> (-0.07%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@jooola jooola left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we have a test to ensure the behavior is correct?

@phm07 phm07 requested a review from jooola April 4, 2025 11:39
@phm07 phm07 merged commit d73356b into main Apr 4, 2025
6 checks passed
@phm07 phm07 deleted the fix-config-option-flag-parsing branch April 4, 2025 11:42
phm07 pushed a commit that referenced this pull request May 9, 2025
<!-- section-start changelog -->
### Features

- **load-balancer**: allow specifying network on create (#1013)
- **context**: add unset commmand (#1017)
- publish image to Docker Hub (#1043)

### Bug Fixes

- allow getting resources with number as name
- some list flags are not correctly parsed (#987)
- **load-balancer**: allow certificate names in addition to IDs when
creating/updating (#1026)
- config option flags sometimes not parsed correctly (#1025)

<!-- section-end changelog -->

---

<details>
<summary><h4>PR by <a
href="https://github.com/apricote/releaser-pleaser">releaser-pleaser</a>
🤖</h4></summary>

If you want to modify the proposed release, add you overrides here. You
can learn more about the options in the docs.

## Release Notes

### Prefix / Start

This will be added to the start of the release notes.

```rp-prefix
```

### Suffix / End

This will be added to the end of the release notes.

```rp-suffix
```

</details>

Co-authored-by: releaser-pleaser <>
phm07 pushed a commit that referenced this pull request May 30, 2025
<!-- section-start changelog -->
### Features

- **load-balancer**: allow specifying network on create (#1013)
- **context**: add unset commmand (#1017)
- publish image to Docker Hub (#1043)

### Bug Fixes

- allow getting resources with number as name
- some list flags are not correctly parsed (#987)
- **load-balancer**: allow certificate names in addition to IDs when
creating/updating (#1026)
- config option flags sometimes not parsed correctly (#1025)

<!-- section-end changelog -->

---

<details>
<summary><h4>PR by <a
href="https://github.com/apricote/releaser-pleaser">releaser-pleaser</a>
🤖</h4></summary>

If you want to modify the proposed release, add you overrides here. You
can learn more about the options in the docs.

## Release Notes

### Prefix / Start

This will be added to the start of the release notes.

```rp-prefix
```

### Suffix / End

This will be added to the end of the release notes.

```rp-suffix
```

</details>

Co-authored-by: releaser-pleaser <>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: --debug is sometimes not applied

3 participants