Skip to content

OUT-4040: L1.3 — Assembly webhook flow tests - #127

Merged
SandipBajracharya merged 4 commits into
mainfrom
OUT-4040
Aug 13, 2026
Merged

OUT-4040: L1.3 — Assembly webhook flow tests#127
SandipBajracharya merged 4 commits into
mainfrom
OUT-4040

Conversation

@SandipBajracharya

Copy link
Copy Markdown
Collaborator

What & why

L1.3 — integration tests for the Assembly→Dropbox webhook flow (Copilot notifies of a file created/deleted/updated → we sync to Dropbox), including the ping-pong dedup that stops us re-syncing our own echoes. Third of the L1 flow spine (after L1.1 initial sync, L1.2 Dropbox webhook delta). Drives the real graph 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) — mockDropboxDeleteFile (/2/files/delete_v2, captures deleted paths)
  • test/flows/assembly-webhook.integration.test.ts — service-direct: create / delete / update
  • test/flows/assembly-webhook-controller.integration.test.ts — controller: ping-pong dedup + event guards

What it proves

  • Service: create uploads to Dropbox + records the mapping; delete removes the exact Dropbox path + soft-deletes the row; update replaces the file (delete-then-recreate).
  • Controller: ignores a created-event echo of our own in-flight create (scoped by path); still creates when a different file is mid-upload; ignores non-handleable events, non-file/folder objects, already-deleted files, no-op updates; skips when sync is disabled; 404 when the connection has no account.

Skip scenarios register no Dropbox handlers, so a stray outbound call trips onUnhandledRequest:'error'; the delete/update tests also assert the exact deleted path and that unchanged rows were never written (updatedAt).

Reviewed by the fullstack reviewer (SHIP). Cases 33–35 (dead-code webhook-record dedup) intentionally out of scope.

Testing

  • pnpm typecheck ✅ · pnpm lint
  • pnpm test:integration — 75/75 ✅ (12 files)

🤖 Generated with Claude Code

SandipBajracharya and others added 3 commits August 13, 2026 14:57
mockDropboxDeleteFile captures the deleted paths, proven by a harness test
driving the real filesDeleteV2 client method.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Drive AssemblyWebhookService directly: create uploads to Dropbox and
records the mapping; delete removes the Dropbox file (verifying the exact
deleted path) and soft-deletes the row; update replaces the Dropbox file.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…p + guards)

Drive the route POST: skips a created-event echo of our own in-flight
create (scoped by path), proceeds otherwise, and honours the event guards
(non-handleable, non-syncable object, already-deleted, no-op update,
sync-disabled, missing account). Skip cases register no Dropbox handlers so
a stray call trips onUnhandledRequest; unchanged updatedAt proves no write.

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

linear-code Bot commented Aug 13, 2026

Copy link
Copy Markdown

OUT-4040

@vercel

vercel Bot commented Aug 13, 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 13, 2026 9:40am

Request Review

@greptile-apps

greptile-apps Bot commented Aug 13, 2026

Copy link
Copy Markdown

Greptile Summary

Adds integration coverage for the Assembly-to-Dropbox webhook flow and its ping-pong deduplication behavior.

  • Covers service-level create, delete, and update synchronization.
  • Covers controller event guards, path-scoped deduplication, disabled synchronization, and missing-account handling.
  • Adds an MSW Dropbox delete_v2 handler that records requested paths for exact-target assertions.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
test/flows/assembly-webhook-controller.integration.test.ts Adds controller-level tests for path-scoped echo deduplication, event guards, disabled synchronization, and missing Dropbox accounts.
test/flows/assembly-webhook.integration.test.ts Adds service-level integration tests for Assembly-originated file creation, deletion, and replacement in Dropbox.
test/msw/write.integration.test.ts Verifies that the Dropbox deletion mock handles delete_v2 and captures the requested path.
test/msw/write.ts Adds a Dropbox delete_v2 MSW handler returning deleted-file metadata and exposing captured paths.

Sequence Diagram

sequenceDiagram
    participant A as Assembly webhook
    participant C as Webhook controller
    participant S as AssemblyWebhookService
    participant D as Dropbox
    participant DB as Postgres
    A->>C: File event
    C->>DB: Check connection and pending sync state
    alt Event should be skipped
        C-->>A: 200 without Dropbox operation
    else Event should be synchronized
        C->>S: Handle create, delete, or update
        S->>D: Upload or delete file
        S->>DB: Create or soft-delete mapping
        S-->>C: Completed
        C-->>A: 200
    end
Loading

Reviews (2): Last reviewed commit: "test(OUT-4040): don't assert the delete_..." | Re-trigger Greptile

Comment thread test/msw/write.ts
The app ignores the delete_v2 response body (only success vs 409), so the
harness test now checks the call works and the deleted path was recorded,
instead of asserting response metadata.

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

Copy link
Copy Markdown
Collaborator Author

@greptileai review PR again

@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 08c7aeb into main Aug 13, 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