refactor(dex): split 1inch LOP dedup models per chain to isolate blast radius - #9905
refactor(dex): split 1inch LOP dedup models per chain to isolate blast radius#9905jeff-dude wants to merge 2 commits into
Conversation
…t radius The venue-settled fills dedup (oneinch_lop_venue_settled_fills -> oneinch_lop_own_trades) was a single cross-chain node that read every dex_<blockchain>_base_trades and fed back into every dex_<blockchain>_trades, so any change to one chain's base trades rebuilt all chains' dex + dex_aggregator lineage. The venue co-occurrence join is strictly per-chain, so the logic now lives in per-chain models under blockchains/<chain>/ (parameterized macros, following the existing oneinch per-chain pattern), and oneinch_lop_dex_trades_passthrough refs the calling chain's model only. Adding a DEX on one chain now rebuilds only that chain's stack plus the cross-chain final unions. oneinch.lop_own_trades stays as a cross-chain union view for users; oneinch_lop_aggregator_trades unions the per-chain fills inline. The old oneinch.lop_venue_settled_fills model is removed (its prod table needs a manual drop). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Regression: CI vs prod — passedAll comparisons run against
Notes:
Merge plan
🤖 Generated with Claude Code |
PR SummaryMedium Risk Overview The former monolithic
Reviewed by Cursor Bugbot for commit c816675. Configure here. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
Bugbot Autofix is ON. A cloud agent has been kicked off to fix the reported issue.
Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit c816675. Configure here.
hide_spells() is reserved for clearing properties on already-materialized models; net-new models omit it, matching the sibling per-chain oneinch models. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Thank you for contributing to Spellbook 🪄
Please open the PR in draft and mark as ready when you want to request a review.
Description:
What & why
The 1inch LOP venue-settled dedup was one cross-chain model reading every chain's
dex_<chain>_base_tradesand feeding back into every chain'sdex_<chain>_trades, so touching one chain's base trades rebuilt all EVM chains' dex + dex_aggregator lineage. The dedup join is strictly per-chain, so the logic now lives in per-chain models and eachdex_<chain>_tradesrefs only its own chain's model. Adding a DEX to one chain now rebuilds only that chain's stack plus the cross-chain final unions. Output data is unchanged;oneinch.lop_own_tradesstays as a cross-chain union view.Architecture
macros/models/oneinch_lop_dex_trades_passthrough.sql- the decoupling edge: refsoneinch_<chain>_lop_own_tradesinstead of the cross-chain view; macro change triggers a one-time rebuild of alldex_<chain>_tradeson this PRmacros/.../LO/oneinch_lop_venue_settled_fills_macro.sql,oneinch_lop_own_trades_macro.sql- former model bodies parameterized by chain; venue co-occurrence now scans only that chain's base tradesoutside/oneinch_lop_own_trades.sql- now a union view of the 13 per-chain views (user-facing name, tests, and seed check preserved)outside/oneinch_lop_aggregator_trades.sql- unions the per-chain fills inline; feedsdex_aggregator.tradesas beforeoutside/oneinch_lop_venue_settled_fills.sql- deleted; prod tableoneinch.lop_venue_settled_fillsneeds a manual drop after mergedbt ls dex_ethereum_base_trades+confirms no other chain's trades/MEV models remain downstream. Not tested: prod data parity (views are definitionally equivalent; fills tables rebuild from full history on first run)dex.trades/dex_aggregator.tradesconsumers see identical data; CI/deploy selection scope shrinks for future per-chain DEX additions (checked via dbt lineage)Agent context
uv run dbt ls --select dex_ethereum_base_trades+ --project-dir dbt_subprojects/dex/ --resource-type model— nodex_<other_chain>_tradesin outputoneinch.lop_venue_settled_fills= ~4.0M rows / 13 chains (2021-06-11 → 2026-07-27), ~270k rows in last 90d;dex.tradesholds ~7.0M1inch-LOProwsloinexposed; solana excluded as before)quick links for more information:
🤖 Generated with Claude Code