fix(memory): replace hermes-specific names with generic equivalents
SaveConfig's hermesHome parameter and HERMES_HOME references in comments were copied from another project. The interface and its callers are entirely internal to archie-core (no external call sites exist outside tests), so renaming them is safe. hermesHome -> dataHome HERMES_HOME -> data directory /tmp/hermes -> /tmp/archie-test
This commit is contained in:
1 parent
6c32550345
commit
782ba5b525
4 files changed
+18
-17
No files matched your search
@@ -2,13 +2,14 @@ package memory
|
||||
|
||||
// ── Backup paths interface ─────────────────────────────────────────────────
|
||||
//
|
||||
// Providers that store data outside HERMES_HOME implement BackupProvider so
|
||||
// the backup/restore workflow can include those external paths.
|
||||
// Providers that store data outside the data directory implement
|
||||
// BackupProvider so the backup/restore workflow can include those external
|
||||
// paths.
|
||||
|
||||
// BackupProvider is an optional interface for providers that store data
|
||||
// outside the main HERMES_HOME directory tree. Examples include external
|
||||
// SQLite databases, vector-store indexes, or key-value stores that live
|
||||
// at well-known paths elsewhere on the filesystem.
|
||||
// outside the main data directory tree. Examples include external SQLite
|
||||
// databases, vector-store indexes, or key-value stores that live at
|
||||
// well-known paths elsewhere on the filesystem.
|
||||
type BackupProvider interface {
|
||||
// BackupPaths returns absolute file or directory paths that should be
|
||||
// included in backup/restore workflows. Return an empty slice when the
|
||||
|
||||
@@ -23,8 +23,8 @@ type ConfigSchemaProvider interface {
|
||||
type SaveConfigProvider interface {
|
||||
// SaveConfig validates and persists the given configuration values.
|
||||
// values is the complete set of provider-specific config key/value
|
||||
// pairs. hermesHome is the root of the HERMES_HOME directory tree;
|
||||
// the provider should write its config to a provider-specific location
|
||||
// under this path.
|
||||
SaveConfig(values map[string]any, hermesHome string) error
|
||||
// pairs. dataHome is the root of the data directory tree; the provider
|
||||
// should write its config to a provider-specific location under this
|
||||
// path.
|
||||
SaveConfig(values map[string]any, dataHome string) error
|
||||
}
|
||||
@@ -930,7 +930,7 @@ func (m *Manager) GetConfigSchemas() map[string]map[string]any {
|
||||
// persists them via SaveConfigProvider. It returns ErrProviderNotFound
|
||||
// when the named provider is not active, and an error when the provider
|
||||
// does not implement SaveConfigProvider or when validation fails.
|
||||
func (m *Manager) SaveConfig(providerName string, values map[string]any, hermesHome string) error {
|
||||
func (m *Manager) SaveConfig(providerName string, values map[string]any, dataHome string) error {
|
||||
m.mu.RLock()
|
||||
p := m.providerByNameLocked(providerName)
|
||||
m.mu.RUnlock()
|
||||
@@ -944,7 +944,7 @@ func (m *Manager) SaveConfig(providerName string, values map[string]any, hermesH
|
||||
return fmt.Errorf("memory: provider %q does not implement SaveConfigProvider", providerName)
|
||||
}
|
||||
|
||||
return scp.SaveConfig(values, hermesHome)
|
||||
return scp.SaveConfig(values, dataHome)
|
||||
}
|
||||
|
||||
// ── Backup paths ───────────────────────────────────────────────────────
|
||||
|
||||
@@ -52,7 +52,7 @@ type mockProvider struct {
|
||||
lastToolName string
|
||||
lastToolArgs map[string]any
|
||||
lastSaveValues map[string]any
|
||||
lastSaveHermesHome string
|
||||
lastSaveDataHome string
|
||||
lastConfigSchema map[string]any
|
||||
lastBackupPaths []string
|
||||
|
||||
@@ -234,11 +234,11 @@ func (m *mockProvider) GetConfigSchema() map[string]any {
|
||||
return schema
|
||||
}
|
||||
|
||||
func (m *mockProvider) SaveConfig(values map[string]any, hermesHome string) error {
|
||||
func (m *mockProvider) SaveConfig(values map[string]any, dataHome string) error {
|
||||
m.mu.Lock()
|
||||
m.saveConfigCalls++
|
||||
m.lastSaveValues = values
|
||||
m.lastSaveHermesHome = hermesHome
|
||||
m.lastSaveDataHome = dataHome
|
||||
m.mu.Unlock()
|
||||
return nil
|
||||
}
|
||||
@@ -957,7 +957,7 @@ func TestManager_SaveConfig(t *testing.T) {
|
||||
}
|
||||
|
||||
values := map[string]any{"key": "value"}
|
||||
if err := mgr.SaveConfig("builtin", values, "/tmp/hermes"); err != nil {
|
||||
if err := mgr.SaveConfig("builtin", values, "/tmp/archie-test"); err != nil {
|
||||
t.Fatalf("SaveConfig() returned error: %v", err)
|
||||
}
|
||||
|
||||
@@ -975,7 +975,7 @@ func TestManager_SaveConfig_UnknownProvider(t *testing.T) {
|
||||
t.Fatalf("NewManager returned error: %v", err)
|
||||
}
|
||||
|
||||
err = mgr.SaveConfig("nonexistent", map[string]any{}, "/tmp/hermes")
|
||||
err = mgr.SaveConfig("nonexistent", map[string]any{}, "/tmp/archie-test")
|
||||
if err == nil {
|
||||
t.Fatal("expected error for unknown provider, got nil")
|
||||
}
|
||||
@@ -988,7 +988,7 @@ func TestManager_SaveConfig_ProviderLacksSaveConfig(t *testing.T) {
|
||||
t.Fatalf("NewManager returned error: %v", err)
|
||||
}
|
||||
|
||||
err = mgr.SaveConfig("minimal", map[string]any{}, "/tmp/hermes")
|
||||
err = mgr.SaveConfig("minimal", map[string]any{}, "/tmp/archie-test")
|
||||
if err == nil {
|
||||
t.Fatal("expected error when provider lacks SaveConfigProvider, got nil")
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user