Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ private static AccountabilityPairDto BuildDto(
Guid userId,
Guid buddyId,
User buddy,
IReadOnlyDictionary<Guid, List<AccountabilityPairHabit>> habitsByPair,
IReadOnlyDictionary<(Guid PairId, Guid UserId), DateOnly> lastCheckInByPairUser)
Dictionary<Guid, List<AccountabilityPairHabit>> habitsByPair,
Dictionary<(Guid PairId, Guid UserId), DateOnly> lastCheckInByPairUser)
{
var linkedHabits = habitsByPair.TryGetValue(pair.Id, out var habits)
? habits
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
IReadOnlyList<Guid> LinkedHabitIds,
IReadOnlyList<Guid> InvitedFriendUserIds) : IRequest<Result<Guid>>;

public partial class CreateChallengeCommandHandler(

Check warning on line 25 in src/Orbit.Application/Challenges/Commands/CreateChallengeCommand.cs

View workflow job for this annotation

GitHub Actions / SonarCloud Analysis

Constructor has 8 parameters, which is greater than the 7 authorized.
SocialAccessGuard socialAccessGuard,
FriendGraphService friendGraphService,
IGenericRepository<Challenge> challengeRepository,
Expand Down Expand Up @@ -86,7 +86,7 @@
return Result.Success(challenge.Id);
}

