fix: bd dolt pull fails when remote added without branch tracking#3443
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
maphew
left a comment
There was a problem hiding this comment.
The fallback approach looks plausible, and the branch-tracking error unit test passes, but this needs coverage for the actual bug path before merge. Please add an integration/regression test that creates or simulates a remote added without branch tracking and verifies DoltStore.Pull / pullWithAutoResolve succeeds through the DOLT_FETCH + DOLT_MERGE fallback.
|
Thanks for the detailed feedback. Two regression tests added in the latest commit: Standard test ( Uses a stored procedure with Integration test ( Reproduces the real failure scenario end-to-end:
This covers lines E–I. Lines E–I require a remotesapi-accessible remote; they can't be exercised in the standard test container (only port 3306 is mapped). |
|
Note on CI failures: The |
…ng branch tracking When a remote is added via bd dolt remote add (rather than bd bootstrap or dolt clone), repo_state.json has an empty "branches" map. DOLT_PULL then fails with "did not specify a branch" even when the branch is passed explicitly, because Dolt checks upstream tracking config first. This fix detects that specific error in pullWithAutoResolve and falls back to the DOLT_FETCH + DOLT_MERGE approach already used by versioncontrolops.Pull (GH#3144). The fallback preserves the existing metadata conflict auto-resolution logic. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
pullWithAutoResolve_BranchTrackingFallback (no build tag) injects the
exact Dolt tracking-error text via a stored procedure SIGNAL, then
verifies pullWithAutoResolve enters the DOLT_FETCH + DOLT_MERGE fallback
path (confirmed by the 'fetch from' error when no remote is configured).
Covers lines A–D of the fallback block.
pullWithAutoResolve_BranchTrackingSuccess (//go:build integration)
reproduces the real failure scenario end-to-end: a remote is added via
DOLT_REMOTE('add', ...) rather than clone, leaving repo_state.json with
an empty 'branches' map, causing DOLT_PULL to fail with the tracking
error. The test then verifies pullWithAutoResolve succeeds via the
DOLT_FETCH + DOLT_MERGE fallback. Covers lines E–I of the fallback block.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
a9b9e38 to
14f29d8
Compare
maphew
left a comment
There was a problem hiding this comment.
Approved after rebase and added normal-path regression coverage for the DOLT_FETCH + DOLT_MERGE fallback. CI is green.
Summary
DOLT_PULLfails with "did not specify a branch" (missing upstream tracking inrepo_state.json), falls back toDOLT_FETCH+DOLT_MERGEwhich does not require tracking configisBranchTrackingError()helper to detect the specific Dolt errorpullWithAutoResolvemetadata conflict resolution logicRoot cause
When a remote is added via
bd dolt remote add(orCALL DOLT_REMOTE('add', ?, ?)), the remote is registered inrepo_state.jsonunder"remotes", but"branches"remains{}.DOLT_PULLvalidates upstream tracking config before executing, even when the branch is passed explicitly.dolt clone/bd bootstrapset up branch tracking automatically, so this only affects databases where remotes were added after init.The
DOLT_FETCH+DOLT_MERGEapproach is already used inversioncontrolops.Pull()(lines 66-80) specifically for this case (GH#3144), but was not applied to thepullWithAutoResolvepath used byDoltStore.Pull().Reproduction
Test plan
TestIsBranchTrackingError— matches Dolt error, rejects unrelated errors, handles nilrepo_state.jsonhas empty"branches": {}on affected databaseversioncontrolops.Pullalready proven in production for the fetch+merge approach🤖 Generated with Claude Code