P1.3: rename storage files to gosentry.json / jobs.json

- ConfigFileName → "gosentry.json", JobsFileName → "jobs.json"
- Remove exported LegacyConfigFileName ("pysentry.yaml")
- Add unexported legacyYAMLConfigFileName / legacyYAMLJobsFileName for
  the upcoming one-time YAML import (P1.4)
- Update store.go fallback path and comments to describe YAML→JSON
  migration rather than the old PySentry→GoSentry rename
- Align store_test.go references and test comments

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
mixeme
2026-06-22 21:33:02 +03:00
parent 7ec5521309
commit 8df248a1b2
4 changed files with 23 additions and 25 deletions
+6 -8
View File
@@ -41,9 +41,9 @@ func OpenStore() (*Store, []domain.Job, error) {
return nil, nil, err
}
normalizeJobs(jobs)
// Jobs are also rewritten after normalization. That keeps jobs.yaml compact:
// Jobs are also rewritten after normalization. That keeps jobs.json compact:
// only durable job definitions remain, because runtime fields are tagged
// yaml:"-" in the model.
// json:"-" in the model.
if err := store.SaveJobs(jobs); err != nil {
return nil, nil, err
}
@@ -80,13 +80,11 @@ func loadOrCreateConfig(paths Paths) (domain.Config, error) {
configPath := paths.ConfigPath
if _, err := os.Stat(configPath); errors.Is(err, os.ErrNotExist) {
legacyPath := filepath.Join(paths.AppDir, LegacyConfigFileName)
legacyPath := filepath.Join(paths.AppDir, legacyYAMLConfigFileName)
if _, legacyErr := os.Stat(legacyPath); legacyErr == nil {
// The rename from PySentry to GoSentry changed the preferred config
// filename. Read the old file once if it is still present so portable
// installs continue to start without a manual migration step. The
// caller later saves the loaded config back through SaveConfig, which
// naturally rewrites it under gosentry.yaml.
// gosentry.yaml is the pre-JSON-migration config file. Read it once
// when gosentry.json is absent so existing installs migrate without
// manual intervention. SaveConfig rewrites the result as gosentry.json.
configPath = legacyPath
} else {
return config, writeJSON(paths.ConfigPath, config)