mirror of
https://github.com/kvcache-ai/AgentENV.git
synced 2026-11-05 01:17:36 +00:00
[PR #369] [MERGED] refactor(volume): implement the volume catalog once on repository documents #382
Labels
No labels
bug
documentation
enhancement
enhancement
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
kvcache-ai/AgentENV#382
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/kvcache-ai/AgentENV/pull/369
Author: @yingdi-shan
Created: 10/12/2026
Status: ✅ Merged
Merged: 10/13/2026
Merged by: @yingdi-shan
Base:
main← Head:refactor/volume-catalog📝 Commits (2)
fad9afdfix(repository): create absent OSS objects with if_not_exists06bfab9refactor(volume): implement the volume catalog once on repository documents📊 Changes
16 files changed (+1008 additions, -1126 deletions)
View changed files
📝
CLAUDE.md(+1 -1)📝
crates/e2e-tests/tests/snapshot_oss_e2e_test.rs(+129 -1)📝
src/api/impls/image_build/tests.rs(+1 -1)📝
src/orchestrator/tests.rs(+2 -2)📝
src/repository/backends/oss/client.rs(+3 -1)📝
src/repository/backends/oss/layout.rs(+0 -12)📝
src/repository/backends/oss/repository.rs(+40 -487)📝
src/repository/backends/posixfs/backend.rs(+11 -69)📝
src/repository/backends/posixfs/catalog.rs(+64 -445)📝
src/repository/backends/posixfs/layout.rs(+0 -28)📝
src/repository/build_cache.rs(+2 -2)📝
src/repository/interfaces.rs(+17 -70)📝
src/repository/layout.rs(+62 -3)📝
src/repository/mod.rs(+2 -4)➕
src/volume/catalog.rs(+671 -0)📝
src/volume/mod.rs(+3 -0)📄 Description
Stacked on #368, which is stacked on #367. Review only the last two commits:
fix(repository): create absent OSS objects with if_not_exists: a bug already onmain.refactor(volume): implement the volume catalog once on repository documentsWhat
OssClient::put_bytes_conditionallysentIf-None-Match: *for create-only-if-absent writes. opendal's S3 service rejects that argument ("use if_not_exists instead"). As a result, creating a volume and the first build-cache state write failed on every OSS backend. The fix uses opendal'sif_not_exists(true).src/volume/catalog.rs. It is written once, as aVolumeCatalogextension trait over generic repository documents.src/volume.rsbecomessrc/volume/mod.rs.Why
OSS and POSIX each implemented the volume catalog, about 400 and 300 lines, and the two had drifted apart:
VolumeManager's earlier, non-atomic check stops itInvalidRequestVolumeNotFoundInvalidRequestVolumeNotFound, or appliedBoth backends now follow the OSS rules, except for how volumes are created (next section).
Related issue
N/A. Third of three stacked PRs from the review behind #367.
Scope and non-goals
delete_documentandlist_documents;update_documentcan now leave a document unchanged. The eight volume methods leave theRepositorytrait.VolumeManageris unchanged apart from its import; call sites only gain an import.Design and behavior changes
Create order. OSS claimed the name before writing the record. A concurrent create that found a name pointing at a not-yet-written record treated it as stale and took it over. Both creates then succeeded with the same name, and the name pointed at only one of them.
The shared code writes the record first (only if absent), then claims the name. A create that loses the name deletes its own record. A name whose record is missing is therefore always stale, never mid-creation.
In a test that inserted a 20 ms delay between the two writes:
Without the delay, the race window on a local filesystem is too small for the concurrency test to hit, so that test guards the protocol rather than proving the old race.
Layout.
DocumentKeykeeps every existing path and lock file:volumes/records/{id}.jsonvolumes/aliases/{name}.jsonon OSS,volumes/aliases/{name}on POSIX, via a POSIX-only path overridevolumes/records/{id}.lockandvolumes/aliases/{name}.lockCompatibility and operations
volumes/directories; they appear on first write.Validation
make fmtmake clippymake test-unitmake -C services test(required whenservices/changes)maketargetCommands and results:
New tests:
src/volume/catalog.rs):snapshot_oss_e2e_test.rs):if_none_matcherrorThe fix commit was checked on its own: clippy is clean and its MinIO test passes.
Skipped checks and reasons:
--ignoredinmake test-unit) andmake test-agent-integration's VM suites were not run; nothing VM- or capability-dependent changed.Risks and reviewer notes
src/volume/catalog.rs(create_volume,claim_alias,update_record), thensrc/repository/layout.rs.maintoday. Happy to split it into its own PR.Checklist
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.