recover_permissions
Documentation for eth_defi.hyperliquid.permission_recovery.recover_permissions function.
- recover_permissions(target, sources, backup_dir, *, dry_run=True, source_available_at=None, parquet_sources=None)
Restore missing price keys and retain uncertain legacy permission evidence.
Current target values win matching-key conflicts; every differing archive row is retained in an audit table. Sources must be immutable scanner DuckDB files. Never pass a live production database as a local rehearsal target. Recovered backup flags use their price timestamp as an explicitly inferred permission clock when no genuine receipt is available. Missing backup flags remain unknown. The corrupted target’s flags never supply this fallback. Mutation is backed up and committed atomically, including ART index removal.
- Parameters
target (pathlib.Path) – Existing target database; stop its owner before applying.
sources (list[pathlib.Path]) – Earlier scanner database snapshots in preference order.
backup_dir (pathlib.Path) – Directory for verified pre-mutation backups.
dry_run (bool) – Read-only analysis; default
True.parquet_sources (Optional[list[pathlib.Path]]) – Optional raw published Parquets, restored after DuckDB sources. Cleaned Parquets are refused.
source_available_at (Optional[dict[str, datetime.datetime]]) – Optional verified archive availability bounds, keyed by absolute source filename. These are never API receipt clocks.
- Returns
Counts, archive hashes, conflicts and optional own-backup receipt.
- Return type