Skip to content

Fix Horreum label creation by sending array payload to API#173

Merged
jhutar merged 1 commit into
redhat-performance:mainfrom
deekshith-24:fix/horreum-create-label-array-payload
Jun 25, 2026
Merged

Fix Horreum label creation by sending array payload to API#173
jhutar merged 1 commit into
redhat-performance:mainfrom
deekshith-24:fix/horreum-create-label-array-payload

Conversation

@deekshith-24

@deekshith-24 deekshith-24 commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes label creation failures in HorreumAPI.create_label by sending the request body as a JSON array instead of a single object.

POST /api/schema/{id}/labels was returning 400 Bad Request with an empty response body because create_label posted json=label_data (a single object). The Horreum API expects an array of label objects, consistent with GET /api/schema/{id}/labels, which returns a list.

Change: wrap the payload in create_label:

response = self.session.post(url, json=[label_data])

The /api/schema/{id}/labels endpoint expects a JSON array of label
objects, not a single object.
@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: da2e0621-7adf-487c-8ca0-c9d256ed4194

📥 Commits

Reviewing files that changed from the base of the PR and between 1e4d6e9 and 166a8a7.

📒 Files selected for processing (1)
  • extras/opl/horreum_api.py

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Improved dry-run handling for label creation so the request payload is now formatted consistently as a single-item list.
    • Dry-run logging and request flow should now better match the expected API body shape, while normal label creation remains unchanged.

Walkthrough

HorreumAPI.create_label now sends the dry-run POST body as a single-item JSON list instead of a bare object. The non-dry-run path is unchanged.

Changes

Label creation payload shape

Layer / File(s) Summary
Dry-run payload list shape
extras/opl/horreum_api.py
create_label posts [label_data] instead of label_data when building the request body.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive No description was provided, so there is no meaningful summary of the changeset. Add a brief description of the code change and its effect on Horreum label creation.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly states the main change: Horreum label creation now sends an array payload.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@deekshith-24 deekshith-24 requested a review from jhutar June 25, 2026 11:20
@jhutar jhutar merged commit 4cd5db6 into redhat-performance:main Jun 25, 2026
2 checks passed
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