Skip to content

Native RolloutRecord schema and RolloutStore for RL rollout storage#124

Merged
beinan merged 2 commits into
lance-format:mainfrom
beinan:feat/rollout-schema
Jul 9, 2026
Merged

Native RolloutRecord schema and RolloutStore for RL rollout storage#124
beinan merged 2 commits into
lance-format:mainfrom
beinan:feat/rollout-schema

Conversation

@beinan

@beinan beinan commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Adds an independent, first-class RolloutRecord schema and RolloutStore for RL rollout storage, per specs/rollout-schema-design.md (Design doc: native RolloutDB schema for lance-context #123).
  • RolloutStore is a separate Lance dataset with its own Arrow schema (MAI Snowflake rolloutdb column conventions). The existing ContextRecord path is untouched — purely additive.
  • Artifacts are stored as their own rows (role="artifact") with binary_payload offloaded via blob v2; get_blob materializes bytes on demand via BlobHandling::AllBinary. Native versioning, blob offload, and the relationship graph are shared from the schema-agnostic layer (store.rs helpers promoted to pub(crate)).

Test plan

  • cargo test -p lance-context-core — 102 passed, 0 failed, 1 ignored
  • cargo clippy --all-targets — clean
  • Round-trip: append → list → get_by_id → get_blob
  • Checkout recovers exact artifact bytes after version rewind

Beinan Wang added 2 commits July 8, 2026 16:56
Add an independent first-class RolloutRecord schema and RolloutStore for
RL rollout storage, per specs/rollout-schema-design.md. RolloutStore is a
separate Lance dataset with its own Arrow schema following MAI Snowflake
rolloutdb conventions; the existing ContextRecord path is untouched.

Artifacts are stored as their own rows (role="artifact") with the
binary_payload column physically offloaded via blob v2, so column scans
skip the bytes. RolloutStore::get_blob materializes payloads on demand via
BlobHandling::AllBinary. Native versioning, blob offload, and the
relationship graph are reused from the schema-agnostic layer (store.rs
helpers promoted to pub(crate)).

Co-Authored-By: Beinan Wang <beinanwang@microsoft.com>
Co-Authored-By: Beinan Wang <beinanwang@microsoft.com>
@beinan beinan marked this pull request as ready for review July 9, 2026 01:14
@beinan beinan merged commit 83691bb into lance-format:main Jul 9, 2026
9 checks passed
beinan added a commit that referenced this pull request Jul 9, 2026
## Summary
- Extends the native `RolloutRecord` / `RolloutStore` (landed in #124)
  across the remote store layer, mirroring the existing `ContextRecord`
  remote path. Purely additive — the `ContextRecord` path is untouched.
- Single `POST /api/v1/rollouts/{name}/records` endpoint accepts either
  encoding, chosen by `Content-Type`: `application/json` inlines
  `binary_payload` as base64; `multipart/form-data` sends a `metadata`
part (records array, payloads null) followed by one raw binary part per
  record-with-a-blob, named by zero-based index. Avoids ~33% base64
  inflation and full-blob buffering for large artifacts.
- Unified `RolloutStore` enum (Local / Remote) behind the `remote`
  feature, mirroring `ContextStore`.

## Multipart strict-reject
A rollout append feeds training and is atomic, so the whole request is
rejected with `400` before anything is written when: the first part is
not `metadata`; a part name is not a valid record index (unparseable /
out of bounds); an index is duplicated; a byte length disagrees with the
record's `payload_size`; or a record declares `payload_size` but no
binary part is supplied.

## Notes
- `payload_checksum` is a caller-supplied opaque string, stored as-is
(no
  server-side hashing — no hashing dep in the workspace).
- Rollout datasets use a `.rollout.lance` suffix so a rollout store and
a
  context store can share a name on disk.

## Test plan
- [x] `cargo test --all-features` — api 6, core 102 (+1 ignored), server
26
- [x] `cargo clippy --all-features --all-targets` — clean
- [x] Multipart attach-by-index round-trip + all strict-reject cases
- [x] JSON inline base64 payload offloaded via blob v2, materialized via
blob endpoint

Co-Authored-By: Beinan Wang <beinanwang@microsoft.com>

---------

Co-authored-by: Beinan Wang <beinanwang@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant