diff --git a/src/Exceptionless.Core/Jobs/EventNotificationsJob.cs b/src/Exceptionless.Core/Jobs/EventNotificationsJob.cs index 8890398ce2..0f164dcabd 100644 --- a/src/Exceptionless.Core/Jobs/EventNotificationsJob.cs +++ b/src/Exceptionless.Core/Jobs/EventNotificationsJob.cs @@ -78,9 +78,9 @@ protected override async Task ProcessQueueEntryAsync(QueueEntryContex { if (shouldLog) _logger.LogTrace("Loaded project: name={ProjectName}", project.Name); - // after the first 2 occurrences, don't send a notification for the same stack more then once every 30 minutes + // after the first 2 occurrences, don't send a notification for the same stack more then once every 15 minutes var lastTimeSentUtc = await _cache.GetAsync(String.Concat("notify:stack-throttle:", ev.StackId), DateTime.MinValue); - if (wi is { TotalOccurrences: > 2, IsRegression: false } && lastTimeSentUtc != DateTime.MinValue && lastTimeSentUtc > _timeProvider.GetUtcNow().UtcDateTime.AddMinutes(-30)) + if (wi is { TotalOccurrences: > 2, IsRegression: false } && lastTimeSentUtc != DateTime.MinValue && lastTimeSentUtc > _timeProvider.GetUtcNow().UtcDateTime.AddMinutes(-15)) { if (shouldLog) _logger.LogInformation("Skipping message because of stack throttling: last sent={LastSentUtc} occurrences={TotalOccurrences}", lastTimeSentUtc, wi.TotalOccurrences); return JobResult.Success; diff --git a/src/Exceptionless.Core/Mail/Mailer.cs b/src/Exceptionless.Core/Mail/Mailer.cs index d36cb1254b..1efbde3a51 100644 --- a/src/Exceptionless.Core/Mail/Mailer.cs +++ b/src/Exceptionless.Core/Mail/Mailer.cs @@ -208,8 +208,8 @@ public async Task SendOrganizationNoticeAsync(User user, Organization organizati : $"[{organization.Name}] Events are currently being throttled."; string upgradeUrl = _appUrls.OrganizationUpgrade(organization.Id); string learnMoreUrl = isOverMonthlyLimit - ? "https://github.com/exceptionless/Exceptionless/wiki/Frequently-Asked-Questions#q-what-happens-if-the-organization-plan-limit-is-reached" - : "https://github.com/exceptionless/Exceptionless/wiki/Frequently-Asked-Questions#q-why-is-my-organization-throttled"; + ? "https://exceptionless.com/docs/FAQ/#what-happens-if-the-organization-plan-limit-is-reached" + : "https://exceptionless.com/docs/FAQ/#why-is-my-organization-throttled"; var message = new OrganizationNoticeEmail( subject, organization.Name, diff --git a/src/Exceptionless.Core/Pipeline/010_AssignToStackAction.cs b/src/Exceptionless.Core/Pipeline/010_AssignToStackAction.cs index c0d067e00f..a601261b3a 100644 --- a/src/Exceptionless.Core/Pipeline/010_AssignToStackAction.cs +++ b/src/Exceptionless.Core/Pipeline/010_AssignToStackAction.cs @@ -34,7 +34,8 @@ public AssignToStackAction(IStackRepository stackRepository, FormattingPluginMan public override async Task ProcessBatchAsync(ICollection contexts) { - var stacks = new Dictionary(); + var stacksBySignatureHash = new Dictionary(); + var stacksById = new Dictionary(); foreach (var ctx in contexts) { @@ -50,15 +51,13 @@ public override async Task ProcessBatchAsync(ICollection contexts) string signatureHash = ctx.StackSignatureData.Values.ToSHA1(); ctx.SignatureHash = signatureHash; - if (stacks.TryGetValue(signatureHash, out var value)) + if (stacksBySignatureHash.TryGetValue(signatureHash, out var value)) { ctx.Stack = value.Stack; } else { ctx.Stack = await _stackRepository.GetStackBySignatureHashAsync(ctx.Event.ProjectId, signatureHash); - if (ctx.Stack is not null) - stacks.Add(signatureHash, new StackInfo { IsNew = false, ShouldSave = false, Stack = ctx.Stack }); } // create new stack in distributed lock @@ -98,8 +97,6 @@ public override async Task ProcessBatchAsync(ICollection contexts) ctx.Stack = stack; await _stackRepository.AddAsync(stack, o => o.Cache()); - - stacks.Add(signatureHash, new StackInfo { IsNew = true, ShouldSave = false, Stack = ctx.Stack }); }, TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(10)); if (!success) @@ -111,7 +108,9 @@ public override async Task ProcessBatchAsync(ICollection contexts) } else { - ctx.Stack = await _stackRepository.GetByIdAsync(ctx.Event.StackId, o => o.Cache()); + ctx.Stack = stacksById.TryGetValue(ctx.Event.StackId, out var existing) + ? existing.Stack + : await _stackRepository.GetByIdAsync(ctx.Event.StackId, o => o.Cache()); if (ctx.Stack is null || ctx.Stack.ProjectId != ctx.Event.ProjectId) { ctx.SetError("Invalid StackId."); @@ -119,13 +118,18 @@ public override async Task ProcessBatchAsync(ICollection contexts) } ctx.SignatureHash = ctx.Stack.SignatureHash; + } - if (!stacks.ContainsKey(ctx.Stack.SignatureHash)) - stacks.Add(ctx.Stack.SignatureHash, new StackInfo { IsNew = false, ShouldSave = false, Stack = ctx.Stack }); - else - stacks[ctx.Stack.SignatureHash].Stack = ctx.Stack; + // New stacks have an ID after AddAsync; share one instance per ID for the rest of the batch. + if (!stacksById.TryGetValue(ctx.Stack!.Id, out var stackInfo)) + { + stackInfo = new StackInfo { IsNew = ctx.IsNew, ShouldSave = false, Stack = ctx.Stack }; + stacksById.Add(ctx.Stack.Id, stackInfo); } + ctx.Stack = stackInfo.Stack; + stacksBySignatureHash[ctx.SignatureHash!] = stackInfo; + if (ctx.Stack!.Status == StackStatus.Discarded) { ctx.IsDiscarded = true; @@ -142,17 +146,14 @@ public override async Task ProcessBatchAsync(ICollection contexts) ctx.Stack.Tags.AddRange(newTags); ctx.Stack.Tags.RemoveExcessTags(); - if (!stacks.ContainsKey(ctx.Stack.SignatureHash)) - stacks.Add(ctx.Stack.SignatureHash, new StackInfo { IsNew = false, ShouldSave = true, Stack = ctx.Stack }); - else - stacks[ctx.Stack.SignatureHash].ShouldSave = true; + stackInfo.ShouldSave = true; } } ctx.Event.IsFirstOccurrence = ctx.IsNew; } - var addedStacks = stacks.Where(s => s.Value.IsNew).Select(kvp => kvp.Value.Stack).ToList(); + var addedStacks = stacksById.Values.Where(s => s.IsNew).Select(s => s.Stack).ToList(); if (addedStacks.Count > 0) { await _publisher.PublishAsync(new EntityChanged @@ -167,7 +168,7 @@ await _publisher.PublishAsync(new EntityChanged }); } - var stacksToSave = stacks.Where(s => s.Value.ShouldSave).Select(kvp => kvp.Value.Stack).ToList(); + var stacksToSave = stacksById.Values.Where(s => s.ShouldSave).Select(s => s.Stack).ToList(); if (stacksToSave.Count > 0) await _stackRepository.SaveAsync(stacksToSave, o => o.Cache().Notifications(false)); // notification will get sent later in the update stats step @@ -183,10 +184,10 @@ public override Task ProcessAsync(EventContext ctx) return Task.CompletedTask; } - private record StackInfo + private sealed class StackInfo { public required bool IsNew { get; init; } public required bool ShouldSave { get; set; } - public required Stack Stack { get; set; } + public required Stack Stack { get; init; } } } diff --git a/src/Exceptionless.Core/Pipeline/030_CheckForRegressionAction.cs b/src/Exceptionless.Core/Pipeline/030_CheckForRegressionAction.cs index f7a8c79a62..bdb0d7b1d7 100644 --- a/src/Exceptionless.Core/Pipeline/030_CheckForRegressionAction.cs +++ b/src/Exceptionless.Core/Pipeline/030_CheckForRegressionAction.cs @@ -53,7 +53,7 @@ public override async Task ProcessBatchAsync(ICollection contexts) var version = _semanticVersionParser.Parse(versionGroup.Key, versionCache) ?? _semanticVersionParser.Default; if (version < fixedInVersion) { - foreach (var ctx in stackGroup.Where(s => s.Organization.HasPremiumFeatures)) + foreach (var ctx in versionGroup.Where(s => s.Organization.HasPremiumFeatures)) { _logger.LogDebug("Discarding fixed stack event: Version {Version} is older than fixed in version {FixedInVersion}", version, fixedInVersion); ctx.IsDiscarded = true; @@ -63,9 +63,11 @@ public override async Task ProcessBatchAsync(ICollection contexts) continue; } - regressedVersion = version; - regressedContext = versionGroup.First(); - break; + if (regressedContext is null) + { + regressedVersion = version; + regressedContext = versionGroup.First(); + } } } @@ -73,8 +75,8 @@ public override async Task ProcessBatchAsync(ICollection contexts) continue; _logger.LogDebug("Marking stack and events as regressed in version: {Version}", regressedVersion); - stack.Status = StackStatus.Regressed; await _stackRepository.MarkAsRegressedAsync(stack.Id); + stack.Status = StackStatus.Regressed; foreach (var ctx in stackGroup) ctx.IsRegression = ctx == regressedContext; diff --git a/src/Exceptionless.Core/Pipeline/060_UpdateStatsAction.cs b/src/Exceptionless.Core/Pipeline/060_UpdateStatsAction.cs index 327e79cbc3..e01c0eae32 100644 --- a/src/Exceptionless.Core/Pipeline/060_UpdateStatsAction.cs +++ b/src/Exceptionless.Core/Pipeline/060_UpdateStatsAction.cs @@ -39,20 +39,18 @@ private async Task IncrementEventCountersAsync(IGrouping s var maxDate = stackContexts.Max(s => s.Event.Date.UtcDateTime); await _stackService.IncrementStackUsageAsync(stackContexts[0].Event.OrganizationId, stackContexts[0].Event.ProjectId, stackGroup.Key, minDate, maxDate, count); - // Update stacks in memory since they are used in notifications. - foreach (var ctx in stackContexts) - { - if (ctx.Stack is null) - continue; + // Contexts with the same stack ID share an instance; update it once for notifications. + var stack = stackContexts[0].Stack; + if (stack is null) + return; - if (ctx.Stack.FirstOccurrence > minDate) - ctx.Stack.FirstOccurrence = minDate; + if (stack.FirstOccurrence > minDate) + stack.FirstOccurrence = minDate; - if (ctx.Stack.LastOccurrence < maxDate) - ctx.Stack.LastOccurrence = maxDate; + if (stack.LastOccurrence < maxDate) + stack.LastOccurrence = maxDate; - ctx.Stack.TotalOccurrences += count; - } + stack.TotalOccurrences += count; } catch (Exception ex) { diff --git a/src/Exceptionless.EmailTemplates/Templates/ProjectDailySummary.razor b/src/Exceptionless.EmailTemplates/Templates/ProjectDailySummary.razor index 340f4a4d60..cbc33cf3af 100644 --- a/src/Exceptionless.EmailTemplates/Templates/ProjectDailySummary.razor +++ b/src/Exceptionless.EmailTemplates/Templates/ProjectDailySummary.razor @@ -27,7 +27,7 @@ @if (Model.Blocked != 0) { -

@Model.Blocked events were discarded due to throttling. Upgrade now to increase your limits. Click here to learn more about throttling.

+

@Model.Blocked events were discarded due to throttling. Upgrade now to increase your limits. Click here to learn more about throttling.

Upgrade Plan
} diff --git a/src/Exceptionless.Web/Api/Handlers/TokenHandler.cs b/src/Exceptionless.Web/Api/Handlers/TokenHandler.cs index aef15d8f04..10f363b892 100644 --- a/src/Exceptionless.Web/Api/Handlers/TokenHandler.cs +++ b/src/Exceptionless.Web/Api/Handlers/TokenHandler.cs @@ -201,7 +201,8 @@ private async Task> CreateTokenImplAsync(NewToken value) var model = await AddModelAsync(mapped); var viewModel = mapper.MapToViewToken(model); AfterResultMap([viewModel]); - string location = linkGenerator.GetUriByName(HttpContext, "GetTokenById", new { id = model.Id }) + // Token ids are case sensitive, so override the global lowercase URL setting for this link. + string location = linkGenerator.GetUriByName(HttpContext, "GetTokenById", new { id = model.Id }, options: new LinkOptions { LowercaseUrls = false }) ?? throw new InvalidOperationException("Unable to generate token location."); return Result.Created(viewModel, location); } diff --git a/src/Exceptionless.Web/Assistant/AssistantSystemPrompt.cs b/src/Exceptionless.Web/Assistant/AssistantSystemPrompt.cs index d3af11afa0..02de9d43d1 100644 --- a/src/Exceptionless.Web/Assistant/AssistantSystemPrompt.cs +++ b/src/Exceptionless.Web/Assistant/AssistantSystemPrompt.cs @@ -13,7 +13,7 @@ public static string Create(string context) => $""" PERIOD RULE: for which errors happened in a period, or the top, most frequent, or most common errors in one, call count_events once per project with groupBy stack, the time, and filter type:error. It counts the events inside the period, ranks stacks by how often they occurred, names each with its title, gives its webUrl, and includes first_occurrence, so an error is new when that falls inside the period. search_stacks matches stacks by their last occurrence and sorts by all-time totals, so a stack that happened in a past period and again since would be missed; use search_stacks only to find stacks by status, tag, title, or other stack fields. - CLIENT SETUP RULE: for any question about configuring, installing, connecting, or sending first events from a client, call get_project_setup once. Use the current project by default. When there is no current project and the user identifies one by name, pass that exact projectName to get_project_setup so it resolves the project within the current organization. If no project is identified, call list_projects once, ask which project they want to configure, and call suggest_followups with up to three of those projects as prompts that name the project, such as "How do I configure a client for Billing API?". Do not call get_stack for setup, and call list_projects only when no project is identified. Use the returned Client Setup webUrl verbatim and only describe the clients and support status returned by that tool. Never invent packages or advertise Python, Java, Ruby, or PHP clients. Treat JavaScript / Node.js as legacy; describe React Native and Expo as supported only when returned by the tool. + CLIENT SETUP RULE: for any question about configuring, installing, connecting, or sending first events from a client, call get_project_setup once. Use the current project by default. When there is no current project and the user identifies one by name, pass that exact projectName to get_project_setup so it resolves the project within the current organization. If no project is identified, call list_projects once, ask which project they want to configure, and call suggest_followups with up to three of those projects as prompts that name the project, such as "How do I configure a client for Billing API?". Do not call get_stack for setup, and call list_projects only when no project is identified. Use the returned Client Setup webUrl verbatim and only describe the clients and support status returned by that tool. Never invent packages or advertise Python, Java, Ruby, or PHP clients. Describe JavaScript / Node.js, React Native, and Expo as supported only when returned by the tool. SAVED VIEW RULE: a saved view is a sidebar page with its own project, filters, time range, and sort. When the user asks to create, change, rename, or delete a view, use the saved view tools; never create one just because the user asked to see data. Choose viewType from what they want to see: stacks for errors or issues grouped together, events for individual events, logs, or feature usage, sessions for user sessions, and stream only when they ask for a live view. Put their criteria in the matching arguments, and use query only for what those arguments cannot express. Use the current project unless they name another project or ask for all projects, and look up a named project with list_projects using filter name:"Project Name". When no current project id is available and they did not name a project or ask for all projects, call list_projects once, use the project if there is only one, and otherwise ask which project they want. If they do not name the view, choose a short descriptive name and say what you chose. Views are private to the user unless they ask to share one with their team, because a shared view appears for everyone in the organization. Who can see a view cannot be changed, so never delete a view to share or unshare it. When asked, say that and offer to create a copy with the new visibility, explaining that the copy gets a new link and does not keep custom columns. Before changing or deleting a view, find its id with one list_saved_views call, passing name when you know it, and never guess an id. When the user says this view, call list_saved_views with the current saved view below as name and its viewType. If more than one view matches, ask which one instead of choosing. Delete a view only when the user explicitly asks to delete that view. Create views, including shared ones, without asking first. Deleting a view and changing a shared view need the user's confirmation, which the server asks for: call the tool as soon as the user asks, without asking them yourself first. When a result has error.code confirmation_required, do not call the tool again in this response. Ask one question that names every view waiting for confirmation and says who it affects, and call suggest_followups with one action whose label and prompt are both "{AssistantConfirmation.Prompt}". When the user confirms, call each of those tools again with the same arguments, without looking the views up again. After creating or changing a view, link to it with its webUrl and say what it shows and who can see it. After deleting a shared view, say that it is gone for everyone. diff --git a/src/Exceptionless.Web/ClientApp/src/lib/features/stacks/components/dialogs/mark-stack-discarded-dialog.svelte b/src/Exceptionless.Web/ClientApp/src/lib/features/stacks/components/dialogs/mark-stack-discarded-dialog.svelte index d9f2ab89d3..3dd6971727 100644 --- a/src/Exceptionless.Web/ClientApp/src/lib/features/stacks/components/dialogs/mark-stack-discarded-dialog.svelte +++ b/src/Exceptionless.Web/ClientApp/src/lib/features/stacks/components/dialogs/mark-stack-discarded-dialog.svelte @@ -45,13 +45,15 @@ {#if stackTitle}{stackTitle}
{/if} - Are you sure you want to discard all current + Are you sure you want to discard future events for {#if count === 1} - stack events + this stack? {:else} - stacks events + stacks? {/if} - and discard any future events? + Existing events are kept. To remove them, delete the + {#if count === 1}stack{:else}stacks{/if} + instead.
All future occurrences will be discarded and will not count against your event limit. diff --git a/src/Exceptionless.Web/ClientApp/src/routes/(app)/project/[projectId]/integrations/+page.svelte b/src/Exceptionless.Web/ClientApp/src/routes/(app)/project/[projectId]/integrations/+page.svelte index d5603bd9b2..e9a255543d 100644 --- a/src/Exceptionless.Web/ClientApp/src/routes/(app)/project/[projectId]/integrations/+page.svelte +++ b/src/Exceptionless.Web/ClientApp/src/routes/(app)/project/[projectId]/integrations/+page.svelte @@ -4,6 +4,7 @@ import Plus from '@lucide/svelte/icons/plus'; import Zapier from '@lucide/svelte/icons/zap'; import { createTable } from '@tanstack/svelte-table'; + import { onDestroy } from 'svelte'; import { toast } from 'svelte-sonner'; import type { NotificationSettings } from '#features/projects/models.ts'; @@ -36,6 +37,7 @@ let toastId = $state(); let showAddWebhookDialog = $state(false); let showRemoveSlackDialog = $state(false); + let slackSettingsRequestId = 0; const projectId = $derived(page.params.projectId || ''); const projectQuery = getProjectQuery({ route: { @@ -127,16 +129,42 @@ } async function updateSlackNotificationSettings(settings: NotificationSettings) { + const requestId = ++slackSettingsRequestId; + const requestProjectId = projectId; + const requestOrganizationId = organization.current; + const isCurrentRequest = () => requestId === slackSettingsRequestId && projectId === requestProjectId && organization.current === requestOrganizationId; + toast.dismiss(toastId); try { await updateSlackNotificationSettingsResponse.mutateAsync(settings); - toastId = toast.success('Successfully updated Slack notification settings.'); - } catch { + if (isCurrentRequest()) { + toastId = toast.success('Successfully updated Slack notification settings.'); + } + } catch (error) { + if (!isCurrentRequest()) { + return; + } + + if ( + showBillingDialogOnUpgradeProblem(error, requestOrganizationId, () => { + if (isCurrentRequest()) { + return updateSlackNotificationSettings(settings); + } + }) + ) { + return; + } + toastId = toast.error('Error updating Slack notification settings. Please try again.'); } } + onDestroy(() => { + // Invalidate pending responses and billing retries when this page is left. + slackSettingsRequestId++; + }); + const DEFAULT_PARAMS = { limit: DEFAULT_LIMIT }; diff --git a/src/Exceptionless.Web/ClientApp/src/routes/(app)/project/[projectId]/integrations/integrations-page.svelte.test.ts b/src/Exceptionless.Web/ClientApp/src/routes/(app)/project/[projectId]/integrations/integrations-page.svelte.test.ts new file mode 100644 index 0000000000..86b9ad7dc6 --- /dev/null +++ b/src/Exceptionless.Web/ClientApp/src/routes/(app)/project/[projectId]/integrations/integrations-page.svelte.test.ts @@ -0,0 +1,209 @@ +import { page } from '$app/state'; +import { ProblemDetails } from '@foundatiofx/fetchclient'; +import { cleanup, fireEvent, render, screen } from '@testing-library/svelte'; +import { tick } from 'svelte'; +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; + +import type { NotificationSettings } from '#features/projects/models.ts'; + +import { upgradeRequiredDialog } from '#features/billing/upgrade-required.svelte.ts'; +import { organization } from '#features/organizations/context.svelte.ts'; + +import IntegrationsPage from './+page.svelte'; + +const mocks = vi.hoisted(() => ({ + save: vi.fn<(settings: NotificationSettings) => Promise>(), + toast: { dismiss: vi.fn(), error: vi.fn(), success: vi.fn() } +})); + +vi.mock('$app/env/public', () => ({ PUBLIC_SLACK_APPID: 'slack-app-id' })); +vi.mock('$app/state', async () => { + const { SvelteMap } = await import('svelte/reactivity'); + const state = new SvelteMap([['projectId', 'project-a']]); + return { + page: { + params: { + get projectId() { + return state.get('projectId')!; + }, + set projectId(value: string) { + state.set('projectId', value); + } + } + } + }; +}); +vi.mock('svelte-sonner', () => ({ toast: mocks.toast })); +vi.mock('@tanstack/svelte-table', () => ({ createTable: () => ({}) })); +vi.mock('#features/auth/index.svelte.ts', () => ({ slackOAuthLogin: vi.fn() })); +vi.mock('#features/billing/index.ts', async () => { + const { showBillingDialogOnUpgradeProblem } = await import('#features/billing/upgrade-required.svelte.ts'); + return { showBillingDialogOnUpgradeProblem }; +}); +vi.mock('#features/organizations/context.svelte.ts', () => ({ organization: { current: 'organization-a' } })); +vi.mock('#features/projects/api.svelte.ts', () => ({ + deleteSlack: () => ({ mutateAsync: vi.fn() }), + getProjectIntegrationNotificationSettings: () => ({ data: { send_daily_summary: false } }), + getProjectQuery: () => ({ data: { has_slack_integration: true } }), + postSlack: () => ({ mutateAsync: vi.fn() }), + putProjectIntegrationNotificationSettings: () => ({ mutateAsync: mocks.save }) +})); +vi.mock('#features/shared/api/api.svelte.ts', () => ({ DEFAULT_LIMIT: 10 })); +vi.mock('#features/webhooks/api.svelte.ts', () => ({ + getProjectWebhooksQuery: () => ({ data: [], isLoading: false }), + postWebhook: () => ({ mutateAsync: vi.fn() }) +})); +vi.mock('#features/webhooks/components/table/options.svelte.ts', () => ({ getTableOptions: () => ({}) })); +vi.mock('#features/webhooks/components/table/webhooks-data-table.svelte', () => ({ default: vi.fn() })); +vi.mock('#shared/query-params/index.ts', async () => { + const { SvelteMap } = await import('svelte/reactivity'); + return { + createQueryParameters: () => { + const state = new SvelteMap([['limit', 10]]); + return { + get limit() { + return state.get('limit')!; + }, + set limit(value: number) { + state.set('limit', value); + } + }; + } + }; +}); + +function planLimitProblem() { + const problem = new ProblemDetails(); + problem.status = 426; + problem.title = 'Please upgrade your plan to enable slack integration.'; + return problem; +} + +async function toggleSetting(index: number) { + await fireEvent.click(screen.getAllByRole('switch')[index]!); + await vi.advanceTimersByTimeAsync(500); + await tick(); +} + +describe('Slack notification settings', () => { + beforeEach(() => { + vi.useFakeTimers(); + mocks.save.mockReset().mockResolvedValue(true); + page.params.projectId = 'project-a'; + organization.current = 'organization-a'; + upgradeRequiredDialog.reset(); + }); + + afterEach(() => { + cleanup(); + upgradeRequiredDialog.reset(); + vi.useRealTimers(); + }); + + it('updateSlackNotificationSettings_UpgradeSucceeds_RetriesOriginalSettings', async () => { + // Arrange + mocks.save.mockRejectedValueOnce(planLimitProblem()); + render(IntegrationsPage); + + // Act + await toggleSetting(0); + const retry = upgradeRequiredDialog.retryCallback; + await retry?.(); + + // Assert + expect(retry).toBeTypeOf('function'); + expect(upgradeRequiredDialog.organizationId).toBe('organization-a'); + expect(mocks.save).toHaveBeenCalledTimes(2); + expect(mocks.save.mock.calls[1]?.[0]).toEqual(mocks.save.mock.calls[0]?.[0]); + expect(mocks.toast.success).toHaveBeenCalledWith('Successfully updated Slack notification settings.'); + expect(mocks.toast.error).not.toHaveBeenCalled(); + }); + + it.each(['Project', 'Organization'] as const)( + 'updateSlackNotificationSettings_PendingResponseAfter%sChanges_DoesNotOpenUpgradeDialog', + async (changedContext) => { + // Arrange + const pending = Promise.withResolvers(); + mocks.save.mockReturnValueOnce(pending.promise); + render(IntegrationsPage); + await toggleSetting(0); + + // Act + if (changedContext === 'Project') { + page.params.projectId = 'project-b'; + } else { + organization.current = 'organization-b'; + } + await tick(); + pending.reject(planLimitProblem()); + await vi.advanceTimersByTimeAsync(0); + + // Assert + expect(upgradeRequiredDialog.open).toBe(false); + expect(mocks.toast.error).not.toHaveBeenCalled(); + } + ); + + it.each(['ProjectChanges', 'OrganizationChanges', 'Unmount'] as const)( + 'updateSlackNotificationSettings_RetryAfter%s_DoesNotSave', + async (changedContext) => { + // Arrange + mocks.save.mockRejectedValueOnce(planLimitProblem()); + const { unmount } = render(IntegrationsPage); + await toggleSetting(0); + const retry = upgradeRequiredDialog.retryCallback; + + // Act + if (changedContext === 'ProjectChanges') { + page.params.projectId = 'project-b'; + } else if (changedContext === 'OrganizationChanges') { + organization.current = 'organization-b'; + } else { + await unmount(); + } + await tick(); + await retry?.(); + + // Assert + expect(retry).toBeTypeOf('function'); + expect(mocks.save).toHaveBeenCalledOnce(); + expect(mocks.toast.success).not.toHaveBeenCalled(); + } + ); + + it('updateSlackNotificationSettings_OlderFailureArrivesLast_RetriesLatestSettings', async () => { + // Arrange + const older = Promise.withResolvers(); + mocks.save.mockReturnValueOnce(older.promise).mockRejectedValueOnce(planLimitProblem()); + render(IntegrationsPage); + await toggleSetting(0); + await toggleSetting(1); + + // Act + older.reject(planLimitProblem()); + await vi.advanceTimersByTimeAsync(0); + await upgradeRequiredDialog.retryCallback?.(); + + // Assert + expect(mocks.save).toHaveBeenCalledTimes(3); + expect(mocks.save.mock.calls[2]?.[0]).toEqual(mocks.save.mock.calls[1]?.[0]); + expect(mocks.save.mock.calls[2]?.[0]).toMatchObject({ report_critical_errors: true, report_new_errors: true }); + }); + + it('updateSlackNotificationSettings_NewerSaveStarts_DoesNotRetryOlderSettings', async () => { + // Arrange + mocks.save.mockRejectedValueOnce(planLimitProblem()); + render(IntegrationsPage); + await toggleSetting(0); + const retry = upgradeRequiredDialog.retryCallback; + + // Act + await toggleSetting(1); + await retry?.(); + + // Assert + expect(retry).toBeTypeOf('function'); + expect(mocks.save).toHaveBeenCalledTimes(2); + expect(mocks.save.mock.calls[1]?.[0]).toMatchObject({ report_critical_errors: true, report_new_errors: true }); + }); +}); diff --git a/src/Exceptionless.Web/Mcp/ExceptionlessMcpTools.cs b/src/Exceptionless.Web/Mcp/ExceptionlessMcpTools.cs index e3053afc12..53b78b0781 100644 --- a/src/Exceptionless.Web/Mcp/ExceptionlessMcpTools.cs +++ b/src/Exceptionless.Web/Mcp/ExceptionlessMcpTools.cs @@ -262,7 +262,7 @@ public async Task> GetProjectSetupAsync( new McpProjectSetupClient(".NET", "current"), new McpProjectSetupClient("React Native", "current"), new McpProjectSetupClient("Expo", "current"), - new McpProjectSetupClient("JavaScript / Node.js", "legacy") + new McpProjectSetupClient("JavaScript / Node.js", "current") ], ["Use the project's Client Setup page for the server URL, API key, and current installation instructions."])); } diff --git a/tests/Exceptionless.Tests/Api/Endpoints/TokenEndpointTests.cs b/tests/Exceptionless.Tests/Api/Endpoints/TokenEndpointTests.cs index 9756b5ddf0..d8a0a67eba 100644 --- a/tests/Exceptionless.Tests/Api/Endpoints/TokenEndpointTests.cs +++ b/tests/Exceptionless.Tests/Api/Endpoints/TokenEndpointTests.cs @@ -66,7 +66,7 @@ public async Task PostAsync_NewToken_MapsAllPropertiesToToken() } [Fact] - public async Task PostAsync_NewToken_ReturnsAbsoluteLocation() + public async Task PostAsync_NewToken_ReturnsRetrievableAbsoluteLocation() { // Arrange var token = new NewToken @@ -77,7 +77,7 @@ public async Task PostAsync_NewToken_ReturnsAbsoluteLocation() }; // Act - var response = await SendRequestAsync(r => r + using var response = await SendRequestAsync(r => r .Post() .AsGlobalAdminUser() .AppendPath("tokens") @@ -90,6 +90,22 @@ public async Task PostAsync_NewToken_ReturnsAbsoluteLocation() Assert.True(response.Headers.Location.IsAbsoluteUri); Assert.Equal("localhost", response.Headers.Location.Host); Assert.StartsWith("/api/v2/tokens/", response.Headers.Location.AbsolutePath); + + // Token ids are case sensitive, so the location must preserve their case. + var viewToken = await response.DeserializeAsync(); + Assert.NotNull(viewToken); + Assert.EndsWith("/" + viewToken.Id, response.Headers.Location.AbsolutePath, StringComparison.Ordinal); + + // Act + var locatedToken = await SendRequestAsAsync(r => r + .AsGlobalAdminUser() + .BaseUri(response.Headers.Location) + .StatusCodeShouldBeOk() + ); + + // Assert + Assert.NotNull(locatedToken); + Assert.Equal(viewToken.Id, locatedToken.Id); } [Fact] diff --git a/tests/Exceptionless.Tests/Assistant/AssistantServiceTests.cs b/tests/Exceptionless.Tests/Assistant/AssistantServiceTests.cs index 85580222b1..007cc0be2e 100644 --- a/tests/Exceptionless.Tests/Assistant/AssistantServiceTests.cs +++ b/tests/Exceptionless.Tests/Assistant/AssistantServiceTests.cs @@ -209,7 +209,7 @@ [new AssistantChatMessage("user", "Say hello")], Assert.Contains("pass that exact projectName to get_project_setup", handler.RequestBody); Assert.Contains("Do not call get_stack for setup, and call list_projects only when no project is identified", handler.RequestBody); Assert.Contains("Never invent packages or advertise Python, Java, Ruby, or PHP clients", handler.RequestBody); - Assert.Contains("describe React Native and Expo as supported only when returned by the tool", handler.RequestBody); + Assert.Contains("Describe JavaScript / Node.js, React Native, and Expo as supported only when returned by the tool", handler.RequestBody); Assert.Contains("do not call list_projects, call each needed project-scoped tool only once", handler.RequestBody); Assert.Contains("Defaults to the current page project id when omitted", handler.RequestBody); Assert.Contains("This tool has no stack id filter", handler.RequestBody); diff --git a/tests/Exceptionless.Tests/Mcp/ExceptionlessMcpToolsTests.cs b/tests/Exceptionless.Tests/Mcp/ExceptionlessMcpToolsTests.cs index 18ca40fcce..ca12ced3ab 100644 --- a/tests/Exceptionless.Tests/Mcp/ExceptionlessMcpToolsTests.cs +++ b/tests/Exceptionless.Tests/Mcp/ExceptionlessMcpToolsTests.cs @@ -407,7 +407,7 @@ public async Task GetProjectSetupAsync_Project_ReturnsOnlyVerifiedClientSupport( client => { Assert.Equal("JavaScript / Node.js", client.Name); - Assert.Equal("legacy", client.Status); + Assert.Equal("current", client.Status); }); Assert.DoesNotContain(setup.Clients, client => client.Name is "Python" or "Java" or "Ruby" or "PHP"); } diff --git a/tests/Exceptionless.Tests/Pipeline/EventPipelineTests.cs b/tests/Exceptionless.Tests/Pipeline/EventPipelineTests.cs index 9b42e36895..bcff4fdc98 100644 --- a/tests/Exceptionless.Tests/Pipeline/EventPipelineTests.cs +++ b/tests/Exceptionless.Tests/Pipeline/EventPipelineTests.cs @@ -1,6 +1,7 @@ using System.Diagnostics; using System.Globalization; using System.Text; +using Exceptionless.Core; using Exceptionless.Core.Billing; using Exceptionless.Core.Extensions; using Exceptionless.Core.Models; @@ -9,17 +10,22 @@ using Exceptionless.Core.Pipeline; using Exceptionless.Core.Plugins.EventParser; using Exceptionless.Core.Plugins.EventProcessor; +using Exceptionless.Core.Plugins.Formatting; using Exceptionless.Core.Queues.Models; using Exceptionless.Core.Repositories; using Exceptionless.Core.Repositories.Configuration; using Exceptionless.Core.Utility; using Exceptionless.DateTimeExtensions; using Exceptionless.Tests.Utility; +using Foundatio.Lock; +using Foundatio.Messaging; +using Foundatio.Queues; using Foundatio.Repositories; using Foundatio.Repositories.Extensions; using Foundatio.Serializer; using Foundatio.Storage; using McSherry.SemanticVersioning; +using Moq; using Xunit; using DataDictionary = Exceptionless.Core.Models.DataDictionary; @@ -729,21 +735,39 @@ public async Task RemoveTagsExceedingLimitsWhileKeepingKnownTags() Assert.Contains(Event.KnownTags.Critical, stack.Tags); } - [Fact] - public async Task EnsureSingleNewStackAsync() + [Theory] + [InlineData(1)] + [InlineData(2)] + public async Task RunAsync_NewStackBatch_AssignsAndReusesDistinctStackIds(int stackCount) { - string source = Guid.NewGuid().ToString(); - var contexts = new List { - new(new PersistentEvent { ProjectId = TestConstants.ProjectId, OrganizationId = TestConstants.OrganizationId, Message = "Test Sample", Source = source, Date = DateTime.UtcNow, Type = Event.KnownTypes.Log }, _organizationData.GenerateSampleOrganization(_billingManager, _plans), _projectData.GenerateSampleProject()), - new(new PersistentEvent { ProjectId = TestConstants.ProjectId, OrganizationId = TestConstants.OrganizationId, Message = "Test Sample", Source = source, Date = DateTime.UtcNow, Type = Event.KnownTypes.Log }, _organizationData.GenerateSampleOrganization(_billingManager, _plans), _projectData.GenerateSampleProject()), - }; + // Arrange + var organization = _organizationData.GenerateSampleOrganization(_billingManager, _plans); + var project = _projectData.GenerateSampleProject(); + var utcNow = TimeProvider.GetUtcNow(); + var contexts = new List(); + for (int i = 0; i < stackCount; i++) + { + string source = Guid.NewGuid().ToString(); + contexts.AddRange(Enumerable.Range(0, 2).Select(_ => new EventContext( + _eventData.GenerateEvent(organizationId: organization.Id, projectId: project.Id, occurrenceDate: utcNow, generateTags: false, generateData: false, type: Event.KnownTypes.Log, source: source), organization, project))); + } + // Act await _pipeline.RunAsync(contexts); - Assert.True(contexts.All(c => !c.HasError)); - Assert.True(contexts.All(c => c.Stack?.Id == contexts.First().Stack?.Id)); - Assert.Equal(1, contexts.Count(c => c.IsNew)); - Assert.Equal(1, contexts.Count(c => !c.IsNew)); - Assert.Equal(2, contexts.Count(c => !c.IsRegression)); + + // Assert + Assert.All(contexts, context => Assert.False(context.HasError, context.ErrorMessage)); + Assert.All(contexts, context => Assert.True(context.IsProcessed)); + Assert.All(contexts, context => Assert.False(String.IsNullOrEmpty(context.Stack?.Id))); + Assert.Equal(stackCount, contexts.Select(context => context.Stack!.Id).Distinct().Count()); + Assert.Equal(stackCount, contexts.Count(context => context.IsNew)); + Assert.Equal(stackCount, contexts.Count(context => !context.IsNew)); + Assert.All(contexts, context => Assert.False(context.IsRegression)); + foreach (var stackContexts in contexts.GroupBy(context => context.Event.Source)) + { + Assert.Same(stackContexts.First().Stack, stackContexts.Last().Stack); + Assert.Equal(2, stackContexts.First().Stack!.TotalOccurrences); + } } [Fact] @@ -776,6 +800,126 @@ public async Task EnsureSingleGlobalErrorStackAsync() Assert.Equal(2, contexts.Count(c => !c.IsRegression)); } + [Theory] + [InlineData(false, false)] + [InlineData(true, true)] + [InlineData(false, true)] + [InlineData(true, false)] + public async Task RunAsync_ExistingStackBatch_AggregatesTagsAndOccurrenceCounts(bool firstUsesExplicitStackId, bool secondUsesExplicitStackId) + { + // Arrange + var organization = _organizationData.GenerateSampleOrganization(_billingManager, _plans); + var project = _projectData.GenerateSampleProject(); + var source = Guid.NewGuid().ToString(); + var utcNow = TimeProvider.GetUtcNow(); + var initialEvent = _eventData.GenerateEvent(organizationId: organization.Id, projectId: project.Id, occurrenceDate: utcNow.AddMinutes(-3), generateTags: false, generateData: false, type: Event.KnownTypes.Log, source: source); + var initialContext = await _pipeline.RunAsync(initialEvent, organization, project); + var stackId = initialContext.Stack!.Id; + await RefreshDataAsync(); + + var firstEvent = _eventData.GenerateEvent(organizationId: organization.Id, projectId: project.Id, stackId: firstUsesExplicitStackId ? stackId : null, occurrenceDate: utcNow.AddMinutes(-2), generateTags: false, generateData: false, type: Event.KnownTypes.Log, source: source); + firstEvent.Tags = new TagSet { "first-tag" }; + var secondEvent = _eventData.GenerateEvent(organizationId: organization.Id, projectId: project.Id, stackId: secondUsesExplicitStackId ? stackId : null, occurrenceDate: utcNow.AddMinutes(-1), generateTags: false, generateData: false, type: Event.KnownTypes.Log, source: source); + secondEvent.Tags = new TagSet { "second-tag" }; + + // Act + var contexts = await _pipeline.RunAsync([firstEvent, secondEvent], organization, project); + await RefreshDataAsync(); + + // Assert + Assert.All(contexts, context => Assert.False(context.HasError, context.ErrorMessage)); + Assert.All(contexts, context => Assert.True(context.IsProcessed)); + Assert.Same(contexts.First().Stack, contexts.Last().Stack); + Assert.Equal(3, contexts.First().Stack!.TotalOccurrences); + + var savedStack = await _stackRepository.GetByIdAsync(stackId, o => o.Cache()); + Assert.NotNull(savedStack); + Assert.Equal(new[] { "first-tag", "second-tag" }, savedStack.Tags.Order(StringComparer.Ordinal).ToArray()); + } + + [Fact] + public async Task ProcessBatchAsync_StackFoundInsideCreationLock_ReusesStackForRemainingEvents() + { + // Arrange + var organization = _organizationData.GenerateSampleOrganization(_billingManager, _plans); + var project = _projectData.GenerateSampleProject(); + var source = Guid.NewGuid().ToString(); + var signatureHash = new[] { Event.KnownTypes.Log, source }.ToSHA1(); + var stackData = GetService(); + var stack = stackData.GenerateStack(generateId: true, organizationId: organization.Id, projectId: project.Id, type: Event.KnownTypes.Log, signatureHash: signatureHash); + stack.Tags.Clear(); + await _stackRepository.AddAsync(stack, o => o.ImmediateConsistency().Cache()); + + int signatureReads = 0; + var repository = new Mock(MockBehavior.Strict); + repository.Setup(r => r.GetStackBySignatureHashAsync(project.Id, signatureHash)).Returns(() => + ++signatureReads == 1 ? Task.FromResult(null) : _stackRepository.GetByIdAsync(stack.Id, o => o.Cache())); + repository.Setup(r => r.SaveAsync(It.IsAny>(), It.IsAny>())) + .Returns((IEnumerable stacks, CommandOptionsDescriptor options) => _stackRepository.SaveAsync(stacks, options)); + + var formatting = GetService(); + var publisher = GetService(); + var options = GetService(); + var lockProvider = GetService(); + var action = new AssignToStackAction(repository.Object, formatting, publisher, options, lockProvider, Log); + var utcNow = TimeProvider.GetUtcNow(); + var firstEvent = _eventData.GenerateEvent(organizationId: organization.Id, projectId: project.Id, occurrenceDate: utcNow, generateTags: false, generateData: false, type: Event.KnownTypes.Log, source: source); + var secondEvent = _eventData.GenerateEvent(organizationId: organization.Id, projectId: project.Id, occurrenceDate: utcNow, generateTags: false, generateData: false, type: Event.KnownTypes.Log, source: source); + secondEvent.Tags = new TagSet { "second-tag" }; + var contexts = new[] { new EventContext(firstEvent, organization, project), new EventContext(secondEvent, organization, project) }; + + // Act + await action.ProcessBatchAsync(contexts); + + // Assert + Assert.All(contexts, context => Assert.False(context.HasError, context.ErrorMessage)); + Assert.All(contexts, context => Assert.False(context.IsNew)); + Assert.All(contexts, context => Assert.Equal(stack.Id, context.Event.StackId)); + Assert.Same(contexts[0].Stack, contexts[1].Stack); + Assert.Equal(2, signatureReads); + var savedStack = await _stackRepository.GetByIdAsync(stack.Id, o => o.Cache()); + Assert.Contains("second-tag", savedStack!.Tags); + } + + [Fact] + public async Task RunAsync_DifferentStackIdsWithSameSignature_PreservesBothStacks() + { + // Arrange + var organization = _organizationData.GenerateSampleOrganization(_billingManager, _plans); + var project = _projectData.GenerateSampleProject(); + var stackData = GetService(); + var signatureHash = Guid.NewGuid().ToString("N"); + var firstStack = stackData.GenerateStack(generateId: true, organizationId: organization.Id, projectId: project.Id, type: Event.KnownTypes.Log, signatureHash: signatureHash); + var secondStack = stackData.GenerateStack(generateId: true, organizationId: organization.Id, projectId: project.Id, type: Event.KnownTypes.Log, signatureHash: signatureHash); + firstStack.Tags.Clear(); + secondStack.Tags.Clear(); + await _stackRepository.AddAsync(firstStack, o => o.ImmediateConsistency().Cache()); + await _stackRepository.AddAsync(secondStack, o => o.ImmediateConsistency().Cache()); + + var utcNow = TimeProvider.GetUtcNow(); + var firstEvent = _eventData.GenerateEvent(organizationId: organization.Id, projectId: project.Id, stackId: firstStack.Id, occurrenceDate: utcNow.AddMinutes(-2), generateTags: false, generateData: false, type: Event.KnownTypes.Log); + firstEvent.Tags = new TagSet { "first-tag" }; + var secondEvent = _eventData.GenerateEvent(organizationId: organization.Id, projectId: project.Id, stackId: secondStack.Id, occurrenceDate: utcNow.AddMinutes(-1), generateTags: false, generateData: false, type: Event.KnownTypes.Log); + secondEvent.Tags = new TagSet { "second-tag" }; + await RefreshDataAsync(); + + // Act + var contexts = await _pipeline.RunAsync([firstEvent, secondEvent], organization, project); + await RefreshDataAsync(); + + // Assert + Assert.All(contexts, context => Assert.False(context.HasError, context.ErrorMessage)); + Assert.All(contexts, context => Assert.True(context.IsProcessed)); + Assert.NotSame(contexts.First().Stack, contexts.Last().Stack); + Assert.Equal(firstStack.Id, contexts.First().Event.StackId); + Assert.Equal(secondStack.Id, contexts.Last().Event.StackId); + + var savedFirstStack = await _stackRepository.GetByIdAsync(firstStack.Id, o => o.Cache()); + var savedSecondStack = await _stackRepository.GetByIdAsync(secondStack.Id, o => o.Cache()); + Assert.Contains("first-tag", savedFirstStack!.Tags); + Assert.Contains("second-tag", savedSecondStack!.Tags); + } + [Fact] public async Task EnsureSingleRegressionAsync() { @@ -960,6 +1104,72 @@ public async Task EnsureVersionedRegressionAsync() Assert.Equal("1.0.1-rc3", regressedEvent.GetVersion()); } + [Theory] + [InlineData(-3, "1.0.1")] + [InlineData(-1, "1.0.2")] + public async Task RunAsync_MixedVersionsForFixedStack_DiscardsOnlyOlderVersionEvents(int olderEventMinutes, string regressedVersion) + { + // Arrange + var utcNow = TimeProvider.GetUtcNow(); + var organization = _organizationData.GenerateSampleOrganization(_billingManager, _plans); + organization.HasPremiumFeatures = true; + var project = _projectData.GenerateSampleProject(); + var ev = _eventData.GenerateEvent(projectId: project.Id, organizationId: organization.Id, occurrenceDate: utcNow.AddMinutes(-5)); + var context = new EventContext(ev, organization, project); + await _pipeline.RunAsync(context); + await RefreshDataAsync(); + + Assert.False(context.HasError, context.ErrorMessage); + ev = await _eventRepository.GetByIdAsync(ev.Id); + Assert.NotNull(ev); + + var stack = await _stackRepository.GetByIdAsync(ev.StackId); + Assert.NotNull(stack); + stack.MarkFixed(new SemanticVersion(1, 0, 1), TimeProvider); + await _stackRepository.SaveAsync(stack, o => o.Cache()); + + project.NotificationSettings[TestConstants.UserId] = new NotificationSettings { ReportEventRegressions = true }; + var notificationQueue = GetService>(); + var olderContext = new EventContext(_eventData.GenerateEvent(stackId: ev.StackId, projectId: project.Id, organizationId: organization.Id, occurrenceDate: utcNow.AddMinutes(olderEventMinutes), semver: "1.0.0"), organization, project); + var newerContext = new EventContext(_eventData.GenerateEvent(stackId: ev.StackId, projectId: project.Id, organizationId: organization.Id, occurrenceDate: utcNow.AddMinutes(-2), semver: regressedVersion), organization, project); + var latestContext = new EventContext(_eventData.GenerateEvent(stackId: ev.StackId, projectId: project.Id, organizationId: organization.Id, occurrenceDate: utcNow, semver: "1.0.3"), organization, project); + await RefreshDataAsync(); + + // Act + await _pipeline.RunAsync([latestContext, olderContext, newerContext]); + + // Assert + Assert.False(olderContext.HasError, olderContext.ErrorMessage); + Assert.False(newerContext.HasError, newerContext.ErrorMessage); + Assert.False(latestContext.HasError, latestContext.ErrorMessage); + Assert.True(olderContext.IsDiscarded); + Assert.True(olderContext.IsCancelled); + Assert.False(olderContext.IsProcessed); + Assert.False(olderContext.IsRegression); + Assert.False(newerContext.IsDiscarded); + Assert.True(newerContext.IsRegression); + Assert.True(newerContext.IsProcessed); + Assert.False(latestContext.IsDiscarded); + Assert.False(latestContext.IsRegression); + Assert.True(latestContext.IsProcessed); + Assert.Equal(StackStatus.Regressed, newerContext.Stack?.Status); + Assert.Equal(StackStatus.Regressed, latestContext.Stack?.Status); + + var savedEvent = await _eventRepository.GetByIdAsync(newerContext.Event.Id); + Assert.NotNull(savedEvent); + Assert.Equal(regressedVersion, savedEvent.GetVersion()); + var savedStack = await _stackRepository.GetByIdAsync(stack.Id); + Assert.Equal(StackStatus.Regressed, savedStack?.Status); + + var queueStats = await notificationQueue.GetQueueStatsAsync(); + Assert.Equal(1, queueStats.Queued); + var notification = await notificationQueue.DequeueAsync(TestCancellationToken); + Assert.NotNull(notification); + Assert.Equal(newerContext.Event.Id, notification.Value.EventId); + Assert.True(notification.Value.IsRegression); + await notification.CompleteAsync(); + } + [Theory] [InlineData(true)] [InlineData(false)]