Poka-yoke is a physical or logical barrier that prevents an error rather than warning someone after it happens. In software, a CI check can fail a build when a change moves an async call into a synchronous request handler. section 12.2.1
When a mistake recurs or is caught only by luck, look for a constraint that makes it impossible. Alerts and dashboards detect problems; poka-yoke prevents them. A check might block the async change until it is corrected or its latency impact receives review from the endpoint’s SLA-owning team. section 12.2.1
Deployment pipelines can enforce constraints such as:
- Requiring a reverse operation for migrations, with an approved exception for irreversible changes. section 12.4
- Requiring production confirmation flags, schema validation, immutable build artifacts, or a runbook link before deployment. section 12.4
Listing 12.5 CI gate that enforces rollback compatibility
def check_migration_rollback(migration_file: str) -> bool:
"""Reject migrations that lack a reverse operation."""
content = read_file(migration_file)
has_forward = "def upgrade(" in content or "def forwards(" in content
has_reverse = "def downgrade(" in content or "def backwards(" in content
if has_forward and not has_reverse:
raise MigrationError(
f"{migration_file} has no rollback. Add a downgrade() function "
f"or set IRREVERSIBLE=True with tech lead approval."
)
return TrueThis CI gate rejects a migration without a reverse operation unless a tech lead approves it as irreversible. section 12.4
