Skip to content

Extract ByteSize to shared domain package#65

Merged
JAORMX merged 3 commits intomainfrom
jaosorior/bytesize-shared-package
Mar 18, 2026
Merged

Extract ByteSize to shared domain package#65
JAORMX merged 3 commits intomainfrom
jaosorior/bytesize-shared-package

Conversation

@JAORMX
Copy link
Copy Markdown
Contributor

@JAORMX JAORMX commented Mar 18, 2026

Summary

  • Extract ByteSize type from pkg/domain/config/ to new pkg/domain/bytesize/ leaf package
  • Change agent.Agent.DefaultMemory and DefaultTmpSize from uint32 to bytesize.ByteSize
  • Simplify config.Merge() by eliminating the ByteSize↔uint32 conversion ping-pong

This resolves the circular import blocker (config → agent already exists, so agent → config would cycle). The new pkg/domain/bytesize/ package is a leaf with no domain imports, keeping the dependency graph clean:

pkg/domain/bytesize/  → (leaf — no domain imports)
pkg/domain/agent/     → egress/, bytesize/
pkg/domain/config/    → agent/, egress/, bytesize/

Follow-up from PR #60 review feedback.

Test plan

  • task fmt passes
  • task lint passes
  • task test passes — all existing tests updated and green
  • No import cycles (go build ./... fails immediately on cycles)
  • YAML round-trip tests pass (ByteSize serialization unchanged)

🤖 Generated with Claude Code

@JAORMX JAORMX requested a review from jhrozek March 18, 2026 07:41
jhrozek
jhrozek previously approved these changes Mar 18, 2026
@JAORMX JAORMX force-pushed the jaosorior/bytesize-shared-package branch from c018186 to 106298e Compare March 18, 2026 11:53
jhrozek
jhrozek previously approved these changes Mar 18, 2026
jhrozek
jhrozek previously approved these changes Mar 18, 2026
@JAORMX JAORMX enabled auto-merge (squash) March 18, 2026 14:59
JAORMX and others added 3 commits March 18, 2026 17:01
Move ByteSize from pkg/domain/config/ to pkg/domain/bytesize/ so that
pkg/domain/agent/ can use it without creating a circular import. Change
Agent.DefaultMemory and DefaultTmpSize from uint32 to bytesize.ByteSize,
eliminating the MiB() conversion ping-pong in config.Merge().

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
VMConfig.Memory and TmpSize now use bytesize.ByteSize instead of
raw uint32. The .MiB() conversion moves to internal/infra/vm/ where
go-microvm actually needs the integer, keeping the domain/application
layers working with the richer type.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Update config_test.go to use bytesize.ByteSize instead of bare
ByteSize after the type was moved to its own package. Also update
DefaultTmpSize test values to 2048 MiB to match the upstream change.
@JAORMX JAORMX force-pushed the jaosorior/bytesize-shared-package branch from 70e8e38 to 15954f1 Compare March 18, 2026 15:04
@JAORMX JAORMX merged commit e45ad7e into main Mar 18, 2026
7 checks passed
@JAORMX JAORMX deleted the jaosorior/bytesize-shared-package branch March 18, 2026 15:08
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.

2 participants