Skip to content

rename CreditOverage to CreditPostpaidLimit - #34

Merged
bpapillon merged 1 commit into
mainfrom
rename-credit-overage-to-credit-postpaid-limit
Sep 9, 2026
Merged

bpapillon merged 1 commit into
mainfrom
rename-credit-overage-to-credit-postpaid-limit

Conversation

@bpapillon

Copy link
Copy Markdown
Contributor

Unblocks the vocabulary rename on schematic-api#7862, which cannot finish while this field carries the old name.

"Overage" already means something else in the platform: a soft limit of free units followed by a rate, on an entitlement (EntitlementPriceBehaviorOverage). This field is consumption past a zero credit balance, where there is no free allowance because the allowance was the grant. Two mechanisms, one word, and it misled a reviewer. The API side settled on postpaid for the arrangement and overdraft for the negative balance, so this field is the postpaid grant's overdraft limit.

The three-state map is unchanged — absent means off, null means unbounded, a value means bounded. Only the names move.

The wire name gains omitempty, and that is the part worth reviewing. Absent has to be a legal payload. A client generated from a spec predating this field decodes strictly and marks every property it knows as required, so two things can go wrong: an empty map serialised as "credit_postpaid_limit":{} is an unknown property to it, and a required field missing from a payload fails validation outright. Omitting the key when the map is empty keeps the payload legal for both, and no postpaid grant is the common case — so this is the shape most payloads take. TestCreditPostpaidLimitOmittedWhenEmpty asserts it and fails without the tag.

No decode alias for the old spelling. Go ignores unknown fields, so a payload still carrying credit_overage leaves the map empty and the company hard-stops at zero, which is the pre-feature behavior — fail-closed, no error. The feature is unreleased, so there is no live arrangement to preserve.

Needs a release tag past v0.1.22 before schematic-api can bump its pin. Note main already carries #32 unreleased, so that tag will include it.

"Overage" already means something else in the platform: a soft limit of free
units followed by a rate, on an entitlement. This field is consumption past a
zero credit balance, where there is no free allowance because the allowance was
the grant. The API side renamed to postpaid for the arrangement and overdraft
for the negative balance, so the field is the postpaid grant's overdraft limit.

The wire name gains omitempty. Absent has to be a legal payload: a client
generated from a spec predating this field decodes strictly and treats every
property it knows as required, so an empty map serialised as
"credit_postpaid_limit":{} is an unknown property to it, and a required field
missing from a payload fails validation outright. Omitting the key when the map
is empty keeps the payload legal either way, and no postpaid grant is the common
case. A new test asserts it, and fails without the tag.

Nothing needs the old spelling accepted on decode. Go ignores unknown fields, so
a payload still carrying credit_overage leaves the map empty and the company
hard-stops at zero, which is the pre-feature behavior. The feature is unreleased,
so there is no arrangement in the field to preserve.
@bpapillon bpapillon self-assigned this Sep 9, 2026
@bpapillon
bpapillon marked this pull request as ready for review September 9, 2026 21:23
@bpapillon
bpapillon merged commit fdbaf87 into main Sep 9, 2026
2 checks passed
@bpapillon
bpapillon deleted the rename-credit-overage-to-credit-postpaid-limit branch September 9, 2026 21:23
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