Embedded-mode push/pull route through versioncontrolops.{Push,Pull,
ForcePush,Fetch}, which always invoked CALL DOLT_PUSH/PULL/FETCH
without --user. The non-embedded DoltStore path has the
'if s.remoteUser != ""' branch that fires CALL DOLT_PUSH('--user',
?, ?, ?), but the embedded path bypasses it entirely.
Result: against a Dolt remotesapi server that requires CLONE_ADMIN
authentication, bd dolt push/pull from embedded mode fails with
"unauthenticated user does not have privilege CLONE_ADMIN", even when
DOLT_REMOTE_USER and DOLT_REMOTE_PASSWORD are set in the environment.
The shell-level workaround was to bypass bd: cd into the embedded
database dir and run 'dolt push --user beads origin main' directly.
Fix: extend versioncontrolops.{Push,Pull,ForcePush,Fetch} with a
trailing 'user string' (empty preserves prior behavior). When non-empty,
the SQL stored procedures get '--user' appended. EmbeddedDoltStore
reads DOLT_REMOTE_USER from the environment at call time and threads
it through; DOLT_REMOTE_PASSWORD is read by the in-process Dolt
server from the same env, matching the existing contract documented
on bd dolt push/pull.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
When DOLT_FETCH fails (network error, timeout, authentication), Dolt
leaves orphaned tmp_pack_* files in .dolt/git-remote-cache/. These
accumulate unboundedly across repeated failures and are never cleaned
up automatically.
Observed impact: 194 GB of tmp_pack_* debris on a single machine after
months of failed federation syncs.
Call DoltGC best-effort after a failed fetch so orphaned pack
temporaries are reclaimed before the error propagates. DoltGC requires
a non-transactional connection; if db is a transaction the GC will
fail silently, which is acceptable — the original fetch error is still
returned correctly.
Cherry-picked from #3308 by @athosmartins. The original PR bundled an
unrelated Gas Town schema migration (re-adding the `crystallizes`
column that migration 012 explicitly dropped) and accidentally deleted
a working #nosec directive in rules.go, so this pulls out just the
valuable fix.
Closes bd-fst
Co-authored-by: Athos Bernardes <athosmartins@gmail.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replace DOLT_PULL(remote, branch) with DOLT_FETCH + DOLT_MERGE to work
around a nil-pointer dereference in Dolt's doDoltPull when branch
tracking is not configured in repo_state.json.
Fixes GH#3144
Amp-Thread-ID: https://ampcode.com/threads/T-019d7329-1065-71ab-9fca-e4df3f7370c3
Co-authored-by: Amp <amp@ampcode.com>
DOLT_PULL('origin') with only the remote name causes a nil pointer
dereference in the embedded Dolt driver when resolving the branch from
tracking config. DOLT_PUSH already passes both remote and branch.
This aligns Pull() with Push() by passing the branch parameter:
DOLT_PULL('origin') → DOLT_PULL('origin', 'main')
Tested with GCS, file, and git+ssh remotes in embedded mode.
Fixes#2118 (related)
* fix: suppress auto-backup address conflict warning when default backup is configured
When a user runs `bd backup init <path>` it registers a Dolt backup named
"default". The auto-backup system also calls BackupDatabase() which registers
its own remote named "backup_export" pointing to the same .beads/backup/
directory. Dolt returns "Error 1105: address conflict with a remote: 'default'"
because two remotes cannot share a URL, causing a noisy warning on every write:
Warning: auto-backup failed: register backup remote: add backup backup_export: \
Error 1105: address conflict with a remote: 'default' -> file://.../backup
Fix: when BackupAdd fails with an address conflict, extract the name of the
already-registered remote from the error message and sync using that name
instead. The backup still runs — it just reuses the existing remote.
Adds ExtractAddressConflictName() to versioncontrolops for parsing the
conflicting name out of the Dolt error. Applies the fix to both the
EmbeddedDoltStore and DoltStore implementations of BackupDatabase().
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* test: add table-driven tests for ExtractAddressConflictName
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>