Skip to content

✨ hub: edit a v1 registration in place with PATCH, key kept - #19097

Merged
hivecommons-hive[bot] merged 2 commits into
v5from
feat/19056-hub-v1-patch-registration
Nov 18, 2026
Merged

hivecommons-hive[bot] merged 2 commits into
v5from
feat/19056-hub-v1-patch-registration

Conversation

@clubanderson

Copy link
Copy Markdown
Member

Refs #19056

Rollout step 1 of the hub registration protocol (RFC #18642) shipped discovery and the resources (#18892, #18896) but not the third slice the RFC's port plan named: PATCH. Without it, adding a repo still meant deleting a registration (revoking its key) and registering again. This PR adds it. The store side (update() that restores the key hashes, owner, ID and timestamps; the revision and ETag) already landed in #18896.

PATCH /api/hub/v1/registrations/{id}

  • Changes repos (a full list, or {add, remove}) and/or dashboard_url (https URL, or "" to clear). The heartbeat key is never touched.
  • If-Match is required: 428 when absent, 412 with the current ETag when stale. Checked before any GitHub call and again under the store lock. If-Match * also re-checks that the stored repos are the ones the edit was planned from.
  • Only repos the edit adds are proven (the same read-only permissions.admin check as create, with the owner's own stored token); one failing repo refuses the whole edit and nothing is applied. Kept repos keep their proof time, removed repos lose theirs.
  • org, the owner, the ID and the keys are not editable: any other field is 400 (org with its own message, per the owner's decision that org changes mean delete and re-register). A list that would leave no repo is 400; over HIVE_HUB_SELFSERVICE_MAX_REPOS is 413 with limit: max_repos.
  • Owner session only. A registration key is not accepted here (that is the later sync-repos step); a hub admin who does not own the hive gets 404.
  • A no-op edit answers 200 with the current ETag and does not bump the revision.
  • Off until a hub enables it: the same HIVE_HUB_SELFSERVICE_REGISTRATION switch as the rest of v1. Discovery now lists update (if_match: required) and patch_fields: [repos, dashboard_url].
  • Audit line selfservice_hive_updated with counts, no key and no hash; refused bodies are selfservice_hive_refused with reason invalid_update.

Not touched: the v6 /api/hub/selfservice/* routes and their bodies, heartbeat_signing.go, the credential fence, existing records (no data change). Nothing here writes to GitHub.

Tests cover add proving only the added repo and keeping the key authenticating, replace and remove with no GitHub call, dashboard set and clear and its refusals, 428 and 412 including weak tags, two editors with one winning, the wildcard re-check, no-op edits, every refusal, proof failure applying nothing, the repo cap, owner-session-only access, key and hash absent from responses and logs, and the legacy list view staying shape-stable. All credentials in tests are synthetic.

Docs: api-reference row, hub-deployment "Editing a registration", audit-log, changelog fragment.

PATCH /api/hub/v1/registrations/{id} changes repos (full list or add and
remove) and dashboard_url with the heartbeat key untouched. If-Match is
required (428 missing, 412 stale). Only added repos are proven, read only,
with the owner's stored token. org, owner and keys are not editable. Owner
session only, gated by HIVE_HUB_SELFSERVICE_REGISTRATION, listed in v1
discovery. Nothing writes to GitHub.

Refs #19056

Signed-off-by: Andrew Anderson <andy@clubanderson.com>
Signed-off-by: Andrew Anderson <andy@clubanderson.com>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Nov 18, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign hanthor for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubestellar-prow kubestellar-prow Bot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Nov 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: v5

Conflicts are checked with every PR merged onto the current tip of v5, so a PR that only needs a rebase is not reported as conflicting with its siblings.

PR Title Relation Files
#19063 ✨ PR gate: fail visibly when the Commit statuses grant is missing same files src/docs/api-reference/hub-server.md

@hivecommons-hive
hivecommons-hive Bot merged commit f3e20ed into v5 Nov 18, 2026
97 of 98 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the feat/19056-hub-v1-patch-registration branch November 18, 2026 19:38
@hivecommons-hive

Copy link
Copy Markdown
Contributor

Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor.

Evidence bundle `#19097d1bac88` sha256:f3ecb3b5d520990bb00f6731bd480fe05372e0a1bff0f8c7068155c669431196 — download from the dashboard or `hivectl review evidence #19097`.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dco-signoff: yes Indicates the PR's author has signed the DCO. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant