Skip to content

feat(rd-rds): add bounded lazy-load database access - #35

Merged
eitsupi merged 2 commits into
mainfrom
feat/lazyload-container
Sep 9, 2026
Merged

eitsupi merged 2 commits into
mainfrom
feat/lazyload-container

Conversation

@eitsupi

@eitsupi eitsupi commented Sep 8, 2026 •

Copy link
Copy Markdown
Owner

Installed R packages retain namespace objects in lazy-load .rdx/.rdb databases, but rd-rds previously had no bounded API for accessing those records without an R session. This adds an opt-in lazyload feature that preserves stored variables and persistence references in index order, applies last-wins lookup for duplicate names, and reads direct raw or zlib records with explicit resource limits and file-change detection.

The lazyload feature enables gzip because normal installed-package .rdx indexes are gzip-enveloped RDS files. Cargo still resolves a single flate2 dependency for the index envelope and zlib record layer. The public compression name follows R's terminology for the unsupported code-3 profile (Xz), while bzip2 and xz record decoding remain outside this milestone.

The reader preserves unknown persistence-reference shapes as unsupported entries, but reports malformed known direct or compound descriptors as invalid index data. This keeps forward-compatible enumeration separate from corruption.

Fixtures cover serialization versions 2 and 3, raw and zlib records, duplicate bindings, compound and unknown references, malformed known references, invalid ranges, limits, unsupported codecs, and data-file replacement. An additional fixture is generated by installing a minimal R package with R CMD INSTALL; its gzip .rdx and zlib .rdb pair verifies open, lookup, record reading, and payload parsing under --no-default-features --features lazyload. The existing hex oracle helper is also adjusted for the latest Clippy lint while retaining the workspace MSRV.

Validation:

  • cargo fmt --all --check
  • cargo test --workspace --all-targets --all-features --locked
  • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings
  • RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps --all-features --locked
  • cargo test -p rd-rds --no-default-features --features lazyload --locked
  • Regenerated the installed-package fixture in two separate output directories; both pairs match the committed files byte for byte.

@eitsupi
eitsupi merged commit 430f9fd into main Sep 9, 2026
31 checks passed
@eitsupi
eitsupi deleted the feat/lazyload-container branch September 9, 2026 00:25
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