Repository navigation
refactor(enterprise/coderd): extract AI model price body decoding and validation - #30716
Merged
Merged
Conversation
This was referenced Oct 13, 2026
SasSwart
force-pushed
the
sdlcgraph/aigov-612-1-price-validation
branch
from
October 14, 2026 12:42
40142e5 to
565c9b3
Compare
SasSwart
commented
Oct 14, 2026
SasSwart
marked this pull request as ready for review
October 14, 2026 15:47
ssncferreira
approved these changes
Oct 15, 2026
… decoding The handler reads the body and writes errors. decodeAIModelPricesBody only decodes and returns an error. aiModelPriceKeys names the keys present in a price, which tell an explicit null apart from a missing price.
Group the four token prices passed to validateAIModelPriceValues into aiModelTokenPrices, so callers set each price by name and cannot pass them in the wrong order.
SasSwart
force-pushed
the
sdlcgraph/aigov-612-1-price-validation
branch
from
October 19, 2026 08:56
f1faa97 to
7542472
Compare
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Moves request body decoding and per-price validation out of the site-wide
upsertAIModelPriceshandler, so the organization price handler later in this stack can reuse them.writeAIModelPricesBodyReadErrorpicks 413 or 400.decodeAIModelPricesBodyonly decodes, and returns an error.aiModelPriceKeysholds the JSON keys present in one price, so validation can tell an explicitnullapart from a missing price.validateAIModelPriceValueschecks the four prices of one model price. It takes them as anaiModelTokenPricesstruct, so callers set each price by name and cannot pass them in the wrong order.No behavior change. The existing
TestUpsertAIModelPrices,TestListAIModelPricesandTestValidateAIModelPricescover the site-wide handler.Used later: #30720 reuses the body read error, the price keys and the value validation for its single-price upsert.
This PR was generated by Coder Agents on behalf of @SasSwart.