Skip to content

feat(oabctl): extract ProvisionDriver trait for the write path (K8s driver slice 3a) - #98

Open
brettchien wants to merge 2 commits into
mainfrom
feat/k8s-driver-slice3a-trait-extraction
Open

feat(oabctl): extract ProvisionDriver trait for the write path (K8s driver slice 3a)#98
brettchien wants to merge 2 commits into
mainfrom
feat/k8s-driver-slice3a-trait-extraction

Conversation

@brettchien

Copy link
Copy Markdown
Contributor

Summary

Why route through the trait now, with only one impl?

manifest::Runtime::Kubernetes has sat as a validated-but-rejected schema stub since slice-0 (both here and upstream in openab/operator) — precedent in this codebase for declaring a seam before the second side exists. Same reasoning here, but scoped tighter: EcsDriver is actually wired into studio_api's real call path (not dead code sitting unused), so slice 3b's K8sDriver has a genuine dispatch point to add itself to, instead of a speculative trait nothing calls.

Scope note

This covers the write path only (provision/scale/delete, the exact surface studio-cp depends on — verified via grep oabctl:: crates/studio-cp). Out of scope for 3a, tracked separately in #97:

  • status.rs/studio_api.rs read-model functions (service_status/instance_status) — no driver branching yet, needs a k8s-observe counterpart.
  • create.rs's interactive wizard — AWS-coupled from step 3 (Secrets Manager), before runtime is even chosen at step 4.

Testing

  • cargo build -p oabctl / cargo test -p oabctl (85 tests) / cargo clippy -p oabctl --all-targets — all clean.
  • Could not run the full cargo build --workspace --all-targets CI gate locally — this environment has a hard 21GB disk ceiling and the workspace's aws-sdk dependency tree exceeded it mid-build (No space left on device, not a code error — CI's own comment already documents "aws-sdk-ec2 exceeds small boxes' RAM" as a known constraint). My change is additive-only to oabctl's public API (new pub mod driver + two re-exports; no existing signature changed), so downstream crates (studio-cp, oab-mcp) shouldn't be affected, but flagging this so CI is the one that actually confirms it rather than my say-so.

Ref #97.

…river slice 3a)

studio_api's write path (provision/scale/delete) called ECS-specific code
(apply_manifests, ecsctl::scale_service, delete::run_with_bucket) directly,
with no trait boundary — ADR-2's "RuntimeDriver is the only layer with
vendor terms" only held for state classification, not CRUD. Introduce
ProvisionDriver and an EcsDriver impl that thin-wraps the existing free
functions unchanged, and route studio_api's write path through it.

No behavior change: EcsDriver's methods are pass-throughs, all 85 existing
oabctl tests stay green. This gives K8s driver (slice 3b, studio#97) a real
seam with an actual caller to dispatch through, instead of a speculative
trait with no consumer.

Ref: studio#97 (K8s driver — ADR #63 slice 3, sub-slice tracking)
…ename ecs_service_name

Found while starting K8sDriver (slice 3b): ProvisionDriver::apply took
apply::ApplyOptions directly (an ECS-shaped type — 'cluster' field documented
as "ECS cluster name or ARN"), and scale/delete took `cluster: &str` as a
per-call parameter. Neither generalizes to a k8s driver, which has no
"cluster" — it has a context+namespace bound at driver-construction time,
same as EcsDriver already binds aws_config.

- EcsDriver now holds `cluster` as an instance field alongside aws_config,
  matching how it already holds the AWS credential/region context.
- New ProvisionOptions carries only what's actually generic (bucket, wait);
  apply::ApplyOptions (still ECS-specific, used directly by apply_manifests)
  is unchanged.
- AppliedService.ecs_service_name -> resource_name: the only field crossing
  the trait boundary that still had a vendor-specific name. ServiceTarget
  (ECS-internal error detail, never crosses the trait) keeps its ECS name —
  it's genuinely ECS-only, not a leak.

No behavior change for the ECS path; 85/85 tests green. This was going to
bite immediately on K8sDriver's first method — fixing it now, before #98
merges, is cheaper than a second breaking change to studio_api after.
@brettchien

Copy link
Copy Markdown
Contributor Author

Pushed a follow-up commit: found while starting 3b that ProvisionDriver's signature leaked ECS-specific shapes (ApplyOptions.cluster, per-call cluster: &str, AppliedService.ecs_service_name) — none of which generalize to a k8s driver (context+namespace, not "cluster"). Fixed now while #98 is still open rather than as a second breaking change later. No ECS behavior change, 85/85 tests + clippy clean. See commit message for detail.

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.

1 participant