Skip to content

Conversation

@desrosj
Copy link
Member

@desrosj desrosj commented Oct 31, 2025

The in:body qualifier is not respected in GraphQL search queries for some reason.

This adds a .filter() before mapping the pull request numbers to the variable that is returned. The filter checks for the presence of the (case insensitive) needles within the pull request's body text, which helps filter out any instances where a Trac ticket is referenced within a comment or PR review.

This also removes the state field. Since is:open is in the search query, all returned pull requests will be open making the state is unnecessary.

Trac ticket: https://core.trac.wordpress.org/ticket/64175


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

The `in:body` qualifier does not exist in GraphQL, only in GitHub's search syntax.

This adds a `.filter()` before mapping the pull request numbers to the variable that is returned. The filter checks for the presence of the needles within the pull request's body text, which helps filter out any instances where a Trac ticket is referenced within a comment or PR review.
This ensures the search is case-insensitive.
This is not used. Since `is:open` is passed in the search query, there's no need to retrieve the state.
@github-actions
Copy link

github-actions bot commented Oct 31, 2025

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props desrosj, dd32, peterwilsoncc.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Copy link
Member

@dd32 dd32 left a comment

Choose a reason for hiding this comment

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

LGTM
This is what I was thinking when I mentioned this https://wordpress.slack.com/archives/C02RQBWTW/p1760401529768629

@desrosj desrosj changed the title Remove invalid in:body GraphQL search qualifier Remove ignored in:body GraphQL search query Oct 31, 2025
Copy link
Contributor

@peterwilsoncc peterwilsoncc left a comment

Choose a reason for hiding this comment

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

This looks sensible to me.

@peterwilsoncc

This comment was marked as outdated.

// Since search queries will match anywhere for any activity on a pull request, the body specifically needs to be manually checked.
const matchingPRs = result.search.nodes
.filter(
const bodyLower = pr.bodyText.toLowerCase();
Copy link
Member

@westonruter westonruter Oct 31, 2025

Choose a reason for hiding this comment

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

This looks like a syntax error to me. Shouldn't the arg to the filter() method look something like:

( pr ) => {
    const bodyLower = pr.bodyText.toLowerCase();
    return bodyLower.includes(tracTicketUrl) || bodyLower.includes(corePrefix);
}

Copy link
Member

Choose a reason for hiding this comment

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

Comment on lines +80 to +83
.filter(
const bodyLower = pr.bodyText.toLowerCase();
pr => pr.bodyText.includes(tracTicketUrl) || pr.bodyText.includes(corePrefix)
)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
.filter(
const bodyLower = pr.bodyText.toLowerCase();
pr => pr.bodyText.includes(tracTicketUrl) || pr.bodyText.includes(corePrefix)
)
.filter(( pr ) => {
const bodyLower = pr.bodyText.toLowerCase();
return bodyLower.includes(tracTicketUrl) || bodyLower.includes(corePrefix);
})

@github-actions
Copy link

A commit was made that fixes the Trac ticket referenced in the description of this pull request.

SVN changeset: 61101
GitHub commit: d1a4644

This PR will be closed, but please confirm the accuracy of this and reopen if there is more work to be done.

@github-actions github-actions bot closed this Oct 31, 2025
@desrosj desrosj deleted the fix/remove-in-body-qualifier branch November 4, 2025 18:28
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.

4 participants