Repository navigation
fix: keep on update what the update does not change - #5
Merged
Merged
Conversation
The API replaces an entitlement or a grant with what it is sent, and the two update commands sent only what their flags held: - `entitlements update --description ...` reset the warning threshold, the icon, the unit and sale-unit labels, userFacing and the display order, and on a periodic entitlement it was refused outright (400 UpdateEntitlement.ImmutableResetPeriod): the window has to be sent back. - `licenses entitlements update --number ...` turned a soft limit into a hard one, since the API derives an omitted allowance from the value. With inline flags, `entitlements update` now reads the entitlement first and sends back every field the flags do not name; --name is no longer required there. --file and --payload are still sent as written. `licenses entitlements update` reads the grant and keeps its allowance when the new value is a finite number, unless --overage-percent gives one. New flags, on create and update: --reset-period, --reset-anchor, --warning-threshold-percent, --icon, --unit-singular, --unit-plural, --sale-unit-singular, --sale-unit-plural, --sale-unit-factor, --user-facing and --display-order; an empty label or icon removes it. --overage-percent on `licenses entitlements associate` and `update`. This needs kaitencloud/sdk-go#5, which adds these fields and the allowance to the SDK: go.mod is pinned to its commit until it is tagged v0.1.0. Signed-off-by: Alexandre Bergere <alexandre.bergere@kaiten.sh> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
7 tasks done
Signed-off-by: Alexandre Bergere <alexandre.bergere@kaiten.sh> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The update commands were built against a commit of the SDK's branch while the grant allowance and the entitlement window were under review. They are released: the module requires v0.1.0. Signed-off-by: Alexandre Bergere <alexandre.bergere@kaiten.sh> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fuzcap
approved these changes
Oct 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR change?
kaiten entitlements update, with inline flags, reads the entitlement first and sends back every field the flags do not name: the reset window, the warning threshold, the icon, unit and sale-unit labels,userFacingand the display order. Groups stay as they are unless--group-slugis given.--nameis no longer required on update.--fileand--payloadare still sent as written, as a full replacement.kaiten licenses entitlements updatereads the grant and keeps its allowance (limitCapExceededOveragePercent) when the new value is a finite number, unless--overage-percentgives one. An unlimited value, or a grant that was unlimited, leaves the allowance to the API.New flags on
entitlements createandupdate:--reset-period,--reset-anchor;--warning-threshold-percent;--icon,--unit-singular,--unit-plural,--user-facing,--display-order;--sale-unit-singular,--sale-unit-plural,--sale-unit-factor.An empty label or icon removes it.
--overage-percentonlicenses entitlements associateandupdate.The README explains the update semantics, with a soft-limit example.
Why?
The API replaces an entitlement or a grant with what it is sent, and both commands sent only what their flags held:
entitlements update monthly-orders --description …UpdateEntitlement.ImmutableResetPeriod. A periodic entitlement's window has to be sent back.entitlements update menu-items --description …userFacingand display order.licenses entitlements update premium-v2 monthly-orders --number 1500The SDK could not send any of these fields until kaitencloud/sdk-go#5, released as
v0.1.0, whichgo.modnow requires.Testing
go test -race ./...: pass. Newentitlements_test.goandlicenses_test.gorun the commands through the root against a fake API that records every call:--iconremoves the icon;--payloadis sent as written, without reading first;--overage-percent.keptOveragePercentkeep nothing fails the soft-limit case.golangci-lintv2.12.2: 0 issues.maintoo since 2026-10-08. A separate PR moves the scan and the release build to 1.26.Checklist
CONTRIBUTING.md.Signed-off-byline.🤖 Generated with Claude Code · ✅ Tested and approved by Alex (@Alexkuva), maintainer