fix(service,user): errors read as the convention says - #575
Merged
Merged
Conversation
The last two providers from #565. service used <domain>: <verb>, a colon away from the convention, so every operation reported "service: " and the verb read as part of the message rather than as the operation. user named commands rather than operations: chpasswd failed, useradd failed, groupadd failed. Those stop being true the day the implementation changes, and a CLI user has no reason to know which binary runs underneath. They now read "user create: useradd: ..." and "user set-password: chpasswd: ...", keeping the command as detail rather than as the subject. Three things the tests caught, all the same shape. Prefixing an error that a caller already wraps doubles the domain, which happened to the password hash and name validations and to chpasswd. And a sed over test files hit a mock's command argument, rewriting the systemctl argument "daemon-reload" rather than the message about it. validate.go keeps its shared "invalid %s name %q" wording. It is used by both user and group and changing it means changing a signature, so it is left for a change that can be about that alone. Refs #565 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FuKUsHFG1EqZXamffh9M2c
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #575 +/- ##
=======================================
Coverage 99.95% 99.95%
=======================================
Files 501 501
Lines 24073 24073
=======================================
Hits 24063 24063
Misses 10 10
Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The last two providers from #565. 13 files. With #573 and #574 this completes the convention across all six.
servicewas a colon away from the convention, so every operation reportedservice:and the verb read as part of the message rather than as the operation.usernamed commands rather than operations.chpasswd failedstops being true the day the implementation changes, and a CLI user has no reason to know which binary runs underneath. The command survives as detail rather than as the subject.Three things the tests caught, all the same shape
Prefixing an error a caller already wraps doubles the domain. Hit the password hash validation, the name validation and chpasswd:
A sed over test files hit a mock's command argument, rewriting the systemctl argument
"daemon-reload"rather than the message about it. The mock then expected a flag that does not exist.Not changed
validate.gokeeps its sharedinvalid %s name %qwording. It is used by both user and group, and changing it means changing a signature, so it belongs in a change that can be about that alone. Worth a follow-up.Checks
go vet ./...clean.go test -count=1 ./internal/...is 41 packages, 0 failures.🤖 Generated with Claude Code
https://claude.ai/code/session_01FuKUsHFG1EqZXamffh9M2c