[PR #368] [MERGED] refactor: move the durable repository out of the snapshot module #381

Closed
opened 2026-10-29 14:22:48 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/kvcache-ai/AgentENV/pull/368
Author: @yingdi-shan
Created: 10/12/2026
Status: ✅ Merged
Merged: 10/13/2026
Merged by: @yingdi-shan

Base: main ← Head: refactor/repository-module


📝 Commits (1)

  • 83803ce refactor: move the durable repository out of the snapshot module

📊 Changes

52 files changed (+183 additions, -220 deletions)

View changed files

📝 CLAUDE.md (+1 -0)
📝 crates/e2e-tests/tests/snapshot_oss_e2e_test.rs (+4 -4)
📝 docs/src/configuration/reference.md (+1 -1)
📝 docs/src/internals/persistence-artifact-inventory.md (+3 -3)
📝 docs/src/internals/template-builder-testing.md (+4 -4)
📝 src/api/impls/image_build.rs (+2 -2)
📝 src/api/impls/image_build/cache.rs (+1 -1)
📝 src/api/impls/image_build/tests.rs (+2 -5)
📝 src/api/impls/image_build/worker.rs (+2 -4)
📝 src/api/impls/mod.rs (+1 -1)
📝 src/api/impls/snapshots.rs (+1 -1)
📝 src/api/impls/template.rs (+5 -4)
📝 src/image/buildkit/history.rs (+2 -2)
📝 src/lib.rs (+1 -0)
📝 src/orchestrator/tests.rs (+2 -2)
📝 src/repository/backends/common/acr/client.rs (+1 -1)
📝 src/repository/backends/common/acr/manifest.rs (+1 -1)
📝 src/repository/backends/common/acr/mod.rs (+0 -0)
📝 src/repository/backends/common/acr/publisher.rs (+4 -4)
📝 src/repository/backends/common/acr/source_image.rs (+1 -1)

...and 32 more files

📄 Description

Stacked on #367. Until that merges, this PR also shows its commit. Review only the last commit, refactor: move the durable repository out of the snapshot module.

What

Move src/snapshot/repository/ to src/repository/, and rename the SnapshotRepository trait to Repository. Its implementations become OssRepository, PosixFsRepository, and MockRepository.

Why

The repository stores snapshots, volumes, build logs, and the build-cache state, and with #347 and #356 it will also store images and webhook config. Keeping it under snapshot/ makes non-snapshot features look like they belong to snapshots, and the trait name says the same.

N/A. Second of three stacked PRs from the review behind #367.

Scope and non-goals

  • Pure move and rename. No behavior changes.
  • Git detects all 25 moved files as renames.
  • Kept as-is: the [snapshot] repository_backend config key and its SnapshotRepositoryBackendKind enum, which is a user-facing config contract.
  • The volume catalog stays in the backends here; the next PR moves it to src/volume/.

Design and behavior changes

  • snapshot/mod.rs no longer re-exports RepositoryError, RepositoryResult, or SnapshotListFilter; callers import them from crate::repository.
  • The backends' snapshot resolvers still use the snapshot artifact cache and P2P modules, which become pub(crate). RuntimeArtifactLease gains a pub(crate) re-export.
  • Docs and the CLAUDE.md code map point at the new path.

Compatibility and operations

  • Public API or generated protocol: the library path changes from agentenv::snapshot::repository to agentenv::repository. The integration tests and e2e crate are updated. The HTTP API is unchanged.
  • Configuration or defaults: none.
  • Snapshot manifest, artifact layout, or storage format: none.
  • Upgrade and rollback: none.
  • Host requirements, permissions, ports, or dependencies: none.

Validation

  • make fmt
  • make clippy
  • make test-unit
  • Relevant Rust integration tests
  • make -C services test (required when services/ changes)
  • Generated clients/server regenerated with the documented make target
  • Documentation updated
  • Benchmarks or performance comparison completed

Commands and results:

make fmt                        # clean
make clippy                     # clean; compiles tests/ and crates/e2e-tests
cargo test -p agentenv --lib    # 963 passed, 4 ignored

Skipped checks and reasons:

  • Capability tests (--ignored) and integration suites were not run; nothing outside import paths changed.

Risks and reviewer notes

  • Mechanical change. git show -M shows the renames.
  • Open PRs that import crate::snapshot::repository (#347, #356) will need their imports updated when rebasing.

Checklist

  • The PR contains one coherent change and no unrelated formatting or refactoring.
  • New behavior is covered by tests, or I explained why testing is impractical.
  • Logs and examples contain no credentials, tokens, or private registry information.
  • I did not manually edit generated code without updating its source and regenerating it.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/kvcache-ai/AgentENV/pull/368 **Author:** [@yingdi-shan](https://github.com/yingdi-shan) **Created:** 10/12/2026 **Status:** ✅ Merged **Merged:** 10/13/2026 **Merged by:** [@yingdi-shan](https://github.com/yingdi-shan) **Base:** `main` ← **Head:** `refactor/repository-module` --- ### 📝 Commits (1) - [`83803ce`](https://github.com/kvcache-ai/AgentENV/commit/83803ce22433904effef677c39a08f09bd31f51c) refactor: move the durable repository out of the snapshot module ### 📊 Changes **52 files changed** (+183 additions, -220 deletions) <details> <summary>View changed files</summary> 📝 `CLAUDE.md` (+1 -0) 📝 `crates/e2e-tests/tests/snapshot_oss_e2e_test.rs` (+4 -4) 📝 `docs/src/configuration/reference.md` (+1 -1) 📝 `docs/src/internals/persistence-artifact-inventory.md` (+3 -3) 📝 `docs/src/internals/template-builder-testing.md` (+4 -4) 📝 `src/api/impls/image_build.rs` (+2 -2) 📝 `src/api/impls/image_build/cache.rs` (+1 -1) 📝 `src/api/impls/image_build/tests.rs` (+2 -5) 📝 `src/api/impls/image_build/worker.rs` (+2 -4) 📝 `src/api/impls/mod.rs` (+1 -1) 📝 `src/api/impls/snapshots.rs` (+1 -1) 📝 `src/api/impls/template.rs` (+5 -4) 📝 `src/image/buildkit/history.rs` (+2 -2) 📝 `src/lib.rs` (+1 -0) 📝 `src/orchestrator/tests.rs` (+2 -2) 📝 `src/repository/backends/common/acr/client.rs` (+1 -1) 📝 `src/repository/backends/common/acr/manifest.rs` (+1 -1) 📝 `src/repository/backends/common/acr/mod.rs` (+0 -0) 📝 `src/repository/backends/common/acr/publisher.rs` (+4 -4) 📝 `src/repository/backends/common/acr/source_image.rs` (+1 -1) _...and 32 more files_ </details> ### 📄 Description **Stacked on #367.** Until that merges, this PR also shows its commit. Review only the last commit, `refactor: move the durable repository out of the snapshot module`. ## What Move `src/snapshot/repository/` to `src/repository/`, and rename the `SnapshotRepository` trait to `Repository`. Its implementations become `OssRepository`, `PosixFsRepository`, and `MockRepository`. ## Why The repository stores snapshots, volumes, build logs, and the build-cache state, and with #347 and #356 it will also store images and webhook config. Keeping it under `snapshot/` makes non-snapshot features look like they belong to snapshots, and the trait name says the same. ## Related issue N/A. Second of three stacked PRs from the review behind #367. ## Scope and non-goals - Pure move and rename. No behavior changes. - Git detects all 25 moved files as renames. - Kept as-is: the `[snapshot] repository_backend` config key and its `SnapshotRepositoryBackendKind` enum, which is a user-facing config contract. - The volume catalog stays in the backends here; the next PR moves it to `src/volume/`. ## Design and behavior changes - `snapshot/mod.rs` no longer re-exports `RepositoryError`, `RepositoryResult`, or `SnapshotListFilter`; callers import them from `crate::repository`. - The backends' snapshot resolvers still use the snapshot artifact cache and P2P modules, which become `pub(crate)`. `RuntimeArtifactLease` gains a `pub(crate)` re-export. - Docs and the `CLAUDE.md` code map point at the new path. ## Compatibility and operations - Public API or generated protocol: the library path changes from `agentenv::snapshot::repository` to `agentenv::repository`. The integration tests and e2e crate are updated. The HTTP API is unchanged. - Configuration or defaults: none. - Snapshot manifest, artifact layout, or storage format: none. - Upgrade and rollback: none. - Host requirements, permissions, ports, or dependencies: none. ## Validation - [x] `make fmt` - [x] `make clippy` - [ ] `make test-unit` - [ ] Relevant Rust integration tests - [ ] `make -C services test` (required when `services/` changes) - [ ] Generated clients/server regenerated with the documented `make` target - [x] Documentation updated - [ ] Benchmarks or performance comparison completed Commands and results: ```text make fmt # clean make clippy # clean; compiles tests/ and crates/e2e-tests cargo test -p agentenv --lib # 963 passed, 4 ignored ``` Skipped checks and reasons: - Capability tests (`--ignored`) and integration suites were not run; nothing outside import paths changed. ## Risks and reviewer notes - Mechanical change. `git show -M` shows the renames. - Open PRs that import `crate::snapshot::repository` (#347, #356) will need their imports updated when rebasing. ## Checklist - [x] The PR contains one coherent change and no unrelated formatting or refactoring. - [x] New behavior is covered by tests, or I explained why testing is impractical. - [x] Logs and examples contain no credentials, tokens, or private registry information. - [x] I did not manually edit generated code without updating its source and regenerating it. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-29 14:22:48 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
kvcache-ai/AgentENV#381
No description provided.