Expose repairable streak gap dates - #522
thomasluizon wants to merge 3 commits into
Conversation
|
Approach:
This keeps rule authority server side and rejects client calendar reconstruction. Existing single day fields remain untouched for shipped clients. |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes Reviewed the sole commit at the current head against main; there is no source, contract, or test diff yet.
- Empty implementation baseline —
9dfb065changes no files, so no functional behavior is available to assess in this review.
GPT Sol | 𝕏
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UFozk1UXf4Pm5spEHYxzT1
|
There was a problem hiding this comment.
Important
The new gap discovery can hide a valid repair after an older unrepaired break.
Reviewed changes Reviewed the implementation commit added since the prior Pullfrog review at 9dfb065.
- Extended the streak contract Appended optional
repairableGapDatestoStreakInfoResponseand OpenAPI without changing existing fields. - Derived server-confirmed gaps Shared schedule and coverage context with command eligibility and returned the full terminal scheduled gap.
- Added regression coverage Covered daily and weekly gaps, completion today, lookback refusal, and echoing discovered dates into the repair command.
GPT Sol | 𝕏
| if (gapEndIndex < 0 || IsCovered(context, gapEnd)) | ||
| return []; | ||
|
|
||
| var precedingDate = user.PreGapLastActiveDate ?? user.LastActiveDate; |
There was a problem hiding this comment.
PreGapLastActiveDate is the first saved break, not necessarily the predecessor of the terminal gap being offered. After an older gap is left unrepaired, a restarted run followed by a new gap makes this slice begin at the old break, include intervening completions, and return [] even though the command accepts the newer terminal gap when the bank is sufficient.
Technical details
# Derive the latest terminal gap
## Affected sites
- `src/Orbit.Infrastructure/Services/UserStreakService.cs:104` selects the persistent first-break snapshot.
- `src/Orbit.Domain/Entities/User.cs:582` intentionally retains that snapshot across later decreases until repair or account reset.
## Required outcome
- Return the newest terminal scheduled gap that the repair command would accept, even when an older snapshot remains.
- Preserve the completion-today and sparse-schedule behavior.
## Suggested approach
- Walk backward from `gapEndIndex` over uncovered scheduled dates to the nearest covered scheduled predecessor instead of unconditionally anchoring to `PreGapLastActiveDate`.
- Add a regression with an old unrepaired gap, a restarted completed run, and a newer terminal gap whose exact returned dates succeed through `RepairStreakGapCommand`.|
Closing as a duplicate I should not have opened. Pull request 518 already implements thomasluizon/orbit-tickets#505 and has since 2026-09-11. It is APPROVED with zero unresolved threads, and its only red check was I opened this one because I read the ticket as unstarted without first listing the open pull requests in this repository. The branch |




Resolves thomasluizon/orbit-tickets#505
Summary
repairableGapDatesto the streak info response and generated OpenAPI contract.isRepairAvailable,repairDate, and every existing response field.Assumptions
PreGapLastActiveDateusesLastActiveDateas its fallback boundary. Scanning backward to older activity was rejected because it changes the identified gap.Test evidence
WeeklyGapWhosePriorOccurrenceIsAWeekBack_IsRepairablepassed at commit9dfb065e. Command:dotnet test tests\Orbit.Infrastructure.Tests\Orbit.Infrastructure.Tests.csproj --filter "FullyQualifiedName~StreakGapRepairTests.WeeklyGapWhosePriorOccurrenceIsAWeekBack_IsRepairable" --logger "console;verbosity=minimal". Result: 1 passed. Existing coverage proved sparse repair acceptance but did not expose dates to clients.Handle_RepairAvailable_AppendsRepairFieldsAndCapturesOfferfailed. Command:dotnet test tests\Orbit.Application.Tests\Orbit.Application.Tests.csproj --filter "FullyQualifiedName~GetStreakInfoQueryHandlerTests.Handle_RepairAvailable_AppendsRepairFieldsAndCapturesOffer" --logger "console;verbosity=detailed". Failure:Expected contract.TryGetProperty("RepairableGapDates", out _) to be True, but found False.dotnet test tests\Orbit.Application.Tests\Orbit.Application.Tests.csproj --filter "FullyQualifiedName~GetStreakInfoQueryHandlerTests.Handle_RepairAvailable_AppendsRepairFieldsAndCapturesOffer" --no-build --no-restore --logger "console;verbosity=minimal". Result: 1 passed.dotnet test tests\Orbit.Infrastructure.Tests\Orbit.Infrastructure.Tests.csproj --filter "FullyQualifiedName~StreakGapRepairTests" --no-restore --logger "console;verbosity=minimal". Result: 34 passed.dotnet build Orbit.slnx --no-restore --verbosity minimal: 0 errors.dotnet test Orbit.slnx --no-build --no-restore --logger "console;verbosity=minimal": 6,248 passed.