Skip to content

fix: offer --slug on update only where the API acts on it - #4

Merged
backtrack5r3 (tomflenner) merged 1 commit into
mainfrom
fix/update-slug
Oct 8, 2026
Merged

backtrack5r3 (tomflenner) merged 1 commit into
mainfrom
fix/update-slug

Conversation

@Alexkuva

Copy link
Copy Markdown
Contributor

Problem

Customers, deployment zones, entitlements, entitlement groups, licenses and service accounts are never renamed. Their update accepts the slug already in the path and refuses any other with a 422, <Operation>.SlugNotRenameable.

Their update commands still offered --slug, and sdk-go dropped the field before sending it. Found on noprod: kaiten entitlements update webhook-2bb271 --slug webhook printed "Entitlement updated", exited 0 and left the slug as it was.

Change

  • For those six resources, --slug is registered on create only, through a small registerSlug next to each register. Passing it to update is an unknown flag and exits 2, and --help no longer advertises it.
  • components update and instances update keep --slug: the API acts on it there, with a new component version or an instance rename.

Tests

  • TestSlugFlagIsOfferedOnlyWhereTheAPIActsOnIt pins which create and update commands carry --slug.
  • TestExitCodeForUsageMistakes gains entitlements update … --slug …, which must exit 2.
  • Both fail on main and pass here. task lint: 0 issues. go test -race ./...: green.

Not covered here

A slug inside --file or --payload is still dropped by sdk-go v0.0.1. kaitencloud/sdk-go#4 fixes that by sending the slug so the API can refuse it. Once that is released, bumping sdk-go here turns that case into exit 5 with the API's message.

🤖 Generated with Claude Code · ✅ Tested and approved by Alex (@Alexkuva), maintainer

Customers, deployment zones, entitlements, entitlement groups, licenses and
service accounts are never renamed: their update accepts the slug already in
the path and refuses any other. Their update commands still offered --slug,
and the SDK dropped the field, so `entitlements update webhook --slug
webhooks` printed "Entitlement updated", exited 0 and left the slug alone.

--slug is now registered on create only for those six, so passing it to
update is an unknown flag and exits 2. Components and instances keep it on
update, where the API does act on a slug.

Signed-off-by: Alexandre Bergere <alexandre.bergere@kaiten.sh>
@Alexkuva
Alex (Alexkuva) requested a review from a team as a code owner October 8, 2026 16:12
@tomflenner
backtrack5r3 (tomflenner) merged commit 441d2b2 into main Oct 8, 2026
7 checks passed
@tomflenner
backtrack5r3 (tomflenner) deleted the fix/update-slug branch October 8, 2026 17:08
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.

2 participants