fleet/changes/41603-fix-query-responses
Scott Gress f093406e04
Fix get/create/update query response (#41966)
<!-- Add the related story/sub-task/bug number, like Resolves #123, or
remove if NA -->
**Related issue:** Resolves #41603 

# Details

Fixes an issue where the nested `query` key in the get, create and
update query API responses, which is the literal SQL query, was getting
duplicated into a `report` key with the SQL. This was happening because
our JSON field duplicator which adds the renamed version of deprecated
keys to responses is intentionally naive; it doesn't account for cases
where the parent and child structs have the same key with different
meanings because that is... not ideal. In Fleet 5 we won't have this
problem since it'll just be `report.query`, but for now the solution is
to just hard-code a `Report` field onto the response structs, rather
than over-complicate the duplicator code to account for different
nesting levels.

# Checklist for submitter

If some of the following don't apply, delete the relevant line.

- [X] Changes file added for user-visible changes in `changes/`,
`orbit/changes/` or `ee/fleetd-chrome/changes`.
See [Changes
files](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/guides/committing-changes.md#changes-files)
for more information.

## Testing

- [X] Added/updated automated tests
- [X] QA'd all new/changed functionality manually
- [X] verified no `query.report` or `report.report` present in get query
response
- [X] verified no `query.report` or `report.report` present in create
query response
- [X] verified no `query.report` or `report.report` present in modify
query response
2026-03-20 10:30:52 -05:00

1 line
71 B
Text

- Removed incorrect `report` key from get/create/modify API responses.