aws-samples / aws-samples/sample-autonomous-cloud-coding-agents
refactor(compute): gate ECS construct on compute_type context instead of comment toggle
- Vorherrschende Sprache
- TypeScript
- Sterne
- 143
- Forks
- 46
- Ø Merge
- 3 T. 10 Std.
- Gemergte PRs (30 T.)
- 24
Beschreibung
## Summary
Replace the commented-out ECS construct in `cdk/src/stacks/agent.ts` with a proper `compute_type` context gate.
## Problem
Currently, enabling ECS requires manually uncommenting code in `agent.ts` (lines ~46, ~524-533). This:
- Requires source code changes to change deployment topology
- Is invisible to the bootstrap/preflight system (commented code doesn't synthesize)
- Defeats the compute-variant architecture established in #123
## Solution
```typescript
const computeType = app.node.tryGetContext('compute_type') ?? 'agentcore';
// In the stack:
if (computeType === 'ecs') {
new EcsAgentCluster(this, 'EcsAgentCluster', { vpc, ... });
}
```
The construct is always in source, always compilable, always tested. The context variable governs synthesis:
- `mise //cdk:synth` → agentcore only (default)
- `mise //cdk:synth -- -c compute_type=ecs` → agentcore + ECS resources
## Acceptance criteria
- [ ] ECS construct uncommented and gated behind `if (computeType === 'ecs')`
- [ ] `mise //cdk:synth` (default) produces same template as today (no ECS resources)
- [ ] `mise //cdk:synth -- -c compute_type=ecs` produces template with ECS resources
- [ ] `mise //cdk:test` passes for both configurations
- [ ] No "uncomment to enable" prose remains in the file
## Relationship to #120 stack
Prerequisite for #124 (resource-action-map) — the synth-coverage test needs to run with `compute_type=ecs` to verify ECS resource types are mapped. Without this issue, ECS resources never appear in the synthesized template.
Blocked by: #123 (compute-ecs policy must exist)
Blocks: #124 (ECS coverage in resource-action-map)
Beitragsleitfaden
Rechercherichtung
Beginne in cdk/src/stacks/agent.ts und überprüfe die durch #123 eingerichtete Compute-Variant-Konfiguration. Führe mise //cdk:synth mit und ohne -c compute_type=ecs aus und führe anschließend mise //cdk:test für beide Konfigurationen aus. Erledigt ist die Aufgabe, wenn das Standard-Template ECS-frei bleibt, der ECS-Kontext ECS-Ressourcen erzeugt und keine Prosa zum Auskommentieren zwecks Aktivierung verbleibt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- aws, typescript
- Bereich
- cloud, infrastructure
- Issue-Typ
- Refactoring
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Ruhig
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 52/100