[PR #386] [MERGED] refactor: move layer references and volume backing out of snapshot #394

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

📋 Pull Request Information

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

Base: main ← Head: refactor/shared-layer-refs


📝 Commits (1)

  • a79be73 refactor: move layer references and volume backing out of snapshot

📊 Changes

9 files changed (+205 additions, -188 deletions)

View changed files

➕ src/repository/layer_config.rs (+163 -0)
📝 src/repository/mod.rs (+2 -0)
📝 src/snapshot/resolver.rs (+8 -158)
📝 src/snapshot/types/drive.rs (+1 -2)
📝 src/snapshot/types/mod.rs (+5 -5)
📝 src/snapshot/types/snapshot.rs (+1 -22)
📝 src/types/mod.rs (+2 -0)
➕ src/types/overlaybd_layer.rs (+22 -0)
📝 src/volume/mod.rs (+1 -1)

📄 Description

What

Move OverlaybdLayerRef, ManagedLayer, and ExternalLayer from snapshot to crate::types, and move materialize_volume_backing with its helper managed_layer_config from snapshot::resolver to crate::repository. The code is moved without changes. snapshot keeps re-exporting the types, so existing paths still work.

Why

These types describe repository layers that snapshots, volumes, and, with #347, published images all store, and the volume backing config needs only the repository. While they live in snapshot, any module that publishes layers has to depend on snapshot; #347 needs image to use them without a cycle between top-level modules (module_cycles). Split out of #347 during review so the move can be reviewed on its own.

N/A. Prerequisite for #347; design proposal: #378.

Scope and non-goals

Moves only. No behavior, API, or storage changes. The only caller outside snapshot that named the old path, VolumeManager, now calls crate::repository::materialize_volume_backing.

Design and behavior changes

None.

Compatibility and operations

  • Public API or generated protocol: none.
  • Configuration or defaults: none.
  • Snapshot manifest, artifact layout, or storage format: none; the serialized shapes of the moved types are unchanged.
  • Upgrade and rollback: N/A, no behavior change.
  • Host requirements, permissions, ports, or dependencies: N/A.

Validation

Based on f7f478d. Run on a Linux test host as a non-root user with isolated AENV_TEST_STATE_DIR and AENV_TEST_DEPS_PATH:

  • 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                        passed
make clippy                     passed
make test-unit PROFILE=debug    passed: agentenv 988 passed, 4 ignored; aenv 114 passed;
                                capability, envd, and ublk suites passed

Skipped checks and reasons: integration tests, because only code moves; the moved unit test materializes_volume_backing_with_backend_layer_urls runs in make test-unit. No services/, schema, or documented behavior changes. Benchmarks: not applicable.

Risks and reviewer notes

src/types/overlaybd_layer.rs and src/repository/layer_config.rs are the code removed from src/snapshot/types/snapshot.rs and src/snapshot/resolver.rs; git diff --color-moved shows the moves.

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.

🔄 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/386 **Author:** [@Primary33](https://github.com/Primary33) **Created:** 10/16/2026 **Status:** ✅ Merged **Merged:** 10/16/2026 **Merged by:** [@yingdi-shan](https://github.com/yingdi-shan) **Base:** `main` ← **Head:** `refactor/shared-layer-refs` --- ### 📝 Commits (1) - [`a79be73`](https://github.com/kvcache-ai/AgentENV/commit/a79be73aa654faef8d0305cc4c227b1d676337d6) refactor: move layer references and volume backing out of snapshot ### 📊 Changes **9 files changed** (+205 additions, -188 deletions) <details> <summary>View changed files</summary> ➕ `src/repository/layer_config.rs` (+163 -0) 📝 `src/repository/mod.rs` (+2 -0) 📝 `src/snapshot/resolver.rs` (+8 -158) 📝 `src/snapshot/types/drive.rs` (+1 -2) 📝 `src/snapshot/types/mod.rs` (+5 -5) 📝 `src/snapshot/types/snapshot.rs` (+1 -22) 📝 `src/types/mod.rs` (+2 -0) ➕ `src/types/overlaybd_layer.rs` (+22 -0) 📝 `src/volume/mod.rs` (+1 -1) </details> ### 📄 Description ## What Move `OverlaybdLayerRef`, `ManagedLayer`, and `ExternalLayer` from `snapshot` to `crate::types`, and move `materialize_volume_backing` with its helper `managed_layer_config` from `snapshot::resolver` to `crate::repository`. The code is moved without changes. `snapshot` keeps re-exporting the types, so existing paths still work. ## Why These types describe repository layers that snapshots, volumes, and, with #347, published images all store, and the volume backing config needs only the repository. While they live in `snapshot`, any module that publishes layers has to depend on `snapshot`; #347 needs `image` to use them without a cycle between top-level modules (`module_cycles`). Split out of #347 during review so the move can be reviewed on its own. ## Related issue N/A. Prerequisite for #347; design proposal: #378. ## Scope and non-goals Moves only. No behavior, API, or storage changes. The only caller outside `snapshot` that named the old path, `VolumeManager`, now calls `crate::repository::materialize_volume_backing`. ## Design and behavior changes None. ## Compatibility and operations - Public API or generated protocol: none. - Configuration or defaults: none. - Snapshot manifest, artifact layout, or storage format: none; the serialized shapes of the moved types are unchanged. - Upgrade and rollback: N/A, no behavior change. - Host requirements, permissions, ports, or dependencies: N/A. ## Validation Based on `f7f478d`. Run on a Linux test host as a non-root user with isolated `AENV_TEST_STATE_DIR` and `AENV_TEST_DEPS_PATH`: - [x] `make fmt` - [x] `make clippy` - [x] `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: ```text make fmt passed make clippy passed make test-unit PROFILE=debug passed: agentenv 988 passed, 4 ignored; aenv 114 passed; capability, envd, and ublk suites passed ``` Skipped checks and reasons: integration tests, because only code moves; the moved unit test `materializes_volume_backing_with_backend_layer_urls` runs in `make test-unit`. No `services/`, schema, or documented behavior changes. Benchmarks: not applicable. ## Risks and reviewer notes `src/types/overlaybd_layer.rs` and `src/repository/layer_config.rs` are the code removed from `src/snapshot/types/snapshot.rs` and `src/snapshot/resolver.rs`; `git diff --color-moved` shows the moves. ## 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. --- <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:56 +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#394
No description provided.