fix: remote dolt server support — backup, push, pull#3595
Draft
trillium wants to merge 20 commits into
Draft
Conversation
e8fa487 to
11983f3
Compare
|
7ce0b17 to
773d23f
Compare
4ec26be to
2a36d35
Compare
dad87a1 to
63db715
Compare
224c8aa to
df8604f
Compare
Add tests for isRemoteHost() and isRemoteDoltServerForDir() that verify remote hosts (LAN IPs, hostnames, FQDNs) are correctly identified. These tests currently FAIL because isRemoteHost() is stubbed to always return false — it does not yet detect remote servers. The next commit will implement the fix.
… (green)
Implement isRemoteHost() to correctly identify non-localhost hosts.
In runBackupExport(), check isRemoteDoltServer() before calling
DOLT_BACKUP. When the server is remote, fall back to JSONL export
via exportToFile() which queries data through SQL SELECT and writes
locally — working correctly regardless of server location.
This prevents DOLT_BACKUP('add', ..., 'file:///local/path') from
sending local filesystem paths to remote servers, which would cause
the remote server to create garbage directories on its own filesystem.
…g (red) Tests verify that pushToRemote and pullFromRemote on a remote Dolt server (e.g., host=mini2) skip the CLI-dir guard and fall through to the SQL path (CALL DOLT_PUSH/DOLT_PULL). Currently fails to compile because the serverHost field and isRemoteServer method don't exist yet.
When beads is configured with dolt_mode: server pointing at a remote host (e.g., mini2), pushToRemote and pullFromRemote now skip the CLI-dir error guards and fall through to the SQL path (CALL DOLT_PUSH / CALL DOLT_PULL). The SQL command is sent to the remote server which executes it server-side, so no local CLI directory is needed. Changes: - Add serverHost field to DoltStore, populated from Config.ServerHost - Add isRemoteServer() method using existing isLocalHost() helper - Guard the two CLI-dir error paths in pushToRemote with !isRemoteServer() - Guard the two CLI-dir error paths in pullFromRemote with !isRemoteServer() - Tests verify remote servers bypass the guard, local servers still hit it
…ds (red) Tests verify that BackupDatabase() and RestoreDatabase() on DoltStore reject remote servers (file:// URLs sent to remote hosts create dirs on wrong machine), and that backup init with file:// URL + remote server returns an error while DoltHub/cloud URLs still work. User stories: docs/REMOTE_SERVER_USER_STORIES.md (Backup section)
… (green) BackupDatabase() and RestoreDatabase() on DoltStore now check isRemoteServer() and return a clear error instead of sending file:// URLs to the remote host. backup init also guards: file:// URLs + remote server = error, while cloud URLs (DoltHub, S3, GCS) pass through since the remote server can reach them. User stories: docs/REMOTE_SERVER_USER_STORIES.md (Backup section)
Add stories for: explicit output location requirement, DoltHub URL passthrough for remote servers, and clearer error messaging guidance.
…red) Tests verify that bd backup sync on a remote Dolt server returns a helpful error suggesting bd export -o when no cloud backup URL is configured, instead of letting the user hit confusing filesystem errors.
When connected to a remote Dolt server, bd backup sync now checks whether a cloud backup destination (DoltHub, S3, GCS) is configured. If only a filesystem path or no backup is configured, it returns a clear error suggesting bd export -o for JSONL export instead of letting the sync fail with a confusing server-side filesystem error.
…hable server (red) Verifies that connection errors use the format "cannot connect to dolt server at <host>:<port>" instead of raw driver errors or "Dolt server unreachable" messages. Also verifies the error completes within a reasonable timeout.
…(green) Change connection error messages from "Dolt server unreachable at" to "cannot connect to dolt server at <host>:<port>" for all three failure paths: auto-start failed, auto-started but still unreachable, and no auto-start. This gives users a clear, consistent message when the SQL connection is down, matching the user story contract. The DSN already has a 5s connect timeout via doltutil.ServerDSN, and the fail-fast TCP dial uses 500ms, so connections don't hang.
…g (red) Tests expect pushToRemote and pullFromRemote to wrap Dolt's raw SQL "remote not found" error with a user-friendly message explaining that no remotes are configured on the server.
…ge (green) When DOLT_PUSH or DOLT_PULL fails because no remotes are configured on the server, wrap the raw SQL error with a clear message: "no remotes configured on the dolt server; configure a remote on the server first".
When beads is connected to a remote Dolt server, filesystem-dependent doctor checks (Dolt Format, Remote Consistency, Btrfs NoCOW) should return "skip" status with message "skipped: remote server mode" instead of misleading errors about missing directories. Also stubs checkBackupSyncRemoteGuard so the test package compiles (pre-existing red test from bc72bff).
Add StatusSkip constant and IsRemoteServerMode() detection to the doctor package. When the configured Dolt server host is not localhost, checks that access the local .dolt/ directory now return "skip" status with message "skipped: remote server mode" instead of misleading errors about missing directories. Skipped checks: Dolt Format, Remote Consistency, Btrfs NoCOW (dolt). SQL-based checks (Dolt Locks, schema, etc.) still run normally since they query the remote server. The printDiagnostics output shows skip count in the summary header.
…d decisions - Remove duplicate checkBackupSyncRemoteGuard stub added by doctor agent (real implementation at line 201, stub at line 489) - Update user stories: resolve config conflict decision (remote host wins, CLI dir ignored with warning), fix backup export stories to match reality (bd export -o exists, auto-backup JSONL fallback works), expand general principle exceptions, remove connection timeout from out-of-scope
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.
Summary
Fixes multiple operations that break when beads connects to a remote dolt server (e.g.,
host: mini2) instead of localhost.Root cause: Several code paths assume local filesystem access — sending
file://URLs to a remote server, or requiring a local dolt CLI directory that doesn't exist.Fixed so far
CALL DOLT_BACKUPwith local pathCALL DOLT_PUSH/CALL DOLT_PULL)Coming
file://URL problem as backup export🚧 Work in progress — more changes coming
Test plan
TestIsRemoteHost— 10 subtests (local/remote host detection)TestIsRemoteDoltServer— 4 subtests (config-based detection)TestIsRemoteServer— 8 subtests (store-level detection)TestRemoteServerPushSkipsCLIDirGuardTestRemoteServerPullSkipsCLIDirGuardTestLocalServerPushStillRequiresCLIDir