config: detect duplicate & internal job names at parse time

Before this PR, config parsing would accept duplicate job names.
`zrepl daemon` would later fail to start with a panic.
But tools like `zrepl configcheck` would pass.

This PR adds a check to ensure job names are unique.

Similarly, internal job names were not being rejected by config
parsing
Move that check to parse-time as well.
This commit is contained in:
Christian Schwarz
2026-01-19 08:20:07 +00:00
parent 4d6583ea5f
commit 8153d399f0
9 changed files with 108 additions and 54 deletions
+2 -2
View File
@@ -11,7 +11,7 @@ import (
yaml "github.com/zrepl/yaml-config"
"github.com/zrepl/zrepl/internal/client/status/viewmodel/stringbuilder"
"github.com/zrepl/zrepl/internal/daemon"
"github.com/zrepl/zrepl/internal/config"
"github.com/zrepl/zrepl/internal/daemon/job"
"github.com/zrepl/zrepl/internal/daemon/pruner"
"github.com/zrepl/zrepl/internal/daemon/snapper"
@@ -85,7 +85,7 @@ func (m *M) Update(p Params) {
// filter out internal jobs
var jobsList []*Job
for _, j := range m.jobsList {
if daemon.IsInternalJobName(j.name) {
if config.IsInternalJobName(j.name) {
continue
}
jobsList = append(jobsList, j)