diff --git a/src/Orbit.Application/Accountability/Queries/GetAccountabilityPairsQuery.cs b/src/Orbit.Application/Accountability/Queries/GetAccountabilityPairsQuery.cs index 10da3de3..57239cbb 100644 --- a/src/Orbit.Application/Accountability/Queries/GetAccountabilityPairsQuery.cs +++ b/src/Orbit.Application/Accountability/Queries/GetAccountabilityPairsQuery.cs @@ -99,8 +99,8 @@ private static AccountabilityPairDto BuildDto( Guid userId, Guid buddyId, User buddy, - IReadOnlyDictionary> habitsByPair, - IReadOnlyDictionary<(Guid PairId, Guid UserId), DateOnly> lastCheckInByPairUser) + Dictionary> habitsByPair, + Dictionary<(Guid PairId, Guid UserId), DateOnly> lastCheckInByPairUser) { var linkedHabits = habitsByPair.TryGetValue(pair.Id, out var habits) ? habits diff --git a/src/Orbit.Application/Challenges/Commands/CreateChallengeCommand.cs b/src/Orbit.Application/Challenges/Commands/CreateChallengeCommand.cs index bbba327f..a6130691 100644 --- a/src/Orbit.Application/Challenges/Commands/CreateChallengeCommand.cs +++ b/src/Orbit.Application/Challenges/Commands/CreateChallengeCommand.cs @@ -86,7 +86,7 @@ public async Task> Handle(CreateChallengeCommand request, Cancellat return Result.Success(challenge.Id); } - private async Task NotifyInvitedFriendsAsync(User requester, IReadOnlyList invitedFriendIds, CancellationToken cancellationToken) + private async Task NotifyInvitedFriendsAsync(User requester, List invitedFriendIds, CancellationToken cancellationToken) { if (invitedFriendIds.Count == 0) return; diff --git a/src/Orbit.Application/Chat/Commands/ProcessUserChatCommand.Accumulator.cs b/src/Orbit.Application/Chat/Commands/ProcessUserChatCommand.Accumulator.cs index 69a0fd8b..6e3ac80c 100644 --- a/src/Orbit.Application/Chat/Commands/ProcessUserChatCommand.Accumulator.cs +++ b/src/Orbit.Application/Chat/Commands/ProcessUserChatCommand.Accumulator.cs @@ -73,7 +73,7 @@ private void CollectRelatedSurfaces(AgentOperationResult operationResult) /// (e.g. describe_feature) by round-tripping it through JSON. Returns an empty sequence /// when the payload is null, not an object, or carries no usable surface IDs. /// - private static IEnumerable ExtractRelatedSurfaces(object? payload) + private static List ExtractRelatedSurfaces(object? payload) { if (payload is null) return []; diff --git a/src/Orbit.Application/Chat/Commands/ProcessUserChatCommand.Tools.cs b/src/Orbit.Application/Chat/Commands/ProcessUserChatCommand.Tools.cs index 0d70dff6..f9a0798c 100644 --- a/src/Orbit.Application/Chat/Commands/ProcessUserChatCommand.Tools.cs +++ b/src/Orbit.Application/Chat/Commands/ProcessUserChatCommand.Tools.cs @@ -88,7 +88,7 @@ public partial class ProcessUserChatCommandHandler /// reassemble results deterministically, independent of task-completion timing. /// private async Task> ExecuteToolCallsAsync( - IReadOnlyList orderedCalls, + List orderedCalls, ProcessUserChatCommand request, CancellationToken cancellationToken) { diff --git a/src/Orbit.Application/Chat/FeatureExplanations/FeatureExplanationService.cs b/src/Orbit.Application/Chat/FeatureExplanations/FeatureExplanationService.cs index 5378bef3..afd55e9c 100644 --- a/src/Orbit.Application/Chat/FeatureExplanations/FeatureExplanationService.cs +++ b/src/Orbit.Application/Chat/FeatureExplanations/FeatureExplanationService.cs @@ -111,7 +111,7 @@ private static FeatureExplanation Parse(string content) return new FeatureExplanation(key, displayName, relatedCapabilities, relatedSurfaces, version, body); } - private static IReadOnlyList ParseInlineList(string value) + private static List ParseInlineList(string value) { var trimmed = value.Trim(); if (trimmed.Length < 2 || trimmed[0] != '[' || trimmed[^1] != ']') diff --git a/src/Orbit.Application/Goals/Commands/RestoreGoalCommand.cs b/src/Orbit.Application/Goals/Commands/RestoreGoalCommand.cs index 9db5e337..0dbdb0b4 100644 --- a/src/Orbit.Application/Goals/Commands/RestoreGoalCommand.cs +++ b/src/Orbit.Application/Goals/Commands/RestoreGoalCommand.cs @@ -29,7 +29,7 @@ public async Task Handle(RestoreGoalCommand request, CancellationToken c g => g.Id == request.GoalId && g.UserId == request.UserId, cancellationToken); - var goal = goals.FirstOrDefault(); + var goal = goals.Count > 0 ? goals[0] : null; if (goal is null || !goal.IsDeleted) return Result.Failure(ErrorMessages.GoalNotFound); diff --git a/src/Orbit.Application/Goals/Queries/GetGoalByIdQuery.cs b/src/Orbit.Application/Goals/Queries/GetGoalByIdQuery.cs index 6660062f..60a9d31c 100644 --- a/src/Orbit.Application/Goals/Queries/GetGoalByIdQuery.cs +++ b/src/Orbit.Application/Goals/Queries/GetGoalByIdQuery.cs @@ -55,7 +55,7 @@ public async Task> Handle(GetGoalByIdQuery request, Cancel q => q.Include(g => g.ProgressLogs) .Include(g => g.Habits).ThenInclude(h => h.Logs.Where(l => l.Date >= streakWindowStart)), cancellationToken); - var goal = goals.FirstOrDefault(); + var goal = goals.Count > 0 ? goals[0] : null; if (goal is null) return Result.Failure(ErrorMessages.GoalNotFound); diff --git a/src/Orbit.Application/Goals/Queries/GetGoalDetailQuery.cs b/src/Orbit.Application/Goals/Queries/GetGoalDetailQuery.cs index b8f71b0b..8d9913f1 100644 --- a/src/Orbit.Application/Goals/Queries/GetGoalDetailQuery.cs +++ b/src/Orbit.Application/Goals/Queries/GetGoalDetailQuery.cs @@ -36,7 +36,7 @@ public async Task> Handle(GetGoalDetailQue q => q.Include(g => g.ProgressLogs) .Include(g => g.Habits).ThenInclude(h => h.Logs.Where(l => l.Date >= streakWindowStart)), cancellationToken); - var goal = goals.FirstOrDefault(); + var goal = goals.Count > 0 ? goals[0] : null; if (goal is null) return Result.Failure(ErrorMessages.GoalNotFound); diff --git a/src/Orbit.Application/Goals/Queries/GetGoalMetricsQuery.cs b/src/Orbit.Application/Goals/Queries/GetGoalMetricsQuery.cs index ed3463b7..c7ef7c75 100644 --- a/src/Orbit.Application/Goals/Queries/GetGoalMetricsQuery.cs +++ b/src/Orbit.Application/Goals/Queries/GetGoalMetricsQuery.cs @@ -30,7 +30,7 @@ public async Task> Handle(GetGoalMetricsQuery request, Cance q => q.Include(g => g.ProgressLogs) .Include(g => g.Habits).ThenInclude(h => h.Logs.Where(l => l.Date >= streakWindowStart)), cancellationToken); - var goal = goals.FirstOrDefault(); + var goal = goals.Count > 0 ? goals[0] : null; if (goal is null) return Result.Failure(ErrorMessages.GoalNotFound); diff --git a/src/Orbit.Application/Habits/Commands/MoveHabitParentCommand.cs b/src/Orbit.Application/Habits/Commands/MoveHabitParentCommand.cs index 6950fb10..6be782ea 100644 --- a/src/Orbit.Application/Habits/Commands/MoveHabitParentCommand.cs +++ b/src/Orbit.Application/Habits/Commands/MoveHabitParentCommand.cs @@ -61,7 +61,7 @@ public async Task Handle(MoveHabitParentCommand request, CancellationTok return Result.Success(); } - private static bool WouldCreateCycle(Guid habitId, Guid targetParentId, IReadOnlyDictionary habitsById) + private static bool WouldCreateCycle(Guid habitId, Guid targetParentId, Dictionary habitsById) { var currentId = targetParentId; while (habitsById.TryGetValue(currentId, out var current)) @@ -73,7 +73,7 @@ private static bool WouldCreateCycle(Guid habitId, Guid targetParentId, IReadOnl return false; } - private static int GetDepth(Guid habitId, IReadOnlyDictionary habitsById) + private static int GetDepth(Guid habitId, Dictionary habitsById) { var depth = 0; var currentId = habitsById.TryGetValue(habitId, out var habit) ? habit.ParentHabitId : null; diff --git a/src/Orbit.Application/Habits/Queries/GetHabitWidgetQuery.cs b/src/Orbit.Application/Habits/Queries/GetHabitWidgetQuery.cs index 025465ce..ee3e0913 100644 --- a/src/Orbit.Application/Habits/Queries/GetHabitWidgetQuery.cs +++ b/src/Orbit.Application/Habits/Queries/GetHabitWidgetQuery.cs @@ -90,7 +90,7 @@ private async Task> LoadWidgetHabits( cancellationToken); } - private static bool ShouldShowTomorrow(IReadOnlyList todayItems) + private static bool ShouldShowTomorrow(List todayItems) { return todayItems.Count == 0 || todayItems.All(item => item.IsCompleted); } diff --git a/src/Orbit.Application/Habits/Queries/GetRescheduleSuggestionQuery.cs b/src/Orbit.Application/Habits/Queries/GetRescheduleSuggestionQuery.cs index 3fd82349..cd260d3b 100644 --- a/src/Orbit.Application/Habits/Queries/GetRescheduleSuggestionQuery.cs +++ b/src/Orbit.Application/Habits/Queries/GetRescheduleSuggestionQuery.cs @@ -49,7 +49,7 @@ public async Task> Handle( q => q.Include(h => h.Logs.Where(l => l.Date >= logWindowStart && l.Date <= userToday)), cancellationToken); - var habit = habits.FirstOrDefault(); + var habit = habits.Count > 0 ? habits[0] : null; if (habit is null) return Result.Failure(ErrorMessages.HabitNotFound); diff --git a/src/Orbit.Application/Habits/Services/RetrospectiveMetricsCalculator.cs b/src/Orbit.Application/Habits/Services/RetrospectiveMetricsCalculator.cs index 41d56ac6..f9a7526d 100644 --- a/src/Orbit.Application/Habits/Services/RetrospectiveMetricsCalculator.cs +++ b/src/Orbit.Application/Habits/Services/RetrospectiveMetricsCalculator.cs @@ -121,7 +121,7 @@ private static RetrospectiveHabitStat BuildHabitStat(Habit habit, int scheduledC scheduledCount, habit.FrequencyUnit is null); - private static IReadOnlyList BuildWeeklyConsistency(int[] weekdayScheduled, int[] weekdayCompleted) + private static int[] BuildWeeklyConsistency(int[] weekdayScheduled, int[] weekdayCompleted) { var consistency = new int[7]; for (var i = 0; i < 7; i++) diff --git a/src/Orbit.Application/Profile/Queries/ExportUserDataQuery.cs b/src/Orbit.Application/Profile/Queries/ExportUserDataQuery.cs index 13c2cc0e..49143ba4 100644 --- a/src/Orbit.Application/Profile/Queries/ExportUserDataQuery.cs +++ b/src/Orbit.Application/Profile/Queries/ExportUserDataQuery.cs @@ -162,7 +162,7 @@ private static ExportedApiKey MapApiKey(ApiKey apiKey) apiKey.IsRevoked); } - private static ExportedHabit MapHabit(Habit habit, IReadOnlyDictionary> logsByHabit) + private static ExportedHabit MapHabit(Habit habit, Dictionary> logsByHabit) { var logs = logsByHabit.TryGetValue(habit.Id, out var habitLogs) ? habitLogs.Select(l => new ExportedHabitLog(l.Date, l.Value, l.Note, l.CreatedAtUtc)).ToList() @@ -187,7 +187,7 @@ private static ExportedHabit MapHabit(Habit habit, IReadOnlyDictionary> progressByGoal, + Dictionary> progressByGoal, IReadOnlyDictionary freshStreakValues) { var progress = progressByGoal.TryGetValue(goal.Id, out var goalLogs) diff --git a/src/Orbit.Application/Profile/Queries/GetPublicProfileQuery.cs b/src/Orbit.Application/Profile/Queries/GetPublicProfileQuery.cs index eeb44f3b..ea8bab1b 100644 --- a/src/Orbit.Application/Profile/Queries/GetPublicProfileQuery.cs +++ b/src/Orbit.Application/Profile/Queries/GetPublicProfileQuery.cs @@ -39,7 +39,7 @@ public async Task> Handle(GetPublicProfileQuery reques return Result.Failure(ErrorMessages.UserNotFound); var matches = await userRepository.FindAsync(u => u.PublicProfileSlug == request.Slug, cancellationToken); - var user = matches.FirstOrDefault(); + var user = matches.Count > 0 ? matches[0] : null; if (user is null) return Result.Failure(ErrorMessages.UserNotFound); diff --git a/src/Orbit.Application/Social/Queries/GetFriendProfileQuery.cs b/src/Orbit.Application/Social/Queries/GetFriendProfileQuery.cs index 9247c61c..a3795892 100644 --- a/src/Orbit.Application/Social/Queries/GetFriendProfileQuery.cs +++ b/src/Orbit.Application/Social/Queries/GetFriendProfileQuery.cs @@ -60,7 +60,7 @@ public async Task> Handle(GetFriendProfileQuery reques return Result.Failure(ErrorMessages.UserNotFound); var matches = await userRepository.FindAsync(u => u.Id == request.FriendUserId, cancellationToken); - var friend = matches.FirstOrDefault(); + var friend = matches.Count > 0 ? matches[0] : null; if (friend is null) return Result.Failure(ErrorMessages.UserNotFound); @@ -101,7 +101,7 @@ public async Task> Handle(GetFriendProfileQuery reques sharedChallenges)); } - private static IReadOnlyList BuildWeeklyActivity(IEnumerable habits, DateOnly today) + private static int[] BuildWeeklyActivity(IEnumerable habits, DateOnly today) { var windowStart = today.AddDays(-(ActivityWindowDays - 1)); var counts = new int[ActivityWindowDays]; diff --git a/src/Orbit.Application/Social/Services/FriendGraphService.cs b/src/Orbit.Application/Social/Services/FriendGraphService.cs index c45aa5e9..6bd3340a 100644 --- a/src/Orbit.Application/Social/Services/FriendGraphService.cs +++ b/src/Orbit.Application/Social/Services/FriendGraphService.cs @@ -23,7 +23,7 @@ public class FriendGraphService( var matches = await userRepository.FindAsync( u => u.Handle != null && u.Handle.ToLower() == normalized, cancellationToken); - return matches.FirstOrDefault(); + return matches.Count > 0 ? matches[0] : null; } if (!string.IsNullOrWhiteSpace(referralCode)) @@ -32,7 +32,7 @@ public class FriendGraphService( var matches = await userRepository.FindAsync( u => u.ReferralCode == normalized, cancellationToken); - return matches.FirstOrDefault(); + return matches.Count > 0 ? matches[0] : null; } return null; diff --git a/src/Orbit.Application/Tags/Commands/RestoreTagCommand.cs b/src/Orbit.Application/Tags/Commands/RestoreTagCommand.cs index eac8f325..890e441f 100644 --- a/src/Orbit.Application/Tags/Commands/RestoreTagCommand.cs +++ b/src/Orbit.Application/Tags/Commands/RestoreTagCommand.cs @@ -23,7 +23,7 @@ public async Task Handle(RestoreTagCommand request, CancellationToken ca t => t.Id == request.TagId && t.UserId == request.UserId, cancellationToken); - var tag = tags.FirstOrDefault(); + var tag = tags.Count > 0 ? tags[0] : null; if (tag is null || !tag.IsDeleted) return Result.Failure(ErrorMessages.TagNotFound); diff --git a/src/Orbit.Application/Tags/Queries/SuggestTagsQuery.cs b/src/Orbit.Application/Tags/Queries/SuggestTagsQuery.cs index 8a9e2b97..12f7842d 100644 --- a/src/Orbit.Application/Tags/Queries/SuggestTagsQuery.cs +++ b/src/Orbit.Application/Tags/Queries/SuggestTagsQuery.cs @@ -53,7 +53,7 @@ public async Task> Handle( return Result.Success(new SuggestTagsResponse(suggestions)); } - private static IReadOnlyList MapSuggestions( + private static List MapSuggestions( IReadOnlyList suggestedNames, IReadOnlyList existingTags) { diff --git a/src/Orbit.Infrastructure/AI/ContentModerationService.cs b/src/Orbit.Infrastructure/AI/ContentModerationService.cs index f242b09c..85c431b5 100644 --- a/src/Orbit.Infrastructure/AI/ContentModerationService.cs +++ b/src/Orbit.Infrastructure/AI/ContentModerationService.cs @@ -44,7 +44,7 @@ public async Task CheckTextAsync(string text, CancellationToke } var payload = await response.Content.ReadFromJsonAsync(SerializerOptions, cancellationToken); - var result = payload?.Results?.FirstOrDefault(); + var result = payload?.Results is { Count: > 0 } results ? results[0] : null; if (result is null) return Unavailable; diff --git a/src/Orbit.Infrastructure/Services/AgentTargetOwnershipService.cs b/src/Orbit.Infrastructure/Services/AgentTargetOwnershipService.cs index 71b9d6b6..dc06abae 100644 --- a/src/Orbit.Infrastructure/Services/AgentTargetOwnershipService.cs +++ b/src/Orbit.Infrastructure/Services/AgentTargetOwnershipService.cs @@ -36,7 +36,7 @@ private static OwnershipCheck CreateCheck(string resourceName, OwnershipResult r private static async Task AllOwnedAsync( IQueryable queryable, Guid userId, - IReadOnlyCollection ids, + List ids, CancellationToken cancellationToken) where TEntity : class { diff --git a/src/Orbit.Infrastructure/Services/AiHabitSuggestionService.cs b/src/Orbit.Infrastructure/Services/AiHabitSuggestionService.cs index f74213b3..0e98dcda 100644 --- a/src/Orbit.Infrastructure/Services/AiHabitSuggestionService.cs +++ b/src/Orbit.Infrastructure/Services/AiHabitSuggestionService.cs @@ -124,7 +124,7 @@ internal static Result MapSuggestion(HabitSuggestionDto? d return quantity is { } value && value >= 1 ? value : 1; } - private static IReadOnlyList SanitizeDays( + private static List SanitizeDays( IReadOnlyList? days, FrequencyUnit? frequencyUnit, int? frequencyQuantity, bool isFlexible) { if (isFlexible || days is null || frequencyUnit != FrequencyUnit.Day || frequencyQuantity != 1) @@ -146,7 +146,7 @@ private static IReadOnlyList SanitizeDays( return time.ToString("HH\\:mm", CultureInfo.InvariantCulture); } - private static IReadOnlyList SanitizeTitles(IReadOnlyList? values, int cap, int maxLength) + private static List SanitizeTitles(IReadOnlyList? values, int cap, int maxLength) { if (values is null) return []; diff --git a/src/Orbit.Infrastructure/Services/GoalDeadlineNotificationService.cs b/src/Orbit.Infrastructure/Services/GoalDeadlineNotificationService.cs index 1141a834..1c29b6b6 100644 --- a/src/Orbit.Infrastructure/Services/GoalDeadlineNotificationService.cs +++ b/src/Orbit.Infrastructure/Services/GoalDeadlineNotificationService.cs @@ -125,7 +125,7 @@ private async Task> ComputeFreshStreakValuesAsync(OrbitDbC return freshValues; } - private static decimal EffectiveCurrentValue(Goal goal, IReadOnlyDictionary freshStreakValues) => + private static decimal EffectiveCurrentValue(Goal goal, Dictionary freshStreakValues) => freshStreakValues.TryGetValue(goal.Id, out var fresh) ? fresh : goal.CurrentValue; private async Task ProcessGoalDeadlineAsync( diff --git a/src/Orbit.Infrastructure/Services/PushNotificationService.cs b/src/Orbit.Infrastructure/Services/PushNotificationService.cs index 080ea836..8eab8ff8 100644 --- a/src/Orbit.Infrastructure/Services/PushNotificationService.cs +++ b/src/Orbit.Infrastructure/Services/PushNotificationService.cs @@ -69,7 +69,7 @@ private async Task SendFcm( } const int FcmBatchSize = 500; - var subsList = subs as IList ?? subs.ToList(); + var subsList = subs as List ?? subs.ToList(); for (int offset = 0; offset < subsList.Count; offset += FcmBatchSize) { var chunk = subsList.Skip(offset).Take(FcmBatchSize).ToList(); diff --git a/tests/Orbit.Application.Tests/Accountability/AccountabilityValidatorsTests.cs b/tests/Orbit.Application.Tests/Accountability/AccountabilityValidatorsTests.cs index b970ba52..c76d4428 100644 --- a/tests/Orbit.Application.Tests/Accountability/AccountabilityValidatorsTests.cs +++ b/tests/Orbit.Application.Tests/Accountability/AccountabilityValidatorsTests.cs @@ -11,7 +11,7 @@ public class AccountabilityValidatorsTests private static readonly Guid UserId = Guid.NewGuid(); private static readonly Guid PairId = Guid.NewGuid(); - private static IReadOnlyList Habits(int count) => + private static List Habits(int count) => Enumerable.Range(0, count).Select(_ => Guid.NewGuid()).ToList(); [Fact] diff --git a/tests/Orbit.Application.Tests/Challenges/ChallengeValidatorsTests.cs b/tests/Orbit.Application.Tests/Challenges/ChallengeValidatorsTests.cs index b635c512..55bd54ef 100644 --- a/tests/Orbit.Application.Tests/Challenges/ChallengeValidatorsTests.cs +++ b/tests/Orbit.Application.Tests/Challenges/ChallengeValidatorsTests.cs @@ -10,7 +10,7 @@ public class ChallengeValidatorsTests private static readonly Guid UserId = Guid.NewGuid(); private static readonly Guid ChallengeId = Guid.NewGuid(); - private static IReadOnlyList Habits(int count) => + private static List Habits(int count) => Enumerable.Range(0, count).Select(_ => Guid.NewGuid()).ToList(); [Theory] diff --git a/tests/Orbit.Application.Tests/Commands/Chat/ProcessUserChatCommandHandlerTests.cs b/tests/Orbit.Application.Tests/Commands/Chat/ProcessUserChatCommandHandlerTests.cs index 88224341..c4c964d0 100644 --- a/tests/Orbit.Application.Tests/Commands/Chat/ProcessUserChatCommandHandlerTests.cs +++ b/tests/Orbit.Application.Tests/Commands/Chat/ProcessUserChatCommandHandlerTests.cs @@ -246,7 +246,7 @@ private static IAiTool FakeTool(string name) return tool; } - private static IReadOnlyList ToolNames(IReadOnlyList declarations) => + private static List ToolNames(IReadOnlyList declarations) => declarations.Select(declaration => (string)declaration.GetType().GetProperty("name")!.GetValue(declaration)!).ToList(); [Fact] diff --git a/tests/Orbit.Application.Tests/Commands/Profile/ApplyOnboardingCommandHandlerTests.cs b/tests/Orbit.Application.Tests/Commands/Profile/ApplyOnboardingCommandHandlerTests.cs index e08e30e9..80dedd6d 100644 --- a/tests/Orbit.Application.Tests/Commands/Profile/ApplyOnboardingCommandHandlerTests.cs +++ b/tests/Orbit.Application.Tests/Commands/Profile/ApplyOnboardingCommandHandlerTests.cs @@ -20,7 +20,7 @@ public class ApplyOnboardingCommandHandlerTests private readonly IUserDateService _userDateService = Substitute.For(); private readonly IAppConfigService _appConfig = Substitute.For(); private readonly IUnitOfWork _unitOfWork = Substitute.For(); - private readonly IMemoryCache _cache = new MemoryCache(new MemoryCacheOptions()); + private readonly MemoryCache _cache = new MemoryCache(new MemoryCacheOptions()); private static readonly Guid UserId = Guid.NewGuid(); private static readonly DateOnly Today = new(2026, 7, 5); diff --git a/tests/Orbit.Domain.Tests/Generators/OrbitArbitraries.cs b/tests/Orbit.Domain.Tests/Generators/OrbitArbitraries.cs index d1f9a189..99ec4b49 100644 --- a/tests/Orbit.Domain.Tests/Generators/OrbitArbitraries.cs +++ b/tests/Orbit.Domain.Tests/Generators/OrbitArbitraries.cs @@ -81,7 +81,7 @@ private static Habit Build( HabitOwnerId, "Property Habit", unit, quantity, Days: days, IsBadHabit: isBadHabit, DueDate: dueDate, IsFlexible: isFlexible)).Value; - private static IReadOnlyList DaysFromMask(int mask) => + private static List DaysFromMask(int mask) => Enumerable.Range(0, 7).Where(bit => (mask & (1 << bit)) != 0).Select(bit => (DayOfWeek)bit).ToList(); private static Gen OneTimeGen => diff --git a/tests/Orbit.Infrastructure.Tests/Services/SystemPromptBuilderTests.cs b/tests/Orbit.Infrastructure.Tests/Services/SystemPromptBuilderTests.cs index aaa5fb94..995abbb7 100644 --- a/tests/Orbit.Infrastructure.Tests/Services/SystemPromptBuilderTests.cs +++ b/tests/Orbit.Infrastructure.Tests/Services/SystemPromptBuilderTests.cs @@ -16,7 +16,7 @@ private static string BuildPrompt( bool hasImage = false, IReadOnlyList? userTags = null, DateOnly? userToday = null, IReadOnlyDictionary? habitMetrics = null) { - ISystemPromptBuilder builder = new SystemPromptBuilder(); + var builder = new SystemPromptBuilder(); var request = new PromptBuildRequest(habits, facts, hasImage, UserTags: userTags, UserToday: userToday ?? new DateOnly(2026, 3, 20), HabitMetrics: habitMetrics); return builder.BuildStatic(request) + builder.BuildDynamic(request); } @@ -162,7 +162,7 @@ public void Build_IncludesEncouragingTone() [Fact] public void BuildStatic_OrdersEncouragingToneAfterIdentityAndBeforeRules() { - ISystemPromptBuilder builder = new SystemPromptBuilder(); + var builder = new SystemPromptBuilder(); var staticPrompt = builder.BuildStatic(new PromptBuildRequest(Array.Empty(), Array.Empty())); staticPrompt.Should().Contain("Tone and Encouragement"); @@ -198,7 +198,7 @@ public void Build_WithFactContainingControlCharacters_SanitizesPromptData() [Fact] public void BuildStatic_IsRequestInvariant_AndExcludesDynamicHabitIndex() { - ISystemPromptBuilder builder = new SystemPromptBuilder(); + var builder = new SystemPromptBuilder(); var habit = Habit.Create(new HabitCreateParams(TestUserId, "Morning Run", FrequencyUnit.Day, 1, DueDate: DateOnly.FromDateTime(DateTime.UtcNow))).Value; var withHabit = new PromptBuildRequest([habit], Array.Empty()); var empty = new PromptBuildRequest(Array.Empty(), Array.Empty()); @@ -214,7 +214,7 @@ public void BuildStatic_IsRequestInvariant_AndExcludesDynamicHabitIndex() [Fact] public void BuildDynamic_ContainsUserData_AndExcludesStaticRules() { - ISystemPromptBuilder builder = new SystemPromptBuilder(); + var builder = new SystemPromptBuilder(); var habit = Habit.Create(new HabitCreateParams(TestUserId, "Morning Run", FrequencyUnit.Day, 1, DueDate: DateOnly.FromDateTime(DateTime.UtcNow))).Value; var request = new PromptBuildRequest([habit], Array.Empty(), UserToday: new DateOnly(2026, 3, 20)); diff --git a/tests/Orbit.Infrastructure.Tests/Services/UserDateServiceTests.cs b/tests/Orbit.Infrastructure.Tests/Services/UserDateServiceTests.cs index 9dd4c8d3..99d95e13 100644 --- a/tests/Orbit.Infrastructure.Tests/Services/UserDateServiceTests.cs +++ b/tests/Orbit.Infrastructure.Tests/Services/UserDateServiceTests.cs @@ -117,6 +117,6 @@ public async Task GetUserWeekStartDayAsync_SecondInstanceSharingCache_ReadsCache await secondInstanceRepo.DidNotReceive().GetByIdAsync(UserId, Arg.Any()); } - private static IDistributedCache NewDistributedCache() => + private static MemoryDistributedCache NewDistributedCache() => new MemoryDistributedCache(Options.Create(new MemoryDistributedCacheOptions())); }