Skip to content

Remove the code duplication flagged by cargo-echoes - #159

Merged
LucaCappelletti94 merged 3 commits into
mainfrom
echoes-dedup
Oct 26, 2026
Merged

LucaCappelletti94 merged 3 commits into
mainfrom
echoes-dedup

Conversation

@LucaCappelletti94

Copy link
Copy Markdown
Collaborator

cargo-echoes flagged 46 duplicate groups, 5 of them in library code and 2 in the benches. The reverse translator now reads INSERT target columns through the forward insert_column_names, table function settings go through translate_query_settings, the rebind planner lists FROM items through one list_from, RLS function argument lists transform through one closure, and interval arithmetic builds its datetime call through shifted_datetime. The statement benchmarks share one bench_statements loop with unchanged benchmark ids.

The other 39 groups were helpers that test files carried their own copies of. Those tests now call shared helpers in tests/helpers, and the gauntlet shares its PostgreSQL session switch, tenant seed insert and row loader. One test, maintenance_trigger_does_not_recurse_with_recursive_triggers_enabled, was an exact copy of maintenance_trigger_fires_on_update_to_maintenance_column and is gone. The kept test's comment now states the recursion it guards.

@codecov

codecov Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

The reverse translator reads INSERT target columns through the forward insert_column_names, table function settings go through translate_query_settings, the rebind planner lists FROM items through one list_from, RLS argument lists transform through one closure, interval arithmetic builds its datetime call through shifted_datetime, and the statement benchmarks share one bench_statements loop.
Test files that carried their own copies of the translate, apply, reverse and execution helpers now call shared ones in tests/helpers, the gauntlet shares its PostgreSQL session switch, seed insert and row loader, and an exact copy of maintenance_trigger_fires_on_update_to_maintenance_column is gone.
@LucaCappelletti94
LucaCappelletti94 merged commit 36483d6 into main Oct 26, 2026
21 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.

1 participant