Skip to content

perf(microvm): reuse native copy-on-write rootfs cloning - #2297

Merged
JAORMX merged 2 commits into
mainfrom
fix/microvm-rootfs-cow-2296
Oct 14, 2026
Merged

JAORMX merged 2 commits into
mainfrom
fix/microvm-rootfs-cow-2296

Conversation

@JAORMX

@JAORMX JAORMX commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Closes #2296.

Use the already-pinned go-microvm/rootfs.CloneDir when materializing the repository-private writable rootfs. The dependency uses APFS cloning on macOS and Linux reflinks where available, with ordinary-copy fallback. No dependency update or upstream change is required.

The integration test exercises real guest-agent materialization and verifies that source and both clones have independent writable contents, retain an in-root symlink and executable file, and retain the installed guest-agent bytes and executable mode.

Verified artifact admission, snapshot copying, cache layout, runtime namespaces and upgrade/recovery behavior remain unchanged. Existing repository rootfs trees are not migrated or retroactively deduplicated.

Design

Reuse go-microvm's supported cloning behavior rather than treating the old local copy helper as a compatibility specification. Production owns a private transaction-scoped staging destination, and artifact admission remains enforced before cloning. Tests focus on actual materialization and write-isolation requirements rather than duplicating dependency implementation details.

This replaces the initial draft's test-only proposal. Its proposed upstream prerequisite was withdrawn after reviewing the real caller boundary; there is no pending upstream blocker.

Validation

  • Focused materializer tests, normally and with the race detector: passed.
  • task lint: passed.
  • task test: passed.
  • task test:race: passed.
  • go run ./cmd/mecademo: passed, including tool call/result and permission ask/approval.
  • git diff --check: passed.

Local full gates used a short isolated TMPDIR to avoid test Unix-socket path limits. Test/race invocations cleared the harness-injected Git configuration override with GIT_CONFIG_COUNT=0 after an empty external-diff setting broke unrelated Git-based tests. No tests were disabled.

No measured disk-savings claim or real macOS VM qualification is made. Storage sharing depends on filesystem support and applies to newly materialized rootfs trees.

API compatibility

Internal filesystem implementation change; no wire fields, remote API semantics, API major, feature identifiers, stored-data schema or public Go signatures change. No migration or client upgrade is required. Existing artifact admission and repository lifecycle behavior remain unchanged; no breaking change approval is needed.

JAORMX and others added 2 commits October 14, 2026 08:52
Add regression coverage for issue #2296 before adopting copy-on-write cloning.

Co-authored-by: Mecatl <[email protected]>
Use the pinned go-microvm clone primitive and test materialization and independent writes rather than incidental old copier behavior.

Co-authored-by: Mecatl <[email protected]>
@JAORMX JAORMX changed the title test(microvm): pin rootfs contract before COW integration perf(microvm): reuse native copy-on-write rootfs cloning Oct 14, 2026
@JAORMX
JAORMX marked this pull request as ready for review October 14, 2026 06:30
@JAORMX
JAORMX merged commit 3145b60 into main Oct 14, 2026
90 of 115 checks passed
@JAORMX
JAORMX deleted the fix/microvm-rootfs-cow-2296 branch October 14, 2026 07:27
@toolhive-release-app toolhive-release-app Bot mentioned this pull request Oct 20, 2026
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use copy-on-write cloning for repository-private microVM rootfs

1 participant