OUT-4041: L1.4 — resync sweep flow tests - #128
Open
SandipBajracharya wants to merge 3 commits into
Open
Conversation
…d ids mockCopilotRetrieveFile (GET /v1/files/:id, 404 for unknown), proven by a harness test. mockDropboxUpload's default now yields a distinct id per path so multiple uploads in one test don't collide on the partial unique index. Clarify the delete_v2 mock comment (returns file/folder metadata). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Removed 3 identical uniqueDbxUpload helpers + 1 inline copy; call sites now use mockDropboxUpload()'s distinct-per-path default. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Backoff selection, retry create/delete, per-row error isolation, reconcile (completed / recently-stuck / abandoned-past-12h), and per-channel resync gating (404 / 409 / reset + run). Driven via ResyncService / retryFailedSyncsForPortal against Postgres with Dropbox + Copilot MSW. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThe PR expands integration coverage for failed-sync retry, reconciliation, and manual resync orchestration while consolidating Dropbox upload mock behavior.
Confidence Score: 5/5The PR appears safe to merge, with its changes confined to coherent integration tests and test harness helpers. The new scenarios map to the intended retry, reconciliation, and orchestration branches, while the shared mock changes preserve existing test behavior without introducing a concrete failure. Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant Service as ResyncService
participant DB
participant Trigger as Inline Trigger
participant Retry as Retry Worker
participant APIs as Dropbox/Copilot Mocks
User->>Service: resyncFailedFilesForChannel
Service->>DB: Validate channel and set resyncingAt
Service->>DB: Reset pending attempts and backoff
Service->>Trigger: Start resync orchestration
Trigger->>Retry: Retry pending rows
loop Each failed row
Retry->>APIs: Delete, retrieve, or recreate
Retry->>DB: Mark updated, deleted, or failed
end
Trigger->>DB: Run master-sync reconciliation
Trigger->>DB: Clear resyncingAt in finally
Service-->>User: Return pendingCount
Reviews (1): Last reviewed commit: "test(OUT-4041): add resync sweep flow te..." | Re-trigger Greptile |
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.
What & why
L1.4 — the last of the L1 flow spine. Integration tests for the resync sweep: retrying and reconciling failed
fileFolderSyncrows (rows carrying apendingActiontombstone that errored). Driven in-process via the L1.0 Trigger double against Testcontainers Postgres, Dropbox + Copilot faked via MSW.Changes (all
test/**, zero production change)test/msw/write.ts(+ harness test) — newmockCopilotRetrieveFile(GET /v1/files/:id);mockDropboxUpload's default now returns a distinct id per path (avoids partial-unique collisions);delete_v2mock comment clarified.test/flows/resync-sweep.integration.test.ts— 12 scenarios.uniqueDbxUploadcopies across the existing flow tests → they use the new default.What it proves (12 scenarios)
findFailedSyncs): past-backoff + null-last-attempt picked; too-recent, attempts=10, and deleted rows skipped — SQLNOW()boundary driven byminutesAgo()seeds.markUpdated+ count++; recently-stuck (<12h) →markFailure, untouched; abandoned (≥12h) → stale file deleted + recreated with a fresh id.markFailure, batch continues.resyncFailedFilesForChannel): 404 unknown / 409 already-resyncing / reset-only (stubbed orchestration) / full end-to-end (reset → retry → clearsresyncingAt).Both clock domains handled: SQL
NOW()viaminutesAgoseeds, JSDate.now()(12h) viacreatedAt: hoursAgo(n).Reviewed by the fullstack reviewer (SHIP). This completes the L1 flow spine (L1.0–L1.4).
Testing
pnpm typecheck✅ ·pnpm lint✅pnpm test:integration— 88/88 ✅ (13 files)🤖 Generated with Claude Code