Skip to content

fix(schedule,ntp,certificate): errors read as the convention says - #574

Merged
retr0h merged 2 commits into
mainfrom
fix/schedule-error-shape
Oct 2, 2026
Merged

retr0h merged 2 commits into
mainfrom
fix/schedule-error-shape

Conversation

@retr0h

@retr0h retr0h commented Oct 2, 2026

Copy link
Copy Markdown
Collaborator

Three more providers onto <domain> <verb>, following osapi-io/specs#245 and #573. 8 files.

schedule     create cron entry: ...        ->  schedule create: ...
             invalid cron entry name       ->  schedule: name must not be empty
ntp          ntp: write file: ...          ->  ntp create: write file: ...
             ntp: chronyc tracking: ...    ->  ntp get: chronyc tracking: ...
certificate  create certificate: ...       ->  certificate create: ...

schedule was still naming cron, which the rename had taken out of every other layer.

ntp used a bare <domain>, so five different operations all reported ntp: and a reader could not tell a failed write from a failed chronyc call.

certificate used <verb> <domain>, the exact mirror of the convention.

One thing worth knowing for the remaining two

Each provider has two name-validation errors, an exact-match and a %q variant:

fmt.Errorf("invalid certificate name: empty")
fmt.Errorf("invalid certificate name %q: must match %s", ...)

The first reads like the whole rule, so the second is easy to miss. certificate's was, until the tests caught it.

Checks

go vet ./... clean. ntp, certificate and schedule all pass. I also grepped the whole repo for every old prefix to catch assertions outside these packages; the only hits are a mock fixture in an ntp handler test (unaffected, and darwin.go returns a bare sentinel), plus log messages and a test name.

Remaining

service uses a bare <domain>, and user has chpasswd failed:, which names a command rather than an operation and stops being true when the implementation changes. 60 errors between them, so they follow separately.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FuKUsHFG1EqZXamffh9M2c

Three more providers onto <domain> <verb>, following osapi-io/specs#245.

schedule used <verb> <domain> and named cron, which the rename had already
taken out of every other layer: "create cron entry" becomes "schedule
create", "invalid cron entry name" becomes "schedule: name must not be
empty".

ntp used a bare <domain>, so five different operations all reported "ntp:"
and the reader could not tell a failed write from a failed chronyc call.
Each now names its operation.

certificate used <verb> <domain>, the mirror of the convention.

Each has an exact-match and a %q variant of its name validation, and the %q
one is easy to miss because the exact-match string reads like the whole rule.
certificate's was, until the tests caught it.

Two providers left: service uses a bare <domain> and user has
"chpasswd failed", which names a command rather than an operation.

Refs #565

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FuKUsHFG1EqZXamffh9M2c
@codecov

codecov Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #574   +/-   ##
=======================================
  Coverage   99.95%   99.95%           
=======================================
  Files         501      501           
  Lines       24073    24073           
=======================================
  Hits        24063    24063           
  Misses         10       10           
Files with missing lines Coverage Δ
internal/provider/node/certificate/debian.go 100.00% <100.00%> (ø)
internal/provider/node/certificate/debian_list.go 100.00% <100.00%> (ø)
internal/provider/node/ntp/debian.go 100.00% <100.00%> (ø)
internal/provider/schedule/cron/debian.go 100.00% <100.00%> (ø)

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 722a54b...ad816c0. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@retr0h
retr0h merged commit 42315fe into main Oct 2, 2026
12 checks passed
@retr0h
retr0h deleted the fix/schedule-error-shape branch October 2, 2026 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant