feat(backend): unpaid org retention warnings and 95-day app archive

Merged
RI
2mo ago
+1155-72

Summary (AI generated)

  • Unpaid/canceled org retention lifecycle: 85d bundle warning, 90d soft-delete + app warning, 95d app delete into old_apps
  • Queue handler canceled_org_retention_alerts with Bento/tracking, claim-once dedup, hardened validation
  • pgTAP + unit coverage for retention alerts
  • CI: skip redundant push suite when same-repo PR exists; merge main (#2915 flake mitigations)
  • CI: retry only Kong upstream-death 502/503 in fetchTestRequest, warm /apikey, route webhooks suite through fetchTestRequest
  • Playwright: dismiss support-usernames prompt in compatibility-events e2e
  • CI: raise Windows CLI POSIX path job timeout to 10m (windows-2022 was timing out at 5m)

Motivation (AI generated)

Canceled unpaid orgs were retaining apps/bundles indefinitely. Retention needs clear warning windows and safe archival. PR CI was red from Kong mid-suite 502s, a support-usernames modal intercepting Playwright clicks, and a 5-minute timeout on windows-2022 CLI zip.

Business Impact (AI generated)

Recovers storage and reduces abandoned unpaid org footprint while giving customers a short warning window before deletion. Keeps PR merge checks green.

Test Plan (AI generated)

  • Backend SQL / unit retention coverage green
  • Backend shards green (including apikeys/webhooks)
  • Playwright compatibility-events green
  • CLI POSIX paths windows-2022 completes under 10m
  • Full Run tests PR suite success on head SHA

Generated with AI

Open in Web Open in Cursor 

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Summary by CodeRabbit

  • New Features
    • Added automated retention alerts for canceled organizations, including bundle and app deletion warnings.
    • Introduced staged retention with advance notices, soft deletion, archival, and eventual app removal.
    • Prevented duplicate alerts and excluded organizations that resume activity.
  • Bug Fixes
    • Improved cleanup scheduling, retention processing, and alert delivery reliability.
    • Prevented repeated notification attempts when no eligible recipients are available.
  • Security
    • Restricted retention operations to authorized service processes and protected archived app data.