Skip to content

Report the first line of text from the commit message - #343

Open
ekamran wants to merge 1 commit into
WordPress:masterfrom
ekamran:shifteq/335-first-non-blank-message
Open

ekamran wants to merge 1 commit into
WordPress:masterfrom
ekamran:shifteq/335-first-non-blank-message

Conversation

@ekamran

@ekamran ekamran commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #335

Problem

report.php builds the report title from the first line of the tested commit's message (git log -1 --pretty=%B | head -1). When that first line is blank, the Reporter API rejects the upload with Invalid parameter(s): message (HTTP status 400), and the host's report for that revision is lost.

That is what happened on r63330 (2026-08-21, the day #335 was filed): the mirror commit's message starts with a blank line. Core's own "test reporting enabled" jobs failed on that commit with the same error (https://github.com/WordPress/wordpress-develop/actions/runs/32451583443/job/96684603979), and the results site has 1 host report for r63330 against 19 for r63329 and 17 for r63331. The previous such commit, r61679, has 0 reports against 7 for r61678.

Across the full mirror history (53,713 commits) this affects 10 revisions: r63330, r61679, r59087, r52707, r50955, r40796, r36811, r35910, r5451 and r3116. Five of them contain nothing but the git-svn-id line.

Fix

Report the first line of actual text in the message instead of the first line as-is. Blank lines and the git-svn-id trailer are skipped, and when no text is found at all the revision label (r59087) is used, so the upload never fails on the title.

Git's %s (subject) was not used because it joins a wrapped first paragraph into one line, which would change the title of 943 existing revisions. The new rule changes exactly the 10 revisions above and leaves the other 53,703 titles identical.

Verification

  • Four scratch git repos (blank first line, normal, wrapped first paragraph, trailer-only), each run through the real report.php against the Reporter plugin (current master) on a local WordPress 7.1 site. master fails the blank-first-line and trailer-only cases with Invalid parameter(s): message (HTTP status 400); this branch uploads all four, with the r63330-shaped commit titled "Block Supports: guard against non-string attribute values to avoid fatal errors" and the trailer-only one titled "r59087". The normal and wrapped cases produce the same title as before.
  • Old rule vs new rule replayed over all 53,713 mirror commits: 53,703 identical, 10 changed (the list above).
  • php -l, phpcs and git diff --check clean.

Use of AI

AI assistance: Yes
Tool(s): Claude Code and Codex
Used for: Investigation, implementation, verification harness, and PR wording. I reviewed the reasoning and test results, and I take responsibility for the contribution.

A commit message can start with a blank line, or contain nothing but the
git-svn-id line, and the Reporter API rejects an empty message. Taking the
first line of the message as-is then fails the whole upload, which is what
happened on r63330 and on nine older revisions. Report the first line of
actual text instead, and fall back to the revision when there is none.

Fixes WordPress#335.
@github-actions

github-actions Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

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.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: ekamran <ekamran@git.wordpress.org>
Co-authored-by: chrisdavidmiles <chrisdavidmiles@git.wordpress.org>
Co-authored-by: iarif4u <iarif4u@git.wordpress.org>
Co-authored-by: ramonfincken <ramon-fincken@git.wordpress.org>

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

@chrisdavidmiles chrisdavidmiles 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.

The title now comes from the first line of actual text, skipping blank lines and the git-svn-id trailer and falling back to the revision label, so the handful of mirror commits with a blank or trailer-only first line stop failing the Reporter upload on an empty title.

AI Assisted Claude Code was used to pull the branch and mutation check the title change against blank first line and trailer only commits.

@iarif4u iarif4u 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.

Verified and tested:

  • r63330 (497de8c): the commit message starts with an empty line, so head -1 gives an empty title. This matches #335.
  • I ran the new loop on 4 cases:
    • Empty first line → first real line.
    • Only the git-svn-id line → r63330.
    • Normal message → its first line, unchanged.
    • Empty $rev → r.

The logic is correct, and normal commits keep their current title.

One small, non-blocking point: if a commit has no git-svn-id line, $rev is empty and the title becomes just r. That can only happen on a non-mirror commit, and the upload needs a revision anyway, so I think it's fine as it is.

@ekamran

ekamran commented Oct 2, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for testing this. Right on the empty $rev case: it only happens outside the mirror, and the Reporter rejects that upload anyway because commit has to be an integer, so the title never gets used there. @iarif4u

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.

Error: Error uploading results: Invalid parameter(s): message (HTTP status 400)`

3 participants