fix(namepool): only persist runtime state, not config in state file
The pool state file was saving CustomNames even though Load() ignored them (CustomNames come from settings/config.json). This caused the state file to have stale/incorrect custom names data. Changes: - Create namePoolState struct for persisting only OverflowNext/MaxSize - Save() now only writes runtime state, not configuration - Load() uses the same struct for consistency - Removed redundant runtime pool update from runNamepoolAdd since the settings file is the source of truth for custom names Fixes: gt-ofqzwv Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
committed by
Steve Yegge
parent
5823c9fb36
commit
bda1dc97c5
@@ -247,15 +247,9 @@ func runNamepoolAdd(cmd *cobra.Command, args []string) error {
|
||||
return fmt.Errorf("saving settings: %w", err)
|
||||
}
|
||||
|
||||
// Also update runtime pool for immediate use
|
||||
pool := polecat.NewNamePool(rigPath, rigName)
|
||||
if err := pool.Load(); err != nil && !os.IsNotExist(err) {
|
||||
return fmt.Errorf("loading pool: %w", err)
|
||||
}
|
||||
pool.AddCustomName(name)
|
||||
if err := pool.Save(); err != nil {
|
||||
return fmt.Errorf("saving pool: %w", err)
|
||||
}
|
||||
// Note: No need to update runtime pool state - the settings file is the source
|
||||
// of truth for custom names. The pool state file only persists OverflowNext/MaxSize.
|
||||
// New managers will load custom names from settings/config.json.
|
||||
|
||||
fmt.Printf("Added '%s' to the name pool\n", name)
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user