Skip to main content

Synopsis

Run comprehensive integrity checks on the Schema Vault.

Description

The verify command performs cryptographic verification of the Schema Vault to detect:
  • Manifest tampering - Modified or corrupted manifest.json
  • Version file tampering - Modified version snapshots
  • Hash mismatches - Schema files that don’t match stored hashes
  • Missing files - Deleted vault files
  • Inconsistent state - Schema files out of sync with versions
This command is used to:
  • Audit vault integrity
  • Detect unauthorized changes
  • Verify schema authenticity
  • Troubleshoot migration issues

Examples

All Checks Passed

Output:

Integrity Violation Detected

Output:

No Vault Found

Output:

What Gets Verified

1. Vault Manifest

Checks .chameleon/vault/manifest.json:
  • Valid JSON structure
  • Required fields present
  • Current version references exist

2. Version Files

For each version in .chameleon/vault/versions/:
  • Version file exists (e.g., v001.json)
  • Hash file exists (e.g., .chameleon/vault/hashes/v001.hash)
  • Computed hash matches stored hash

3. Schema Files

Verifies merged schema:
  • Schema file exists at configured path
  • Hash matches current vault version (if applicable)

4. Integrity Log

Checks .chameleon/vault/integrity.log:
  • File is append-only
  • No suspicious modifications

Vault Structure

Verification Process

Step 1: Load Manifest

Step 2: Verify Each Version

For each version:
  1. Read version file (e.g., v001.json)
  2. Compute SHA256 hash of contents
  3. Compare with stored hash in v001.hash
  4. Report OK or FAILED

Step 3: Check Tampering

Or if issues found:

Step 4: Verify Schema Files

Checks if current schema matches vault:
Or if modified:

Common Scenarios

After Migration

Output:

After Manual Vault Edit

If someone manually edits .chameleon/vault/versions/v002.json:
Output:

After Schema Edit (Not Yet Migrated)

Edit schemas/users.cham but don’t migrate:
Output:
Modified schema files are expected during development. This is not an error until you run migrate --apply.

Integrity Log

View detailed audit trail:
Example output:

Recovery Options

If Vault is Corrupted

  1. Check integrity log:
  2. Review recent changes:
  3. Restore from backup:
  4. Contact DBA if tampering suspected

If Schema File is Missing

This will recreate .chameleon/state/schema.merged.cham.

Integration with Migrate

The migrate command automatically runs integrity verification:
Output includes:
If verification fails, migration is aborted:

Exit Codes

  • 0 - All integrity checks passed
  • 1 - Integrity violations found or vault not initialized

Automated Verification

Daily Cron Job

CI/CD Pipeline

Troubleshooting

Cannot Load Manifest

Solution: Vault not initialized. Run:

Permission Denied

Solution: Ensure read permissions:

See Also