Skip to content

fix: create_vm robustness and cleanup - #16

Merged
atoomic merged 2 commits into
cpan-authors:mainfrom
Koan-Bot:koan.atoomic/fix-create-vm-bugs
Sep 11, 2026
Merged

atoomic merged 2 commits into
cpan-authors:mainfrom
Koan-Bot:koan.atoomic/fix-create-vm-bugs

Conversation

@Koan-Bot

@Koan-Bot Koan-Bot commented Apr 9, 2026 •

Copy link
Copy Markdown
Contributor

What

Fix three bugs in create_vm() and remove dead WhiteSource config.

Why

  • Image null-check missing: If image lookup fails (neither UUID nor name match), $image->{id} crashes with cryptic "Can't use undef as HASH ref" instead of a helpful error message.
  • Redundant condition: $server_status->{status} was checked twice in the active-status loop — copy-paste artifact.
  • Wrong test fixture: json_imageid() used Compute-style {image: {...}} wrapping, but image_from_uid hits Glance v2 API which returns a flat hash. This meant $image->{id} was silently undef in tests (masked because the POST mock ignores parameter values).

How

  • Added null-check after image lookup matching the pattern used by look_by_id_or_name() for other resources
  • Removed the duplicate condition line
  • Fixed test fixture to match actual Glance v2 API response format
  • Added test for image-not-found error path
  • Removed abandoned .whitesource config (separate commit)

Testing

Full test suite passes (prove -lv t/ — 27 tests across 6 files).

🤖 Generated with Claude Code


Quality Report

Changes: 3 files changed, 39 insertions(+), 44 deletions(-)

Code scan: clean

Tests: passed (OK)

Branch hygiene: clean

Generated by Kōan post-mission quality pipeline

Koan-Bot and others added 2 commits September 10, 2026 19:18
…st fixture

Three bugs fixed in create_vm():

1. Missing null-check after image lookup — if neither image_from_uid nor
   image_from_name finds a match, $image->{id} would crash with a cryptic
   "Can't use undef as HASH ref" error. Now dies with a descriptive message.

2. Redundant condition — $server_status->{status} was checked twice in the
   active-status condition (copy-paste artifact).

3. Wrong test fixture format — json_imageid() used Compute-style {image: {...}}
   wrapping, but image_from_uid hits Glance v2 API which returns a flat hash.
   This meant $image->{id} was silently undef in tests (masked because the
   POST mock doesn't validate imageRef). Fixed to match actual Glance v2 format.

Also adds a test for the image-not-found error path and fixes a typo in comment.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
WhiteSource dependency scanning config has been abandoned — no active
integration exists. Modern projects use GitHub's native Dependabot or
similar alternatives.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Koan-Bot
Koan-Bot force-pushed the koan.atoomic/fix-create-vm-bugs branch from a19d7c7 to 2985fe3 Compare September 11, 2026 01:19
@Koan-Bot

Copy link
Copy Markdown
Contributor Author

Rebase with conflict resolution

Branch koan.atoomic/fix-create-vm-bugs was rebased onto main with automatic conflict resolution.

Stats

3 files changed, 38 insertions(+), 42 deletions(-)
Actions performed
  • Already-solved check: negative (confidence=high, reasoning=Main still lacks the image null-check after image_from_name, still has the duplicate `$server_stat)
  • Resolved merge conflicts (1 round(s))
  • Rebased koan.atoomic/fix-create-vm-bugs onto origin/main
  • Pre-push CI check: previous run #24189294649 failed
  • Pre-push CI fix: no changes needed or Claude found nothing to fix
  • Force-pushed koan.atoomic/fix-create-vm-bugs to fork-Koan-Bot
  • Private review gate passed
  • CI check enqueued in ## CI (async)

CI status

CI will be checked asynchronously.


Automated by Skuggi

@atoomic
atoomic marked this pull request as ready for review September 11, 2026 01:57
@atoomic
atoomic merged commit 93d01d4 into cpan-authors:main Sep 11, 2026
19 checks passed
atoomic added a commit that referenced this pull request Sep 11, 2026
Covers the merges of #12 and #16: the create_vm image null-check, the
removal of the broken Compute v2_1 delete spec, the dead .whitesource
config, and the Glance image fixture correction.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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