Count Stripe calls and finish activity backfill once#1881
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThe PR adds external subrequest accounting to Stripe retries and changes activity-log backfill to return progress counts and use completion checkpoints for resumable maintenance execution. It also adds a migration preserving completed backfill state and expands related tests. ChangesActivity-log backfill checkpointing
Stripe subrequest budgeting
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant MaintenanceRunner
participant MaintenanceRegistry
participant ActivityLogBackfill
MaintenanceRunner->>MaintenanceRegistry: run activity_log_backfill task
MaintenanceRegistry->>ActivityLogBackfill: runActivityLogBackfill(publicKey)
ActivityLogBackfill-->>MaintenanceRegistry: converted row count
MaintenanceRegistry->>MaintenanceRunner: set complete checkpoint or request follow-up
sequenceDiagram
participant StripeCaller
participant StripeRequest
participant StripeAPI
StripeCaller->>StripeRequest: execute Stripe operation
StripeRequest->>StripeRequest: count external subrequest
StripeRequest->>StripeAPI: fetch request
StripeAPI-->>StripeRequest: response or retryable failure
StripeRequest-->>StripeCaller: result or blocked-operation error
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@test/shared/stripe/request.test.ts`:
- Around line 197-214: Extend the Stripe retry tests around recordingCheckout
and config.fetch to cover a network failure: make the first fetch attempt reject
and the retry succeed, then assert getSubrequestUsage() reports database 0,
external 2, and total 2 within runWithSubrequestBudget. Keep the existing HTTP
500 retry coverage unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 83b7ffb8-1598-4531-9494-c6a45df9822e
📒 Files selected for processing (8)
scripts/mutation/equivalent-mutants.txtsrc/shared/db/activity-log-backfill.tssrc/shared/maintenance/registry.tssrc/shared/stripe/request.tstest/shared/db/activity-log-backfill.test.tstest/shared/maintenance/registry.test.tstest/shared/maintenance/runner.test.tstest/shared/stripe/request.test.ts
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: eb39445345
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…et-followups # Conflicts: # test/shared/maintenance/registry.test.ts
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@test/shared/db/migrations/2026-07-21_activity_backfill_complete.test.ts`:
- Around line 34-62: Add a test alongside the existing migration cases that
seeds an already completed activity_log_backfill task, calls runMigration(), and
asserts activityTask() returns exactly one unchanged row with
ACTIVITY_LOG_BACKFILL_COMPLETE and its original next_run_at value. Use the
existing task setup and expectation patterns.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: e3e89301-ccb7-4edf-a43e-98f0fba96255
📒 Files selected for processing (7)
src/shared/db/migrations/2026-07-21_activity_backfill_complete.tssrc/shared/db/migrations/registry.tstest/integration/migration-restore-verify.test.tstest/shared/db/migrations/2026-07-21_activity_backfill_complete.test.tstest/shared/db/migrations/registry.test.tstest/shared/db/migrations/schema/version/guard.test.tstest/shared/stripe/request.test.ts
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1891fa3838
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
What changed
Why
These changes address the review findings added to #1862 after it merged. They close the remaining budget blind spot and remove repeated unindexed activity-log scans, including the first scan that old completed sites would otherwise perform after upgrading.
Verification
nix develop -c deno task precommitSummary by CodeRabbit