fix(ws-worker): suppress credential environment mismatch from sentry - #1534
CaptainAni187 wants to merge 1 commit into
Conversation
A project whose environment has no matching credential environment raises `Credential environment mismatch`. That is a configuration mistake for the user to fix, and the message already tells them how, so it should not be reported as a worker fault. Adds the pattern to IGNORED_ERROR_PATTERNS, following the OAuth expiry entry. No severity override is set, so the exit reason is unchanged and only the sentry report is suppressed. Also adds the first tests for this module, covering both patterns, the case-insensitive match, nullish input and the severity lookup.
|
Note on the red The worker integration suite hangs rather than fails: Nothing errors; three tests just never resolve and ava times out. That's the same open-handle symptom described in #1321 ("some open loop is keeping the process alive"). It also isn't specific to forks or to these PRs — #1527 and #1530, both branched inside this repo, fail the same job, while #1528, #1529, #1532 and #1533 pass it. Looks intermittent. Unit tests and type-checks for the packages touched here are green locally, and identical to a clean checkout. |
|
Thanks for this @CaptainAni187 🎉 I'm a bit torn on the tests. They're not very valuable because they're mostly just asserting on basic regex patterns. It's 43 lines of bloat. I'm planning a release today so I'll probably just merge this in. I might remove the tests, maybe it's better than nothing 🤔 For the record, pasting test suite results into the PR body is pointless, misleading, potentialy dangerous, and kinda annoying. We have automated test suites which tell is if tests are passing. I'll take those over plain text any day. Please carefully review AI generated PR summaries and make sure to remove irrelevant or misleading information. Humans have to read this stuff and make decisions based on it. |
|
Both fair. Please drop the tests, they assert the regex engine more than the behaviour and aren't worth 43 lines to carry. Point taken on the pasted test output too. I'll stop putting it in PR bodies and trim it from my open ones. |
|
Closing in favour of #1550 |
Closes #1460
Adds
Credential environment mismatchtoIGNORED_ERROR_PATTERNS, following theOAuth token has expiredentry added in #1440.On the missing severity
The OAuth entry carries
severity: 'crash', whichonRunErroruses to override the exit reason. I deliberately left it off here.The issue asks for this to be suppressed from sentry, and
matchesIgnoredErroralone does that —getIgnoredErrorSeverityis a separate lookup, andonRunErroronly overrides when it returns something. So omitting it keeps the change to exactly what was asked and leaves the reason Lightning receives untouched. If you do want an override, say which reason and it's a one-line addition; I did not want to change what the user sees reported without being asked.On the wider point in the thread
@josephjclark noted that the more important problem is differentiating these in sentry, since
LightningSocketErroris generic and sentry lumps everything together. That is a bigger change than this and I have not attempted it — this PR only stops this particular message from being reported.Tests
src/util/ignored-errors.tshad no tests, so this adds the first ones: both patterns, the case-insensitive match, an unrelated message, empty and nullish input, and the severity lookup for both entries — including that a credential mismatch returns no override, which pins the decision above.test/util: 75 passing, up from 67. The 4 failures, 1 skip and 3 uncaught exceptions in that directory are identical before and after this change.tsc --noEmit: output identical before and after (the existing errors are unbuilt workspace deps and someanyparameters inwake-up.test.ts).