Skip to content

Sync: replace a piece's contracts in the same transaction as its upsert - #486

Closed
wmobley wants to merge 1 commit into
developfrom
fix/sync-replaces-contracts-atomically
Closed

wmobley wants to merge 1 commit into
developfrom
fix/sync-replaces-contracts-atomically

Conversation

@wmobley

@wmobley wmobley commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Seen on dev: runs were briefly refused with "This flow does not fit its pieces or its data" (FLOW_WIRE_TARGET, FLOW_WIRE_SOURCE, FLOW_OUTPUT on every step), then went through a little later.

Cause: POST /admin/sync-from-mint deleted the contracts of every piece up front, then upserted the pieces one request at a time (about 250 requests, ~30 s on dev). Any flow checked in that window saw pieces with no inputs or outputs.

Fix: each piece's contract delete and upsert are now root fields of one mutation (ReplaceMintSyncSpec / ReplaceMintETLSpec), which Hasura runs in order inside one transaction, so a piece is never visible without its contracts. Rows synced without contracts keep theirs, as before. The single-piece path (sync_one_etl_process) uses the same mutation. The demo store handles the new operations.

Tests: adapter 1522 passed; 4 pre-existing local test_demo_api failures (git-ignored .env). test_etl_sync_roundtrip now checks that one request carries both the delete and the upsert, delete first, and that no separate bulk delete runs.

🤖 Generated with Claude Code

The catalog sync deleted the contracts of every piece first, then upserted the
pieces one request at a time. For the ~30 s that took, a flow check found pieces
with no inputs or outputs and refused runs with FLOW_WIRE_TARGET, FLOW_WIRE_SOURCE
and FLOW_OUTPUT. Each piece's delete and upsert are now one mutation, which
Hasura runs as one transaction.
@vercel

vercel Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
monorepo Ready Ready Preview Nov 20, 2026 9:44pm UTC

@wmobley

wmobley commented Nov 20, 2026

Copy link
Copy Markdown
Contributor Author

Combined into #489 so all three build and deploy together.

This branch was successfully deployed

1 active deployment
Preview — b9714a9e Deployed Nov 20, 2026 by vercel[bot]
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