Skip to content

fix(config): mark config structs non_exhaustive + center donation section#44

Merged
polaz merged 2 commits into
mainfrom
fix/#43-config-non-exhaustive
Jun 20, 2026
Merged

fix(config): mark config structs non_exhaustive + center donation section#44
polaz merged 2 commits into
mainfrom
fix/#43-config-non-exhaustive

Conversation

@polaz

@polaz polaz commented Jun 20, 2026

Copy link
Copy Markdown
Member

Summary

Fixes the failing cargo-semver-checks run on the release PR. Since v1.1.0, every config field add/remove (and the BFF removal / ext_authz reshape) broke the public config API, because the structs are a struct-literal contract. They are loaded from YAML via Deserialize, not hand-built by downstream.

Marking every config struct and the DescriptorSource enum #[non_exhaustive] stops field changes from being breaking, so the config can evolve via minor bumps and semver-checks stops failing on each new field.

Breaking change → 2.0.0

Adding #[non_exhaustive] is itself a breaking change (downstream can no longer use struct literals / exhaustive matches), so this release is a major bump to 2.0.0. The commit carries a BREAKING CHANGE: footer so release-plz cuts 2.0.0 and semver-checks passes (a major bump is allowed to contain breaking changes). After 2.0.0, config fields can be added/removed without a major bump.

Within this crate, struct literals still work (#[non_exhaustive] only restricts other crates), so tests and internal construction are unaffected.

Also

  • Center the README Support the Project donation section (heading + QR inside the centered block, HTML <img> for reliable rendering).

Testing

cargo nextest run --features redis: 119 passed. clippy (all-features) + fmt clean. Build green.

Closes #43

polaz added 2 commits June 20, 2026 11:21
The public config structs are loaded from YAML via Deserialize and are
not meant to be constructed with struct literals by downstream crates.
Marking every config struct (and DescriptorSource) #[non_exhaustive]
stops field additions/removals from being breaking changes, so the
config can evolve without forcing a major bump each time and without
tripping cargo-semver-checks on every new field.

BREAKING CHANGE: config structs are now #[non_exhaustive]; downstream
crates can no longer build them with struct literals or match them
exhaustively. Construct config via ProxyConfig::from_file / Deserialize.

Closes #43
Wrap the heading + QR in the centered block and use an HTML img so the
donation section renders centered on GitHub / crates.io.
@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 892cd03d-25b6-46d8-8cbd-53c9b17d7736

📥 Commits

Reviewing files that changed from the base of the PR and between 2185f21 and b88ac13.

📒 Files selected for processing (2)
  • README.md
  • src/config.rs

📝 Walkthrough

Summary by CodeRabbit

  • Documentation

    • Restructured the "Support the Project" section in README.md with improved layout, consolidating the section heading and donation QR code within a unified centered display.
  • Chores

    • Updated configuration type declarations to enhance codebase consistency.

Walkthrough

Adds #[non_exhaustive] to all 21 public config structs and the DescriptorSource enum in src/config.rs without altering any fields or deserialization logic. Also reformats the "Support the Project" section in README.md to use an HTML-centered block for the heading and donation QR image.

Changes

Mark config types #[non_exhaustive]

Layer / File(s) Summary
Add #[non_exhaustive] to all public config types
src/config.rs
ProxyConfig, UpstreamConfig, DescriptorSource, ListenConfig, ServiceConfig, AliasConfig, OpenApiConfig, AuthConfig, JwtConfig, ForwardAuthConfig, RoutePolicyConfig, AuthzConfig, ShieldConfig, EndpointClassConfig, IdentifierEndpointConfig, OidcDiscoveryConfig, SigningKeyConfig, MaintenanceConfig, CorsConfig, LoggingConfig, and MetricsClassConfig all receive the #[non_exhaustive] attribute. No fields, defaults, or deserialization logic are modified.

README Donation Section

Layer / File(s) Summary
Reformat donation section to HTML-centered block
README.md
The "Support the Project" heading and donation QR code image are moved inside a single HTML <div align="center"> block, replacing the previous standalone Markdown heading and image/link format.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically summarizes both main changes: marking config structs non_exhaustive and centering the donation section in the README.
Description check ✅ Passed The description comprehensively explains the rationale for marking config structs non_exhaustive, the semver implications, the breaking change requiring 2.0.0, and mentions the secondary README formatting change.
Linked Issues check ✅ Passed The PR fully implements issue #43 requirements: marks all config structs and DescriptorSource enum with #[non_exhaustive] to stabilize the API, and centers the README donation section.
Out of Scope Changes check ✅ Passed All changes are in scope: README.md formatting aligns with issue #43's secondary task, and src/config.rs changes directly address the core objective of applying #[non_exhaustive] annotations.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/#43-config-non-exhaustive

Comment @coderabbitai help to get the list of available commands and usage tips.

@greptile-apps

greptile-apps Bot commented Jun 20, 2026

Copy link
Copy Markdown

Greptile Summary

Applies #[non_exhaustive] to every public struct and the DescriptorSource enum in src/config.rs so future field additions/removals no longer constitute a breaking change under semver. A corresponding major-version bump to 2.0.0 is required (and intended) because the attribute itself is a breaking change for downstream consumers using struct-literal syntax.

  • All 20 public config structs and the DescriptorSource enum receive #[non_exhaustive]. Coverage is complete; the only type without the attribute is the private DescriptorSourceYaml helper, which is correct.
  • Default implementations that use struct literals (e.g. ListenConfig, MaintenanceConfig) are unaffected because #[non_exhaustive] only restricts construction from outside the crate.
  • The README donation section is re-centered by moving the ## Support the Project heading inside the existing <div align="center"> block and replacing the Markdown image with an explicit <img> tag.

Confidence Score: 5/5

Safe to merge; changes are mechanical attribute additions with no runtime behavior changes.

The config.rs change is a uniform, complete application of #[non_exhaustive] across every public type — no logic is altered, serde deserialization is unaffected, and all in-crate struct-literal constructions (including Default impls) continue to compile correctly. The README edit is purely cosmetic. The breaking-change intent is explicit and handled by the planned 2.0.0 major bump.

No files require special attention.

Important Files Changed

Filename Overview
src/config.rs Adds #[non_exhaustive] to all 20 public structs and the DescriptorSource enum; the private DescriptorSourceYaml helper is correctly left untouched. No functional logic is changed.
README.md Moves the donation heading inside the centering div and switches to an HTML img tag for the QR code; purely cosmetic, renders correctly on GitHub.

Reviews (1): Last reviewed commit: "docs: center the Support the Project sec..." | Re-trigger Greptile

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.

fix(config)!: mark config structs non_exhaustive to stabilize the public API

1 participant