vibe.review.filestore

Simple on-disk file store for VIBE Review uploads.

We store original binaries (e.g., PDFs) outside the database to enable: - layout-faithful document viewing (page renders) - OCR processing without re-upload

ReviewFileStore

Controlled access to persisted uploaded files.

This is a thin wrapper around an on-disk store today, but provides a stable API boundary so call sites don't depend on filesystem paths directly.

store_bytes

store_bytes(data: bytes, *, suffix: str) -> str

Store bytes and return SHA256 digest prefix; deduplicates existing files.

resolve

resolve(digest: str, *, suffix: str) -> Path

Resolve digest to filesystem path, raising FileNotFoundError if missing.

open_for_read

open_for_read(digest: str, *, suffix: str) -> BinaryIO

Open stored file for binary reading by digest.

get_file_store_dir

get_file_store_dir() -> Path

Return the base directory for review file storage.

sha256_bytes

sha256_bytes(data: bytes) -> str

Return the short SHA256 digest prefix for bytes.

store_bytes

store_bytes(data: bytes, *, suffix: str) -> tuple[str, Path]

Store bytes under the review filestore and return digest + path.

resolve_file

resolve_file(digest: str, *, suffix: str) -> Path

Resolve a stored file by digest and suffix.