A missing leftover config.yaml starts the setup wizard even when state.db already holds Settings. Finishing the wizard can commit that new YAML over live configuration.
Found on master 6eadec3f (schema 2: settings live in SQLite; YAML is a locator and rollback seed).
What happens
cfg, err := config.Load(*configPath)
if err != nil {
if isConfigMissing(*configPath) {
runBootstrap(*configPath, *webDir, resolveDriverDir())
return
}
}
isConfigMissing is only Lstat of the seed path. It does not look for state.db or settings/config_v1.
The wizard writes a new YAML. InitializeStorage then sees an existing settings row whose YAMLSourceHash does not match the new file, sets legacySave, and saveStored commits the wizard document over the live Settings (go/internal/config/storage.go).
The same legacySave path fires if the leftover seed is edited or config_database is removed: YAML becomes authority again.
TestMissingDatabaseDoesNotStartSetup only covers the inverse (locator present, DB gone).
What a fix needs
- If
state.db already has settings/config_v1, do not enter the wizard because the seed file is missing. Recreate the locator YAML from SQLite instead.
- Refuse
legacySave when the new YAML is a wizard/default document rather than an old-Core rollback save.
- Tests: delete
config.yaml, keep state.db with Settings, start Core — Settings unchanged, locator rewritten, wizard not shown.
- Same for an edited leftover seed.
This is a data-loss path on every schema-2 box that still has a seed file beside the DB (the documented layout).
A missing leftover
config.yamlstarts the setup wizard even whenstate.dbalready holds Settings. Finishing the wizard can commit that new YAML over live configuration.Found on master
6eadec3f(schema 2: settings live in SQLite; YAML is a locator and rollback seed).What happens
isConfigMissingis onlyLstatof the seed path. It does not look forstate.dborsettings/config_v1.The wizard writes a new YAML.
InitializeStoragethen sees an existing settings row whoseYAMLSourceHashdoes not match the new file, setslegacySave, andsaveStoredcommits the wizard document over the live Settings (go/internal/config/storage.go).The same
legacySavepath fires if the leftover seed is edited orconfig_databaseis removed: YAML becomes authority again.TestMissingDatabaseDoesNotStartSetuponly covers the inverse (locator present, DB gone).What a fix needs
state.dbalready hassettings/config_v1, do not enter the wizard because the seed file is missing. Recreate the locator YAML from SQLite instead.legacySavewhen the new YAML is a wizard/default document rather than an old-Core rollback save.config.yaml, keepstate.dbwith Settings, start Core — Settings unchanged, locator rewritten, wizard not shown.This is a data-loss path on every schema-2 box that still has a seed file beside the DB (the documented layout).