feat(api): credit dimensions on the credit_schema API shape - #3217
Draft
charlietlamb wants to merge 3 commits into
Draft
feat(api): credit dimensions on the credit_schema API shape#3217charlietlamb wants to merge 3 commits into
charlietlamb wants to merge 3 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
charlietlamb
force-pushed
the
charlie/dim-api
branch
from
September 2, 2026 16:43
451fdfc to
330fa16
Compare
credit_schema items accept named dimensions and multipliers with API naming; both converters round-trip them. Legacy V0 shapes cannot represent them and bail. All three schema comparators (diffFeatureV1, hasCreditRateCardChanged, entsAreSame) compare the rules structurally so both cache-clear lanes and customize see edits. The atmn CLI carries them through pull/push instead of wiping them.
…nistic stringify One rate converter per direction serves rows and dimensions in both the shared converters and the atmn transforms. The API reuses the model's match and dimension-name schemas. deterministicStringify moves to shared so creditDimensionRulesEqual and hashJson use the same implementation.
charlietlamb
force-pushed
the
charlie/dim-api
branch
from
September 2, 2026 16:49
330fa16 to
64dee86
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 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.
Layer 2 of the credit dimensions stack — the API surface.
Goal —
credit_schemaitems acceptdimensions/multiplierswith API naming (credit_cost), strict like the rest of the item, and everything that copies or compares a schema item carries them.What's here
creditRateCard.ts:ApiCreditDimensionSchema,ApiCreditMultiplierSchemaon the.strict()item base; tier refinement shared with rows.apiCreditSchemaItemToDb/dbCreditSchemaItemToApi(feature overrides, plan items and agent types inherit).credit_cost: undefined:apiCreditSchemaToV0,toApiFeature.diffFeatureV1andhasCreditRateCardChangedare the two separate cache-clear lanes (catalogV2 vs features.update);entsAreSameis customize.atmnCLI: compose model + both transforms + compare normalizers, so pull/push round-trips dimensions instead of wiping them.Verify
cd server && bun tstests/unit/features/credit-dimensions-api.test.ts+credit-rate-card-cache,shared/diffFeatureV1,catalogV2/comparators/entsAreSamecd packages/atmn && bun test src/lib/transformsOpenAPI derives from the zod schemas, so the contract picks the fields up without edits.
Summary by cubic
Adds named dimensions and multipliers to
credit_schemaitems with APIcredit_costnaming, so credit pricing rules round-trip through API, DB, SDK, andatmn. Legacy V0 shapes bail instead of emitting unsupported dimension data.diffFeatureV1,hasCreditRateCardChanged, andentsAreSamedetect rule changes while ignoring record order.atmnpull, push, and diff normalization preserve dimensions and multipliers instead of dropping them.Written for commit 64dee86. Summary will update on new commits.