Skip to content

Cache plan preview repository routing - #7088

Open
rootp1 wants to merge 1 commit into
pipe-cd:masterfrom
rootp1:fix/plan-preview-routing-cache
Open

Cache plan preview repository routing#7088
rootp1 wants to merge 1 commit into
pipe-cd:masterfrom
rootp1:fix/plan-preview-routing-cache

Conversation

@rootp1

@rootp1 rootp1 commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • cache plan preview repository-to-piped matches by project, repo remote, and base branch
  • avoid repeated full active-piped scans for repeated requests on the same route
  • add focused tests and a benchmark covering 1, 100, and 10000 pipeds

Linked Issue

Fixes #7087

What Changed

  • added a bounded in-memory TTL cache for RequestPlanPreview routing matches
  • reused cached repository matches before falling back to pipedStore.List
  • added regression tests for cached matches and cached empty results
  • added a benchmark verifying repeated requests stay off the datastore scan path

Verification

  • go test ./pkg/app/server/grpcapi -run 'TestRequestPlanPreview|TestRequireAPIKey' — passed
  • go test -bench BenchmarkRequestPlanPreviewRepositoryRouting -benchmem ./pkg/app/server/grpcapi — passed
  • make build/go — passed
  • make check/gen/code — passed
  • make check — not passed: lint/go uses a pinned golangci-lint image built with Go 1.25, but this repository targets Go 1.26.2, so lint fails before the rest of make check can complete
  • make check/dco — not passed: fails on upstream commit 25ae69937e55e8330bff96c34346718f3e5e7148, which is already contained in upstream/master

Scope

  • only the plan preview routing path and its focused tests were changed; unrelated files were not modified

What this PR does:

Caches repository routing for plan preview requests so repeated requests do not rescan every active piped in the project.

Why we need it:

Plan preview is an interactive path, and repeated requests for the same repository and branch should not require a full active-piped scan each time.

Which issue(s) this PR fixes:

Fixes #7087

Does this PR introduce a user-facing change?:

  • How are users affected by this change: Plan preview routing avoids repeated full scans for the same repository and base branch, reducing control-plane work on repeated requests.
  • Is this breaking change: No
  • How to migrate (if breaking change): Not applicable

Signed-off-by: rootp1 <arnav.iitr@gmail.com>
@rootp1
rootp1 requested a review from a team as a code owner July 24, 2026 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Plan preview request routing scans all active pipeds

1 participant