From 2d78534bee1107333abe54c16c70e7c4db7bca0f Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Wed, 6 May 2026 12:34:04 +0200 Subject: [PATCH 1/2] race tag vs id --- test/IntegrationTest/Integration.Tests.ps1 | 33 +++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/test/IntegrationTest/Integration.Tests.ps1 b/test/IntegrationTest/Integration.Tests.ps1 index d4c3048c9..1a7cb2ad6 100644 --- a/test/IntegrationTest/Integration.Tests.ps1 +++ b/test/IntegrationTest/Integration.Tests.ps1 @@ -371,7 +371,38 @@ if ($env:SENTRY_TEST_PLATFORM -ne "WebGL") { $eventId = Get-EventIds -AppOutput $script:runResult.Output -ExpectedCount 1 if ($eventId) { Write-Host "::group::Getting event content" - $script:runEvent = Get-SentryTestEvent -TagName "test.crash_id" -TagValue "$eventId" -TimeoutSeconds 300 + + # Race two lookups: the project events endpoint resolves as soon as the event is + # ingested + tag-indexed, while the issues endpoint also requires issue grouping. + # We poll the events endpoint here and hand off to Get-SentryTestEvent for the + # full fetch + entry flattening; if the events endpoint never returns a hit we + # fall back to the original tag-via-issues path so the failure mode is unchanged. + $pollBudgetSeconds = 300 + $pollStart = Get-Date + $pollEnd = $pollStart.AddSeconds($pollBudgetSeconds) + $resolvedEventId = $null + do { + try { + $hits = Get-SentryEventsByTag -TagName "test.crash_id" -TagValue "$eventId" -Limit 1 + if ($hits -and @($hits).Count -ge 1) { + $resolvedEventId = $hits[0].eventID + break + } + } catch { + Write-Debug "Get-SentryEventsByTag poll failed: $($_.Exception.Message)" + } + Start-Sleep -Milliseconds 500 + } while ((Get-Date) -lt $pollEnd) + + if ($resolvedEventId) { + Write-Host "Resolved crash event $resolvedEventId via project events endpoint" + $remaining = [Math]::Max(30, [int]($pollEnd - (Get-Date)).TotalSeconds) + $script:runEvent = Get-SentryTestEvent -EventId $resolvedEventId -TimeoutSeconds $remaining + } else { + Write-Host "Project events endpoint did not return the crash within $pollBudgetSeconds s; falling back to tag-via-issues lookup" + $script:runEvent = Get-SentryTestEvent -TagName "test.crash_id" -TagValue "$eventId" -TimeoutSeconds 30 + } + Write-Host "::endgroup::" } } From 85020636bafa4a008ea05bc2e457d892479fdb42 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Wed, 6 May 2026 15:55:19 +0200 Subject: [PATCH 2/2] poll every 5s --- test/IntegrationTest/Integration.Tests.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/IntegrationTest/Integration.Tests.ps1 b/test/IntegrationTest/Integration.Tests.ps1 index 1a7cb2ad6..1a1c7ef4d 100644 --- a/test/IntegrationTest/Integration.Tests.ps1 +++ b/test/IntegrationTest/Integration.Tests.ps1 @@ -377,6 +377,7 @@ if ($env:SENTRY_TEST_PLATFORM -ne "WebGL") { # We poll the events endpoint here and hand off to Get-SentryTestEvent for the # full fetch + entry flattening; if the events endpoint never returns a hit we # fall back to the original tag-via-issues path so the failure mode is unchanged. + # Poll every 5 s to stay well under Sentry's API rate limit on this endpoint. $pollBudgetSeconds = 300 $pollStart = Get-Date $pollEnd = $pollStart.AddSeconds($pollBudgetSeconds) @@ -391,7 +392,7 @@ if ($env:SENTRY_TEST_PLATFORM -ne "WebGL") { } catch { Write-Debug "Get-SentryEventsByTag poll failed: $($_.Exception.Message)" } - Start-Sleep -Milliseconds 500 + Start-Sleep -Seconds 5 } while ((Get-Date) -lt $pollEnd) if ($resolvedEventId) {