Skip to content

Guard against null getTitle(); send same comment body to each Jira issue#9

Open
tosfos wants to merge 1 commit intomainfrom
fix-getTitle-null-and-comment-body
Open

Guard against null getTitle(); send same comment body to each Jira issue#9
tosfos wants to merge 1 commit intomainfrom
fix-getTitle-null-and-comment-body

Conversation

@tosfos
Copy link

@tosfos tosfos commented Feb 14, 2026

Summary

Two fixes in PageSaveComplete hook handler:

  1. Null getTitle(): WikiPage::getTitle() can return null in edge cases. We now check and return early in onPageSaveComplete, and defensively in getDiffLink() return '' when title is null, avoiding a fatal when calling getFullText() or getFullURL().

  2. Comment body per issue: The loop previously accumulated the comment string and sent that growing string to each Jira issue (first issue got one block, second got two blocks, etc.). The comment body is now built once and the same body is sent to each issue key.

Changes

  • src/Hooks.php: Early return when $wikiPage->getTitle() is null; build $commentBody once and pass it to each sendToJira() call; in getDiffLink() null-check title and return '' when null.

Testing

  • php -l src/Hooks.php passes.

Jira: create SLOP task(s) and add comment (summary, PR link, scores, humorous paragraph, "Work was performed by AI / Cursor Agent").

Work performed by AI / Cursor Agent.

- onPageSaveComplete: check wikiPage->getTitle() and return early if null to
  avoid fatal in getFullText() or inside getDiffLink()
- getDiffLink: null-check getTitle() and return '' when null (defensive)
- Fix comment body: build commentBody once and send that same string to each
  issue key instead of accumulating and sending a growing string to each

Co-authored-by: Cursor <cursoragent@cursor.com>
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.

1 participant