fix(worker): backup scheduler covers hobby_plus + *_yearly + refunds quota on failure - #27
Merged
Merged
Conversation
…quota on failure Wave FIX-H worker companion to InstaNode-dev/api#107. Closes the worker- side gaps in BugBash B36. #56/#R6 — scheduler tier set The hardcoded `tier IN ('hobby','pro','growth','team')` silently excluded hobby_plus and every _yearly variant: paying hobby_plus / hobby_plus_yearly / pro_yearly customers received zero scheduled backups. The fix widens the IN list to every tier whose plans.yaml row has backup_retention_days > 0 (hobby, hobby_plus, pro, growth, team plus all _yearly counterparts) and treats hobby/hobby_plus as daily-slot cadence (canonicalTier strips _yearly). #59 — SHA-256 integrity pg_dump → gzip output is now teed through a sha256.Hash via io.MultiWriter; the hex digest is stamped into the new resource_backups.sha256 column (migration 043 ships in api PR #107) at finalize. On failure the digest is NOT written so the restore handler treats it as "unknown integrity, skip the check". #65/#Q47 — refund manual-backup counter on failure New WithRefundClient wires the runner to call POST /internal/teams/:id/backup-quota/refund (HS256 with WORKER_INTERNAL_JWT_SECRET) when a MANUAL backup row fails terminally. Scheduled-row failures skip the refund. Idempotent on the api side — a worker restart that re-processes the same backup id is a no-op. Tests - TestScheduler_HobbyPlus_OnSlotInserts (regression for #56/#R6) - TestScheduler_YearlyVariants_BackupHourly - TestCanonicalTier - Existing TestRunner_HappyPath / _PgDumpFails / _ClaimRace updated to expect backup_kind + sha256 in the row shape DO NOT TOUCH list respected — no edits to circuit/, apiclient internals beyond using New() at the boundary. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Worker companion to InstaNode-dev/api#107 (FIX-H). Closes the worker-side BugBash B36 backup items:
Test plan
Deploy notes
🤖 Generated with Claude Code