Skip to content

config: detect duplicate & internal job names at parse time - #908

Merged
problame merged 1 commit into
masterfrom
problame/config-job-names
Jan 19, 2026
Merged

problame merged 1 commit into
masterfrom
problame/config-job-names

Conversation

@problame

@problame problame commented Jan 19, 2026 •

Copy link
Copy Markdown
Member

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.

Last, drive-by change: remove internal/config/config_include_test.go introduced in #856 . These aren't necessary because there is already a wildcard test for all valid configs.
This PR adds the complimentary "invalid config" wildcard test.

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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR moves validation of duplicate job names and internal job names (those starting with "_") from daemon runtime to configuration parse time. This improvement allows tools like zrepl configcheck to catch these errors without starting the daemon.

Changes:

  • Moved IsInternalJobName function from daemon package to config package for better accessibility
  • Added validateJobNames function in config parsing that checks for both internal job names and duplicates after config includes are expanded
  • Added comprehensive test coverage with three invalid sample configs

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
internal/config/config.go Added IsInternalJobName function and validateJobNames that validates job names after includes are expanded
internal/daemon/daemon.go Removed IsInternalJobName function and updated all calls to use config.IsInternalJobName
internal/client/status/viewmodel/render.go Updated import and function call to use config.IsInternalJobName
internal/config/config_test.go Added TestInvalidSampleConfigsFailToParse to verify invalid configs are rejected
internal/config/config_include_test.go Removed redundant tests that are covered by existing TestSampleConfigsAreParsedWithoutErrors
internal/config/samples/invalid/* Added three test cases: internal job name, duplicate job names, and duplicate job names with includes

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@problame
problame merged commit 860a9be into master Jan 19, 2026
11 of 19 checks passed
@problame
problame deleted the problame/config-job-names branch January 19, 2026 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants