Skip to content

[PR] Allow to query config reports#1407

Open
knoppi wants to merge 1 commit intoSatelliteQE:masterfrom
ATIX-AG:upstream-read-config-reports
Open

[PR] Allow to query config reports#1407
knoppi wants to merge 1 commit intoSatelliteQE:masterfrom
ATIX-AG:upstream-read-config-reports

Conversation

@knoppi
Copy link
Contributor

@knoppi knoppi commented Mar 3, 2026

Description of changes

Enable querying the API endpoint for config reports.

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • Renaming the host field to host_name on Report is a breaking change for existing callers; consider either supporting both keys or adding a backwards-compatible alias/mapping to avoid runtime failures in existing code.
  • Changing the _meta['api_path'] from api/v2/reports to api/v2/config_reports may break any usage that relied on the previous endpoint; if both endpoints must remain usable, consider parameterizing or versioning the path instead of hard-switching it.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Renaming the `host` field to `host_name` on `Report` is a breaking change for existing callers; consider either supporting both keys or adding a backwards-compatible alias/mapping to avoid runtime failures in existing code.
- Changing the `_meta['api_path']` from `api/v2/reports` to `api/v2/config_reports` may break any usage that relied on the previous endpoint; if both endpoints must remain usable, consider parameterizing or versioning the path instead of hard-switching it.

## Individual Comments

### Comment 1
<location path="nailgun/entities.py" line_range="7182-7186" />
<code_context>
     def __init__(self, server_config=None, **kwargs):
         self._fields = {
-            'host': entity_fields.StringField(required=True),
+            'host_name': entity_fields.StringField(required=True),
             'logs': entity_fields.ListField(),
             'reported_at': entity_fields.DateTimeField(required=True),
         }
-        self._meta = {'api_path': 'api/v2/reports'}
+        self._meta = {'api_path': 'api/v2/config_reports'}
         super().__init__(server_config=server_config, **kwargs)

</code_context>
<issue_to_address>
**issue (bug_risk):** Renaming `host` to `host_name` and changing the API path may break existing consumers or deserialization.

Since this class now targets `api/v2/config_reports` and uses `host_name`, verify that:
- The API response actually uses `host_name` (not `host`), and
- No existing code or callers still depend on `Report.host` or the old `api/v2/reports` shape.
If there is existing usage, consider keeping `host` and adding `host_name` as an alias/derived field, or introducing a separate entity for config reports so the original `Report` interface remains unchanged.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@Satellite-QE
Copy link
Contributor

Can one of the admins verify this patch?

@dosas dosas added 6.17.z 6.18.z 6.19.z CherryPick PR needs CherryPick to previous branches labels Mar 4, 2026
@knoppi knoppi marked this pull request as draft March 5, 2026 07:06
@knoppi knoppi force-pushed the upstream-read-config-reports branch 4 times, most recently from 55e7214 to 48cd98e Compare March 5, 2026 08:04
@knoppi knoppi marked this pull request as ready for review March 5, 2026 08:05
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@knoppi
Copy link
Contributor Author

knoppi commented Mar 5, 2026

I changed the scope of this PR to adding a new class instead of modifying the class for legacy host reports.

- New class for reading API endpoint config_reports
- Entities are deletable, readable and searchable

Note: The JSON response contains host_name unlike host in the response
of the legacy reports API.
@knoppi knoppi changed the base branch from 6.18.z to master March 5, 2026 08:36
@knoppi knoppi force-pushed the upstream-read-config-reports branch from 48cd98e to 0621e8a Compare March 5, 2026 08:36
@dosas dosas requested review from ogajduse and vsedmik March 12, 2026 08:44
Copy link
Member

@ogajduse ogajduse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you!

@ogajduse
Copy link
Member

Waiting for second review. Is this something @SatelliteQE/team-endeavour wants to take a look at?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.17.z 6.18.z 6.19.z CherryPick PR needs CherryPick to previous branches

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants