mirror of
https://github.com/kvcache-ai/AgentENV.git
synced 2026-11-05 01:17:36 +00:00
[PR #382] [MERGED] refactor(repository): stop depending on snapshot, image, volume and sandbox #391
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#391
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/382
Author: @yingdi-shan
Created: 10/13/2026
Status: ✅ Merged
Merged: 10/14/2026
Merged by: @yingdi-shan
Base:
main← Head:refactor/repository-leaf📝 Commits (1)
85358c3refactor(repository): stop depending on snapshot, image, volume and sandbox📊 Changes
41 files changed (+1601 additions, -1583 deletions)
View changed files
📝
crates/e2e-tests/tests/snapshot_oss_e2e_test.rs(+5 -4)📝
docs/src/internals/template-builder-testing.md(+4 -3)📝
src/api/impls/image_build/tests.rs(+1 -1)📝
src/api/impls/image_build/worker.rs(+5 -2)📝
src/api/impls/snapshots.rs(+1 -1)📝
src/api/impls/template.rs(+2 -3)📝
src/image/buildkit/history.rs(+2 -2)📝
src/orchestrator/tests.rs(+2 -2)📝
src/repository/backends/mod.rs(+2 -180)📝
src/repository/backends/oss/mod.rs(+0 -106)📝
src/repository/backends/oss/repository.rs(+27 -60)📝
src/repository/backends/posixfs/artifacts.rs(+1 -414)📝
src/repository/backends/posixfs/backend.rs(+8 -633)📝
src/repository/backends/posixfs/mod.rs(+0 -3)📝
src/repository/build_cache.rs(+11 -9)📝
src/repository/errors.rs(+1 -1)📝
src/repository/interfaces.rs(+7 -111)📝
src/repository/layout.rs(+15 -7)📝
src/repository/mod.rs(+38 -1)➕
src/snapshot/backends/mod.rs(+288 -0)...and 21 more files
📄 Description
What
Make
src/repositorya leaf module: it no longer importssnapshot,image,volumeorsandbox. After this change it depends only oncfg,digest,typesand (for one OSS metrics guard)observability.SnapshotId,SnapshotAliassnapshot/types/value.rstypes/snapshot_id.rs(still re-exported fromcrate::snapshot)SnapshotListFilterrepository/interfaces.rssnapshot/catalog.rsSnapshotPublicationrepository/interfaces.rssnapshot/publish.rsSnapshotRuntimeResolvertraitrepository/interfaces.rssnapshot/resolver.rsPosixFsBackend,PosixFsBackendConfig,OssBackend,build_snapshot_backend,build_builder_snapshot_backendrepository/backends/{mod.rs,oss/mod.rs,posixfs/backend.rs}snapshot/backends/mod.rsvm_state.bin,firecracker-manifest.json,memory-startup.pack)SNAPSHOT_ARTIFACT_LAYOUT/MEMORY_STARTUP_PACK_ARTIFACTSnapshotFile::name()inrepository/layout.rs; the snapshot constants now derive from itis_valid_volume_componentvolume/mod.rsrepository/layout.rs, next to the volume document keys it guards (volumere-exports it)The repository side keeps two small constructors that the snapshot wiring uses:
PosixFsRepository::new(root)andOssRepository::from_config(..).Why
The repository's job is to store blobs and documents for the catalogs built on it. But it also imported those catalogs: it built the snapshot runtime resolver and artifact cache, took the image layer store, defined snapshot-specific filter, publication and resolver types, and named its stored files through snapshot constants. As a result
repositoryandsnapshotdepended on each other, and neither could be read or changed without the other. This is item 3 of the post-#380 architecture review (break the module cycles), limited to therepositoryedges.Related issue
None. This follows the architecture review done after #380.
Scope and non-goals
test_repositoryhelper change:posixfs/backend.rsandbackends/mod.rstests →snapshot/backends/tests.rsposixfs/artifacts.rstests →snapshot/store/posix_tests.rssnapshot/resolver.rsrepositoryand now opensPosixFsRepositorydirectly.repository → observability: oneMetricGuardin the OSS client.image → template/snapshot/sandbox,volume → snapshot,observability → orchestrator).repository/backends/common::write_dense_overlaybd_layer_to_file, which only snapshot uses but has no outward dependency.Design and behavior changes
No behavior change. A new unit test,
repository::tests::repository_does_not_depend_on_its_users, scanssrc/repository/**/*.rsand fails if any file referencescrate::{snapshot,image,volume,sandbox}::. I checked that it fails when such an import is added back.Compatibility and operations
agentenvlib change. Useagentenv::snapshot::backends::{PosixFsBackend, PosixFsBackendConfig, OssBackend}instead ofagentenv::repository::backends::…, andagentenv::snapshot::{SnapshotListFilter, SnapshotRuntimeResolver, SnapshotPublication}instead ofagentenv::repository::…. The workspace callers (tests/common,crates/e2e-tests) are updated. HTTP API: N/A.repository/layout.rs, with the same values. The existingblob_paths_match_existing_repositoriestest pins them.Validation
make fmtmake clippymake test-unit(the agentenv lib suite was run; see below)--all-targets, not run)make -C services test(required whenservices/changes)maketargetCommands and results:
Skipped checks and reasons:
tests/integration andcrates/e2e-testswere compiled (clippy--all-targets) but not run. They need KVM, ublk or an object-storage service, and their only change is an import path.--ignored) tests and non-agentenv crates inmake test-unitwere not run: this PR does not touch them.services/is unchanged.Risks and reviewer notes
git diff -M,types/snapshot_id.rsshows as a rename. The newsnapshot/backends/mod.rsisrepository/backends/mod.rs+oss/mod.rs+ the bundle half ofposixfs/backend.rs, unchanged except that the repository is built withPosixFsRepository::new(root)/OssRepository::from_config.snapshot/image_export/service.rsused to assemblePosixFsRepositoryfrom its two internal stores. It now callsPosixFsRepository::new(root), and those stores are private toposixfs.docs/src/internals/template-builder-testing.mdis updated for the moved resolver trait and tests.Checklist
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.