Skip to content

refactor(compute-providers): reuse EC2 runner clients - #5301

Merged
edersonbrilhante merged 5 commits into
mainfrom
refactor-ec2-runner-orchestration-boundary
Sep 2, 2026
Merged

edersonbrilhante merged 5 commits into
mainfrom
refactor-ec2-runner-orchestration-boundary

Conversation

@edersonbrilhante

@edersonbrilhante edersonbrilhante commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Description

Depends on #5308.

Introduces an Ec2RunnerClient that owns a reusable EC2 client and exposes request-bound EC2 runner operations through forRequest({ signal }). The control-plane registry creates the client once for the warm Lambda execution environment, and the pool, scale-up, and scale-down capabilities share those operations while keeping cancellation scoped to each request.

The EC2 capability boundary now distinguishes resource operations from provisioning operations, uses consistent capability naming, and removes the legacy default-operation wrappers. Launch-template block-device lookup uses the same bound EC2 client, and runner creation is named separately from runner configuration.

Test Plan

  • Ran Prettier, ESLint, and the control-plane TypeScript type-check.
  • Ran the complete compute-provider suite: 286 tests passed.
  • Ran the complete control-plane suite: 345 tests passed.
  • Added three runner-client tests covering launch-template lookup with the bound client and request signal, rejection of an already-cancelled request before AWS is called, and isolation between cancelled and active requests sharing one client.
  • Updated pool, scale-up, and scale-down tests to exercise the returned capability methods and their dependency wiring.
  • Ran git diff --check.

Related Issues

None.

@edersonbrilhante
edersonbrilhante requested a review from a team as a code owner August 26, 2026 11:22
@github-actions

Copy link
Copy Markdown
Contributor

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@edersonbrilhante
edersonbrilhante force-pushed the refactor-ec2-runner-orchestration-boundary branch from fda6bc5 to 3ee6cad Compare August 27, 2026 10:48
@edersonbrilhante edersonbrilhante changed the title refactor(compute-providers): share EC2 runner operations refactor(compute-providers): reuse EC2 runner clients Aug 27, 2026
@edersonbrilhante
edersonbrilhante changed the base branch from refactor-ec2-provider-isolation to refactor-ec2-runner-operations August 27, 2026 10:49
@edersonbrilhante
edersonbrilhante marked this pull request as draft August 27, 2026 10:51
@edersonbrilhante
edersonbrilhante force-pushed the refactor-ec2-runner-orchestration-boundary branch from 3ee6cad to ce667cf Compare August 27, 2026 11:20
@edersonbrilhante
edersonbrilhante changed the base branch from refactor-ec2-runner-operations to refactor-pool-provider-test-boundary August 27, 2026 11:21
@edersonbrilhante
edersonbrilhante force-pushed the refactor-ec2-runner-orchestration-boundary branch 2 times, most recently from af43f2b to e8f4188 Compare August 27, 2026 11:50
@edersonbrilhante
edersonbrilhante marked this pull request as ready for review August 27, 2026 12:12
@edersonbrilhante
edersonbrilhante marked this pull request as draft August 27, 2026 12:13
@edersonbrilhante
edersonbrilhante changed the base branch from refactor-pool-provider-test-boundary to refactor-control-plane-provider-neutral-tests August 27, 2026 13:13
@edersonbrilhante
edersonbrilhante force-pushed the refactor-ec2-runner-orchestration-boundary branch 15 times, most recently from b390b74 to 6f4e8cf Compare August 27, 2026 18:01
@edersonbrilhante
edersonbrilhante force-pushed the refactor-ec2-runner-orchestration-boundary branch from 1f56d9a to 3d5186e Compare August 27, 2026 21:00
@edersonbrilhante
edersonbrilhante force-pushed the refactor-ec2-runner-orchestration-boundary branch from 3d5186e to 6857f95 Compare August 28, 2026 11:03
Brend-Smits
Brend-Smits previously approved these changes Sep 2, 2026

@Brend-Smits Brend-Smits left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested it locally and all is good, working as expected.

@edersonbrilhante
edersonbrilhante force-pushed the refactor-ec2-runner-orchestration-boundary branch from 6857f95 to ac1bd03 Compare September 2, 2026 15:40
edersonbrilhante added a commit that referenced this pull request Sep 2, 2026
## Description

Moves the shared EC2 runner implementation and types out of the
control-plane directory and exposes them through the EC2 provider
package boundary so multiple orchestration entry points can use the same
runner operations.

Requires callers to provide a `RunnerSource`, preserving the existing
`scale-up-lambda` and `pool-lambda` values. Both EC2 launch paths now
use that caller-provided source for the `ghr:created_by` tag.

PR #5301 is the follow-up and will be stacked on this PR.

## Test Plan

- Ran ESLint for the compute-provider and control-plane projects.
- Ran the Lambda Vitest suite: 50 test files and 819 tests passed.
- Ran `git diff --check` against `refactor-ec2-provider-isolation`.

## Related Issues

None.
@edersonbrilhante
edersonbrilhante force-pushed the refactor-ec2-runner-orchestration-boundary branch from ac1bd03 to 52cb98b Compare September 2, 2026 16:42
@edersonbrilhante
edersonbrilhante force-pushed the refactor-ec2-runner-orchestration-boundary branch from 52cb98b to 9a1d2a7 Compare September 2, 2026 16:46
Base automatically changed from refactor-control-plane-provider-neutral-tests to main September 2, 2026 16:53
@edersonbrilhante
edersonbrilhante force-pushed the refactor-ec2-runner-orchestration-boundary branch from 9a1d2a7 to 09668c8 Compare September 2, 2026 16:53
@edersonbrilhante
edersonbrilhante merged commit 6fe0612 into main Sep 2, 2026
9 checks passed
@edersonbrilhante
edersonbrilhante deleted the refactor-ec2-runner-orchestration-boundary branch September 2, 2026 17:09
edersonbrilhante added a commit that referenced this pull request Sep 2, 2026
## Description

Separates the result returned by shared EC2 runner creation from the
control-plane `CreateRunnerResult` contract.

`createEc2Runner()` and `Ec2RunnerResourceOperations.create()` now
return `Ec2RunnerCreateResult`, containing created instance IDs, the
failed-instance count, and bounded AWS failure identifiers.

The control-plane adapter converts that result into its existing
`CreateRunnerResult` and applies retryable or non-retryable
classification using `scaleErrors`. The core contract and existing pool
and scale-up behavior remain unchanged.

## Test Plan

- Compute-provider suite: 14 files, 295 tests passed.
- Control-plane suite: 14 files, 345 tests passed.
- Control-plane TypeScript type-check passed.
- ESLint and Prettier passed for changed EC2 TypeScript files.
- `git diff --check` and pre-commit checks passed.

## Related Issues

Depends on #5301.
edersonbrilhante added a commit that referenced this pull request Sep 3, 2026
## Description

Clarifies the partial runner creation test name so it explicitly states
that non-retryable failures are not retried, while keeping the
terminology provider-neutral.

This addresses the same review suggestion raised in the stacked PR
discussions for
[#5308](#5308 (comment))
and
[#5301](#5301 (comment)).

## Test Plan

- Ran the focused control-plane scale-up suite: 113 tests passed.
- Ran Prettier for the changed file.
- Ran `git diff --check`.
- Repository pre-commit hooks passed.

## Related Issues

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants