fix: reliable metadata writes for Dolt backend (bd_version, repo_id, clone_id)#1741
Merged
steveyegge merged 4 commits intosteveyegge:mainfrom Feb 14, 2026
Merged
Conversation
…kend bd init --backend dolt silently swallowed metadata write failures for bd_version, repo_id, and clone_id. Doctor and daemon then failed with confusing errors about missing metadata. Add verifyMetadata() helper that writes each field then reads it back, emitting a specific warning with "bd doctor --fix" guidance on failure. Init continues (non-fatal) but failures are now visible and actionable. - Add verifyMetadata() write+verify helper to init.go - Replace Pattern B (warn-and-swallow) with belt-and-suspenders pattern - Handle non-git environments gracefully (skip repo_id with warning) - Add function-level tests for all 3 fields, failure paths, and edge cases - Add e2e test for init→doctor roundtrip validation Refs: steveyegge#1725
… messages Add doctor --fix metadata remediation for existing Dolt databases missing bd_version, repo_id, or clone_id. Wire into both Database and Repo Fingerprint doctor check cases. Update fix messages to suggest 'bd doctor --fix' instead of 'bd migrate'.
Problem: - Migration skipped repo_id and clone_id when bd_version matched - Missing identity fields left Dolt metadata incomplete Solution: - Extend Dolt metadata migration to set repo_id and clone_id - Cover migration paths with unit and e2e tests Impact: - Repositories keep identity fields even when version is current - Metadata migration behaves consistently across scenarios
golangci-lint flagged the quiet parameter as unused (unparam). The function always prints warnings on failure, and callers already gate success messages externally. Metadata write warnings should always be visible regardless of quiet mode.
fccbc53 to
98b090a
Compare
Contributor
Author
CI Notes4 of the CI checks show failures. Here's a breakdown: Pre-existing (not from this PR)
Fixed in this push
All failures are in files and packages outside this PR's scope ( |
Atmosphere-Aviation
pushed a commit
to Atmosphere-Aviation/beads
that referenced
this pull request
Feb 17, 2026
…clone_id) (steveyegge#1741) * fix(init): add belt-and-suspenders metadata verification for Dolt backend bd init --backend dolt silently swallowed metadata write failures for bd_version, repo_id, and clone_id. Doctor and daemon then failed with confusing errors about missing metadata. Add verifyMetadata() helper that writes each field then reads it back, emitting a specific warning with "bd doctor --fix" guidance on failure. Init continues (non-fatal) but failures are now visible and actionable. - Add verifyMetadata() write+verify helper to init.go - Replace Pattern B (warn-and-swallow) with belt-and-suspenders pattern - Handle non-git environments gracefully (skip repo_id with warning) - Add function-level tests for all 3 fields, failure paths, and edge cases - Add e2e test for init→doctor roundtrip validation Refs: steveyegge#1725 * fix(doctor): add FixMissingMetadata for Dolt databases and update fix messages Add doctor --fix metadata remediation for existing Dolt databases missing bd_version, repo_id, or clone_id. Wire into both Database and Repo Fingerprint doctor check cases. Update fix messages to suggest 'bd doctor --fix' instead of 'bd migrate'. * fix(migrate): set repo_id and clone_id when version is current Problem: - Migration skipped repo_id and clone_id when bd_version matched - Missing identity fields left Dolt metadata incomplete Solution: - Extend Dolt metadata migration to set repo_id and clone_id - Cover migration paths with unit and e2e tests Impact: - Repositories keep identity fields even when version is current - Metadata migration behaves consistently across scenarios * fix(init): remove unused quiet parameter from verifyMetadata golangci-lint flagged the quiet parameter as unused (unparam). The function always prints warnings on failure, and callers already gate success messages externally. Metadata write warnings should always be visible regardless of quiet mode.
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 #1725 —
bd init --backend doltsilently swallows metadata write failures, leaving databases withoutbd_version,repo_id, andclone_id. This PR adds three complementary repair paths so metadata is reliably set regardless of how a Dolt database was created.Repair Paths
Changes
1. Belt-and-suspenders init (
init.go)verifyMetadata()helper: write + read-back verification for each metadata field. On failure: warns with actionable guidance ("runbd doctor --fix"). Preserves existing Pattern B (warn-and-continue) semantics.2. Doctor fix remediation (
doctor/fix/metadata.go)New
FixMissingMetadatacheck forbd doctor --fix. Detects and repairs missing fields on existing Dolt databases. Identity fields are non-fatal.3. Migration metadata extension (
migrate.go)handleDoltMetadataUpdate()now sets all three fields. Checks upfront; early-returns only when ALL are present.4. Lint cleanup (
init.go)Removed unused
quietparameter fromverifyMetadata(golangci-lint unparam finding).Commit Guide
8235e227f78558d879ac5fdafccbc535Testing
//go:build cgo && integration)make testclean (4 pre-existing failures ininternal/syncbranchunrelated)golangci-lint run --new-from-rev=upstream/main— 0 issuesReview Guidance
migrate.gohandleDoltMetadataUpdate— early-return logic changeddoctor/fix/metadata.goinit.goverifyMetadatahelper — straightforward write+read-backdoctor_fix.go,doctor/*.go*_test.go,*_e2e_test.go