Skip to content

fix: paginate ListNotCompletedDeployments in pipedv1#6727

Open
sridhar-panigrahi wants to merge 3 commits intopipe-cd:masterfrom
sridhar-panigrahi:fix/pipedv1-list-not-completed-deployments-pagination
Open

fix: paginate ListNotCompletedDeployments in pipedv1#6727
sridhar-panigrahi wants to merge 3 commits intopipe-cd:masterfrom
sridhar-panigrahi:fix/pipedv1-list-not-completed-deployments-pagination

Conversation

@sridhar-panigrahi
Copy link
Copy Markdown

@sridhar-panigrahi sridhar-panigrahi commented Apr 28, 2026

What this PR does:

Makes piped actually paginate when it calls ListNotCompletedDeployments. The pipedv1 deployment store now loops through all pages using the cursor the server returns, instead of taking only the first page and throwing the cursor away.

Why we need it:

Right now piped calls ListNotCompletedDeployments once per sync tick and ignores the cursor on the response. If the datastore returns a partial page, anything past that boundary just gets dropped on the floor — those deployments look stuck in PENDING or PLANNED until the overall volume drops enough to fit in a single page. I hit this while reading through the store code and traced it back to #6696.

Which issue(s) this PR fixes:

Fixes #6696

Does this PR introduce a user-facing change?:

  • How are users affected by this change: Deployments stop being silently skipped when the not-completed list spans more than one page. Anyone running pipedv1 under heavier load should see every pending/planned/running deployment picked up each sync tick.
  • Is this breaking change: No
  • How to migrate (if breaking change): N/A

A bit more detail on the changes

  • service.proto — added page_size (int32) and cursor (string) to ListNotCompletedDeploymentsRequest. Regenerated stubs with make gen/code.
  • pkg/app/server/grpcapi/piped_api.go — forwards req.PageSizeopts.Limit and req.Cursoropts.Cursor so the server respects the client's position.
  • pkg/app/pipedv1/apistore/deploymentstore/store.go — swaps the single RPC for a loop that feeds each response's cursor back into the next request, until the server returns an empty one. All pages get accumulated before classifying into pending/planned/running.
  • pkg/app/pipedv1/apistore/deploymentstore/store_test.go (new) — table-driven tests covering empty, single-page, and multi-page responses, plus the status classification paths, using a fake API client.

v0 store is left alone since it's frozen.

Signed-off-by: Shridhar Panigrahi sridharpanigrahi2006@gmail.com

@sridhar-panigrahi
Copy link
Copy Markdown
Author

sridhar-panigrahi commented Apr 28, 2026

@khanhtc1202 updated the patch at #6727 — went with the proto approach as originally proposed. Added cursor and page_size to the request, forwarded them server-side, and the pipedv1 store now loops until it gets an empty cursor. v0 store untouched. Let me know if anything needs changing!

piped was calling ListNotCompletedDeployments once per sync tick and
throwing away the cursor on the response. If the datastore returned a
partial page, every deployment past the first page would be silently
skipped until the next tick — showing up as stuck PENDING or PLANNED.

Fix:
- Add cursor and page_size to ListNotCompletedDeploymentsRequest proto
- Forward them in PipedAPI.ListNotCompletedDeployments into the
  datastore ListOptions so the server honours the client's position
- Replace the single RPC call in the pipedv1 deployment store with a
  loop that follows the cursor until the server returns an empty one,
  accumulating all deployments before classifying them
- Add table-driven tests for the v1 store covering single-page,
  multi-page, and all deployment status classifications

v0 store is intentionally untouched (frozen).

Fixes pipe-cd#6696

Signed-off-by: Shridhar Panigrahi <sridharpanigrahi2006@gmail.com>
@sridhar-panigrahi sridhar-panigrahi force-pushed the fix/pipedv1-list-not-completed-deployments-pagination branch from 0dc66c0 to fb7eff4 Compare April 28, 2026 06:48
@sridhar-panigrahi sridhar-panigrahi changed the title fix: make ListNotCompletedDeployments fetch all pages fix: paginate ListNotCompletedDeployments in pipedv1 Apr 28, 2026
@mohammedfirdouss
Copy link
Copy Markdown
Contributor

mohammedfirdouss commented Apr 30, 2026

@sridhar-panigrahi please follow the PR template used for pipecd. It is hard to tell why this PR/Change is needed. Look at previous PRs for any idea.
Example: #6724

@sridhar-panigrahi
Copy link
Copy Markdown
Author

@mohammedfirdouss thanks for the nudge — you're right, the original description didn't make the motivation clear. I've rewritten it to follow the PR template (using #6724 as the reference). Let me know if it reads better now.

@mohammedfirdouss
Copy link
Copy Markdown
Contributor

@mohammedfirdouss thanks for the nudge — you're right, the original description didn't make the motivation clear. I've rewritten it to follow the PR template (using #6724 as the reference). Let me know if it reads better now.

@sridhar-panigrahi This is good, but try and remove the extra details beneath the template "A bit more detail on the changes"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: piped's ListNotCompletedDeployments call ignores pagination and can miss deployments

2 participants