# FastAPI: preserve requirements through advanced agent edits - [Preserve tenant authorization inside an atomic FastAPI update](https://frameworkrecipes.dev/fastapi/tenant-cancellation/guide.md): A read-then-write authorization check has two boundaries: who can see the row, and whether the write still applies the same scope. Put tenant, owner, and pending status into the UPDATE itself. A concurrent cancellation can then change at most one pending row. - [tenant-scoped-update rule pack](https://reporules.fyi/fastapi/tenant-cancellation/rule-pack.zip): YAML requirement and agent task. - [Keep a FastAPI order update and its outbox event in one transaction](https://frameworkrecipes.dev/fastapi/outbox-transaction/guide.md): Publishing a message after a database write leaves a crash window. An outbox row is written with the order state, so a worker can deliver it later. A unique event_key prevents accidental duplicate event insertion; a delivery consumer still needs its own deduplication. - [outbox-no-early-commit rule pack](https://reporules.fyi/fastapi/outbox-transaction/rule-pack.zip): YAML requirement and agent task. - [Framework rule pack](https://reporules.fyi/fastapi/rule-pack.zip): All requirements from this framework site.