fix: image_from_name() dies on duplicate names instead of returning wrong type - #23
Draft
Koan-Bot wants to merge 1 commit into
Draft
Conversation
…rong type
image_from_name() returned an arrayref when multiple images shared the
same name, but callers (like create_vm) expected a hashref. This caused
$image->{id} to silently evaluate to undef, leading to confusing API
errors downstream.
Now dies with a descriptive message listing the duplicate IDs and
suggesting image_from_uid as the workaround.
Also fixes bare die statements in Images.pm with descriptive messages
and corrects the images() error message (missing "or").
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
image_from_name()now dies with a descriptive error when multiple images share the same name, instead of returning an incompatible type.Why
When multiple Glance images shared a name,
image_from_name()returned an arrayref instead of a hashref. Callers likecreate_vm()do$image->{id}— on an arrayref, this silently evaluates toundef, causing a confusing "Failed to create server" error much later in the flow. The root cause was invisible.How
image_from_uiddiestatements in Images.pm with descriptive messagesimages()error message (missing "or")Testing
images()not exposed via AUTOLOAD🤖 Generated with Claude Code
Quality Report
Changes: 2 files changed, 92 insertions(+), 6 deletions(-)
Code scan: clean
Tests: passed (OK)
Branch hygiene: clean
Generated by Kōan post-mission quality pipeline