Skip to content

fix: flag option as experimental#2628

Merged
alepane21 merged 7 commits intomainfrom
dominik/eng-9159-make-config-option-experimental
Mar 11, 2026
Merged

fix: flag option as experimental#2628
alepane21 merged 7 commits intomainfrom
dominik/eng-9159-make-config-option-experimental

Conversation

@dkorittki
Copy link
Copy Markdown
Contributor

@dkorittki dkorittki commented Mar 11, 2026

Summary by CodeRabbit

  • Configuration

    • Replaced nested NATS consumer configuration with a single top-level experimental boolean to control deletion of durable NATS consumers on shutdown; example config and schema updated.
  • Tests

    • Updated tests to use the new top-level flag path for NATS providers.
  • Documentation

    • Minor schema text fix and the new experimental flag documented in the public schema.

Checklist

  • I have discussed my proposed changes in an issue and have received approval to proceed.
  • I have followed the coding standards of the project.
  • Tests or benchmarks have been added or updated.
  • Documentation has been updated on https://github.com/wundergraph/cosmo-docs.
  • I have read the Contributors Guide.

We shortly added a configuration option meant to be experimental but hasn't been flagged so. This pr changes it be making the whole consumers option category experimental. Given that this option has only been added today I think we are safe when renaming it.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 11, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4a0d761d-0304-4be8-9c7a-fa7c62c5d964

📥 Commits

Reviewing files that changed from the base of the PR and between 416a4d1 and ba4353f.

📒 Files selected for processing (1)
  • router/pkg/config/config.go

Walkthrough

Replaces nested NATS consumers configuration with a single top-level boolean DeleteDurableConsumersOnShutdown (YAML experiment_delete_durable_consumers_on_shutdown), removes NatsConsumersConfiguration and NatsDurableConsumersConfiguration, and updates schema, testdata, provider call site, and tests.

Changes

Cohort / File(s) Summary
Config types
router/pkg/config/config.go
Removed NatsConsumersConfiguration and NatsDurableConsumersConfiguration. NatsEventSource now has DeleteDurableConsumersOnShutdown (bool, YAML experiment_delete_durable_consumers_on_shutdown) replacing the Consumers field.
Schema & example config
router/pkg/config/config.schema.json, router/pkg/config/testdata/config_full.json
Removed nested consumers.durable.delete_on_shutdown; added top-level experiment_delete_durable_consumers_on_shutdown boolean (default false). Minor typo fix in token description.
Provider builder
router/pkg/pubsub/nats/provider_builder.go
Updated call site to read provider.DeleteDurableConsumersOnShutdown instead of provider.Consumers.Durable.DeleteOnShutdown.
Tests
router-tests/events/nats_events_test.go
Updated tests to set/assert DeleteDurableConsumersOnShutdown on the NATS provider object instead of the nested Consumers.Durable.DeleteOnShutdown path.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'fix: flag option as experimental' is vague and does not clearly convey the main changes made in the PR, which involve restructuring NATS consumer configuration by removing nested types and replacing them with a single experimental boolean flag. Consider revising the title to be more specific, such as 'refactor: replace nested NATS consumers config with experimental boolean flag' or 'chore: simplify NATS consumer configuration structure'.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)

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 and usage tips.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 11, 2026

Router image scan passed

✅ No security vulnerabilities found in image:

ghcr.io/wundergraph/cosmo/router:sha-da182ba1adbbdec68acf54e6f0438eca63423d1f

@github-actions
Copy link
Copy Markdown

Router image scan passed

✅ No security vulnerabilities found in image:

ghcr.io/wundergraph/cosmo/router:sha-37b56d77299872cc123666f665a7f539edf727ea

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 62.79%. Comparing base (2375cd8) to head (ba4353f).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #2628       +/-   ##
===========================================
+ Coverage   38.38%   62.79%   +24.41%     
===========================================
  Files         969      244      -725     
  Lines      125253    25818    -99435     
  Branches     5419        0     -5419     
