Skip to content

Fix date scoped habit search through hidden descendants - #648

Merged
thomasluizon merged 1 commit into
mainfrom
fix/ticket-913-search-descendant
Sep 29, 2026
Merged

thomasluizon merged 1 commit into
mainfrom
fix/ticket-913-search-descendant

Conversation

@thomasluizon

Copy link
Copy Markdown
Owner

Closes thomasluizon/orbit-tickets#913

Approach

Search now traverses every incomplete child branch even when the child has no visible occurrence in the requested date range. A child contributes its own search match only when it is relevant on that range. This preserves the existing due and overdue rules while allowing a due grandchild to keep its root in the results.

The change is in src/Orbit.Application/Habits/Queries/HabitScheduleFilters.cs. Regression coverage in tests/Orbit.Application.Tests/Queries/Habits/GetHabitScheduleQueryHandlerTests.cs exercises skipped flexible and unscheduled weekly middle children, excludes their own title matches, checks the due grandchild metadata, and compares the regular schedule response.

Assumptions

  • A middle child with no occurrence remains in the response as a navigation container for its due descendant, with empty scheduled dates. I rejected dropping the container because the existing non-search mapping keeps branches with due descendants.

Test evidence

  • Before edits, env -u LANG LC_ALL=en_US.UTF-8 dotnet test tests/Orbit.Application.Tests/Orbit.Application.Tests.csproj --filter 'FullyQualifiedName~Handle_SearchMatchesDescendantField_PreservesDateAndOverdueGates' --verbosity normal passed both cases with the defect present.
  • After strengthening that test and before changing production code, the same command with --no-restore --verbosity minimal failed both cases because the result omitted the root with a due grandchild beneath a future middle child.
  • After the fix, env -u LANG LC_ALL=en_US.UTF-8 dotnet test tests/Orbit.Application.Tests/Orbit.Application.Tests.csproj --filter 'FullyQualifiedName~Handle_SearchMatchesDescendantField_PreservesDateAndOverdueGates|FullyQualifiedName~Handle_SearchTraversesHiddenMiddleChild|FullyQualifiedName~Handle_SearchMatchesOnlyHiddenMiddleChild' --verbosity minimal passed all 6 cases.
  • env -u LANG LC_ALL=en_US.UTF-8 dotnet build Orbit.slnx --verbosity quiet exited 0 with 0 errors.
  • env -u LANG LC_ALL=en_US.UTF-8 dotnet test --verbosity quiet exited 0 with 6,934 passed and 0 failed.

@sonarqubecloud

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 Search traversal and match attribution for date scoped habit schedules, including the regression tests.

  • Descendant traversal: Incomplete hidden middle children no longer prevent a due grandchild from satisfying the root search.
  • Match metadata: A hidden child's own fields no longer count as matches, while its relevant descendants still appear in ancestor metadata.
  • Regression coverage: Positive and negative cases cover skipped flexible and off-date weekly middle children, plus due and overdue attribution.

Pullfrog  | View workflow run | Using GPT Sol | 𝕏

@thomasluizon
thomasluizon merged commit a624eda into main Sep 29, 2026
26 checks passed
@thomasluizon
thomasluizon deleted the fix/ticket-913-search-descendant branch September 29, 2026 02:08
thomasluizon added a commit that referenced this pull request Sep 29, 2026
thomasluizon added a commit that referenced this pull request Sep 29, 2026
)

* Keep flexible skips hidden on their selected dates (#646)

* Fix flexible skip visibility in schedule query

* fix: retain completed flexible dates with skips

* test: cover loaded-log schedule visibility paths

(cherry picked from commit 8ccf227)

* Fix date scoped search through hidden sub habits (#648)

(cherry picked from commit a624eda)
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