Skip to content

Add backend refinements, new API tests, and fix flaky tests#795

Merged
tjementum merged 19 commits intomainfrom
backend-refinements-and-flaky-test-fixes
Nov 25, 2025
Merged

Add backend refinements, new API tests, and fix flaky tests#795
tjementum merged 19 commits intomainfrom
backend-refinements-and-flaky-test-fixes

Conversation

@tjementum
Copy link
Copy Markdown
Member

@tjementum tjementum commented Nov 25, 2025

Summary & Motivation

Add SharedKernel improvements, new API tests, and fix flaky tests caused by non-deterministic test data.

  • Add StronglyTypedString<T> base class for creating string-based strongly typed IDs with optional prefix validation (Stripe-style IDs like cus_abc123).
  • Add IBlobStorageClient interface to enable mocking and improve testability.
  • Add Result.Redirect() and corresponding ApiResult support for HTTP redirects.
  • Add bulk repository interfaces IBulkAddRepository<T> and IBulkUpdateRepository<T>, and rename BulkRemove to RemoveRange for consistency with EF Core naming.
  • Add AddRangeAsync, UpdateRange, and RemoveRange methods to RepositoryBase.
  • Add MapStronglyTypedString and OwnedNavigationBuilder overloads to ModelBuilderExtensions for EF Core mapping of owned entities.
  • Add CreateContainerIfNotExistsAsync, DeleteIfExistsAsync, and User Delegation Key SAS support to BlobStorageClient.
  • Fix UseStringForEnums to handle nullable enum properties.
  • Simplify email validation by using MailAddress.TryCreate instead of custom regex rules.
  • Move AddCrossServiceDataProtection from ApiDependencyConfiguration to SharedDependencyConfiguration.
  • Exclude owned entities from global tenant query filters to fix query issues.
  • Fix NotSupportedException when copying avatar during tenant switch by buffering Azure's non-seekable stream.
  • Add API tests for Logout, ChangeLocale, and ChangeUserRole commands.
  • Fix flaky tests by adding Faker.Internet.UniqueEmail() to prevent email collisions when tests run in parallel.
  • Fix flaky test using Faker.Random.String2() instead of String() to avoid whitespace trimming issues.

Downstream projects

  1. Update any BlobStorageClient usage to use the IBlobStorageClient interface:
- BlobStorageClient blobStorageClient
+ IBlobStorageClient blobStorageClient
- services.AddKeyedSingleton("your-self-contained-system-storage",
+ services.AddKeyedSingleton<IBlobStorageClient>("your-self-contained-system-storage",
  1. Rename BulkRemove to RemoveRange in repositories:
- repository.BulkRemove(entities);
+ repository.RemoveRange(entities);

Checklist

  • I have added tests, or done manual regression tests
  • I have updated the documentation, if necessary

@tjementum tjementum self-assigned this Nov 25, 2025
@tjementum tjementum added Bug Something isn't working Enhancement New feature or request Deploy to Staging Set this label on pull requests to deploy code or infrastructure to the Staging environment labels Nov 25, 2025
@tjementum tjementum force-pushed the backend-refinements-and-flaky-test-fixes branch from 5c5b8ea to 0b6373c Compare November 25, 2025 17:59
@tjementum tjementum removed the Deploy to Staging Set this label on pull requests to deploy code or infrastructure to the Staging environment label Nov 25, 2025
@tjementum tjementum moved this to 🏗 In Progress in Kanban board Nov 25, 2025
@sonarqubecloud
Copy link
Copy Markdown

@tjementum tjementum merged commit b28c9e8 into main Nov 25, 2025
29 checks passed
@tjementum tjementum deleted the backend-refinements-and-flaky-test-fixes branch November 25, 2025 18:25
@github-project-automation github-project-automation bot moved this from 🏗 In Progress to ✅ Done in Kanban board Nov 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working Enhancement New feature or request

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

1 participant