docs: a 0.3 → 0.4 migration guide, and make the configuration example demonstrate configuration - #72
Merged
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three gaps found while reviewing whether 0.4 was ready to publish.
1.
MIGRATION.mdwas stale — and had become wrongIt documented only 0.2 → 0.3, and line 177 still showed:
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:
[basic]/[application]→ top level +[server]), with a before/afterconfig.application.name→config.name), and#[config]/State<ServerConfig>__environment separator, and that typed fields now parse instead of failing the loadmessagefeature, and thatcors/static_filesnow enable only their own half oftower-http422validation rejections,E: ErrorResponsible, unit-returning handlers,OperablefieldsThe 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
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 withState<ServerConfig>, and letsrun()bind what the file says.Verified by actually running it rather than only compiling:
That also confirms end-to-end that the documented environment-override rules match real behaviour.
3. A
todo!()in a production pathgotcha/src/router.rsmatchedMethodFilterwith_ => todo!().MethodFilteris#[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