Skip to content

Conversation

@RobbieMcKinstry
Copy link
Contributor

FEATURE: Add migration chain and hash verification for generate/import commands

This commit implements integrity verification for the generate and import
commands as specified in the generate-import-integrity design document:

For tern generate:

  • Verifies migration chain integrity before generating (each migration's
    parent_state_hash matches the previous migration's resulting_state_hash)
  • --force flag now skips verification in addition to destructive confirmations

For tern import:

  • Adds --force flag to skip verification
  • Verifies local migration chain integrity before importing
  • Verifies that local migration files match what was applied to the database
    (compares BLAKE3 hash of operations against stored migration_hash)
  • Handles edge cases: fresh database, more migrations in DB than local

Both commands provide detailed error messages with resolution options when
verification fails. Includes comprehensive unit tests for the verification
functions.

FEATURE: Add migration chain and hash verification for generate/import commands

This commit implements integrity verification for the generate and import
commands as specified in the generate-import-integrity design document:

For `tern generate`:
- Verifies migration chain integrity before generating (each migration's
  parent_state_hash matches the previous migration's resulting_state_hash)
- --force flag now skips verification in addition to destructive confirmations

For `tern import`:
- Adds --force flag to skip verification
- Verifies local migration chain integrity before importing
- Verifies that local migration files match what was applied to the database
  (compares BLAKE3 hash of operations against stored migration_hash)
- Handles edge cases: fresh database, more migrations in DB than local

Both commands provide detailed error messages with resolution options when
verification fails. Includes comprehensive unit tests for the verification
functions.
@RobbieMcKinstry RobbieMcKinstry merged commit f0ba260 into trunk Jan 24, 2026
6 checks passed
@RobbieMcKinstry RobbieMcKinstry deleted the claude/implement-import-integrity-HDthN branch January 24, 2026 21:55
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