Skip to content

perf(#6179): skip WIF provisioning when provider already exists - #6195

Open
fullsend-ai-coder[bot] wants to merge 2 commits into
mainfrom
agent/6179-skip-inference-provision
Open

perf(#6179): skip WIF provisioning when provider already exists#6195
fullsend-ai-coder[bot] wants to merge 2 commits into
mainfrom
agent/6179-skip-inference-provision

Conversation

@fullsend-ai-coder

Copy link
Copy Markdown
Contributor

Summary

Add a read-before-write guard to RunGitHubSetup so that WIF provider provisioning is skipped when an existing healthy provider is found via inference status. This eliminates redundant IAM write operations (create/undelete/update/enable) on every merge-queue attempt for repos whose WIF providers are already correctly configured.

Related Issue

Changes

  • Added GetExistingInferenceWIFProvider in pkg/behaviourtest/drivers/install/common/setup.go — runs inference status to check for an existing healthy WIF provider before provisioning
  • Modified RunGitHubSetup to try the existing provider lookup first, falling back to ProvisionInference only when the provider is missing or unhealthy
  • Updated TestRepoEnsurer_DoEnsure_WithGCPProject → renamed to _SkipsProvision to verify the read-before-write guard skips provisioning (2 CLI calls instead of 3)
  • Added TestRepoEnsurer_DoEnsure_WithGCPProject_FallsBackToProvision to verify the fallback path when no existing provider is found (4 CLI calls: status-fail, provision, status-ok, setup)

Testing

  • All existing tests pass (go vet, go test)
  • Tests added for both the skip path (provider exists) and fallback path (provider missing)
  • 100% function-level coverage on RunGitHubSetup and GetExistingInferenceWIFProvider
  • Existing error propagation tests (ProvisionInferenceError, StatusCLIError, ParseWIFProviderError) continue to pass — the fallback path preserves their behavior

Closes #6179

Post-script verification

  • Branch is not main/master (agent/6179-skip-inference-provision)
  • Secret scan passed (gitleaks — 0dfd422a67a70dad790965ecd11e132fb421e704..HEAD)
  • PR body secret scan passed (gitleaks — no-git)

@fullsend-ai-coder
fullsend-ai-coder Bot requested a review from a team as a code owner August 13, 2026 17:29
@fullsend-ai-coder fullsend-ai-coder Bot added the ready-for-review Agent PR ready for human review label Aug 13, 2026
@fullsend-ai-review

fullsend-ai-review Bot commented Aug 13, 2026

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 5:31 PM UTC · Completed 5:43 PM UTC

Commit: a3d4840 · View workflow run →

@codecov

codecov Bot commented Aug 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@fullsend-ai-review

fullsend-ai-review Bot commented Aug 13, 2026

Copy link
Copy Markdown

Review

Findings

Low

  • [stale-behavior-description] docs/guides/dev/e2e-testing.md:83 — Documentation states the install driver runs fullsend inference provision unconditionally. The PR added a read-before-write guard that checks inference status first and only provisions when no healthy provider exists. The doc is slightly stale but the overall flow is still accurate for first-use scenarios.
  • [stale-behavior-description] docs/guides/dev/behaviour-testing.md:209 — Documentation states the install driver provisions repo-scoped inference WIF unconditionally before github setup. The code now checks for existing providers first via inference status, only provisioning when needed.
Previous run

Review

Findings

Low

  • [stale-behavior-description] docs/guides/dev/e2e-testing.md:83 — Documentation states the install driver runs fullsend inference provision unconditionally. The PR added a read-before-write guard that checks inference status first and only provisions when no healthy provider exists. The doc is slightly stale but the overall flow is still accurate for first-use scenarios.
  • [stale-behavior-description] docs/guides/dev/behaviour-testing.md:209 — Documentation states the install driver provisions repo-scoped inference WIF unconditionally before github setup. The code now checks for existing providers first via inference status, only provisioning when needed.
Previous run (2)

Review

Findings

Low

  • [stale-behavior-description] docs/guides/dev/e2e-testing.md:83 — Documentation states the install driver runs fullsend inference provision unconditionally. The PR added a read-before-write guard that checks inference status first and only provisions when no healthy provider exists. The doc is slightly stale but the overall flow is still accurate for first-use scenarios.
  • [stale-behavior-description] docs/guides/dev/behaviour-testing.md:209 — Documentation states the install driver provisions repo-scoped inference WIF unconditionally before github setup. The code now checks for existing providers first via inference status, only provisioning when needed.

Labels: PR modifies behaviour test install driver (pkg/behaviourtest/drivers/install/)

fullsend-ai-review[bot]

This comment was marked as outdated.

@fullsend-ai-review fullsend-ai-review Bot added ready-for-merge All reviewers approved — ready to merge component/e2e End-to-end tests component/install CLI install and app setup labels Aug 13, 2026
fullsend-ai-coder Bot and others added 2 commits August 13, 2026 14:25
Add a read-before-write guard in RunGitHubSetup: before calling
ProvisionInference (which walks the full create → conflict →
undelete → update → enable IAM write sequence), first check
whether a healthy WIF provider already exists via "inference
status". When the provider is found and healthy, skip
provisioning entirely and reuse it.

This eliminates redundant IAM write operations on every
merge-queue attempt for repos whose WIF providers are already
correctly configured. The fallback path still provisions when
the provider is missing or unhealthy.

Note: pre-commit could not run (sandbox network policy blocks
git fetch). golangci-lint not available in sandbox. go vet and
all tests passed.

Closes #6179

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The pkg/behaviourtest/drivers/install/common package had no test files
of its own; RunGitHubSetup and GetExistingInferenceWIFProvider were
only exercised indirectly through the install package's tests, which
does not count toward common's own coverage in CI's default
`go test ./...` (no -coverpkg), leaving codecov/patch at 0% for this
PR's changes despite passing tests. Add setup_test.go with direct unit
tests for both functions.

Assisted-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Ralph Bean <rbean@redhat.com>
@ralphbean
ralphbean force-pushed the agent/6179-skip-inference-provision branch from a3d4840 to fcda183 Compare August 13, 2026 18:31
@fullsend-ai-review

fullsend-ai-review Bot commented Aug 13, 2026

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 6:33 PM UTC · Completed 6:46 PM UTC

Commit: fcda183 · View workflow run →

fullsend-ai-review[bot]

This comment was marked as outdated.

@ralphbean

Copy link
Copy Markdown
Member

/fs-review

@fullsend-ai-review

fullsend-ai-review Bot commented Aug 14, 2026

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 1:47 PM UTC · Completed 1:59 PM UTC

Commit: fcda183 · View workflow run →

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

Labels

component/e2e End-to-end tests component/install CLI install and app setup ready-for-merge All reviewers approved — ready to merge ready-for-review Agent PR ready for human review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reuse WIF providers across merge-queue attempts instead of recreating on every run

1 participant