Skip to content

fix(calendar): omit flexible dates after the window target is met - #686

Merged
thomasluizon merged 1 commit into
mainfrom
fix/ticket-903-flexible-calendar-missed
Oct 2, 2026
Merged

thomasluizon merged 1 commit into
mainfrom
fix/ticket-903-flexible-calendar-missed

Conversation

@thomasluizon

Copy link
Copy Markdown
Owner

Flexible habits whose window target was met still projected every day in that window, so Calendario marked the remaining days missed. Filter projected dates through IsFlexibleHabitDueOnDate and merge positive logged dates back into the existing scheduledDates field. A met weekly target logged Monday through Wednesday now returns those three dates only.

The change lives in src/Orbit.Application/Habits/Queries/GetCalendarMonthQuery.cs, with handler coverage in tests/Orbit.Application.Tests/Queries/Habits/GetCalendarMonthQueryHandlerTests.cs. One helper applies the same rule to roots, children, and descendant visibility, preserving the exhausted parent kept for a logged child. Short windows retain due dates; DTO names and types remain unchanged. No external interface field was added or read by this change.

Closes thomasluizon/orbit-tickets#903. Carry to redesign/main belongs to thomasluizon/orbit-tickets#746.

Test evidence

The continuation preserves the implementation at 8c29fe69. Saved logs from the preceding run establish the before/after observations:

  • Unchanged GetCalendarMonthQueryHandlerTests: 19 passed while the defect was present (/tmp/ticket-903-baseline.log). Existing coverage did not catch the met-window projection.
  • Added Handle_FlexibleTargetMet_ReturnsOnlyLoggedDatesInWindow and Handle_FlexibleTargetMetWithSkip_OnlyProjectsNextWindow: 8 failures before the fix, 21 passing cases (/tmp/ticket-903-red.log). The weekly case expected only April 6 to 8 but received April 6 to 12. Monthly and nested cases also failed on extra projected dates.
  • After the fix: all 29 handler cases passed (/tmp/ticket-903-green.log), including the shortfall and exhausted-parent cases.

Focused reproduction command: dotnet test tests/Orbit.Application.Tests/Orbit.Application.Tests.csproj --filter FullyQualifiedName~GetCalendarMonthQueryHandlerTests. The saved focused logs contain the outcomes but not the original shell invocation, so its exact historical flags cannot be confirmed in this continuation.

Full validation:

  • dotnet build Orbit.slnx: 0 errors, confirmed in /tmp/ticket-903-build.log from the preceding run.
  • env -u LANG dotnet test: 7,065 passed, confirmed by the continuation and /tmp/ticket-903-test-no-lang.log.
  • LC_ALL=en_US.UTF-8 dotnet test: run in this continuation, exit 0; 7,065 passed, 0 failed, 0 skipped.
  • Saved producer/consumer check (/tmp/ticket-903-client-proof.log) reports a met target as 3 logged dates, 3 scheduled dates, 0 missed, and completion ratio 1. A one-log shortfall remains 1 logged date, 7 scheduled dates, 6 missed. The latest ticket decision limits required validation to the API; no client suites are required.

Assumptions

  • Preserve the ticket's fallback of still-due dates plus positive logged dates for flexible windows, rather than changing all flexible windows to logged-only reporting or introducing a per-window response field.

Manual steps

None.

@sonarqubecloud

sonarqubecloud Bot commented Oct 2, 2026

Copy link
Copy Markdown

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes Reviewed the flexible calendar projection fix and its regression tests, including the existing web/mobile consumer's handling of scheduledDates and empty instances.

  • Window-aware projection: Flexible dates use the canonical remaining-target check, while positive logged dates remain in the sorted schedule and unmet windows retain their due dates.
  • Hierarchy consistency: Roots, children, and descendant visibility share the filtered projection, preserving parents needed to expose logged descendants without adding exhausted parent dates.
  • Regression coverage: Exact-date assertions cover weekly/monthly targets at three hierarchy depths, skip-adjusted targets, next-window projection, and Sunday/Monday week starts. Local verification passed all 29 calendar-handler cases and 114 scheduling-service/property cases.

Pullfrog  | View workflow run | Using gpt-6.1-sol | 𝕏

@thomasluizon
thomasluizon merged commit f2e5180 into main Oct 2, 2026
26 checks passed
@thomasluizon
thomasluizon deleted the fix/ticket-903-flexible-calendar-missed branch October 2, 2026 01:31
thomasluizon added a commit that referenced this pull request Oct 2, 2026
* fix(calendar): filter flexible dates by remaining window target (#686)

(cherry picked from commit f2e5180)

* fix: capitalize standalone proactive check-in bodies (#687)

(cherry picked from commit 6c4e92d)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant