Skip to content

Handle incomplete survey responses safely - #74

Open
mageroni with github-agentic-autofix[bot] wants to merge 4 commits into
mainfrom
agentic-autofix/fix-code-scanning-alerts-again
Open

mageroni with github-agentic-autofix[bot] wants to merge 4 commits into
mainfrom
agentic-autofix/fix-code-scanning-alerts-again

Conversation

@github-agentic-autofix

@github-agentic-autofix github-agentic-autofix AI commented Nov 12, 2026 •

Copy link
Copy Markdown

Edited survey bodies without PR numbers or expected question markers could throw during parsing and abort webhook processing.

  • Parsing: Treat missing PR numbers as empty and absent question markers as unanswered.
  • Response handling: Default missing answers to an empty list before checking selections.
let pr_number = issue_body?.match(/[0-9]+/)?.[0] || '';
let firstQuestionResponse =
  (await getQuestionResponse(1, 2, issue_body)) || [];

Co-authored-by: mageroni <107436170+mageroni@users.noreply.github.com>
@github-agentic-autofix github-agentic-autofix AI changed the title [WIP] Fix all code scanning alerts in repository Handle incomplete survey responses safely Nov 12, 2026
@github-agentic-autofix
github-agentic-autofix AI marked this pull request as ready for review November 12, 2026 16:30
GitHub Agentic Autofix finished work on behalf of mageroni November 12, 2026 16:30
Copilot AI dynamic review requested due to automatic review settings November 12, 2026 16:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The PR-number extraction still accepts unrelated numbers in edited survey text, which can corrupt stored survey records when the explicit pull-request marker is absent.

1 open issue
What changed in this PR

Hardens survey webhook parsing for incomplete or edited issue bodies so missing responses no longer abort processing.

Changes:

  • Adds defensive handling for missing PR numbers and question markers.
  • Defaults missing question responses to empty values.
  • Adds regression coverage for incomplete edited survey bodies.
File Description
test/​index.test.js Adds regression coverage verifying incomplete edited survey bodies are processed safely and persist empty responses.
index.js Adds null-safe parsing for missing PR numbers and question responses during survey webhook processing.

Review effort: Lite (auto)

Comment thread index.js Resolved
mageroni and others added 2 commits November 12, 2026 10:36
Do not include the words Pull Request in the match, just the symbol `#`

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.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.

3 participants