Skip to content

fix: filter out more user error messages#8230

Merged
khendrikse merged 1 commit intomainfrom
EX-2132/filter-out-more-user-error-messages
May 1, 2026
Merged

fix: filter out more user error messages#8230
khendrikse merged 1 commit intomainfrom
EX-2132/filter-out-more-user-error-messages

Conversation

@khendrikse
Copy link
Copy Markdown
Contributor

🎉 Thanks for submitting a pull request! 🎉

Summary

This filters out a few extra user errors that I think we do not need to have in our monitoring.


For us to review and ship your PR efficiently, please perform the following steps:

  • Open a bug/issue before writing your code 🧑‍💻. This ensures we can discuss the changes and get feedback from everyone that should be involved. If you`re fixing a typo or something that`s on fire 🔥 (e.g. incident related), you can skip this step.
  • Read the contribution guidelines 📖. This ensures your code follows our style guide and
    passes our tests.
  • Update or add tests (if any source code was changed or added) 🧪
  • Update or add documentation (if features were changed or added) 📝
  • Make sure the status checks below are successful ✅

A picture of a cute animal (not mandatory, but encouraged)

@khendrikse khendrikse requested review from a team as code owners May 1, 2026 08:57
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 1, 2026

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced error detection to properly identify and handle additional user input errors, reducing unnecessary error reports.

Walkthrough

This change expands the user input error filter in the error reporting handler by adding four new message substrings to the USER_INPUT_ERROR_MESSAGE_PATTERNS list. These additions enable the handler to recognize and filter out additional error types, preventing them from being reported to Bugsnag when they match the new patterns. The error reporting endpoint will return a 200 status code for these errors without calling the notification service.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: filtering out additional user error messages from monitoring.
Description check ✅ Passed The description is related to the changeset, explaining the motivation to filter out extra user errors from monitoring.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch EX-2132/filter-out-more-user-error-messages

Review rate limit: 4/5 reviews remaining, refill in 12 minutes.

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 1, 2026

📊 Benchmark results

Comparing with c3ffebf

  • Dependency count: 1,061 (no change)
  • Package size: 357 MB (no change)
  • Number of ts-expect-error directives: 355 (no change)

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
site/netlify/functions/error-reporting.ts (1)

15-21: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Normalize error-message matching to avoid case-sensitive misses.

At Line 15 and Line 21, matching is case-sensitive, so equivalent messages with different capitalization won’t be filtered.

Proposed fix
-const isUserInputError = (message: unknown): boolean =>
-  typeof message === 'string' && USER_INPUT_ERROR_MESSAGE_PATTERNS.some((pattern) => message.includes(pattern))
+const isUserInputError = (message: unknown): boolean => {
+  if (typeof message !== 'string') {
+    return false
+  }
+
+  const normalizedMessage = message.toLowerCase()
+  return USER_INPUT_ERROR_MESSAGE_PATTERNS.some((pattern) =>
+    normalizedMessage.includes(pattern.toLowerCase()),
+  )
+}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@site/netlify/functions/error-reporting.ts` around lines 15 - 21, The
isUserInputError function and USER_INPUT_ERROR_MESSAGE_PATTERNS perform
case-sensitive string matching, so normalize case before comparing: convert the
incoming message to a lowercase string (e.g. messageLower =
String(message).toLowerCase()) and compare against lowercased pattern values
(pattern.toLowerCase()) when using includes; update isUserInputError to use
messageLower.includes(pattern.toLowerCase()) so variants in capitalization are
correctly detected (references: isUserInputError and
USER_INPUT_ERROR_MESSAGE_PATTERNS).
🧹 Nitpick comments (1)
site/netlify/functions/error-reporting.ts (1)

14-17: ⚡ Quick win

Add regression tests for each newly filtered message pattern.

These string filters are easy to break with message wording drift; tests will lock expected behavior for all four additions.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@site/netlify/functions/error-reporting.ts` around lines 14 - 17, The new
filtered message strings ('Not authorized to view the currently linked project',
'could not retrieve project', "You don't appear to be in a folder that is linked
to a project", 'EADDRINUSE: address already in use') need regression tests to
prevent accidental breaks: add unit tests that assert the error-filtering
function (the filter/listing logic in error-reporting.ts — e.g., the array of
filtered messages and the function that checks messages, locate symbols like the
filtered messages array and the function that evaluates error text) returns true
(is filtered) for each exact message and false for slight variants; place tests
alongside existing error-reporting tests, covering all four strings as
independent test cases to lock expected behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@site/netlify/functions/error-reporting.ts`:
- Around line 15-21: The isUserInputError function and
USER_INPUT_ERROR_MESSAGE_PATTERNS perform case-sensitive string matching, so
normalize case before comparing: convert the incoming message to a lowercase
string (e.g. messageLower = String(message).toLowerCase()) and compare against
lowercased pattern values (pattern.toLowerCase()) when using includes; update
isUserInputError to use messageLower.includes(pattern.toLowerCase()) so variants
in capitalization are correctly detected (references: isUserInputError and
USER_INPUT_ERROR_MESSAGE_PATTERNS).

---

Nitpick comments:
In `@site/netlify/functions/error-reporting.ts`:
- Around line 14-17: The new filtered message strings ('Not authorized to view
the currently linked project', 'could not retrieve project', "You don't appear
to be in a folder that is linked to a project", 'EADDRINUSE: address already in
use') need regression tests to prevent accidental breaks: add unit tests that
assert the error-filtering function (the filter/listing logic in
error-reporting.ts — e.g., the array of filtered messages and the function that
checks messages, locate symbols like the filtered messages array and the
function that evaluates error text) returns true (is filtered) for each exact
message and false for slight variants; place tests alongside existing
error-reporting tests, covering all four strings as independent test cases to
lock expected behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 26f210e3-6163-4d6a-beaf-bdfa0ca362a2

📥 Commits

Reviewing files that changed from the base of the PR and between c3ffebf and a4ae71c.

📒 Files selected for processing (1)
  • site/netlify/functions/error-reporting.ts

@khendrikse khendrikse merged commit c94f4b7 into main May 1, 2026
52 of 54 checks passed
@khendrikse khendrikse deleted the EX-2132/filter-out-more-user-error-messages branch May 1, 2026 09:18
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.

2 participants