===========================================
- Hits        48077    16213    -31864     
+ Misses      75490     8223    -67267     
+ Partials     1686     1382      -304     
Files with missing lines Coverage Δ
router/pkg/config/config.go 65.11% <ø> (-15.41%) ⬇️
router/pkg/pubsub/nats/provider_builder.go 68.60% <100.00%> (ø)

... and 746 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
router/pkg/config/config.schema.json (1)

2584-2596: ⚠️ Potential issue | 🟠 Major

Keep consumers as a deprecated alias instead of hard-renaming the key.

Line 2584 changes the public config key, and LoadConfig validates user YAML against this schema before unmarshal (router/pkg/config/config.go Line 1278 and Line 1311). That means any existing config still using consumers: now fails startup even though the behavior behind the option is unchanged. If the goal is only to flag the setting as experimental, keep consumers working for at least one release and deprecate it while introducing experiment_consumers—and make sure the Go YAML mapping accepts both names during the transition.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@router/pkg/config/config.schema.json` around lines 2584 - 2596, The schema
change renamed the public config key to "experiment_consumers" which breaks
existing configs using "consumers"; restore a deprecated alias and accept both
names during config load: add a "consumers" property in the JSON schema that
mirrors "experiment_consumers" (same object schema and a description noting it's
deprecated) so validation accepts old configs, and update the Go config
loading/unmarshal logic in LoadConfig (and the Config struct field handling
ExperimentConsumers/Consumers) to accept both keys—if only "consumers" is
present, copy its value into the ExperimentConsumers field and emit a
deprecation warning; ensure this mapping happens before the rest of validation
so old configs continue to work for one release.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@router/pkg/config/config.schema.json`:
- Around line 2584-2596: The schema change renamed the public config key to
"experiment_consumers" which breaks existing configs using "consumers"; restore
a deprecated alias and accept both names during config load: add a "consumers"
property in the JSON schema that mirrors "experiment_consumers" (same object
schema and a description noting it's deprecated) so validation accepts old
configs, and update the Go config loading/unmarshal logic in LoadConfig (and the
Config struct field handling ExperimentConsumers/Consumers) to accept both
keys—if only "consumers" is present, copy its value into the ExperimentConsumers
field and emit a deprecation warning; ensure this mapping happens before the
rest of validation so old configs continue to work for one release.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 66727b2e-27d0-44ea-afc8-930429ee87e0

📥 Commits

Reviewing files that changed from the base of the PR and between e3e9803 and 1eed39a.

📒 Files selected for processing (2)
  • router/pkg/config/config.go
  • router/pkg/config/config.schema.json

@dkorittki dkorittki requested a review from alepane21 as a code owner March 11, 2026 11:49
Copy link
Copy Markdown
Contributor

@SkArchon SkArchon left a comment

Choose a reason for hiding this comment

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

LGTM, just one nit

@alepane21 alepane21 requested a review from endigma March 11, 2026 14:09
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@router/pkg/config/config.go`:
- Around line 620-623: Remove the env tag from the
DeleteDurableConsumersOnShutdown field in the struct that defines NATS provider
entries (the field named DeleteDurableConsumersOnShutdown of type bool, adjacent
to ID, URL and Authentication/NatsAuthentication) so it no longer has
env:"EXPERIMENT_DELETE_DURABLE_CONSUMERS_ON_SHUTDOWN" envDefault:"false"; keep
the YAML tag intact and ensure only the yaml tag remains
(yaml:"experiment_delete_durable_consumers_on_shutdown") to match other array
element structs and avoid a global env variable applying to individual slice
elements.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9e1331a6-1637-464e-a26a-6aec471d8269

📥 Commits

Reviewing files that changed from the base of the PR and between 1cc1bbf and 416a4d1.

📒 Files selected for processing (2)
  • router/pkg/config/config.go
  • router/pkg/config/config.schema.json

Copy link
Copy Markdown
Member

@endigma endigma left a comment

Choose a reason for hiding this comment

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

approved once the env tag is removed

…ion-experimental' into dominik/eng-9159-make-config-option-experimental
@alepane21 alepane21 merged commit bea448f into main Mar 11, 2026
32 checks passed
@alepane21 alepane21 deleted the dominik/eng-9159-make-config-option-experimental branch March 11, 2026 15:01
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.

4 participants