fix(aws): harden CloudFormation BYOC releases - #179
Conversation
Greptile SummaryThis PR hardens the AWS BYOC release path across several independently validated dimensions. CloudFormation emitters now emit valid NextGen OpenSearch Serverless collection groups with optional OCU capacity limits and valid S3 CORS rules. Storage bindings switch from
Confidence Score: 5/5Safe to merge; all five hardening paths are independently validated with real AWS deployments and focused unit tests. Changes are well-scoped: CloudFormation template generation is purely additive, the storage path fix is a targeted single-call swap, OTLP deferral is guarded by an env-var check, and the Lambda pre-start sequence correctly orders registration before secret loading. The executor parallelism is safe because HeartbeatCollector uses Arc and all parallel tasks read from the same immutable state snapshot. The only inconsistency found — setup_teardown.rs yielding on a zero-delay step where runner.rs would not — is a cosmetic edge case that does not affect correctness in practice. Files Needing Attention: crates/alien-deployment/src/setup_teardown.rs — minor inconsistency in the zero-delay yield guard compared to runner.rs
|
| Filename | Overview |
|---|---|
| crates/alien-cloudformation/src/emitters/aws/storage.rs | Adds S3 CorsConfiguration block (GET/HEAD, AllowedHeaders *, ETag exposed, 3600 MaxAge) when cors_allowed_origins is non-empty; guarded by an emptiness check so existing buckets are unaffected. |
| crates/alien-cloudformation/src/emitters/aws/open_search.rs | Emits Generation: NEXTGEN on collection groups and conditionally inserts CapacityLimits; calls validate_capacity() before template generation to catch invalid OCU values early. |
| crates/alien-bindings-node/src/storage.rs | Replaces Path::from() with Path::parse() for all storage operations so reserved characters in object keys are encoded exactly once rather than double-encoded when signing. |
| crates/alien-worker-runtime/src/otlp.rs | Defers OTLP bootstrap when ENV_ALIEN_RUNTIME_SECRETS is present so an unauthenticated tracing bridge is not installed before vault-backed credentials are resolved. |
| crates/alien-worker-runtime/src/runtime.rs | Pre-starts the Lambda transport before secret loading to satisfy AWS's 10-second Init window; cleanly shuts it down if application startup fails. |
| crates/alien-deployment/src/runner.rs | Replaces delay_threshold with DelayStrategy enum; adds a concurrent lease-renewal loop and correctly propagates non-retryable checkpoint errors immediately without further retries. |
| crates/alien-deployment/src/setup_teardown.rs | Adopts DelayStrategy::Yield in place of delay_threshold but omits the !delay.is_zero() guard present in runner.rs, so a zero suggested_delay_ms would cause an unnecessary yield. |
| crates/alien-infra/src/core/executor.rs | Converts sequential resource stepping to parallel (up to 4 concurrent via buffer_unordered); HeartbeatCollector is Arc-based so cloning correctly shares state across tasks. Adds RunningResourcePolicy enum. |
| crates/alien-cli/src/commands/release.rs | Push cache now validates that a cached URI belongs to the resolved destination repository before applying it, preventing cross-manager/project cache cross-contamination. |
| crates/alien-manager/src/routes/sync.rs | New /v1/sync/renew endpoint renews a deployment lease without writing state; auth, ownership, and authz are all verified before the store call. |
Sequence Diagram
sequenceDiagram
participant CLI as alien-cli
participant Mgr as Manager API
participant Runner as DeploymentRunner
participant Executor as StackExecutor
CLI->>Mgr: POST /v1/sync/acquire (session)
Mgr-->>CLI: deployment_id + state
loop Step loop (max 200)
Runner->>Executor: step(state, config)
Executor->>Executor: buffer_unordered(4) – step ready resources
Executor-->>Runner: suggested_delay_ms, heartbeats
Runner->>Mgr: POST /v1/sync/reconcile (checkpoint)
alt non-retryable rejection
Mgr-->>Runner: 4xx (non-retryable)
Runner-->>CLI: Err(DEPLOYMENT_CHECKPOINT_FAILED)
else delay and Yield strategy
Runner-->>CLI: Ok(Delayed) – yield to scheduler
end
end
par Lease renewal (every 60s)
Runner->>Mgr: POST /v1/sync/renew (session)
Mgr-->>Runner: 200 OK
end
Runner-->>CLI: Ok(Synced / Failed)
CLI->>Mgr: POST /v1/sync/release
Reviews (9): Last reviewed commit: "test(helm): update worker memory snapsho..." | Re-trigger Greptile
| export const StorageSchema = z.object({ | ||
| "id": z.string().describe("Name of the the storage bucket.\nFor names with dots, each dot-separated label must be ≤ 63 characters."), | ||
| "corsAllowedOrigins": z.optional(z.array(z.string()).describe("Browser origins allowed to read objects through signed URLs.\n\nWhen non-empty, providers configure CORS for `GET` and `HEAD` requests.\nAn origin of `*` is appropriate for private buckets whose signed URLs\nare bearer credentials and do not use browser cookies.\nDefault: `[]` (CORS disabled).")), | ||
| "id": z.string().describe("Name of the the storage bucket.\nFor names with dots, each dot-separated label must be ≤ 63 characters."), |
There was a problem hiding this comment.
Generated file drops indentation for
id field
The newly added corsAllowedOrigins property is indented (4 spaces) but "id" and the remaining pre-existing properties ("publicRead", "versioning") have zero indentation. This is a generator artifact: the tool appears to emit consistent indentation only for the first alphabetical property. TypeScript and Zod parse the file correctly, so this has no runtime impact, but it points to an inconsistency in the code generator that may resurface as the schema grows.
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/core/src/generated/zod/storage-schema.ts
Line: 14
Comment:
**Generated file drops indentation for `id` field**
The newly added `corsAllowedOrigins` property is indented (4 spaces) but `"id"` and the remaining pre-existing properties (`"publicRead"`, `"versioning"`) have zero indentation. This is a generator artifact: the tool appears to emit consistent indentation only for the first alphabetical property. TypeScript and Zod parse the file correctly, so this has no runtime impact, but it points to an inconsistency in the code generator that may resurface as the schema grows.
How can I resolve this? If you propose a fix, please make it concise.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
f9e9801 to
d0e58d7
Compare
Refs ALIEN-320
d0e58d7 to
b1d404a
Compare
Refs ALIEN-320
|
Final AWS validation update:
|
## Summary - persist delayed reconciliation wakeups instead of repeatedly reacquiring work that is not ready - keep eligible controller work under one bounded lease and run independent ready resources concurrently - renew ownership through a dedicated endpoint without rewriting deployment state - cancel promptly when ownership is lost and clear scheduled delays for explicit user actions ## Why A fresh multi-resource deployment exposed two framework failures: short controller waits were repeatedly yielded through the shared scheduler, and manager replicas could remain occupied retrying work after lease loss. This preserves durable checkpoints while avoiding unnecessary distributed scheduling between adjacent controller steps. ## Validation - `cargo check -p alien-infra -p alien-deployment -p alien-manager --all-features` - 851 tests across `alien-infra`, `alien-deployment`, and `alien-manager` passed (1 skipped) - generated OpenAPI artifacts were produced through the repository generators ## Dependency Stacked on #179. Linear: https://linear.app/alienplatform/issue/ALIEN-324/make-deployment-leases-cancellable-and-keep-short-controller
|
The remaining 4/5 finding is fixed in 35400f5: |
|
The fix looks correct. Tip: You can customize Greptile's behavior for this repo with |
Refs ALIEN-320
|
@greptileai The generated API schema is now synchronized from the source generator, removing the erroneous nullable component wrapper that broke the Rust SDK and CLI. |
Refs ALIEN-320
|
@greptileai review |
Summary
Validation
Generation: NEXTGEN, zero minimum indexing/search OCU,on.awsendpointpnpm dev: TLS/health, send, asynchronous indexing, full-text search hit, and content retrievalLinear: ALIEN-320