b502db8fdc
Replays sha256 chain in given audit partition from given id: 1. Uses pgsql_supplier (BYPASSRLS) to see all rows regardless of RLS scope. 2. Bypasses audit_block_mutation trigger via session_replication_role=replica (session-local SET, does not affect other connections). 3. Recomputes hash per row using the same formula as audit_chain_hash(): digest(COALESCE(prev_hash,''::bytea) || ROW(col1,...,NULL::bytea,...,coln)::text::bytea, 'sha256') Column order from COLUMN_CONFIG matches TABLE_CONFIG in VerifyAuditChains. 4. Supports --dry-run (count without UPDATE) and --force (skip confirmation). Validated against breaking partitions: --partition=activity_log_y2026_m05 --from-id=599 --partition=balance_transactions_y2026_m05 --from-id=462 Tests: 4 tests — activity_log rebuild, balance_transactions rebuild, dry-run no-op, unknown partition rejection. All pass (4/4 GREEN). Refs: docs/superpowers/plans/2026-05-29-audit-chain-race-fix.md Task 3 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>