Fix one time habit retrospective rankings - #516
Conversation
|
I will update This belongs in the producer because filtering after |
There was a problem hiding this comment.
Important
The current head contains no implementation, so this PR does not yet change retrospective rankings.
Reviewed changes I reviewed the complete current head and checked the stated approach against the existing retrospective calculator and handler coverage.
- Scaffold commit:
010d7c9changes zero files and leaves production behavior unchanged. - Intended ranking fix: The proposed producer-side filter is correctly placed before ordering and
Take(3), but it has not been committed.
⚠️ The ranking defect remains unchanged
The branch has no file delta from main, so RetrospectiveMetricsCalculator still includes one-time habits in both rankings and the existing test still expects that behavior. Merging this head cannot deliver the fix described by the PR.
Technical details
# Commit the retrospective ranking fix
## Affected sites
- `src/Orbit.Application/Habits/Services/RetrospectiveMetricsCalculator.cs:119` - `TopHabits` is still ranked from every generated stat.
- `src/Orbit.Application/Habits/Services/RetrospectiveMetricsCalculator.cs:125` - `NeedsAttention` is still ranked from every generated stat.
- `tests/Orbit.Application.Tests/Queries/Habits/GetRetrospectiveQueryHandlerTests.cs:329` - Existing coverage still asserts that a one-time task appears in `NeedsAttention`.
## Required outcome
- Exclude one-time stats before ordering and truncating both ranking lists.
- Add exact regression coverage proving a one-time task cannot displace a recurring ranking candidate.GPT Sol | 𝕏
|
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes I reviewed the retrospective ranking implementation added since the prior Pullfrog review and its strengthened regression coverage.
- Filtered recurring rankings: Reused a recurring stats sequence before ordering and
Take(3)so one time habits cannot occupy eitherTopHabitsorNeedsAttention. - Strengthened regression coverage: Replaced the previous binary flag assertion with exact ranking checks around completed and incomplete one time competitors and an 86 percent recurring habit.
GPT Sol | 𝕏




Closes #488
Summary
Assumptions
Test evidence
dotnet test tests\Orbit.Application.Tests\Orbit.Application.Tests.csproj --filter "FullyQualifiedName~GetRetrospectiveQueryHandlerTests.Handle_FlagsOneTimeTasks_AsBinary"passed 1 test with the defect present.dotnet test tests\Orbit.Application.Tests\Orbit.Application.Tests.csproj --no-restore --filter "FullyQualifiedName~GetRetrospectiveQueryHandlerTests.Handle_HabitRankings_ExcludeOneTimeTasks"failed as intended becauseTopHabitsreturned the completed one time task at 100 percent, the recurring habit at 86 percent, and the incomplete one time task at 0 percent.dotnet build Orbit.slnxpassed with 0 errors and 20 warnings from existing package constraints, analyzer compiler version mismatch, and deprecated Firebase token usage.dotnet testpassed all 6,162 tests.