Skip to content

S3 (28): Scope S3 object keys by repository name alone - #856

Open
CleanCut wants to merge 1 commit into
mainfrom
cleancut/s3-28
Open

S3 (28): Scope S3 object keys by repository name alone#856
CleanCut wants to merge 1 commit into
mainfrom
cleancut/s3-28

Conversation

@CleanCut

Copy link
Copy Markdown
Contributor

Moving a repository to another namespace no longer implies re-keying every object it has stored in S3. The version store previously built each repo's object prefix from the <namespace>/<name> tail of its path, so a namespace transfer would have had to copy every blob to a new key; the prefix is now the repository's name alone, and a transfer leaves stored objects untouched.

S3 is pre-GA, so there is no stored data to migrate.

ENG-1171

Moving a repository to another namespace no longer implies re-keying every
object it has stored in S3. The version store previously built each repo's
object prefix from the `<namespace>/<name>` tail of its path, so a namespace
transfer would have had to copy every blob to a new key; the prefix is now
the repository's name alone, and a transfer leaves stored objects untouched.

S3 is pre-GA, so there is no stored data to migrate. This has to land before
the first production S3 write, including the file->S3 migration, or migrated
objects land under the old prefix and need an expensive re-key later.

`OxenError::S3PrefixUnresolvable` now reports a missing or non-UTF-8 final
path component, which is what can actually go wrong once the parent directory
is no longer read. SelfHosting.md documents the new prefix.

ENG-1171
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • Changes
    • S3-backed repositories now store objects using the repository name rather than including the namespace in the storage path.
    • Moving a repository between namespaces no longer relocates its existing stored objects.
    • Repository storage URLs are now consistent regardless of namespace.
  • Bug Fixes
    • Improved error messages for repository paths that cannot be resolved to a valid repository name.
  • Documentation
    • Updated self-hosting documentation to describe the revised S3 storage layout.

Walkthrough

S3 repository object prefixes now use {name}/ instead of {namespace}/{name}/. Prefix resolution reports structured errors for paths without a valid repository directory name. Tests and self-hosting documentation reflect namespace-independent storage.

Changes

S3 repository prefix simplification

Layer / File(s) Summary
Repository-only prefix derivation
crates/liboxen/src/storage/version_store.rs, crates/liboxen/src/error.rs
S3 prefixes now use only the repository directory name. S3PrefixUnresolvable describes missing or non-UTF-8 final path components.
Prefix behavior validation
crates/liboxen/src/storage/s3.rs, crates/liboxen/src/storage/version_store.rs, SelfHosting.md
Tests and documentation verify namespace-independent S3 URLs, sibling-prefix isolation, and unchanged object locations after namespace transfers.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • Oxen-AI/Oxen#649: Modifies S3 version-store and version_location handling, but addresses region configuration instead of prefix derivation.
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely states that S3 object keys are scoped by repository name alone, which is the main change.
Description check ✅ Passed The description accurately explains the namespace-independent S3 prefix change and its effect on repository transfers.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cleancut/s3-28

Comment @coderabbitai help to get the list of available commands.

@CleanCut CleanCut changed the title S3 (28): Scope S3 object keys by repository name alone S3 (28.1): Scope S3 object keys by repository name alone Aug 10, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crates/liboxen/src/storage/version_store.rs`:
- Around line 611-623: Extend the S3 version-store tests alongside
create_version_store_s3_without_a_repo_directory_name_errors with a
Unix-specific path whose final component contains invalid UTF-8 bytes, and
assert create_version_store returns Err(OxenError::S3PrefixUnresolvable(_)).
Guard the test with the appropriate platform-specific configuration and
construct the path using raw bytes so the non-UTF-8 branch is exercised.
- Around line 535-542: Update the S3 prefix construction in the version-store
initialization around S3VersionStore::new so it uses a globally unique,
persisted immutable repository identifier rather than only repo_dir.file_name().
Preserve that identifier when the repository moves between namespaces, and add a
regression test proving repositories with the same name in different namespaces
use isolated prefixes and cannot cross-read or cross-delete objects.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 4ce440c6-4184-4d5b-a6ce-4106558d52e5

📥 Commits

Reviewing files that changed from the base of the PR and between ebab2cc and c07774a.

📒 Files selected for processing (4)
  • SelfHosting.md
  • crates/liboxen/src/error.rs
  • crates/liboxen/src/storage/s3.rs
  • crates/liboxen/src/storage/version_store.rs

Comment thread crates/liboxen/src/storage/version_store.rs
Comment thread crates/liboxen/src/storage/version_store.rs
@CleanCut CleanCut changed the title S3 (28.1): Scope S3 object keys by repository name alone S3 (28): Scope S3 object keys by repository name alone Aug 10, 2026
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