Skip to content

Credit reporters of Trac tickets linked in the description - #311

Open
obenland wants to merge 4 commits into
WordPress:trunkfrom
obenland:add/trac-reporters
Open

obenland wants to merge 4 commits into
WordPress:trunkfrom
obenland:add/trac-reporters

Conversation

@obenland

@obenland obenland commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

Pull requests for WordPress.org projects link their Trac ticket in the description, but Props Bot never credited the ticket's reporter, since it only collects from GitHub issues. That's how the reporter of https://meta.trac.wordpress.org/ticket/7932 was left out of the props for WordPress/wordpress.org#1121, see comment:3.

This reads the *.trac.wordpress.org/ticket/<id> links in the PR description and looks up each ticket's reporter through Trac's query CSV, asking for the reporter column only. Reporters go by their WordPress.org username, so they are credited through the same @git.wordpress.org email path as co-authors without a GitHub account. That covers duplicates with linked GitHub accounts, @propsbot remove <username>, and the check that the account exists.

  • Redirects aren't followed, since an unknown Trac instance redirects to Core Trac, where the same ticket number is a different ticket.
  • Anonymous reporters on old tickets are skipped, and so is free-form reporter text that no WordPress.org login could have.
  • A reporter whose WordPress.org account doesn't exist is left out with a warning, like a username added with @propsbot add (Accept WordPress.org usernames in @propsbot add #315). When the account check itself fails, the reporter stays listed as unlinked so a committer can check.
  • @propsbot remove <username> leaves out a reporter, as it does other WordPress.org users.
  • Only the first 10 linked tickets are looked up, concurrently, since the description is up to the PR author.
  • When Trac can't be reached, or answers with its bot check, the reporter is skipped with a warning and the rest of the props are unaffected.

Known limitation: Trac shows a bot check to GitHub's runners. The "Test the Action" run on this PR got Could not get the reporter of https://meta.trac.wordpress.org/ticket/7932: HTTP 403. Until WordPress.org lets Props Bot's lookups through, or offers a lookup endpoint, reporters are skipped with that warning and the rest of the props are unaffected.

Commenters on Trac tickets are left out on purpose; see the concerns in #30. This doesn't close that issue.

Refs #30.

🤖 Generated with Claude Code

Copilot AI lite review requested due to automatic review settings November 2, 2026 21:35

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The review identifies an unverified GraphQL body selection that could disable reporter collection and slug normalization that rejects valid Trac logins with repeated or surrounding hyphens.

2 open issues
What changed in this PR

This pull request adds support for crediting reporters of WordPress.org Trac tickets linked in pull request descriptions, while preserving existing contributor, duplicate, and removal handling.

Changes:

  • Extracts unique Trac ticket links and retrieves reporter usernames through Trac’s CSV endpoint.
  • Integrates Trac reporters into the existing WordPress.org attribution flow.
  • Handles anonymous reporters, redirects, lookup failures, duplicates, and removals.
  • Updates GitHub data collection, tests, documentation, and the bundled action output.
File Description
tests/​trac.test.mjs Tests Trac ticket extraction and reporter lookup behavior.
tests/​contribution-collector.test.mjs Tests reporter attribution, deduplication, and removal handling.
src/​trac.js Implements Trac URL parsing and reporter retrieval.
src/​github.js Fetches pull request descriptions through GitHub GraphQL.
src/​contribution-collector.js Integrates Trac reporters into contributor processing and filtering.
README.md Documents Trac reporter attribution and removal behavior.
dist/​index.js Updates the bundled GitHub Action implementation.

Review effort: Lite

Comment thread src/trac.js Resolved
Comment thread src/github.js Resolved

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Approval should be deferred because the integration relies on live Trac and WordPress.org HTTP behaviors that mocked tests cannot verify, requiring a human check of the GitHub-runner execution.

No open issues 🎉

2 resolved since last review

Review effort: Lite

@lancewillett

Copy link
Copy Markdown
Member

Could you refresh this against trunk? The merge preview found conflicts in the README, the contributor collector, its tests and the compiled action. #315 changed how the collector credits WordPress.org users. Resolving the source and tests first, then rebuilding the action, would let us check the reporter credits alongside that change.

obenland and others added 4 commits November 30, 2026 11:29
Pull requests for WordPress.org projects link their Trac ticket in the
description, but its reporter was never credited, since only GitHub
issues were collected.

Reporters go by their WordPress.org username, so they are credited
through the same `@git.wordpress.org` email path as co-authors without a
GitHub account. That covers duplicates, `@propsbot remove`, and the
check that the account exists.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
WordPress derives the profile slug with
`sanitize_title( mb_substr( $user_login, 0, 50 ) )`, which turns dots
into hyphens, collapses repeated hyphens, and trims them from the ends.
The approximation stripped dots and left hyphens alone, so a reporter
like `john.doe` or `john--doe` was looked up under the wrong slug and
left out of the props.

Also test that the pull request query selects the description, since
Trac reporters are read from it and the query is mocked everywhere else.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- A reporter who is also a commit co-author got a second identical
  `Co-authored-by` line, since Trac reporters skipped the check every
  other source makes for contributors already in the list.
- A reporter whose WordPress.org account can't be found was listed as an
  unlinked GitHub account, asking them to link an account they may not
  have. They are now left out with a warning.
- Free-form reporters on old tickets, such as a quoted name with a
  comma, could turn into the slug of an unrelated account. Reporters
  must now look like a WordPress.org login.
- The description is up to the PR author, so only the first 10 linked
  tickets are looked up, concurrently.
- The User-Agent sent to WordPress.org is built in one place.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CodeQL flags a substring check on a URL, even in a test mock.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@obenland

Copy link
Copy Markdown
Member Author

Thanks, I rebased it on latest trunk. It's currently blocked by https://make.wordpress.org/systems/2026/11/04/exempt-propsbot-from-trac-browser-challenge/.

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

Labels

None yet

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

4 participants