Repository navigation
fix(api): correct GetManyClients paging (#51) - #86
Merged
Merged
Conversation
|
View your CI Pipeline Execution ↗ for commit 80be9eb
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗ ☁️ Nx Cloud last updated this comment at |
brinehart
commented
Nov 2, 2026
brinehart
left a comment
Collaborator
Author
There was a problem hiding this comment.
Reviewed against .kiro/specs/must-fix-51/spec.md. All acceptance points met.
Paging logic (ClientsGrpcService.cs)
pageis a 1-based page number, default 1. ✅skipreused as page size, defaultDefaultPageSize = 10. ✅offset = (page - 1) * pageSize, fed to.Skip(skip);.Take(pageSize). ✅NextUrlrebuilt from the samepage/pageSizevars (page={page+1}&skip={pageSize}), consistent with the window. ✅hasMore = skip + clients.Count < totalcorrectly suppressesNextUrlon the last page (replaces the old no-opanyMoreClientsguard). ✅Totalset on every response, not only when a next page exists. ✅
Proto (client.proto) — comment-only edits to page/skip docs; no field added, removed, or renumbered. No schema break. ✅
Tests (ClientsGrpcServiceTests.cs, 25 seeded clients)
- Page 1 → first 10 by name,
Total=25,NextUrlhaspage=2/skip=10. ✅ - Page 2 → clients 11–20, asserted disjoint from page 1. ✅ (proves non-overlapping)
- Last page (3) → 21–25, no
NextUrl. ✅ - Defaults (
Page=0,Skip=0) behave as page 1 size 10. ✅ Totalset on every response. ✅
Scope — the searchTerm $"%{request}%" bug (#50) is left untouched in the method; the diff does not modify those lines. ✅
CI — gh pr checks 86: dotnet pass, main pass. ✅
No change requests.
Collaborator
Author
Treat request.Page as a 1-based page number (default 1) and reuse request.Skip as the page size (default 10). Compute the offset as (page - 1) * pageSize so consecutive pages no longer overlap, and build NextUrl from the same page/pageSize variables. Set Total on every response and emit NextUrl only when more rows exist beyond the window. Update the client.proto comments for page/skip to match the new meaning (comment-only, no schema or field-number change). Add ClientsGrpcServiceTests covering page 1, a non-overlapping page 2, the last page without NextUrl, default paging, and Total on every response. Alias the transitive MicroZen.OAuth2 reference in the test project so the duplicated MicroZen.Grpc.V1 proto types resolve to MicroZen.Api. Scope: paging only; the searchTerm filter (#50) is untouched. Closes #51
brinehart
force-pushed
the
fix/must-fix-51
branch
from
November 2, 2026 03:47
b019880 to
80be9eb
Compare
brinehart
added a commit
that referenced
this pull request
Nov 2, 2026
Treat request.Page as a 1-based page number (default 1) and reuse request.Skip as the page size (default 10). Compute the offset as (page - 1) * pageSize so consecutive pages no longer overlap, and build NextUrl from the same page/pageSize variables. Set Total on every response and emit NextUrl only when more rows exist beyond the window. Update the client.proto comments for page/skip to match the new meaning (comment-only, no schema or field-number change). Add ClientsGrpcServiceTests covering page 1, a non-overlapping page 2, the last page without NextUrl, default paging, and Total on every response. Alias the transitive MicroZen.OAuth2 reference in the test project so the duplicated MicroZen.Grpc.V1 proto types resolve to MicroZen.Api. Scope: paging only; the searchTerm filter (#50) is untouched. Closes #51 Co-authored-by: brinehart <ben.rinehart@avifoodsystems.comc>
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 #51
What
Fixes paging in
GetManyClients(ClientsGrpcService.cs) per.kiro/specs/must-fix-51/spec.md.request.Pageis now a 1-based page number (default 1).request.Skipis reused as the page size (defaultDefaultPageSize = 10).(page - 1) * pageSize, so consecutive pages no longer overlap.NextUrlis built from the samepage/pageSizevariables (page={page+1}&skip={pageSize}).Totalis set on every response;NextUrlis emitted only when more rows exist beyond the window.Proto
Comment-only edit to the
page/skipfield docs inclient.prototo match the new meaning. No field added, removed, or renumbered — no schema change, no client regen forced.Tests
New
MicroZen.Api.Test/Services/ClientsGrpcServiceTests.cs(EF Core InMemory), seeding 25 clients:Total=25;NextUrlhaspage=2,skip=10.NextUrlhaspage=3.NextUrl.Page=0, Skip=0) behave as page 1, size 10.Totalis set on every response.The test project aliases the transitive
MicroZen.OAuth2reference so the duplicatedMicroZen.Grpc.V1proto types resolve unambiguously toMicroZen.Api.Scope / notes
searchTermfilter bug is Client search filters on the whole request object, not the search term #50 and is untouched here.skip(now page size) is a wire-contract change, but the old behaviour produced overlapping windows, so there is no correct caller to preserve.Verification (from the worktree)
npx nx affected -t lint test build— green (16/16 tests).dotnet test core/csharp/MicroZen.Core.sln— green (16/16).npx nx format:checkpasses for all files in this change; the only flags are pre-existing tracked spec.mdfiles and untracked local.nx/data, both outside GetManyClients paging defaults are wrong and NextUrl double-counts #51's scope.