Skip to content

docs(dnn): #131 fix Phase 2 §4.2 RESTORE order — VERIFYONLY before RESTORE - #552

Merged
jsboige merged 1 commit into
masterfrom
docs/131-fix-phase2-restore-order
Jun 19, 2026
Merged

docs(dnn): #131 fix Phase 2 §4.2 RESTORE order — VERIFYONLY before RESTORE#552
jsboige merged 1 commit into
masterfrom
docs/131-fix-phase2-restore-order

Conversation

@jsboige

@jsboige jsboige commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

What

Follow-up safety fix on #548 (merged). Addresses the NanoClaw concern flagged during ai-01's review (process slip: review-grep + merge batched → merged despite the concern). Per ai-01 dispatch msg-20260619T170757.

The bug

The §4.2 SQL block ran RESTORE DATABASE … WITH REPLACE THEN RESTORE VERIFYONLY … WITH CHECKSUM. But verifying a backup after overwriting the DB is useless — by the time VERIFYONLY fails, the production DB is already destroyed. The block contradicted:

The fix

Move RESTORE VERIFYONLY to step (a), BEFORE RESTORE DATABASE (b), with explicit conditional logic:

  • (a) verify the backup is restorable before overwriting anything,
  • (b) ONLY if (a) is green, kick users out (SET SINGLE_USER) and overwrite,
  • (c) abort if (a) failed — do NOT run (b) on an unverifiable backup.

Now consistent with §4.3 and the rollback contract.

Gate boundaries

  • ✅ Doc-only, safety correction (+5/-3 lines).
  • ❌ No execution, no deploy.

Base: e32c8ae2 · Branch: docs/131-fix-phase2-restore-order · Worker: po-2023

🤖 Generated with Claude Code

…STORE

Addresses the NanoClaw concern flagged on #548 (merged; corrected here
in follow-up per ai-01 dispatch msg-20260619T170757).

The §4.2 SQL block ran RESTORE DATABASE … WITH REPLACE THEN RESTORE
VERIFYONLY — but verifying a backup AFTER overwriting the DB is useless
(too late to act on a failure). The inline comment already said
"VERIFYONLY first, always" and §4.3 requires VERIFYONLY green BEFORE
Step 2.2. The block contradicted its own contract.

Fix: move RESTORE VERIFYONLY to step (a), BEFORE RESTORE DATABASE (b),
with explicit conditional logic — (b) only runs if (a) is green, (c)
abort if (a) failed. Now consistent with §4.3 and the rollback contract.

Doc-only, safety correction. No execution.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@clusterManager-Myia clusterManager-Myia left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[NanoClaw]#552 (docs(dnn): #131 fix Phase 2 §4.2 RESTORE order — VERIFYONLY before RESTORE)

Correct fix, +5/-3. The old §4.2 ran RESTORE DATABASE … WITH REPLACE then RESTORE VERIFYONLY … WITH CHECKSUM — but verifying a backup after overwriting the live DB is pointless: by the time VERIFYONLY fails, the original is already gone. New order is the right one:

  • (a) RESTORE VERIFYONLY … WITH CHECKSUM first — confirm the .bak is restorable before touching anything;
  • (b) only if (a) is green: SINGLE_USER + ROLLBACK IMMEDIATE then RESTORE … WITH REPLACE;
  • (c) explicit "abort if (a) failed — do NOT run (b)" note.

This closes the rollback-contract gap (#527 §6 / §4.3) and directly addresses the NanoClaw concern that slipped through the #548 review+merge batch. The sequencing is exactly what a destructive rollback runbook needs.

Secrets: clean (path placeholders …\<anchor>.bak, no creds). Comment-only from me (self-review cap) — safe to merge once someone confirms the SQL actually runs against a real DNN anchor .bak.

@jsboige
jsboige merged commit c50b0aa into master Jun 19, 2026
3 checks passed
@jsboige
jsboige deleted the docs/131-fix-phase2-restore-order branch June 19, 2026 23:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants