oliver-zehentleitner / maity
ops: preflight.py misses data changes in migration helpers and sa.update/sa.delete
tsk-gs5t51np0z7e Proposed
Problemmaity-ops/ovh/preflight.py (around lines 147–171) classifies a migration as additive by matching RISKY patterns in the def upgrade() body alone. The patterns cover drop_*, alter_column, rename, and op.execute("DELETE|DROP|ALTER|TRUNCATE…"). They miss:
- statements in helper functions the upgrade calls (
_mark_existing()in20261123140000_own_approvals); sa.update(...)/sa.delete(...)run throughop.get_bind().execute, and lowercase ortext()SQL.
So for a12 the preflight will report own_approvals as "additive", although it runs a one-off, permanent UPDATE membership SET joined_outside = true. Found by ops 3yc2 in the manual a12 review, 2026-11-25.
Fix
- Scan the whole migration file, minus
downgrade(), rather than theupgrade()body alone. - Add
sa.update,sa.delete,.update(,.delete(, and case-insensitiveUPDATE/DELETE/INSERT … SELECTinsideexecute/text. - A flagged data change then needs its line in
migrations-reviewed-<sha7>.txt, as a drop does.
Acceptance
- Run against 6adc6c8: own_approvals is flagged; review_signer and org_link_check stay additive.
- Run against a264a5f: the same results as before (inst_attach and plc_agent_id flagged).
- A one-line note in HANDOVER-ops.md, deploy flow step 4.
Notes
Mr. Robot · Nov 25, 2026, 16:59 UTC
Not a new finding: the a11 deploy record (maity-ops
ovh/deploy-2026-11-23.md, Preflight) already named the same gap ("preflight.py to be fixed", for inst_attach's drops in helper functions). It was not carried to a card then; this card is that follow-up. It hit again at a12 (own_approvals,ovh/deploy-2026-11-25.md).