feat(config): add central server config library#3258
Draft
trillium wants to merge 4 commits intogastownhall:mainfrom
Draft
feat(config): add central server config library#3258trillium wants to merge 4 commits intogastownhall:mainfrom
trillium wants to merge 4 commits intogastownhall:mainfrom
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Add test cases for LoadCentralConfig, ApplyCentralDefaults, and DefaultCentralConfigPath with stub implementations. Tests define the expected behavior; implementations follow in the next commit.
Implement LoadCentralConfig and ApplyCentralDefaults to satisfy the specs from the previous commit. LoadCentralConfig reads and parses ~/.config/beads/server.json; ApplyCentralDefaults merges server-only fields into per-project config at zero values.
a4d4e59 to
18634c8
Compare
Add tests that verify applyCentralConfigDefaults loads the central server config and merges it into the per-project config. Stub implementation is a no-op; tests define expected behavior before the wiring is implemented.
Implement applyCentralConfigDefaults and call it in both NewFromConfigWithOptions and NewFromConfigWithCLIOptions so that server fields from ~/.config/beads/server.json are applied as defaults before per-project config resolution.
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.
Overview
Eliminates the need to duplicate server connection settings (host, port, user, mode, TLS) across 30+ per-project
metadata.jsonfiles by introducing a central config library that can load machine-wide defaults from~/.config/beads/server.json.Changes
LoadCentralConfig(),DefaultCentralConfigPath(), andApplyCentralDefaults()to the configfile packageapplyCentralConfigDefaults()intoNewFromConfigWithOptionsandNewFromConfigWithCLIOptionsininternal/storage/dolt/open.goDesign decisions
BEADS_CENTRAL_CONFIGenv varTest plan
Run
go test ./internal/configfile/ -run TestLoadCentral -vandgo test ./internal/configfile/ -run TestApplyCentral -vto validate the library, andgo test ./internal/storage/dolt/ -run TestApplyCentralConfigDefaults -vto validate the integration wiring:(nil, nil)— no error, graceful skipBEADS_DOLT_SERVER_HOST, etc.) override both project and central via getter methodsnilcentral config is a no-opDefaultCentralConfigPath()returns a path ending inbeads/server.jsonapplyCentralConfigDefaultsloads and applies central config to per-project configCommits
test(config): add specs for central server config library— Stub implementations + full test suite. Three tests fail (LoadCentralConfig_FileExists,LoadCentralConfig_InvalidJSON,ApplyCentralDefaults_FillsEmptyFields), defining expected behavior before implementation.feat(config): implement central server config library— Fill inLoadCentralConfig(read + parse JSON, graceful skip on missing file) andApplyCentralDefaults(merge server-only fields at zero values). All 9 tests pass.test(config): add integration specs for central config wiring— StubapplyCentralConfigDefaultsinopen.go+ integration tests. One test fails (WiresIntoOpenPath), proving the glue function doesn't yet load/apply the central config.feat(config): wire central config into store open paths— ImplementapplyCentralConfigDefaultsand call it in bothNewFromConfigWithOptionsandNewFromConfigWithCLIOptions. All integration tests pass.