Repository navigation
#478 (2): checkpoint time window and latest-first on flows (audit consumption pattern) - #489
Merged
lsulak merged 10 commits intoOct 16, 2026
Conversation
lsulak
force-pushed
the
feature/adr02-audit-time-window
branch
2 times, most recently
from
October 9, 2026 16:45
fce14fa to
8305398
Compare
lsulak
marked this pull request as ready for review
October 9, 2026 16:53
lsulak
requested review from
ABLL526,
MatloaItumeleng,
Zejnilovic,
benedeki,
dk1844 and
salamonpavel
as code owners
October 9, 2026 16:53
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The synchronous reader can overflow the JVM stack across many pages, and key database behavior lacks effective integration coverage.
6 open findings
Paging recursion overflows the stack with synchronous effects · New Test bypasses flow filtering and window behavior · New Test bypasses partition time filtering and ordering · New Endpoint response granularity does not match documented page items · New Worked example uses incorrect checkpoint response fields · New Ancestor function cannot reconstruct exact parent-child edges · New
What changed in this PR
Adds audit-oriented checkpoint time-window filtering, flow ordering, and all-page reader retrieval.
Changes:
- Adds
from,to, and flowlatest-firstquery support across server layers. - Extends readers with filtering and
getAllCheckpoints. - Adds a supporting database index, tests, and ADR 02.
| File | Description |
|---|---|
server/src/test/.../CheckpointItemWithPartitioningFromDBUnitTests.scala |
Tests preservation of database order. |
server/src/test/.../service/FlowServiceUnitTests.scala |
Updates flow service mocks. |
server/src/test/.../service/CheckpointServiceUnitTests.scala |
Updates checkpoint service mocks. |
server/src/test/.../repository/FlowRepositoryUnitTests.scala |
Updates flow repository tests. |
server/src/test/.../repository/CheckpointRepositoryUnitTests.scala |
Updates checkpoint repository tests. |
server/src/test/.../http/GetPartitioningCheckpointsEndpointUnitTests.scala |
Tests partitioning time-window requests. |
server/src/test/.../http/GetFlowCheckpointsEndpointUnitTests.scala |
Tests flow windows and ordering. |
server/src/test/.../controller/FlowControllerUnitTests.scala |
Updates flow controller calls. |
server/src/test/.../controller/CheckpointControllerUnitTests.scala |
Updates checkpoint controller mocks. |
server/src/test/.../runs/functions/GetPartitioningCheckpointsIntegrationTests.scala |
Adds partitioning window binding coverage. |
server/src/test/.../flows/functions/GetFlowCheckpointsIntegrationTests.scala |
Adds flow filter binding coverage. |
server/src/main/.../CheckpointItemWithPartitioningFromDB.scala |
Preserves database checkpoint ordering. |
server/src/main/.../service/FlowServiceImpl.scala |
Forwards flow filters. |
server/src/main/.../service/FlowService.scala |
Extends flow service API. |
server/src/main/.../service/CheckpointServiceImpl.scala |
Forwards partitioning windows. |
server/src/main/.../service/CheckpointService.scala |
Extends checkpoint service API. |
server/src/main/.../repository/FlowRepositoryImpl.scala |
Binds flow query arguments. |
server/src/main/.../repository/FlowRepository.scala |
Extends flow repository API. |
server/src/main/.../repository/CheckpointRepositoryImpl.scala |
Binds partitioning windows. |
server/src/main/.../repository/CheckpointRepository.scala |
Extends checkpoint repository API. |
server/src/main/.../http/Endpoints.scala |
Defines and validates query parameters. |
server/src/main/.../controller/FlowControllerImpl.scala |
Forwards flow endpoint filters. |
server/src/main/.../controller/FlowController.scala |
Extends flow controller API. |
server/src/main/.../controller/CheckpointControllerImpl.scala |
Forwards partitioning windows. |
server/src/main/.../controller/CheckpointController.scala |
Extends checkpoint controller API. |
server/src/main/.../runs/functions/GetPartitioningCheckpoints.scala |
Binds database window arguments. |
server/src/main/.../flows/functions/GetFlowCheckpoints.scala |
Binds flow ordering and windows. |
reader/src/test/.../requests/CheckpointFilterUnitTests.scala |
Tests filter serialization. |
reader/src/test/.../PartitioningReaderUnitTests.scala |
Tests partitioning paging and filters. |
reader/src/test/.../FlowReaderUnitTests.scala |
Tests flow paging and filters. |
reader/src/main/.../requests/QueryParamNames.scala |
Adds new query parameter names. |
reader/src/main/.../requests/CheckpointFilter.scala |
Adds time and ordering filters. |
reader/src/main/.../PartitioningReader.scala |
Adds all-page checkpoint retrieval. |
reader/src/main/.../FlowReader.scala |
Adds all-page flow retrieval. |
reader/src/main/.../core/Reader.scala |
Implements page accumulation. |
database/src/main/postgres/runs/V0.8.0.4__checkpoints_partitioning_start_time_index.ddl |
Adds the supporting composite index. |
adrs/02-consumption-pattern-for-audits.md |
Documents the audit consumption design. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
lsulak
force-pushed
the
feature/adr02-audit-time-window
branch
from
October 9, 2026 17:12
8305398 to
248695b
Compare
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The filtering, ordering, paging, migration, and boundary behavior are consistently implemented and adequately tested.
0 open findings
6 resolved since last review
Paging recursion overflows the stack with synchronous effects Test bypasses partition time filtering and ordering Test bypasses flow filtering and window behavior Ancestor function cannot reconstruct exact parent-child edges Worked example uses incorrect checkpoint response fields Endpoint response granularity does not match documented page items
🧠 Review effort: Balanced
lsulak
force-pushed
the
feature/adr02-audit-time-window
branch
from
October 9, 2026 18:48
2a8052d to
1e9fbf9
Compare
…and latest-first on flows Builds on the #478 reader capability work and exposes what ADR 02 section 4 needs for audits: - server: optional `from` / `to` (half-open window on process_start_time, from < to validated) on GET /partitionings/{id}/checkpoints and GET /flows/{id}/checkpoints, and `latest-first` on the flows endpoint; wired through controllers, services, repositories and DB function wrappers - server: flow checkpoints keep the DB order instead of re-sorting by start time, so latest-first=false works - reader: CheckpointFilter.from / to / latestFirst, getAllCheckpoints on FlowReader and PartitioningReader (Reader.queryAllPages), new query parameter names - db: V0.8.0.4 composite index runs.checkpoints (fk_partitioning, process_start_time) for the time window - ADR 02 - consumption pattern for audits The DB function signatures (i_from_time / i_to_time) already landed with #478, so no function is re-created here. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
queryAllPages recursed through flatMap, which for strict effects (e.g. Identity) runs the continuation right away, adding stack frames per page. The continuation now hands the collected records over to a tail-recursive loop when it runs synchronously, and recurses within the effect otherwise (asynchronous or lazy effects), the hand-over being atomic. ADR 02: a flow checkpoints page item is one checkpoint with its measurements nested (processStartTime, measurements, partitioning), and parent -> child edges cannot be reconstructed today (Bet 3). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
lsulak
force-pushed
the
feature/adr02-audit-time-window
branch
from
October 9, 2026 18:50
1e9fbf9 to
03ac8f3
Compare
…2-audit-time-window
Move LIMIT/OFFSET inside the counted subquery so nonzero offsets cannot discard the aggregate row and return NULL for has_more. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Clarify requirements for Reader features and server compatibility. Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
salamonpavel
approved these changes
Oct 16, 2026
salamonpavel
left a comment
Collaborator
There was a problem hiding this comment.
LGTM (read the code)
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.



Overview
Adding a server-side process start time window and
latest-firston flows.JFYI this is Stacked on #488. The base is
feature/478-better-reader-capability; retarget tomasteronce #488 is merged.Release Notes
from(inclusive) andto(exclusive) query parameterslatest-firstquery parameter supported by the flow checkpoints endpointCheckpointFiltersupportsfrom,toandlatestFirstruns.checkpoints (fk_partitioning, process_start_time)Related
Follow-up of #478 / #488