fix: refuse to shrink VM disk below base image; floor resource values #12

Closed
opened 2026-07-03 12:26:55 +00:00 by a73x · 1 comment
a73x commented 2026-07-03 12:26:55 +00:00 (Migrated from git.a73x.sh)

[claude 2026-07-03] Fixes 3fdd2ad6. Agent: PrepareDisk stats the base image and errors before any command if disk_gb*GiB < base size (truncate -s sets exact size — shrinking corrupts the guest). Server: validateCreateVM floors vcpus/mem_mb/disk_gb at 1 post-defaults. TDD: TestPrepareDiskRefusesToShrinkBaseImage, TestPrepareDiskFailsOnMissingBaseImage, TestCreateVMResourceValidation all watched fail first (sparse files keep the 2GiB base test cheap). Existing PrepareDisk test updated to use a real base file since the guard stats it. make ci green.


Migrated from git-collab patche ee6171b094f49ee4a1965ece3cf1c6cd8ab567ee.

Original author: a73x dev@a73x.sh.

Fixes git-collab issue 3fdd2ad6

Historical merged patch. The original head and merge commits were not recorded. Forgejo cannot display a pull request without a head commit, so this record is preserved as a closed issue. The original diff is unavailable; no commit was guessed.

Original branches: fix/disk-never-shrink → main.

[claude 2026-07-03] Fixes 3fdd2ad6. Agent: PrepareDisk stats the base image and errors before any command if disk_gb*GiB < base size (truncate -s sets exact size — shrinking corrupts the guest). Server: validateCreateVM floors vcpus/mem_mb/disk_gb at 1 post-defaults. TDD: TestPrepareDiskRefusesToShrinkBaseImage, TestPrepareDiskFailsOnMissingBaseImage, TestCreateVMResourceValidation all watched fail first (sparse files keep the 2GiB base test cheap). Existing PrepareDisk test updated to use a real base file since the guard stats it. make ci green. --- Migrated from git-collab patche `ee6171b094f49ee4a1965ece3cf1c6cd8ab567ee`. Original author: a73x <dev@a73x.sh>. Fixes git-collab issue `3fdd2ad6` **Historical merged patch.** The original head and merge commits were not recorded. Forgejo cannot display a pull request without a head commit, so this record is preserved as a closed issue. The original diff is unavailable; no commit was guessed. Original branches: `fix/disk-never-shrink` → `main`.
a73x commented 2026-07-03 12:33:30 +00:00 (Migrated from git.a73x.sh)

Original review: comment (revision not recorded)

[claude 2026-07-03] Fresh-context reviewer verdict: needs-changes on one Important finding — integer overflow in the guard (DiskGB<<30 wraps; a narrow band e.g. 2^34+10 wraps to small POSITIVE bytes and bypasses the guard). Fixed in 0121429: DiskGB bounded to [1, 2^20] (1 PiB) before the shift, plus edge-case tests pinning exact-fit and the overflow band (TDD, watched fail). Reviewer minors: exact-fit boundary test (added); permanent-vs-transient create retry distinction (status quo, deliberately out of scope); stale doc phrase in validateCreateVM (cosmetic, skipped). make ci green. Merging per session goal (backlog burn-down authorized by operator).

**Original review: comment** (revision not recorded) [claude 2026-07-03] Fresh-context reviewer verdict: needs-changes on one Important finding — integer overflow in the guard (DiskGB<<30 wraps; a narrow band e.g. 2^34+10 wraps to small POSITIVE bytes and bypasses the guard). Fixed in 0121429: DiskGB bounded to [1, 2^20] (1 PiB) before the shift, plus edge-case tests pinning exact-fit and the overflow band (TDD, watched fail). Reviewer minors: exact-fit boundary test (added); permanent-vs-transient create retry distinction (status quo, deliberately out of scope); stale doc phrase in validateCreateVM (cosmetic, skipped). make ci green. Merging per session goal (backlog burn-down authorized by operator).
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
a73x/eitri#12
No description provided.