Axum: preserve requirements through advanced agent edits
Work through Rust examples of real application boundaries: Keep Axum’s verified tenant inside the SQLx order update; Stop an Axum worker while it waits for queued input. Each recipe includes implementation code, integration prerequisites, failure-path tests to add, a Perch rule, and the captured broken/fixed source checks.
Download the Axum rule pack ZIP · Inspect the YAML rules
Rust
Middleware can authenticate an Axum request while the handler still writes globally. Extract the verified actor and include tenant and owner in the SQL statement that changes state. The affected-row check rejects inaccessible or already transitioned rows.
Broken edit flagged · corrected edit passes
Rust
Graceful HTTP shutdown does not automatically stop a separately spawned worker. Give the worker a token, use a cancellation-safe channel receive, signal the token with server shutdown, and await the JoinHandle before the process exits.
Broken edit flagged · corrected edit passes
Use a correction as a saved requirement
Choose the failure you need to prevent, add the scoped rule to your repository, and check both the broken and corrected implementation. Ask your agent to inspect the finding, repair the code and recheck the same rule. Keep framework tests beside the model check.
Perch keeps the requirement beside the code. Reuse the named check during the agent’s next edit and in CI, with cached answers free on unchanged requests.
Official Axum documentation · All language and framework recipes