fix: root_uri() version detection for real OpenStack endpoints#25
Draft
Koan-Bot wants to merge 1 commit into
Draft
fix: root_uri() version detection for real OpenStack endpoints#25Koan-Bot wants to merge 1 commit into
Koan-Bot wants to merge 1 commit into
Conversation
root_uri() line 87 had two bugs that combined to create a silent
failure for OpenStack deployments where catalog endpoints include
version paths (e.g. http://host:9696/v2.0):
1. The regex m{:[\d]/v} only matched single-digit ports — real
endpoints use 4-5 digit ports like :8774 or :9696, so the
guard never triggered.
2. On match, bare `return` yielded undef instead of `return $uri`,
which would propagate undef to HTTP methods causing cryptic errors.
The practical effect: services with both a version_prefix AND a versioned
endpoint (e.g. Network with prefix v2.0 and endpoint .../v2.0) would
produce double-versioned URLs like /v2.0/v2.0/floatingips.
Fix: use m{/v\d}a to match any versioned path regardless of port format,
and return $uri (not undef) so the URI is preserved.
Adds t/root-uri.t with tests covering version detection, prefix behavior,
double-versioning prevention, and various endpoint formats.
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
Fix
root_uri()in Service.pm returningundefwhen the OpenStack catalog endpoint URL contains a version path.Why
Two bugs in line 87 combined to create a silent failure:
m{:[\d]/v}only matched single-digit ports — all real OpenStack endpoints use 4-5 digit ports (:8774,:9696), so the version-detection guard never triggered.return(without$uri) would yieldundef, propagating to HTTP methods and causing cryptic errors.For deployments where the service catalog includes versioned URLs (e.g.
http://host:9696/v2.0), services with aversion_prefixwould generate double-versioned URIs like/v2.0/v2.0/floatingips.How
m{:[\d]/v}atom{/v\d}a— matches versioned paths regardless of port format or presence.returntoreturn $uri— preserves the URI instead of losing it.Testing
New
t/root-uri.tcovering:v(passthrough)Quality Report
Changes: 2 files changed, 127 insertions(+), 1 deletion(-)
Code scan: clean
Tests: passed (OK)
Branch hygiene: clean
Generated by Kōan post-mission quality pipeline