Resolve project name to UUID in S3 mode via IBUTSU_SERVER_URL#103
Resolve project name to UUID in S3 mode via IBUTSU_SERVER_URL#103akhil-jha wants to merge 1 commit into
Conversation
Reviewer's GuideAdds a project_uuid cached_property implementation that always resolves project names to UUIDs via the Ibutsu server when possible, using IBUTSU_SERVER_URL in S3 mode, and extends tests to cover the new resolution logic and environment handling. Sequence diagram for resolving project name to UUID using IBUTSU_SERVER_URLsequenceDiagram
participant Plugin as PytestIbutsuPlugin
participant Validator as validate_uuid_string
participant Env as os_environ
participant Config as create_api_configuration
participant ProjectApi
Plugin->>Validator: validate_uuid_string(project_value)
alt project_value_is_uuid
Validator-->>Plugin: True
Plugin-->>Plugin: return project_value
else project_value_is_name
Validator-->>Plugin: False
Plugin->>Env: get(IBUTSU_SERVER_URL, "")
alt server_url_missing
Env-->>Plugin: ""
Plugin-->>Plugin: logger.warning(no server URL)
Plugin-->>Plugin: return project_value
else server_url_present
Env-->>Plugin: server_url
Plugin->>Config: create_api_configuration(server_url, ibutsu_token, use_ssl_ca_cert=False)
Config-->>Plugin: configuration
Plugin->>ProjectApi: ProjectApi(ApiClient(configuration))
Plugin->>ProjectApi: get_project_list(filter=["name=project_value"])
alt project_not_found_404
ProjectApi-->>Plugin: NotFoundException
Plugin-->>Plugin: logger.warning(project not found)
Plugin-->>Plugin: return project_value
else project_found
ProjectApi-->>Plugin: response.projects
Plugin-->>Plugin: return response.projects[0].id
end
end
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="tests/test_plugin.py" line_range="412-421" />
<code_context>
+ def test_project_uuid_server_returns_empty_list_falls_back(
</code_context>
<issue_to_address>
**issue (testing):** Add a test case for the NotFoundException (404) path when resolving project UUID
We currently only test the successful resolution and the empty-projects fallback paths. Please add a test where `ProjectApi.get_project_list` raises `NotFoundException` and assert that `plugin.project_uuid` falls back to the project name (and optionally that a warning is logged), so the 404-handling branch is covered and protected against regressions.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #103 +/- ##
==========================================
+ Coverage 68.15% 70.27% +2.12%
==========================================
Files 7 7
Lines 829 831 +2
Branches 140 140
==========================================
+ Hits 565 584 +19
+ Misses 235 218 -17
Partials 29 29
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
Summary
Problem
When running in S3 mode (IBUTSU_MODE=s3), the project_uuid property returned the project name as-is because it short-circuited with:
This caused downstream consumers (e.g. IQE metrics ibutsu_url label) to generate URLs like /project/insights-qe/runs/... instead of /project/<>/runs/....

Changes
Dependency
app-interface MR 190001