Source: https://frameworkrecipes.dev/phoenix/

# Phoenix: preserve requirements through advanced agent edits

Work through Elixir examples of real application boundaries: Keep Phoenix order and audit changes in one Ecto.Multi; Insert an Oban job in the same transaction as the Phoenix order change. Each recipe includes implementation code, integration prerequisites, failure-path tests to add, a Perch rule, and the captured broken/fixed source checks.

[Download the Phoenix rule pack ZIP](https://reporules.fyi/phoenix/rule-pack.zip) · [Inspect the YAML rules](https://reporules.fyi/phoenix/rules.yaml)

Elixir

## [Keep Phoenix order and audit changes in one Ecto.Multi](https://frameworkrecipes.dev/phoenix/multi-transaction/)

Ecto.Multi names each database operation and reports the failed step. Keeping order and audit in one Multi makes an invalid audit roll back the state transition. A successful placeholder callback can accidentally remove that guarantee while preserving the outer transaction shape.

Broken edit flagged · corrected edit passes

Elixir

## [Insert an Oban job in the same transaction as the Phoenix order change](https://frameworkrecipes.dev/phoenix/oban-atomic-job/)

A queued job belongs in the same database commit as the business change when workers depend on that change. Oban’s Multi integration keeps the job row transactional and preserves Oban-specific insertion behavior.

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 Phoenix documentation](https://hexdocs.pm/phoenix/overview.html) · [All language and framework recipes](https://frameworkrecipes.dev/)

**Framework Recipes**

Implementation, failure path, check.

Published by Perch · © 2026 Verglas LLC. Framework Recipes is a Perch publication.

Perch’s MIT license covers the CLI; hosted model analysis is a paid service. Relevant source is sent to the configured model service.

[Perch CLI MIT license](https://github.com/lakeday-org/perch/blob/main/LICENSE) · [Article text](https://frameworkrecipes.dev/phoenix/index.md) · [Resource index](https://frameworkrecipes.dev/llms.txt)
