Repository navigation
Reduce Today schedule candidate reads for #790 - #615
Merged
Merged
Conversation
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes Candidate projection, schedule filtering and page hydration for dated and undated Today responses, plus query and relational tests.
- Candidate reads: Non-general habits now load schedule fields, title and position, adding description and tags only when filters require them.
- Page hydration: Selected roots and descendants load complete habit rows and page relations before response mapping; the response DTO remains unchanged.
- Coverage: Updated handler and widget substitutes exercise the projected read, while SQLite tests inspect column selection, page scope, and description and tag search.
GPT Sol | 𝕏
|
thomasluizon
added a commit
that referenced
this pull request
Sep 27, 2026
* Reduce Today schedule candidate reads for #790 (#615) * fix: project Today schedule candidates before page hydration * test: adapt widget schedule parity setup to candidate projection * test: report emitted Today candidate SQL (cherry picked from commit a2312d6) * Fix Today schedule candidate consistency (#617) (cherry picked from commit 392b224)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




Closes thomasluizon/orbit-tickets#790
Change
GetHabitScheduleQuery.csnow projects schedule candidates throughHabitScheduleCandidate.cs, using the schedule fields plus title and position. Description and tags join the candidate read only when search or tag filtering needs them. After filtering and paging, the handler fetches completeHabitrows for the selected roots and descendants, then uses the existing page loader for logs, tags, and goals.Habit.csmaterializes the candidate fields for the existing schedule rules. The schedule handler and widget parity test mocks now exercise the projected read.HabitScheduleReadShapeTests.cschecks the SQL column list, page-only full-row loading, and search by description and tag.This keeps both date and non-date response paths on the same candidate and page hydration flow. The response contract is unchanged.
Candidate read evidence
Before, the ticket's production sample recorded 41,071 rows across 60 calls, or 684.5 rows per call. The mean full-row width was 354 bytes using
pg_column_size(h.*), giving 242,319 bytes per call for the candidate read.After, the SQLite relational test emitted this candidate SQL for a request without search or tag filters:
The candidate row count remains one per owned non-general habit, so the same production workload would read 684.5 candidate rows per call. Production access was prohibited for this worker, so the new
pg_column_sizewidth is not measured. A column-list estimate removes the 83-byte average Description from the 354-byte full-row width and leaves the other omitted columns uncredited. That gives an upper estimate of 271 bytes per candidate row and 185,504 bytes per call. The actual width needs measurement on a deployed query before it can be stated as a production result. The test observed two candidate rows and a full-row fetch limited to the one page item.Measured width (orchestrator, read-only on production, 2026-09-27): over the live non-general habits, the average
pg_column_size(row(...))of the 19 candidate columns above is 167 bytes, against 348 bytes for the full row over the same rows. At the recorded 684.5 candidate rows per call that is about 114 KB per call instead of about 238 KB, plus full rows for the page items only. The deployed rows per call are recorded on the ticket after merge.Test evidence
TodayPage_MaterializesOnlyPageLogsWithinTheResponseWindowpassed with the defect present at baseline commit43d847ec:env -u LANG dotnet test tests/Orbit.Infrastructure.Tests --filter FullyQualifiedName~TodayPage_MaterializesOnlyPageLogsWithinTheResponseWindow --logger 'console;verbosity=normal'returned exit 0, one test passed.TodayCandidates_ReadOnlyFilterColumns_AndPageRetainsDisplayFieldsfailed against the same baseline with its test file copied into a detached worktree:env -u LANG dotnet test tests/Orbit.Infrastructure.Tests --filter FullyQualifiedName~TodayCandidates_ReadOnlyFilterColumns_AndPageRetainsDisplayFields --logger 'console;verbosity=normal'returned exit 1 because candidate SQL containedDescriptionandChecklistItems.GetHabitScheduleQueryHandlerTestspassed 81 tests andHabitScheduleReadShapeTestspassed 5 tests.env -u LANG dotnet build Orbit.slnxcompleted with 0 errors.env -u LANG dotnet testpassed all 6,755 tests across Domain, Analyzers, Application, and Infrastructure.Assumptions