Repository navigation
usage: carry the claim's template and size on claim events - #409
Merged
Merged
Conversation
A consumer pricing compute by sandbox shape could only read the shape from the claim record, which is gone after release, and `key` is a one-way hash. Claim events now carry `template` and `size` from the claim's pool key, in the journal line and as two new `sandboxd_usage` columns. Tested: the tenant claim test and the PG round-trip test fail with the implementation reverted (empty template/size) and pass with it; sandboxd go test ./... and go-lint pass; PG tests run against postgres:16.
tonicmuroq
force-pushed
the
usage-claim-template-size
branch
from
November 2, 2026 02:52
8b63ad3 to
496ee4b
Compare
…lines Renaming either JSON tag passed every test, so the documented journal and API keys could break silently. The /v1/usage example now shows both fields, and the docs state that claim lines from v0.1.20 or earlier lack them.
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.
Claim events now carry
templateandsizefrom the claim's pool key, in the journal line and as two new columns ofsandboxd_usage.A consumer that prices compute by sandbox shape (e.g. 4c8g vs 8c16g, or by the platform the template implies) can only get the shape from the claim record today, and that record is gone after release.
keyis a hash, so it can't be mapped back. With the shape on the claim event, the usage stream alone is enough to price a sandbox.usage.Event:template,size(omitted when empty; only claim events set them)sandboxd_usage:template,sizetext columns,NOT NULL DEFAULT ''sandboxd-api.md, DDL indeploy.mdUpgrade note:
sandboxd_usageis only created when missing, so a table made by a pre-release build of #407 needs the columns added by hand before this runs. Until then landing fails andGET /v1/usageanswers 503. The journal itself is unaffected and catches up after theALTER, for lines still inusage.jsonland its.1backup: