fix(backup): fit live reconcile idempotency key

This commit is contained in:
ogt
2026-07-15 05:51:22 +08:00
parent c69eab84f9
commit 3f9642cc28
2 changed files with 14 additions and 1 deletions

View File

@@ -46,7 +46,10 @@ BACKFILL_IDEMPOTENCY_CHANNEL = "backup_restore_backfill"
BACKFILL_DB_CONTRACT_REPAIR_GENERATION = "cost_usd_state_bind_v1"
LIVE_RECONCILE_SCHEMA_VERSION = "backup_restore_outbound_reconciler_v1"
LIVE_RECONCILE_AGENT_ID = "backup_restore_outbound_reconciler"
LIVE_RECONCILE_IDEMPOTENCY_CHANNEL = "backup_restore_outbound_reconcile"
# ``awooop_run_idempotency.channel_type`` is VARCHAR(32). Keep this durable
# identity explicit and below that limit; the previous 33-character value
# caused PostgreSQL 22001 before a live backup card could be claimed.
LIVE_RECONCILE_IDEMPOTENCY_CHANNEL = "backup_restore_live_reconcile"
BACKUP_RESTORE_EVENT_TYPE = "backup_restore_escrow_signal"
BACKUP_RESTORE_LANE = "backup_restore_escrow_triage"
PROJECTION_SCHEMA_VERSION = "telegram_agent99_dispatch_receipt_projection_v1"

View File

@@ -576,6 +576,16 @@ async def test_live_reconciler_reserves_only_unowned_incomplete_cards(
assert "backup-signal:" in sql
def test_live_reconciler_idempotency_channel_fits_durable_schema() -> None:
# awooop_run_idempotency.channel_type is VARCHAR(32). This invariant must
# be checked without relying on a mock database, which cannot reproduce a
# production PostgreSQL 22001 truncation error.
assert job.LIVE_RECONCILE_IDEMPOTENCY_CHANNEL == (
"backup_restore_live_reconcile"
)
assert len(job.LIVE_RECONCILE_IDEMPOTENCY_CHANNEL) <= 32
@pytest.mark.asyncio
async def test_live_reconciler_projects_bounded_agent99_receipt(
monkeypatch: pytest.MonkeyPatch,