Skip to content

[0 BOUNTY] [Python] Add dry-run restore validation to legacy migration tool - #133

Open
Saiaaax wants to merge 2 commits into
jaxassistant55:mainfrom
Saiaaax:bounty20-dryrun-restore-validation
Open

[0 BOUNTY] [Python] Add dry-run restore validation to legacy migration tool#133
Saiaaax wants to merge 2 commits into
jaxassistant55:mainfrom
Saiaaax:bounty20-dryrun-restore-validation

Conversation

@Saiaaax

@Saiaaax Saiaaax commented Jun 25, 2026

Copy link
Copy Markdown

Summary

Implements a dry-run restore validation path for the legacy migration tool (tools/legacy_migration.py) that checks backup presence, target compatibility, and expected row-count/checksum metadata without modifying production data.

Closes #20

Changes

  • Added: DryRunRestoreResult dataclass — Structured result with valid, errors, warnings, row_counts, checksums, schema_version, target_compatible, backup_present, and metadata fields
  • Added: dry_run_restore_validation() function — Performs 5 validation checks:
    1. Backup directory exists (BACKUP_NOT_FOUND)
    2. Manifest file exists and is valid JSON (MANIFEST_MISSING, MANIFEST_INVALID)
    3. Schema version compatibility (SCHEMA_MISMATCH, SCHEMA_UNKNOWN, SCHEMA_UNSUPPORTED)
    4. Row-count and checksum metadata extraction from manifest
    5. Referenced data files exist (DATA_FILES_MISSING)
  • Added: dry-run-restore CLI subcommandpython3 legacy_migration.py dry-run-restore --backup-dir DIR --migration-id ID [--target-schema-version VER]
  • Added: tests/test_dryrun_restore.py — 12 unit tests covering:
    • Successful dry run with valid backup
    • Metadata and row-count/checksum extraction
    • Missing backup directory
    • Missing manifest file
    • Invalid manifest JSON
    • Schema version mismatch
    • Unknown schema version in manifest
    • Unsupported schema version
    • No target schema version (skip compatibility check)
    • Missing referenced data files
    • No validation metadata (warnings only)
  • Updated: docs/OPERATIONS.md — Added "Dry-Run Restore Validation" section with usage, validation checks table, and supported schema versions

Testing

cd tests && python -m pytest test_dryrun_restore.py -v
# 12 passed in 0.16s

Build diagnostic:

python3 build.py -m backend,market,frailbox
# diagnostic/build-db991709.logd generated

Checklist

  • Relevant modules affected by these changes build locally
  • Tests pass locally
  • Diagnostic build log is committed in this PR
  • Documentation has been updated
  • Changes are scoped to the PR purpose
  • Security, privacy, and error-handling implications have been considered

Payout address: 0x5253757322092903C2F0a8EfEed592344216CC7E
Diagnostic artifact reference: diagnostic/build-db991709.logd

Saiaaax added 2 commits June 25, 2026 10:42
…n tool

- Add DryRunRestoreResult dataclass with structured error reporting
- Implement dry_run_restore_validation() function with checks for:
  - Backup directory presence (BACKUP_NOT_FOUND)
  - Manifest file presence (MANIFEST_MISSING)
  - Valid manifest JSON (MANIFEST_INVALID)
  - Schema version compatibility (SCHEMA_MISMATCH, SCHEMA_UNKNOWN, SCHEMA_UNSUPPORTED)
  - Referenced data file existence (DATA_FILES_MISSING)
  - Row-count and checksum metadata extraction
- Add 'dry-run-restore' CLI subcommand
- Add 12 unit tests covering all acceptance criteria
- Update OPERATIONS.md with dry-run restore validation docs

Closes #20
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.

[$50 BOUNTY] [Python] Add dry-run restore validation to legacy migration tool

1 participant