Skip to content

docs: a 0.3 → 0.4 migration guide, and make the configuration example demonstrate configuration - #72

Merged
Kilerd merged 1 commit into
mainfrom
fix/release-readiness
Aug 2, 2026
Merged

docs: a 0.3 → 0.4 migration guide, and make the configuration example demonstrate configuration#72
Kilerd merged 1 commit into
mainfrom
fix/release-readiness

Conversation

@Kilerd

@Kilerd Kilerd commented Aug 2, 2026

Copy link
Copy Markdown
Owner

Three gaps found while reviewing whether 0.4 was ready to publish.

1. MIGRATION.md was stale — and had become wrong

It documented only 0.2 → 0.3, and line 177 still showed:

DatabasePool::connect(&config.application.database_url).await

which no longer compiles in 0.4. Meanwhile 0.4 carries the most invasive breaking change the project has had — every application must edit its configuration file — and the repository offered no guide for it at all. The release notes covered it; the file a user actually opens when upgrading did not.

Adds a 0.3 → 0.4 section:

  • configuration file layout ([basic]/[application] → top level + [server]), with a before/after
  • reading config in code (config.application.nameconfig.name), and #[config] / State<ServerConfig>
  • the __ environment separator, and that typed fields now parse instead of failing the load
  • the removed message feature, and that cors / static_files now enable only their own half of tower-http
  • smaller changes: 422 validation rejections, E: ErrorResponsible, unit-returning handlers, Operable fields

The 0.2 → 0.3 section is kept and labelled — its examples are correct for the version it describes, and it now says so.

2. The configuration example did not demonstrate configuration

.with_optional_config("config.toml")   // does not exist — and optional, so it failed silently
.listen("127.0.0.1:3000")              // hardcoded, ignoring the `[server] port = 8000` it ships

The one example named after the feature was the one not showing it. It now uses the trait API, extracts the application config with #[config] and the bind settings with State<ServerConfig>, and lets run() bind what the file says.

Verified by actually running it rather than only compiling:

$ curl :8000/          → Gotcha                         # top-level `welcome`
$ curl :8000/server    → listening on 127.0.0.1:8000    # the [server] section

$ APP_SERVER__PORT=9100 APP_WELCOME=from-env cargo run
$ curl :9100/          → from-env                       # single underscore = field name
$ curl :9100/server    → listening on 127.0.0.1:9100    # `__` = nested section

That also confirms end-to-end that the documented environment-override rules match real behaviour.

3. A todo!() in a production path

gotcha/src/router.rs matched MethodFilter with _ => todo!(). MethodFilter is #[non_exhaustive], so a method axum adds later would panic the application while it registered its routes. It now leaves such a route working and merely undocumented, with a warning — consistent with the panic removal in #40 and #31.

Verification

Workspace builds with --all-features, all feature combinations test, clippy --all-features --workspace, fmt, and the configuration example exercised over HTTP.

🤖 Generated with Claude Code

…e demonstrate configuration

Three gaps found while reviewing whether 0.4 was ready to publish.

**MIGRATION.md was stale, and had become wrong.** It documented only 0.2 -> 0.3 and still showed
`config.application.database_url`, which no longer compiles. Meanwhile 0.4 carries the most
invasive breaking change so far — every application must edit its configuration file — and the
repository offered no guide for it. Adds a 0.3 -> 0.4 section covering the file layout, reading
config in code, the `__` environment separator, the removed `message` feature, and the smaller
changes (422 rejections, `ErrorResponsible`, unit-returning handlers). The older section is kept
and labelled, since its examples are correct for the version it describes.

**The configuration example did not demonstrate configuration.** It loaded `config.toml` — a file
that does not exist, and optional, so the failure was silent — and hardcoded
`listen("127.0.0.1:3000")`, ignoring the `[server] port = 8000` it ships. The one example named
after the feature was the one not showing it. It now uses the trait API, extracts the application
config with `#[config]` and the bind settings with `State<ServerConfig>`, and lets `run()` bind
what the file says. Verified by running it: `/` returns the configured welcome and `/server`
reports `127.0.0.1:8000`, and with `APP_SERVER__PORT=9100 APP_WELCOME=from-env` both overrides
take effect.

**`router.rs` had a `todo!()` in a production path.** `MethodFilter` is `#[non_exhaustive]`, so a
method axum adds later would have panicked the application while it registered its routes. It now
leaves such a route working and merely undocumented, with a warning — consistent with the panic
removal done in #40 and #31.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Kilerd
Kilerd merged commit 66345a3 into main Aug 2, 2026
11 checks passed
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