Repository navigation
feat: Add Filter parameter to Get-SentryTestEvent - #63
Draft
bitsandfoxes wants to merge 1 commit into
Draft
bitsandfoxes wants to merge 1 commit into
bitsandfoxes wants to merge 1 commit into
Conversation
This was referenced Oct 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Get-SentryTestEventtakes an optional-Filterscriptblock now. When looking up events by tag, it drops the events the filter rejects before checking that exactly one is left.The tag lookup expects exactly one event per tag. A test app can send an unrelated event that carries the same scope tag, and then the lookup fails. sentry-unity's iOS Crash Capture test hits this: on a slow simulator, sentry-cocoa's app-hang watchdog reports an
App Hang Non Fully Blockedevent about a second before the crash. The hang event carries thetest.crash_idtag that was already set on the scope, so the lookup sees two events and polls for 300 s before failing with "Expected 1, but got 2". Over the last 30 days that happened 15 times in sentry-unity CI.How it works:
entriesitem becomes a top-level property such asexception) before the filter runs. The filter sees the same shape the function returns, so a caller can write{ $_.exception.values[0].mechanism.type -ne 'AppHang' }. The flattening moved into a privateConvertTo-SentryTestEventhelper. Both lookup paths andGet-SentryTestTransactionuse it.-Filtertogether with-EventIdthrows, because an event looked up by ID can't be filtered.-Filternothing changes for existing callers.Usage in sentry-unity: getsentry/sentry-unity#2899
Tested locally with Pester, mocking
Find-SentryEventByTagandGet-SentryEventwith events parsed throughConvertFrom-Json -AsHashtable, the way the API client parses them: it picks the crash out of crash plus hang, still fails on two crashes plus a hang, keeps polling while only hang events exist, leaves the unfiltered behaviour alone, and rejects-Filterwith-EventId. No workflow coversutils/, so this PR runs no CI of its own. sentry-unity CI covers it: with a hang forced right before the iOS crash, Sentry held a crash event and an AppHang event for the same tag, and the filtered lookup still passed on all four iOS jobs (getsentry/sentry-unity#2899, run).🤖 Generated with Claude Code