Vapor: preserve requirements through advanced agent edits
Work through Swift examples of real application boundaries: Keep Vapor’s order and audit writes on the Fluent transaction database; Observe Swift task cancellation between bounded order-processing steps. Each recipe includes implementation code, integration prerequisites, failure-path tests to add, a Perch rule, and the captured broken/fixed source checks.
Download the Vapor rule pack ZIP · Inspect the YAML rules
Swift
Fluent hands the closure a database bound to its transaction. Using the request’s ordinary database for a second write can escape that boundary. Pass the transaction database to every helper participating in the state change.
Broken edit flagged · corrected edit passes
Swift
Cancellation is cooperative in Swift. A canceled task may continue a loop unless the operation or loop observes cancellation. Check at safe boundaries before starting another side effect, while preserving a recovery policy for effects already underway.
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 Vapor documentation · All language and framework recipes