private async Task NotifyInvitedFriendsAsync(User requester, IReadOnlyList<Guid> invitedFriendIds, CancellationToken cancellationToken)
private async Task NotifyInvitedFriendsAsync(User requester, List<Guid> invitedFriendIds, CancellationToken cancellationToken)
{
if (invitedFriendIds.Count == 0)
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
if (operationResult.Status != AgentOperationStatus.Succeeded)
return;

foreach (var surface in ExtractRelatedSurfaces(operationResult.Payload))

Check warning on line 63 in src/Orbit.Application/Chat/Commands/ProcessUserChatCommand.Accumulator.cs

View workflow job for this annotation

GitHub Actions / SonarCloud Analysis

Loops should be simplified using the "Where" LINQ method
{
if (_seenRelatedSurfaces.Add(surface))
_relatedSurfaces.Add(surface);
Expand All @@ -73,7 +73,7 @@
/// (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.
/// </summary>
private static IEnumerable<string> ExtractRelatedSurfaces(object? payload)
private static List<string> ExtractRelatedSurfaces(object? payload)
{
if (payload is null)
return [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
/// reassemble results deterministically, independent of task-completion timing.
/// </summary>
private async Task<IReadOnlyDictionary<string, ToolCallOutcome>> ExecuteToolCallsAsync(
IReadOnlyList<AiToolCall> orderedCalls,
List<AiToolCall> orderedCalls,
ProcessUserChatCommand request,
CancellationToken cancellationToken)
{
Expand Down Expand Up @@ -267,7 +267,7 @@
}
}

private async Task<ToolCallOutcome> StashClarificationAsync(

Check warning on line 270 in src/Orbit.Application/Chat/Commands/ProcessUserChatCommand.Tools.cs

View workflow job for this annotation

GitHub Actions / SonarCloud Analysis

Method has 8 parameters, which is greater than the 7 authorized.
AiToolCall call,
ProcessUserChatCommand request,
IPendingClarificationStore clarificationStore,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ private static FeatureExplanation Parse(string content)
return new FeatureExplanation(key, displayName, relatedCapabilities, relatedSurfaces, version, body);
}

private static IReadOnlyList<string> ParseInlineList(string value)
private static List<string> ParseInlineList(string value)
{
var trimmed = value.Trim();
if (trimmed.Length < 2 || trimmed[0] != '[' || trimmed[^1] != ']')
Expand Down
2 changes: 1 addition & 1 deletion src/Orbit.Application/Goals/Commands/RestoreGoalCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public async Task<Result> 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);

Expand Down
2 changes: 1 addition & 1 deletion src/Orbit.Application/Goals/Queries/GetGoalByIdQuery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public async Task<Result<GoalDetailDto>> 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<GoalDetailDto>(ErrorMessages.GoalNotFound);
Expand Down
2 changes: 1 addition & 1 deletion src/Orbit.Application/Goals/Queries/GetGoalDetailQuery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public async Task<Result<GoalDetailWithMetricsResponse>> 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<GoalDetailWithMetricsResponse>(ErrorMessages.GoalNotFound);
Expand Down
2 changes: 1 addition & 1 deletion src/Orbit.Application/Goals/Queries/GetGoalMetricsQuery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public async Task<Result<GoalMetrics>> 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<GoalMetrics>(ErrorMessages.GoalNotFound);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public async Task<Result> Handle(MoveHabitParentCommand request, CancellationTok
return Result.Success();
}

private static bool WouldCreateCycle(Guid habitId, Guid targetParentId, IReadOnlyDictionary<Guid, Habit> habitsById)
private static bool WouldCreateCycle(Guid habitId, Guid targetParentId, Dictionary<Guid, Habit> habitsById)
{
var currentId = targetParentId;
while (habitsById.TryGetValue(currentId, out var current))
Expand All @@ -73,7 +73,7 @@ private static bool WouldCreateCycle(Guid habitId, Guid targetParentId, IReadOnl
return false;
}

private static int GetDepth(Guid habitId, IReadOnlyDictionary<Guid, Habit> habitsById)
private static int GetDepth(Guid habitId, Dictionary<Guid, Habit> habitsById)
{
var depth = 0;
var currentId = habitsById.TryGetValue(habitId, out var habit) ? habit.ParentHabitId : null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
cancellationToken);
}

private static bool ShouldShowTomorrow(IReadOnlyList<HabitWidgetItem> todayItems)
private static bool ShouldShowTomorrow(List<HabitWidgetItem> todayItems)
{
return todayItems.Count == 0 || todayItems.All(item => item.IsCompleted);
}
Expand All @@ -116,7 +116,7 @@

private static bool HasVisibleDescendant(Guid parentId, ILookup<Guid?, Habit> lookup, DateOnly date)
{
foreach (var child in lookup[parentId])

Check warning on line 119 in src/Orbit.Application/Habits/Queries/GetHabitWidgetQuery.cs

View workflow job for this annotation

GitHub Actions / SonarCloud Analysis

Loops should be simplified using the "Where" LINQ method
{
if (IsVisibleOnWidget(child, lookup, date))
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public async Task<Result<RescheduleSuggestionResponse>> 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<RescheduleSuggestionResponse>(ErrorMessages.HabitNotFound);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ private static RetrospectiveHabitStat BuildHabitStat(Habit habit, int scheduledC
scheduledCount,
habit.FrequencyUnit is null);

private static IReadOnlyList<int> 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++)
Expand Down
4 changes: 2 additions & 2 deletions src/Orbit.Application/Profile/Queries/ExportUserDataQuery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

public record ExportUserDataQuery(Guid UserId) : IRequest<Result<UserDataExport>>;

public class ExportUserDataQueryHandler(

Check warning on line 13 in src/Orbit.Application/Profile/Queries/ExportUserDataQuery.cs

View workflow job for this annotation

GitHub Actions / SonarCloud Analysis

Constructor has 20 parameters, which is greater than the 7 authorized.
IGenericRepository<User> userRepository,
IGenericRepository<Habit> habitRepository,
IGenericRepository<HabitLog> habitLogRepository,
Expand Down Expand Up @@ -162,7 +162,7 @@
apiKey.IsRevoked);
}

private static ExportedHabit MapHabit(Habit habit, IReadOnlyDictionary<Guid, List<HabitLog>> logsByHabit)
private static ExportedHabit MapHabit(Habit habit, Dictionary<Guid, List<HabitLog>> logsByHabit)
{
var logs = logsByHabit.TryGetValue(habit.Id, out var habitLogs)
? habitLogs.Select(l => new ExportedHabitLog(l.Date, l.Value, l.Note, l.CreatedAtUtc)).ToList()
Expand All @@ -187,7 +187,7 @@

private static ExportedGoal MapGoal(
Goal goal,
IReadOnlyDictionary<Guid, List<GoalProgressLog>> progressByGoal,
Dictionary<Guid, List<GoalProgressLog>> progressByGoal,
IReadOnlyDictionary<Guid, int> freshStreakValues)
{
var progress = progressByGoal.TryGetValue(goal.Id, out var goalLogs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public async Task<Result<PublicProfileView>> Handle(GetPublicProfileQuery reques
return Result.Failure<PublicProfileView>(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<PublicProfileView>(ErrorMessages.UserNotFound);

Expand Down
4 changes: 2 additions & 2 deletions src/Orbit.Application/Social/Queries/GetFriendProfileQuery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

public record GetFriendProfileQuery(Guid UserId, Guid FriendUserId) : IRequest<Result<FriendProfileView>>;

public class GetFriendProfileQueryHandler(

Check warning on line 40 in src/Orbit.Application/Social/Queries/GetFriendProfileQuery.cs

View workflow job for this annotation

GitHub Actions / SonarCloud Analysis

Constructor has 8 parameters, which is greater than the 7 authorized.
SocialAccessGuard socialAccessGuard,
FriendGraphService friendGraphService,
IUserDateService userDateService,
Expand All @@ -60,7 +60,7 @@
return Result.Failure<FriendProfileView>(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<FriendProfileView>(ErrorMessages.UserNotFound);

Expand Down Expand Up @@ -93,7 +93,7 @@
level.Level,
level.Title,
friend.TotalXp,
friendship?.RespondedAtUtc,

Check warning on line 96 in src/Orbit.Application/Social/Queries/GetFriendProfileQuery.cs

View workflow job for this annotation

GitHub Actions / SonarCloud Analysis

Remove this unnecessary check for null.
weeklyActivity,
achievements,
topHabits,
Expand All @@ -101,7 +101,7 @@
sharedChallenges));
}

private static IReadOnlyList<int> BuildWeeklyActivity(IEnumerable<Habit> habits, DateOnly today)
private static int[] BuildWeeklyActivity(IEnumerable<Habit> habits, DateOnly today)
{
var windowStart = today.AddDays(-(ActivityWindowDays - 1));
var counts = new int[ActivityWindowDays];
Expand Down
4 changes: 2 additions & 2 deletions src/Orbit.Application/Social/Services/FriendGraphService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/Orbit.Application/Tags/Commands/RestoreTagCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public async Task<Result> 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);

Expand Down
2 changes: 1 addition & 1 deletion src/Orbit.Application/Tags/Queries/SuggestTagsQuery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public async Task<Result<SuggestTagsResponse>> Handle(
return Result.Success(new SuggestTagsResponse(suggestions));
}

private static IReadOnlyList<SuggestedTag> MapSuggestions(
private static List<SuggestedTag> MapSuggestions(
IReadOnlyList<string> suggestedNames,
IReadOnlyList<Tag> existingTags)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Orbit.Infrastructure/AI/ContentModerationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public async Task<ModerationResult> CheckTextAsync(string text, CancellationToke
}

var payload = await response.Content.ReadFromJsonAsync<ModerationResponse>(SerializerOptions, cancellationToken);
var result = payload?.Results?.FirstOrDefault();
var result = payload?.Results is { Count: > 0 } results ? results[0] : null;
if (result is null)
return Unavailable;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ private static OwnershipCheck CreateCheck(string resourceName, OwnershipResult r
private static async Task<OwnershipResult> AllOwnedAsync<TEntity>(
IQueryable<TEntity> queryable,
Guid userId,
IReadOnlyCollection<Guid> ids,
List<Guid> ids,
CancellationToken cancellationToken)
where TEntity : class
{
Expand Down
4 changes: 2 additions & 2 deletions src/Orbit.Infrastructure/Services/AiHabitSuggestionService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ internal static Result<HabitSetupSuggestion> MapSuggestion(HabitSuggestionDto? d
return quantity is { } value && value >= 1 ? value : 1;
}

private static IReadOnlyList<DayOfWeek> SanitizeDays(
private static List<DayOfWeek> SanitizeDays(
IReadOnlyList<string>? days, FrequencyUnit? frequencyUnit, int? frequencyQuantity, bool isFlexible)
{
if (isFlexible || days is null || frequencyUnit != FrequencyUnit.Day || frequencyQuantity != 1)
Expand All @@ -146,7 +146,7 @@ private static IReadOnlyList<DayOfWeek> SanitizeDays(
return time.ToString("HH\\:mm", CultureInfo.InvariantCulture);
}

private static IReadOnlyList<string> SanitizeTitles(IReadOnlyList<string>? values, int cap, int maxLength)
private static List<string> SanitizeTitles(IReadOnlyList<string>? values, int cap, int maxLength)
{
if (values is null)
return [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ private async Task<Dictionary<Guid, int>> ComputeFreshStreakValuesAsync(OrbitDbC
return freshValues;
}

private static decimal EffectiveCurrentValue(Goal goal, IReadOnlyDictionary<Guid, int> freshStreakValues) =>
private static decimal EffectiveCurrentValue(Goal goal, Dictionary<Guid, int> freshStreakValues) =>
freshStreakValues.TryGetValue(goal.Id, out var fresh) ? fresh : goal.CurrentValue;

private async Task ProcessGoalDeadlineAsync(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
}
}

private async Task SendFcm(

Check warning on line 58 in src/Orbit.Infrastructure/Services/PushNotificationService.cs

View workflow job for this annotation

GitHub Actions / SonarCloud Analysis

Refactor this method to reduce its Cognitive Complexity from 27 to the 15 allowed.
List<Domain.Entities.PushSubscription> subs,
string title, string body, string? url,
List<Domain.Entities.PushSubscription> staleSubscriptions,
Expand All @@ -69,7 +69,7 @@
}

const int FcmBatchSize = 500;
var subsList = subs as IList<Domain.Entities.PushSubscription> ?? subs.ToList();
var subsList = subs as List<Domain.Entities.PushSubscription> ?? subs.ToList();

Check warning on line 72 in src/Orbit.Infrastructure/Services/PushNotificationService.cs

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this unnecessary cast to 'List<Domain.Entities.PushSubscription>'.

See more on https://sonarcloud.io/project/issues?id=thomasluizon_orbit-api&issues=AZ9dC00kNKmjP9Iy-hyR&open=AZ9dC00kNKmjP9Iy-hyR&pullRequest=388
for (int offset = 0; offset < subsList.Count; offset += FcmBatchSize)
{
var chunk = subsList.Skip(offset).Take(FcmBatchSize).ToList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class AccountabilityValidatorsTests
private static readonly Guid UserId = Guid.NewGuid();
private static readonly Guid PairId = Guid.NewGuid();

private static IReadOnlyList<Guid> Habits(int count) =>
private static List<Guid> Habits(int count) =>
Enumerable.Range(0, count).Select(_ => Guid.NewGuid()).ToList();

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class ChallengeValidatorsTests
private static readonly Guid UserId = Guid.NewGuid();
private static readonly Guid ChallengeId = Guid.NewGuid();

private static IReadOnlyList<Guid> Habits(int count) =>
private static List<Guid> Habits(int count) =>
Enumerable.Range(0, count).Select(_ => Guid.NewGuid()).ToList();

[Theory]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ private static IAiTool FakeTool(string name)
return tool;
}

private static IReadOnlyList<string> ToolNames(IReadOnlyList<object> declarations) =>
private static List<string> ToolNames(IReadOnlyList<object> declarations) =>
declarations.Select(declaration => (string)declaration.GetType().GetProperty("name")!.GetValue(declaration)!).ToList();

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class ApplyOnboardingCommandHandlerTests
private readonly IUserDateService _userDateService = Substitute.For<IUserDateService>();
private readonly IAppConfigService _appConfig = Substitute.For<IAppConfigService>();
private readonly IUnitOfWork _unitOfWork = Substitute.For<IUnitOfWork>();
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);
Expand Down
2 changes: 1 addition & 1 deletion tests/Orbit.Domain.Tests/Generators/OrbitArbitraries.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<DayOfWeek> DaysFromMask(int mask) =>
private static List<DayOfWeek> DaysFromMask(int mask) =>
Enumerable.Range(0, 7).Where(bit => (mask & (1 << bit)) != 0).Select(bit => (DayOfWeek)bit).ToList();

private static Gen<Habit> OneTimeGen =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ private static string BuildPrompt(
bool hasImage = false, IReadOnlyList<Tag>? userTags = null,
DateOnly? userToday = null, IReadOnlyDictionary<Guid, HabitMetrics>? 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);
}
Expand Down Expand Up @@ -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<Habit>(), Array.Empty<UserFact>()));

staticPrompt.Should().Contain("Tone and Encouragement");
Expand Down Expand Up @@ -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<UserFact>());
var empty = new PromptBuildRequest(Array.Empty<Habit>(), Array.Empty<UserFact>());
Expand All @@ -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<UserFact>(), UserToday: new DateOnly(2026, 3, 20));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,6 @@ public async Task GetUserWeekStartDayAsync_SecondInstanceSharingCache_ReadsCache
await secondInstanceRepo.DidNotReceive().GetByIdAsync(UserId, Arg.Any<CancellationToken>());
}

private static IDistributedCache NewDistributedCache() =>
private static MemoryDistributedCache NewDistributedCache() =>
new MemoryDistributedCache(Options.Create(new MemoryDistributedCacheOptions()));
}
Loading