Skip to content

Commit b69a4d6

Browse files
julianknutsenclaude
andcommitted
fix: filter dolt_diff by status/claimed_by to eliminate updated_at drift
The dolt_diff query was returning false positives when a fork's main was synced from upstream after branching — rows with only updated_at changes (same status and claimed_by) appeared as modified. Add a WHERE clause to only include rows where status or claimed_by actually differ, and use <> instead of != for MySQL/Dolt compatibility. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 32e247e commit b69a4d6

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

internal/remote/dolthub.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -664,9 +664,10 @@ func (d *DoltHubProvider) ListPendingWantedIDs(upstreamOrg, db string) (map[stri
664664
var wg sync.WaitGroup
665665
sem2 := make(chan struct{}, maxConcurrency)
666666

667-
// dolt_diff query: returns only rows the branch actually modified vs its
668-
// own main. The to_* columns hold the branch's version of each changed row.
669-
diffQuery := "SELECT COALESCE(to_id, from_id) as id, COALESCE(to_status, '') as status, COALESCE(to_claimed_by, '') as claimed_by, diff_type FROM dolt_diff('main', '%s', 'wanted')"
667+
// dolt_diff query: returns only rows where status or claimed_by actually
668+
// changed on the branch. Without the WHERE filter, updated_at drift from
669+
// fork main syncs would produce false positives for every row.
670+
diffQuery := "SELECT COALESCE(to_id, from_id) as id, COALESCE(to_status, '') as status, COALESCE(to_claimed_by, '') as claimed_by, diff_type FROM dolt_diff('main', '%s', 'wanted') WHERE diff_type <> 'modified' OR COALESCE(to_status,'') <> COALESCE(from_status,'') OR COALESCE(to_claimed_by,'') <> COALESCE(from_claimed_by,'')"
670671
snapshotQuery := "SELECT id, status, COALESCE(claimed_by, '') as claimed_by FROM wanted"
671672

672673
for _, pr := range prs {

0 commit comments

Comments
 (0)