fix: resolve false-positive conflicts in import and apply#151
Merged
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Fix multiple bugs causing phantom diffs when running import after import --force: Type comparison (types/compare.go): - Fix Comment *string pointer comparison (compare values not addresses) - Remove duplicate Comment check block - Fix Enum range iterating indices instead of values - Fix Attribute range iterating indices instead of values Table relation comparison (tables/compare.go): - Add fallback relation matching by schema.table.column when constraint name lookup fails (remote uses real DB names, local uses generated names) - Gate nil-Action diff to apply mode only Table state extraction (state/table.go): - Add fallback relation lookup by SourceTableName+SourceColumnName in buildTableRelation when constraint name lookup fails Cross-schema relation filtering (import.go): - Filter remote relationships to exclude references to tables not in local model set before comparison RPC comparison (import.go): - Restore state CompleteStatement before comparison instead of using rebuilt one from BuildRpc which differs from pg_get_functiondef() Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Codecov Report❌ Patch coverage is
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 1 file with indirect coverage changes 🚀 New features to boost your workflow:
|
- Fix relation comparison: skip duplicate FK deletes for matched columns - Fix relation comparison: skip cross-schema FK references (e.g., auth.users) - Fix index creation: only propose when target has index but source doesn't - Fix policy comparison: use schema+table+name key instead of name-only - Fix RPC state extraction: preserve stored CompleteStatement from import - Fix addModelRelation: use raiden.GetTableName() for TargetTableName - Fix duplicate table registration: skip second model with same tableName Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
toopay
approved these changes
Feb 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix false-positive conflict detection in raiden imports and false-change detection in raiden apply --dry-run. After running import --force followed by a normal import, the system incorrectly reported
conflicts on identical resources. After running import followed by apply --dry-run, the system incorrectly detected relation creates/deletes, policy table reassignments, RPC updates, and duplicate "New
Table" entries — all without any code changes.
Root causes & fixes
Import false-conflicts:
schema.table.column
before comparison
Apply false-changes:
Other fixes (prior commits in branch):
Type of change
Checklist
Validation
Tested against a real pivot project (dashboard-tiktok-be):
Files changed
31 files, +1962 / -60 lines across: