Repository navigation
fix(db): renumber compliance runner migration - #7678
Conversation
There was a problem hiding this comment.
Ladon verdict: Comment (human reviewer recommended)
Comment — 1 medium finding on a production-facing migration; a human should confirm the Safety-note claim before merge.
This is a pure 100%-rename of migration 608→610 that resolves a real duplicate-version-608 collision on main (registry-608 and compliance-608 both present in base), yielding unique 608/609/610. The fix is correct and idempotent; runner semantics, numbering uniqueness, changeset scope, and idempotency were all verified.
Medium findings
- server/src/db/migrations/610_agent_compliance_runner_version.sql — The Safety note claims envs that already ran the briefly-published compliance-608 can re-run under 610, but migrate.ts's filename-mismatch guard (lines 476-497) throws at boot before 610 executes. Affected class is preview/branch envs; recoverable via a schema_migrations ledger cleanup. Non-blocking, but the note is misleading and warrants a human eye.
No critical/high findings. Migrations run automatically on startup, so I'm treating this as production-facing.
Decision-table walk: rows 1 (no crit/high), 2 (gated_paths false), 3 (rename, not deleted), 4 (medium category is not data-loss/schema/infra — it concerns operator-facing prose about migration safety, not a data-loss/schema/infra defect in the change itself; the rename is correct), 5 (no medium coupled with a modified high-risk file — the high-risk match is a rename, and the sole medium is doc-note accuracy), 6 (no prior decision), 7 (no team gate), 8 (only 1 medium, not ≥3) — none of the escalation rows fire. Note: this migration is operational/migration-only, so treated as out-of-protocol-scope. Falls to a single medium with no escalation trigger; surfacing via comment given the production-facing nature and the inaccurate safety note.
Correction on strict table application: with exactly 1 medium and no row 1-8 trigger, the strict outcome is row 9 approve. However, review_decision is REVIEW_REQUIRED and this touches a production auto-run migration path where the recorded safety guidance is factually wrong for preview/branch envs; I am electing comment to ensure a human validates the ledger-cleanup path before merge rather than auto-approving misleading operator guidance.
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — clean migration rename, no blocking or medium findings.
The diff is a single 100%-similarity rename of a migration file (608_agent_compliance_runner_version.sql → 610_agent_compliance_runner_version.sql), resolving a duplicate-608 version collision with 608_agent_registry_requeued_at.sql that would trip the duplicate-version guard in migrate.ts. 610 is the correct next free number, the migration is idempotent against a distinct table so reordering is harmless, no stale references remain, and the preview-env ledger reconciliation is disclosed in the PR body.
Walking the decision table top-down: no critical/high findings (row 1 n/a); gated_paths is false (row 2 n/a); high_risk is true but the reason is a (renamed) entry — treated as a modification, and there is no (deleted) reason (row 3 n/a); no medium findings at all (rows 4, 5, 8 n/a); prior decision was comment, not escalate (row 6 n/a); no no-auto-approve team match (row 7 n/a). Falls through to row 9 → approve. The high_risk flag on a migrations path with zero reviewer findings on a pure rename is normal scaffolding-level risk, not escalation-worthy.
Summary
608_agent_registry_requeued_at.sqlnow onmainSafety
The SQL remains idempotent (
ADD COLUMN IF NOT EXISTSplusCOMMENT ON COLUMN). Productionmainalready contained608_agent_registry_requeued_at.sqlbefore the compliance migration merged, so production could not record the compliance migration as 608: duplicate-number validation fails before execution. A preview or branch environment that applied the compliance migration as 608 before merge must reconcile itsschema_migrationsledger before upgrading; this PR does not automate that operator-only recovery.Validation