Skip to content

Push GetRoots limit/offset pagination into SurrealStore::get_children - #1175

Merged
malibio merged 1 commit into
mainfrom
issue-1167-push-pagination-into-surreal-store
May 19, 2026
Merged

malibio merged 1 commit into
mainfrom
issue-1167-push-pagination-into-surreal-store

Conversation

@malibio

@malibio malibio commented May 19, 2026

Copy link
Copy Markdown
Collaborator

Closes #1167

- Split SurrealStore::get_children(Option<&str>) into get_children(&str)
  and get_roots(limit, offset) — removes silent discard of limit/offset
  on the non-root path and makes the separation explicit
- Add ORDER BY id ASC to all root query variants for stable pagination
- Remove in-memory skip/truncate from daemon GetRoots handler
- Add three store-level tests: no pagination, limit only, limit+offset
  non-overlapping pages
- Update GetRootsRequest proto comment to reflect store-level pagination
- Declare testing feature in desktop-app Cargo.toml and add matching
  #[cfg] guard in local_agent.rs AgentSession initializer
- Fix missing success field in capture_service.rs test helper

Co-Authored-By: Claude <[email protected]>
@malibio

malibio commented May 19, 2026

Copy link
Copy Markdown
Collaborator Author

Review Findings — Addressed

All recommendations from the initial code review have been implemented in commit ecc0af00.

✅ Addressed (4/4)

🟡 ORDER BY id ASC on paginated root query — Added to all four SQL variants in SurrealStore::get_roots. Without a deterministic sort, LIMIT/START AT produces overlapping or skipped pages across calls.

🟡 Split get_children/get_roots at store layer — SurrealStore::get_children(Option<&str>, ...) replaced with two distinct methods: get_children(&str) and get_roots(limit, offset). The overloaded dual-purpose signature no longer exists; limit/offset can no longer be silently ignored on the non-root path.

🟡 Pagination tests — Three new store-level integration tests added:

  • test_get_roots_no_pagination — child nodes excluded from roots
  • test_get_roots_limit — DB-level LIMIT applied
  • test_get_roots_limit_offset_non_overlapping — page1 ∪ page2 = full set, no overlap

🟢 Proto comment updated — GetRootsRequest comment now reflects that pagination is pushed into SurrealDB, not applied in application memory. "tracked in #1167" forward reference removed.

Also fixed (compilation regressions from main)

⏭️ Skipped: 0

@malibio
malibio merged commit 5e45bd0 into main May 19, 2026
@malibio
malibio deleted the issue-1167-push-pagination-into-surreal-store branch May 19, 2026 00:09
malibio added a commit that referenced this pull request Jun 22, 2026
#1175)

- Split SurrealStore::get_children(Option<&str>) into get_children(&str)
  and get_roots(limit, offset) — removes silent discard of limit/offset
  on the non-root path and makes the separation explicit
- Add ORDER BY id ASC to all root query variants for stable pagination
- Remove in-memory skip/truncate from daemon GetRoots handler
- Add three store-level tests: no pagination, limit only, limit+offset
  non-overlapping pages
- Update GetRootsRequest proto comment to reflect store-level pagination
- Declare testing feature in desktop-app Cargo.toml and add matching
  #[cfg] guard in local_agent.rs AgentSession initializer
- Fix missing success field in capture_service.rs test helper

Co-authored-by: Michael Libio <[email protected]>
Co-authored-by: Claude <[email protected]>
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.

Push GetRoots limit/offset pagination into SurrealStore::get_children

1 participant