Skip to content

Add new GraphQL query InfrahubGraphQLQueryReport#9055

Merged
ajtmccarty merged 1 commit into
stablefrom
ifc-2504-graphql-query-report
Apr 29, 2026
Merged

Add new GraphQL query InfrahubGraphQLQueryReport#9055
ajtmccarty merged 1 commit into
stablefrom
ifc-2504-graphql-query-report

Conversation

@ogenstad
Copy link
Copy Markdown
Contributor

@ogenstad ogenstad commented Apr 25, 2026

Why

New GraphQL query to make it easier for end users to figure out how the GraphQLQueryAnalyzer views a query (for artifact regeneration).

This will later be used by infrahubctl graphql query-report (note that PR works together with this mutation but the PR itself hasn't been reviewed by me it's just some generated code which I'll get back to once this is merged to stable. Then after the next patch release of Infrahub I'll get back to the SDK PR and create some integration tests for it as well and potentially clean up that code. Once that is done I'll also remove the SpecKit files generated here.

What changed

  • Relevant changes are in backend/infrahub/graphql/queries/graphql_query_report.py, where we add a new GraphQL query called InfrahubGraphQLQueryReport, it produces a report based on the contents of a GraphQL query, as it is now the only field is targets_unique_nodes which indicates if the query can be used for artifact definitions and able to target a single unique base node. (In the future we can add stuff like models being queried along with attributes and relationships) Perhaps the permissions that would be required to run the query. The types of relationships it traverses, if fragments etc are used and the complexity of the query. But for now it's only a single field.
  • Added a number of tests for this new mutation.

@github-actions github-actions Bot added group/backend Issue related to the backend (API Server, Git Agent) group/frontend Issue related to the frontend (React) type/spec A specification for an upcoming change to the project labels Apr 25, 2026
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Apr 25, 2026

Merging this PR will not alter performance

✅ 12 untouched benchmarks


Comparing ifc-2504-graphql-query-report (540653c) with stable (12a5b15)

Open in CodSpeed

@ogenstad ogenstad force-pushed the ifc-2504-graphql-query-report branch from da5bdd5 to 540653c Compare April 29, 2026 10:13
default_branch: Branch,
car_person_schema: SchemaBranch,
) -> None:
assert UNIQUE_TARGETS_TEST_CASES, "No test cases defined for unique targets test"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The reason we have this here is to avoid test setups between each test case.



async def resolve_graphql_query_report(
_root: None,
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Note I tried a different approach here to avoid having to have # noqa: ARG003 comments. This is an argument that Graphene adds that we never and up using. So something we could perhaps transfer to other places as well..

@ogenstad ogenstad marked this pull request as ready for review April 29, 2026 12:13
@ogenstad ogenstad requested a review from a team as a code owner April 29, 2026 12:13
@ajtmccarty ajtmccarty merged commit 283efb0 into stable Apr 29, 2026
53 checks passed
@ajtmccarty ajtmccarty deleted the ifc-2504-graphql-query-report branch April 29, 2026 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

group/backend Issue related to the backend (API Server, Git Agent) group/frontend Issue related to the frontend (React) type/spec A specification for an upcoming change to the project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants