Repository navigation
feat: expose rift 0.22.0 body/journal limits (maxBodySize, bodyMemoryBudget, journalMaxBytes) and RecordedRequest._bodyOmitted - #320
Merged
Conversation
….bodyOmitted() rift 0.22.0 adds three engine limits the SDK could not set: the largest body (413 past it), the memory buffered bodies share (503 past it) and each imposter's recorded-request budget. SpawnOptions passes them as CLI flags, gated on the declared engine version; EmbeddedOptions sends them to rift_serve_admin, gated on advertisement, and serves the admin plane at start because the engine applies them only to imposters created afterwards; RiftContainer sets the engine's env vars, gated on the image tag. All three refuse the combinations the engine refuses, including a budget below the engine's own default ceiling, so a bad setup fails at the builder rather than at engine start. A request larger than the journal budget is recorded without its body; it read as an empty body with no sign why. RecordedRequest.bodyOmitted() now reports the engine's _bodyOmitted flag. Closes #309
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.
rift 0.22.0 added three engine limits (rift#1439, rift#1441) that the SDK could not set. This PR exposes them on every transport and adds
RecordedRequest.bodyOmitted().SpawnOptions)EmbeddedOptions)RiftContainer)maxBodySize(larger body →413)--max-body-sizemaxBodySizeserve optionRIFT_MAX_BODY_SIZEbodyMemoryBudget(bodies buffered at once; past it →503+Retry-After: 1;0= no budget)--body-memory-budgetbodyMemoryBudgetRIFT_BODY_MEMORY_BUDGETjournalMaxBytes(recorded-request bytes per imposter)--journal-max-bytesjournalMaxBytesRIFT_JOURNAL_MAX_BYTESAll three take a
longbyte count.Gating and validation
Spawn: refused at
build()whenversionis below 0.22.0, because the older CLI has no such flag.Embedded: refused with
EngineUnavailableunless the engine lists the key inbuildInfo().serveOptions. Setting any limit serves the admin plane at engine start, because the engine applies the limits only to imposters created afterrift_serve_admin. A mutation that removed this made both embedded ITs fail.Container: refused for a version-numbered image tag below 0.22.0. An unversioned tag such as
latestcan't be checked, so it is accepted.Shared checks. The SDK mirrors the engine's own refusals (
server.rs,body_limits.rs,rift-ffi):maxBodySizeandjournalMaxBytesmust be at least 1, andbodyMemoryBudgetat least 0.maxBodySizeis unset, the comparison uses the engine's 512 MiB default.Spawn and embedded run these checks at build time; the container runs them at start.
RecordedRequest.bodyOmitted()When a request is larger than the whole journal budget, the engine records it without the body and sets
_bodyOmitted: true. The SDK read that entry as an empty body with no indication why.bodyOmitted()now reports the flag. It is a derived accessor overraw, likestatus(), so the record's components and constructors are unchanged and the rift-scala bridge is untouched.Docs
docs/design/sdk-api.md,README.mdanddocs/testcontainers.md(new "Body and journal limits" section).Tests
SpawnBodyLimitsTest: flags placed beforestartas plain bytes (values above 2^31), absent when unset, version gate, range and budget/ceiling rules.EmbeddedBodyLimitsTest.ServeOptionsBodyLimitsTest: payload, the per-key advertisement gate, and the eager-plane condition.RiftContainerBodyLimitsTest: env vars, tag gate on every setter with boundary tags, and the start-time cross-check.RecordedRequestBodyOmittedTest.SpawnBodyLimitsIT(conformance, spawn) andLaunchOptionsIT(embedded):maxBodySize(1024)returns413for a 2 KiB body and200for 512 bytes.journalMaxBytes(4096), a 16 KiB POST is recorded withbodyOmitted()true and an empty body.Verification
RIFT_IT=1 ./mvnw -B -fae verifyon JDK 21, against the rift 0.22.0 corpus, dylib and binary: green.The code review caught one blocker, which is fixed here: a
bodyMemoryBudgetset on its own was not checked against the engine's default 512 MiB ceiling.Closes #309
🤖 Generated with Claude Code