mirror of
https://github.com/kvcache-ai/AgentENV.git
synced 2026-11-05 01:17:36 +00:00
[PR #367] [MERGED] refactor(repository): store build logs and cache state as shared documents #379
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#379
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/367
Author: @yingdi-shan
Created: 10/12/2026
Status: ✅ Merged
Merged: 10/13/2026
Merged by: @yingdi-shan
Base:
main← Head:refactor/repository-documents📝 Commits (1)
5bafb6crefactor(repository): store build logs and cache state as shared documents📊 Changes
13 files changed (+337 additions, -296 deletions)
View changed files
📝
src/api/impls/image_build/cache.rs(+1 -0)📝
src/api/impls/image_build/tests.rs(+1 -1)📝
src/api/impls/template.rs(+2 -1)📝
src/snapshot/repository/backends/oss/layout.rs(+0 -4)📝
src/snapshot/repository/backends/oss/repository.rs(+47 -87)📝
src/snapshot/repository/backends/posixfs/backend.rs(+14 -36)📝
src/snapshot/repository/backends/posixfs/catalog.rs(+35 -124)📝
src/snapshot/repository/backends/posixfs/layout.rs(+0 -6)📝
src/snapshot/repository/build_cache.rs(+118 -3)📝
src/snapshot/repository/interfaces.rs(+20 -31)➕
src/snapshot/repository/layout.rs(+53 -0)📝
src/snapshot/repository/mod.rs(+5 -2)📝
src/template/logs.rs(+41 -1)📄 Description
What
Replace the repository's build-log and build-cache trait methods with three generic document operations:
get_document,put_document, and a compare-and-swapupdate_document. Each backend implements them once. A newDocumentKeyenum insrc/snapshot/repository/layout.rsis the single place that names these paths.Why
Each small record the repository stores has needed its own trait method, plus layout, wrapper, and implementation code in both backends. That cost is about 6 files per record type. In #321, about a quarter of the handwritten files existed only to store one JSON file per build, and #356 repeats the pattern for webhook config. After this change, a new record type is one
DocumentKeyvariant plus the feature's own code.Related issue
N/A. This came out of a review of why recent feature PRs (#321, #338, #341, #347, #356) each touched 20–40 files.
Scope and non-goals
BuildLogStore(template/logs.rs) andBuildCacheStore(repository/build_cache.rs) extension traits, so call sites only gain an import.Design and behavior changes
update_documentruns the caller's update with an ETag compare-and-swap on OSS and under a file lock on POSIX. The update may run more than once and returns the document it was applied to.DocumentKeykeeps the existing paths:snapshots/build-logs/{id}.jsonandtemplate-build/cache-head.json.volumes/aliases/aenv-buildkit-cache-head.lock, so mixed-version nodes on a shared filesystem still exclude each other.Compatibility and operations
Validation
make fmtmake clippymake test-unitmake -C services test(required whenservices/changes)maketargetCommands and results:
New tests: one pins every document path and the POSIX lock path. The POSIX build-cache concurrency test (16 repository instances replacing the head at once) now runs through the public
BuildCacheStoremethods.Skipped checks and reasons:
make test-unitcapability tests (--ignored) were not run; the change does not touch capability-dependent code.mainin the OSS create-if-absent call.Risks and reviewer notes
src/snapshot/repository/layout.rsandinterfaces.rs, then the two backends'update_document.src/repository/, then the volume catalog.Checklist
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.