feat(drive): ttl ephemeral-bytes fee reclassification — processing-priced, flagless, refundless - #4583
feat(drive): ttl ephemeral-bytes fee reclassification — processing-priced, flagless, refundless#4583QuantumExplorer wants to merge 3 commits into
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Team Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
📖 Book Preview built successfully. Download the preview from the workflow artifacts. Updated at 2026-09-02T08:49:06.140Z |
…flat-drop batch The walkers now emit a TimeRangeTtlDrainRequest instead of draining inline; apply_batch_low_level_drive_operations runs the requests after both batches, one per level, and the drain collects its flat drops into a single grovedb batch (indexed-tree deletes stay immediate). This removes the InvalidPath failure when a transition queued removals under an expired bucket before a later write drained it, and bounds the drop budget per level instead of per index. Also: the insert walker filters expired buckets (award re-inserts), finalize_block warns on skipped live prefix drops, the ephemeral op class is visible to every partition and dedup helper, the walkers share one ephemeral-routing helper and one expiry predicate, add_reference v0/v1 share one body, FeeVersionFieldsBeforeVersion4 keeps its frozen storage layout, ttl immutability is documented, messaged and tested, and the fee doc records the second-batch surcharge. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…ix branch Keeps the post-batch, per-level drain from the review fixes and folds in upstream's delete-walker drain and its two tests; the drain sweep helper now queues requests instead of draining inline. The partial-drain test uses 14 zero-padded groups so the bucket survives the (now draining) deletes, and the shared-grid test gains a survivor document so the bucket is taken by the drain rather than by up-tree pruning. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…tanding group Five filler groups sort before the deleted document's group, so the delete's own drain budget stops short of it and its removal is queued against standing trees; a later transition's drain in the same batch would then drop them. Fails on the pre-queue sweep alone with InvalidPath, passes with the post-batch requests. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
Pushed the fixes from an xhigh-effort review of #4581 + #4583 (10 finder angles, one verifier per finding, then a gap sweep), merged on top of the branch's newer "drain once per write, before queuing" commits. Which drain fix to keepThe branch's
The cross-document case is the one that matters: a documents batch and drive-abci would turn that into an InternalError that strips the valid transition unpaid. With the requests run after the batch it passes. So the merge keeps the post-batch design and folds in the branch's delete-walker drain (as a request) and its two tests, with two fixture adjustments described below. Correctness
Cleanup
Docs and tests
Verified
Not done: the 🤖 Posted autonomously by Claude on behalf of pasta. |
|
Folded into #4581 — the base branch was fast-forwarded to this branch's head ( 🤖 Generated with Claude Code |
Issue being fixed or feature implemented
Stacked on #4581 (time-range TTL). That PR shipped the lifecycle — lazy budgeted drainage on grovedb's flat-subtree drop — but TTL'd index bytes still billed at the perpetuity storage rate, which defeats the point: windowed data with a hard one-week life cap was prepaying decades of retention. This PR is the economic payoff the design describes: TTL'd bytes bill to processing, carry no storage flags, and refund nothing.
What was done?
Fee tables (
rs-platform-version)FeeStorageVersiongainsttl_ephemeral_disk_usage_credit_per_byte.FEE_STORAGE_VERSION2prices it at 270 credits/byte — 1% of the 27,000 storage rate, ~27× a pro-rata week of epoch-distributed retention, so it's a safe over-charge, not a subsidy. V1 carries 0 (unreachable pre-PV14: thettlgrammar does not parse).FEE_VERSION3= FEE_VERSION2 + the new storage table, wired into PV14. It keepsfee_version_number: 1deliberately — the persisted number tags the refund algorithm, which is unchanged (same aliasing precedent as FEE_VERSION2).Ephemeral operation class (
rs-drive::fees::op)LowLevelDriveOperationvariants:EphemeralGroveOperationandCalculatedEphemeralCostOperation. Grove ops normally collapse into ONE batch whose cost is consumed as a unit, so ephemeral ops ride a second grovedb batch (apply_batch_low_level_drive_operationssplits 3-way); its captured cost is consumed on its own terms:storage_fee = 0,processing_fee += added_bytes × 270(checked arithmetic). ASectionedStorageRemovalsurfacing in an ephemeral batch is aCorruptedCodeExecution— TTL'd elements have no flags, so refundable removal there means a classification bug.estimated >= actualholds per class (regression-tested).Walker routing — the insert (top v2), delete (top v2), and update (v1 bucketed branch) walkers detect
ttlon a sub-level, collect that sub-level's ops into a local vec, retag them ephemeral, and passNonestorage flags down (actual writes and estimation layers both).Reference walker v1 (the one real subtlety):
add_reference_for_index_level_for_contract_operationsv0 builds the terminal reference element from the document info's own flags, ignoring the flags the walker passed down. Those historically diverge (immutable doctypes: walker passesNone, element still gets flags), so v0 is kept verbatim for replay and a v1 — terminal ref takes the walker's flags — is wired intoDRIVE_DOCUMENT_METHOD_VERSIONS_V4(PV14-only, table unreleased). The v1 update walker's prebuilt reference is likewise rebuilt flagless on the ephemeral branch. Without this, TTL'd references carry flags and their removal turns sectioned/refundable.Docs —
book/src/drive/time-range-ttl.mdfee sections rewritten from "planned" to shipped; meta-schemattldescription now states the fee semantics.How Has This Been Tested?
New
ttl_index_bytes_bill_to_processing_without_refunds: a TTL'd contract, its standing twin (identical minusttl), and an index-free twin, all receiving the same document with owner-carrying flags:Full
drivelib suite (3563 green — the v1 reference walker touches every PV14 index insert), drive-abci time-range proof + ranked batteries,cargo check --all-targetson drive/drive-abci/queries, fmt, clippy.Breaking Changes
None released — everything is gated on still-unreleased PV14 (FEE_VERSION3, document method versions v4). v0 walker behavior is preserved verbatim for historical replay.
Checklist
For repository code-owners and collaborators only
🤖 Generated with Claude Code