refactor(#175): extract shared workflow-polling utility#217
refactor(#175): extract shared workflow-polling utility#217fullsend-ai-coder[bot] wants to merge 1 commit into
Conversation
Extract duplicated workflow-polling logic from admin.go (awaitRepoMaintenanceWithInterval) and enrollment.go (awaitWorkflowRun) into a shared AwaitWorkflowCompletion function in a new workflowpoll.go file under internal/layers/. The shared utility accepts a PollConfig struct with InitialInterval, MaxInterval, and Timeout fields, enabling exponential backoff (2s initial, 15s cap, 3-minute timeout by default). Both call sites now delegate to AwaitWorkflowCompletion, eliminating the duplicated polling loop. The admin.go path adopts exponential backoff in production while preserving the test helper signature for existing tests. An optional ProgressFunc callback replaces the direct printer coupling, allowing callers to relay status messages to their own UI layer. New tests in workflowpoll_test.go cover: successful completion, timeout, context cancellation, progress callbacks, filtering of old runs, and the backoff interval doubling logic. Note: make lint could not run in the sandbox due to shellcheck-py failing to download (403 Forbidden network restriction). go vet passed. The post-script runs an authoritative pre-commit check on the runner. Closes #175
E2E tests did not runE2E tests run automatically for org/repo members and collaborators on pull requests. For other contributors, a maintainer must add the See E2E testing guide for details. |
Review — #217 refactor(#175): extract shared workflow-polling utilityVerdict: approve SummaryClean refactoring that extracts duplicated workflow-polling logic from What was verifiedIssue #175 validation criteria:
Correctness:
Security: No concerns — pure internal refactoring with no new external inputs. Architecture: Correctly places the shared utility in Low-severity notes
Previous runReviewVerdict: Approve Clean refactoring that extracts duplicated workflow-polling logic into a shared FindingsAll findings are low severity and non-blocking. 1. Undocumented The 2. Exponential backoff applies unconditionally during in-progress waiting (
3. No validation that Timeout > InitialInterval ( If a caller constructs a 4. Parameter In Labels: PR refactors internal Go code to extract shared utility, matching enhancement label from linked issue. |
|
/fs-review |
Extract duplicated workflow-polling logic from admin.go (awaitRepoMaintenanceWithInterval) and enrollment.go (awaitWorkflowRun) into a shared AwaitWorkflowCompletion function in a new workflowpoll.go file under internal/layers/.
The shared utility accepts a PollConfig struct with InitialInterval, MaxInterval, and Timeout fields, enabling exponential backoff (2s initial, 15s cap, 3-minute timeout by default). Both call sites now delegate to AwaitWorkflowCompletion, eliminating the duplicated polling loop. The admin.go path adopts exponential backoff in production while preserving the test helper signature for existing tests.
An optional ProgressFunc callback replaces the direct printer coupling, allowing callers to relay status messages to their own UI layer.
New tests in workflowpoll_test.go cover: successful completion, timeout, context cancellation, progress callbacks, filtering of old runs, and the backoff interval doubling logic.
Note: make lint could not run in the sandbox due to shellcheck-py failing to download (403 Forbidden network restriction). go vet passed. The post-script runs an authoritative pre-commit check on the runner.
Closes #175
Post-script verification
agent/175-extract-workflow-poll)f96750babbed5ada406a9ae04e8068449701d9c7..HEAD)