Skip to content

refactor: names follow the URL they serve - #569

Merged
retr0h merged 4 commits into
mainfrom
refactor/names-follow-the-url
Oct 1, 2026
Merged

retr0h merged 4 commits into
mainfrom
refactor/names-follow-the-url

Conversation

@retr0h

@retr0h retr0h commented Oct 1, 2026

Copy link
Copy Markdown
Collaborator

Applies the rule merged as osapi-io/specs#243. Five moves. The provider tree's nesting is untouched.

What moved

URL        /schedule/cron          ->  /schedule
scopes     cron:read/write         ->  schedule:read/write
SDK        client/cron.go          ->  client/schedule.go       (Client.Cron -> Client.Schedule)
provider   provider/scheduled/     ->  provider/schedule/       (cron/ stays nested inside)

API dir    api/node/docker/        ->  api/node/container/
API files  container_*.go          ->  docker_*.go              (prefix was inverted)
processor  processor_docker.go     ->  processor_container.go

provider   node/mem                ->  node/memory

cron is not a caller's choice the way a container runtime is. You would swap in at behind the same entrypoint, so it leaves the URL. The provider keeps provider/schedule/cron because that is where a second driver goes.

The container handlers had it inverted both ways: the directory named for the second URL segment, the files named for the first. network already does this correctly with dns_get.go and route_get.go, so container now matches.

What deliberately did not change

  • /container/docker keeps the driver in the URL. You choose Docker over Podman; Podman becomes /container/podman beside it.
  • provider/container/docker and provider/network/netplan/* keep their nesting. The provider tree groups by implementation so a new driver is a new directory.
  • node/apt and node/ntp keep hiding their drivers, because the host picks the package manager and chrony is swappable behind /ntp.

Checks

go build ./internal/... ./cmd/... ./pkg/... clean. go test ./internal/... is 41 packages, 0 failures.

Two things the tests caught, both path literals rather than identifiers:

  • schedule's HTTP tests POSTed to /schedule/cron, which now matches /schedule/{name} with name=cron and has no POST, so they got 405 instead of 401
  • the cron provider's own test files still imported provider/scheduled/cron

Still to do, not in this PR: docs pages, the UI TypeScript, and the orchestrator once this merges.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FuKUsHFG1EqZXamffh9M2c

Applies the rule in osapi-io/specs#243. Five moves, no change to the
provider tree's nesting.

cron is not a caller's choice the way a container runtime is, so it leaves
the URL. /schedule/cron becomes /schedule, the permission scopes become
schedule:read and schedule:write, and the SDK service is Schedule. The
provider keeps its driver directory at provider/schedule/cron, because that
is where a second driver would go.

The container handlers had the convention inverted: the directory was named
for the second URL segment and the files for the first. The directory is now
container and the files are docker_*.go, which is what network already does
with dns_get.go and route_get.go. The agent processor follows.

mem becomes memory. An abbreviation is not a name, and the URL, the SDK and
the generated types all said memory already.

What deliberately did not change: /container/docker keeps its driver in the
URL, provider/container/docker and provider/network/netplan/* keep their
nesting, and node/apt and node/ntp keep hiding their drivers.

Refs #566

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FuKUsHFG1EqZXamffh9M2c
retr0h and others added 3 commits October 1, 2026 13:15
The spec change renamed the schedule operations and schemas, so the
generated UI client had to be regenerated. orval writes new files but does
not delete the ones it no longer produces, which left the old
schedule-management-api-cron-operations module and twenty cron*.ts schemas
beside the new ones. Both sets exported the same shapes and the build broke
on the stale half.

The three hand-written components follow: cron-picker, cron-block and
cron-delete-block are named for the resource rather than the driver, like
every other component in that directory.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FuKUsHFG1EqZXamffh9M2c
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FuKUsHFG1EqZXamffh9M2c
Three classes of reference the sweeps missed, all caught by go vet rather
than by go test.

The memory package's own _test.go files are package memory_test and refer
to the package under test by its import name. The import path was rewritten
and the references were not, because the sweep skipped files inside the
package's own directory to avoid touching gopsutil's mem.

The SDK's Client field is Schedule now, and two tests plus one example still
read c.Cron.

go test had been reporting these packages as cached passes from before the
rename, which is why they looked green locally while CI failed.

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

codecov Bot commented Oct 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #569   +/-   ##
=======================================
  Coverage   99.95%   99.95%           
=======================================
  Files         501      501           
  Lines       24073    24073           
=======================================
  Hits        24063    24063           
  Misses         10       10           
Files with missing lines Coverage Δ
internal/agent/agent.go 100.00% <100.00%> (ø)
internal/agent/condition.go 100.00% <ø> (ø)
internal/agent/heartbeat.go 100.00% <100.00%> (ø)
internal/agent/processor.go 100.00% <100.00%> (ø)
internal/agent/processor_container.go 100.00% <ø> (ø)
internal/agent/processor_schedule.go 100.00% <100.00%> (ø)
...nternal/controller/api/node/container/container.go 100.00% <ø> (ø)
internal/controller/api/node/container/convert.go 100.00% <ø> (ø)
...nal/controller/api/node/container/docker_create.go 100.00% <ø> (ø)
...ernal/controller/api/node/container/docker_exec.go 100.00% <ø> (ø)
... and 28 more

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 0423785...250540d. 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 bff8401 into main Oct 1, 2026
12 checks passed
@retr0h
retr0h deleted the refactor/names-follow-the-url branch October 1, 2026 20:40
retr0h added a commit that referenced this pull request Oct 4, 2026
#569 settled that cron is the driver and schedule is the domain, and
renamed the URL, the provider directory, the processor and the SDK. The
CLI help text and the documentation were not renamed with them, so
`osapi client node schedule list --help` said it listed cron entries.

The eight help strings that named the thing a user manages are now
scheduled entries. The ones that name cron itself stay: the file paths
under /etc/cron.d, the five-field expression format, and the provider.
Whether cron implements it is not the caller's concern, which is the
reason the URL says schedule.

Three of these were wrong rather than merely stale. The SDK page was
titled Cron, documented `client.Cron.List()` and used CronCreateOpts and
CronUpdateOpts throughout its examples. The field is `Schedule
*ScheduleService` and the types are ScheduleCreateOpts and
ScheduleUpdateOpts, so every call on that page named something that does
not exist and none of it would compile. The page also linked to
examples/sdk/client/cron.go, which is schedule.go, so the link was dead.
The SDK dropdown and the service index listed it as Cron as well.

Swept docs/, examples/ and the README for other stale symbols. There
were none.

Closes: #590


Claude-Session: https://claude.ai/code/session_01FuKUsHFG1EqZXamffh9M2c

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
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