Skip to content

Rename a provisioner, filter jobs, inbox done from the CLI - #71

Merged
helightdev merged 3 commits into
mainfrom
api-gaps
Nov 15, 2026
Merged

helightdev merged 3 commits into
mainfrom
api-gaps

Conversation

@helightdev

Copy link
Copy Markdown
Owner

Adds a rename action for provisioners and fills two small gaps found in an audit of the API.

  • Provisioner rename (rename action, berth provisioner rename NAME NEW). One store transaction moves the entry (with its type, settings and node), the provisioner's own secrets provisioner/NAME/*, the legacy settings row, the provisioner name in every resource record (deployments, made machines and planned machines, own and file scopes), and the jobs of provisioner:NAME. Secrets left over under the new name are dropped. The rename also takes the new name's lock and the locks of everything the provisioner holds, so no running work writes a record with the old name. A name that is taken, invalid or unchanged gets a 400 before the job starts. A node's provisioner stays the node's, and the next apply still finds it (it is matched by node and type).
  • jobs.list filters: subject, host (exact, also inside a roll-out's host list), running and before (a job id, for the next page). The response shape stays the same. berth job list gets matching flags.
  • CLI inbox: berth inbox done/reopen HOST ID, which the API already had, and --before SEQ so the "older messages" hint can be followed.

The store gets rename_subject in both backends, tested on SQLite and PostgreSQL.

Gaps left for a decision are listed in the comment below.

The action rename carries the provisioner's entry, its own secrets, the records of what it made or plans, and its jobs to the new name in one change. berth provisioner rename NAME NEW runs it.
jobs.list takes subject, host, running and before, the id of the last job of the page before. berth job list takes the same as flags.
@helightdev

Copy link
Copy Markdown
Owner Author

Gaps the audit found that need a decision, most missed first:

  1. Registry rename loses the login and breaks profiles. The screens rename a registry by saving the new one and removing the old, which drops registry/NAME (they ask for the password again). Host profiles that list it under registries are left pointing at the old name. Proposal: a registries.rename op that moves the login and rewrites stored profiles, and refuses while a profile in a file names it.
  2. Secret rename. Profiles and resource records name secrets, so a rename has the same reference question. Proposal: secrets.rename, which rewrites resource records and stored profiles.
  3. Resource rename. The name is the one at the provisioner. Proposal: decide whether a resource gets a berth-side label, or whether rename asks the plugin (a new verb).
  4. The server's own token cannot be rotated through the API, and there is no op to list or revoke callers (roles come from the OAuth issuer). Proposal: an installation action rotate-token, admin, for callers on the socket only.
  5. No way to abandon a key rotation that waits on a host that is gone. Proposal: a keys.rotate option or a key action that cancels it, removing the new key from the hosts that took it.
  6. kv.list has no prefix or paging. Plugins can fill a namespace. Proposal: prefix, limit and after like inbox, returning next.
  7. berthd sessions.list returns every session ever, ended ones included. Proposal: running=true. This is the host API, owned by other work in progress.
  8. jobs.list has no next marker. Its result is a bare array, so a next field would change the shape callers rely on. Proposal: decide this with the API version 3 changes.
  9. Show one for keys, registries and plugins. Only lists exist, and the CLI filters them. Proposal: keys.get, registries.get, plugins.get. Low value, the lists are small.
  10. Naming. Creating is add, save, create or set (keys/plugins vs provisioners/registries/hosts vs resources vs secrets/kv), and removing is remove or delete (kv.delete, sessions.delete, files.delete). The CLI says kv remove for kv.delete. Provisioners have both provisioners.remove and a remove action. Proposal: pick one verb pair in the next API version and keep the others as aliases.
  11. CLI has no channel publish or channel read (the API has both). Small, but it overlaps the host areas others are working on.

@helightdev
helightdev merged commit 3c7557d into main Nov 15, 2026
21 checks passed
@helightdev
helightdev deleted the api-gaps branch November 15, 2026 23:36
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.

1 participant