Skip to content

OUT-4045: channel-map mismatch + resync query guards - #132

Open
SandipBajracharya wants to merge 1 commit into
OUT-4044from
OUT-4045
Open

OUT-4045: channel-map mismatch + resync query guards#132
SandipBajracharya wants to merge 1 commit into
OUT-4044from
OUT-4045

Conversation

@SandipBajracharya

Copy link
Copy Markdown
Collaborator

What

Direct-DB integration tests (Testcontainers Postgres + MSW for Copilot) for the channel-map mismatch guard, the stale channel-map bulk soft-delete, and the remaining resync guards (OUT-4045).

test/flows/channel-map-resync-guards.integration.test.ts (5 tests):

getOrCreateChannelMap

  • throws 400 when an existing channel matches one key (assemblyChannelId) but the other (dbxRootPath) differs
  • returns the existing channel when both keys match (proves the throw is specific to a real mismatch)

listFormattedChannelMap (Copilot faked via MSW)

  • bulk soft-deletes channel maps whose Assembly file channel no longer exists (deletedAt + status=false), cascading to their fileFolderSync rows, while the live channel and its rows are returned and untouched. Mocks /v1/channels/files + /v1/companies inline.

resyncFailedFilesForChannel (the 404-unknown-channel and 409-already-resyncing guards are already covered in the resync-sweep suite; these are the remaining paths)

  • throws 404 when the portal has no active Dropbox connection (asserts the specific message so it can't silently hit the other 404 guard)
  • when the Trigger.dev call fails, it clears resyncingAt and rethrows — the spy asserts resyncingAt was set before throwing, proving the full set→clear cycle

Why

Part of the DB-integration suite (parent OUT-4042). Partial-unique conflict, the transactional cascade, and the resync guard branches are real behaviors mocks can't reproduce, so they run against a container DB.

Verification

  • pnpm test:integration test/flows/channel-map-resync-guards.integration.test.ts → 5/5 pass
  • pnpm typecheck clean · pnpm lint clean

Notes

  • Base is OUT-4044 (stack: OUT-4041 → OUT-4043 → OUT-4044 → OUT-4045).
  • Reviewed by fullstack-code-reviewer — verdict Looks Good, no false positives; its three suggestions (prove resyncingAt was set, pin the 404 message, exercise the file-row cascade) are all applied.

🤖 Generated with Claude Code

Direct-DB integration tests: getOrCreateChannelMap conflict (400 on partial
match) vs returns-existing on full match; listFormattedChannelMap bulk
soft-deletes stale channel maps and their file rows (Copilot faked via MSW)
while keeping live ones; and the remaining resyncFailedFilesForChannel guards
(missing active connection -> 404; a trigger failure clears resyncingAt and
rethrows).

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

linear-code Bot commented Aug 14, 2026

Copy link
Copy Markdown

OUT-4045

@vercel

vercel Bot commented Aug 14, 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 14, 2026 11:44am

Request Review

@SandipBajracharya SandipBajracharya changed the title test(OUT-4045): channel-map mismatch + resync query guards OUT-4045: channel-map mismatch + resync query guards Aug 14, 2026
@greptile-apps

greptile-apps Bot commented Aug 14, 2026

Copy link
Copy Markdown

Greptile Summary

The PR adds direct-database integration coverage for channel-map mismatch handling, stale-map cascading soft deletion, and resync guard behavior.

  • Verifies conflicting and matching channel-map key combinations.
  • Verifies stale channel and file-sync rows are soft-deleted while live rows remain untouched.
  • Verifies inactive-connection rejection and cleanup after trigger failure.

Confidence Score: 5/5

The PR appears safe to merge, with no concrete defects identified in the added integration tests.

The tests use the repository’s established database and mock cleanup mechanisms, and their fixtures reach the intended channel-map and resync service branches without altering production behavior.

Important Files Changed

Filename Overview
test/flows/channel-map-resync-guards.integration.test.ts Adds five isolated integration tests whose fixtures, database lifecycle, MSW handlers, and spies align with the exercised service paths.

Reviews (1): Last reviewed commit: "test(OUT-4045): add channel-map mismatch..." | Re-trigger Greptile

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.

1 participant