Skip to content

OUT-4066: service-branch tests for sync error-shape edges - #135

Merged
SandipBajracharya merged 3 commits into
mainfrom
OUT-4066
Aug 20, 2026
Merged

OUT-4066: service-branch tests for sync error-shape edges#135
SandipBajracharya merged 3 commits into
mainfrom
OUT-4066

Conversation

@SandipBajracharya

Copy link
Copy Markdown
Collaborator

What & why

Adds integration tests for the residual defensive / error-shape branches that a happy-path flow never hits — precise external-error handling, create-vs-update dead-ends, webhook controller guards, and resync-helper edges. Real Postgres + MSW, single service, no task orchestration. Test-only: no production changes.

Linear: OUT-4066

Coverage (10 new tests)

Dropbox create + quiet-delete (sync-error-shape.integration.test.ts, new)

  • createAndUploadFileInDropbox dead-ends — existing item with an unexpected tag, and out-of-range file type — surface as a throw via completePendingDropboxCreate.
  • deleteDropboxFileQuietly swallows a 409 path_lookup/not_found, rethrows any other error (→ markFailure + rethrow).
  • deleteAssemblyFileQuietly swallows a Copilot 404, rethrows others.

Assembly webhook controller (+2)

  • 800ms ping-pong guard runs before processing (asserted even on a skipped event).
  • A create for an already soft-deleted file is skipped — the existingFile lookup intentionally omits the deletedAt IS NULL filter.

Resync sweep (+2)

  • retryFailedSyncsForPortal returns early (no rows touched) when the portal has no Dropbox connection.
  • An unrecognised (action, target) combo is caught per-row and recorded as a failure rather than aborting the sweep.

Harness

One shared change: the delete MSW mocks (mockDropboxDeleteFile / mockCopilotDeleteFile) now optionally return an error response (backward-compatible — existing callers pass no args).

Scoped out (per design)

Branches already covered by the flow tests (not_found→create, webhook status/eventType/create-gate/update/delete guards, resync per-row isolation). No extraction — these are I/O error branches tested through public entry points.

Testing

  • pnpm typecheck ✅ · pnpm lint ✅ · pnpm test → 197 passed ✅
  • pnpm test:integration → 141 passed ✅ (was 131; +10 new)

🤖 Generated with Claude Code

SandipBajracharya and others added 3 commits August 17, 2026 18:28
Teach the delete MSW mocks (mockDropboxDeleteFile / mockCopilotDeleteFile)
to return error responses, then assert the service-branch edges:
- createAndUploadFileInDropbox dead-ends (unexpected tag, out-of-range type)
  surface as a throw via completePendingDropboxCreate.
- deleteDropboxFileQuietly swallows 409 path_lookup/not_found, rethrows others.
- deleteAssemblyFileQuietly swallows Copilot 404, rethrows others.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- 800ms ping-pong guard runs before processing (even for skipped events).
- A create for an already soft-deleted file is skipped because the
  existingFile lookup intentionally omits the deletedAt filter.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- retryFailedSyncsForPortal returns early (no rows touched) when the portal
  has no Dropbox connection.
- An unrecognised (action, target) combo is caught per-row and recorded as
  a failure rather than aborting the sweep.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@linear-code

linear-code Bot commented Aug 17, 2026

Copy link
Copy Markdown

OUT-4066

@vercel

vercel Bot commented Aug 17, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
dropbox-integration Ready Ready Preview Aug 17, 2026 12:45pm

Request Review

@greptile-apps

greptile-apps Bot commented Aug 17, 2026

Copy link
Copy Markdown

Greptile Summary

Adds integration coverage for defensive synchronization branches without changing production code.

  • Covers Dropbox and Copilot deletion error handling and create dead ends.
  • Verifies webhook delay and soft-deleted-file guards.
  • Exercises resync behavior for missing connections and unsupported action-target combinations.
  • Extends MSW deletion helpers with optional error responses.

Confidence Score: 5/5

The PR appears safe to merge with no actionable defects identified.

The changes are test-only, and the new fixtures, mocks, seeded states, public entry points, and assertions align with the production branches they are intended to cover.

Important Files Changed

Filename Overview
test/flows/assembly-webhook-controller.integration.test.ts Adds correctly targeted coverage for the unconditional webhook delay and tombstoned-file create guard.
test/flows/resync-sweep.integration.test.ts Adds deterministic coverage for missing-connection early return and per-row handling of an unsupported dispatch target.
test/flows/sync-error-shape.integration.test.ts Adds integration tests that reach the intended create dead ends and distinguish swallowed not-found responses from rethrown deletion errors.
test/msw/write.ts Extends existing delete mocks with backward-compatible optional error responses while retaining attempted-operation recording.

Reviews (1): Last reviewed commit: "test(OUT-4066): cover resync missing-con..." | Re-trigger Greptile

@priosshrsth priosshrsth left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@SandipBajracharya
SandipBajracharya merged commit e19da97 into main Aug 20, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants