Skip to content

Add -W and -E flags to allow users to control error severity#2049

Merged
Prashansa-K merged 4 commits into
mainfrom
use-diagnostics
May 11, 2026
Merged

Add -W and -E flags to allow users to control error severity#2049
Prashansa-K merged 4 commits into
mainfrom
use-diagnostics

Conversation

@mheap
Copy link
Copy Markdown
Member

@mheap mheap commented May 6, 2026

Uses emitter from Kong/go-database-reconciler#466

When we added the OIDC validation we received feedback that some customers want to treat this as a warning and not an error. We do not want to make this a warning only, and so I've added the ability for users to choose which validation are an error and which are a warning using the -W and -E flags

NOTE: This is using a branch from go-database-reconciler. Once the GDR PR is merged, I'll update this PR to point at a release

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 6, 2026

Codecov Report

❌ Patch coverage is 6.32911% with 74 lines in your changes missing coverage. Please review.
✅ Project coverage is 32.57%. Comparing base (1136bd9) to head (cd7fca9).

Files with missing lines Patch % Lines
cmd/utils.go 0.00% 27 Missing ⚠️
cmd/gateway_validate.go 0.00% 8 Missing ⚠️
cmd/file_convert.go 0.00% 7 Missing ⚠️
cmd/file_render.go 0.00% 5 Missing ⚠️
cmd/gateway_diff.go 0.00% 5 Missing ⚠️
cmd/gateway_sync.go 0.00% 5 Missing ⚠️
cmd/common.go 0.00% 4 Missing ⚠️
cmd/common_konnect.go 0.00% 4 Missing ⚠️
cmd/gateway_apply.go 0.00% 3 Missing ⚠️
cmd/konnect_diff.go 0.00% 3 Missing ⚠️
... and 1 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2049      +/-   ##
==========================================
- Coverage   32.85%   32.57%   -0.29%     
==========================================
  Files          77       77              
  Lines        7068     7132      +64     
==========================================
+ Hits         2322     2323       +1     
- Misses       4550     4613      +63     
  Partials      196      196              

☔ 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.

@mheap mheap force-pushed the use-diagnostics branch 3 times, most recently from c5f48d8 to be31a54 Compare May 7, 2026 13:03
@mheap mheap requested a review from Prashansa-K May 7, 2026 13:12
err := sync(
context.Background(),
"testdata/render/005-diagnostics/rla-consumer-groups.yaml",
"-W", "rla-consumer-groups-deprecated",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't think this particular code should be allowed as a warning. Do customers require this deprecated way of defining configs?
We have had a lot of consumer-group reconciliation bugs and I don't want a deprecated flow that used to error out since at least 2 years to be allowed now. I don't know what other can of worms would it open up if folks start using it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

There's one customer that still uses this heavily. It used to be a 2.8 gate, and we moved it to be 3.4.

By adding this option we provide a "you can make this a warning, but you're on your own" option. The alternative is that we bump the gate to 3.10 (and 3.14 etc as they upgrade) and have to officially support it

)
require.Error(t, err)
require.ErrorContains(t, err, "Valid diagnostic codes")
require.ErrorContains(t, err, "route-regex-path-format")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@mheap How would folks know about these valid codes?
I don't see them in the help output.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The intention is that we only tell people who hit issues. We should continue to be opinionated (e.g. OIDC salt is an error). Support will be enabled on which codes are available to respond.

The "hidden" way to get a list is to pass an invalid value:

❯ go run main.go file render -W foobar
Error: invalid value for -W/--errors-as-warnings: unknown diagnostic code: foobar. Valid diagnostic codes: [oidc-missing-required-config rla-consumer-groups-deprecated route-regex-path-format]
exit status 1

@mheap mheap force-pushed the use-diagnostics branch 2 times, most recently from daccbe8 to 3e931f4 Compare May 8, 2026 13:08
@mheap mheap force-pushed the use-diagnostics branch from 3e931f4 to acfeef4 Compare May 8, 2026 15:09
@Prashansa-K Prashansa-K merged commit 39a9214 into main May 11, 2026
42 checks passed
@Prashansa-K Prashansa-K deleted the use-diagnostics branch May 11, 2026 05:22
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.

3 participants