aws-samples / aws-samples/sample-autonomous-cloud-coding-agents

refactor(compute): gate ECS construct on compute_type context instead of comment toggle

Abierto
#164 2 comentarios 0 reacciones 0 asignados Ver en GitHub
enhancement infra-cdk
Lenguaje dominante
TypeScript
Estrellas
146
Forks
46
Merge medio
3 d 10 h
PR fusionados (30 d)
24

Descripción

## 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)

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Comienza en cdk/src/stacks/agent.ts y revisa la configuración de la variante de cómputo establecida por #123. Ejecuta mise //cdk:synth con y sin -c compute_type=ecs, y luego ejecuta mise //cdk:test para ambas configuraciones. Se considera terminado cuando la plantilla predeterminada sigue sin ECS, el contexto de ECS produce recursos de ECS y no queda texto que indique quitar comentarios para habilitarlo.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
aws, typescript
Área
cloud, infrastructure
Tipo de issue
Refactorización
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Tranquilo
Claridad
Bien especificado
Aptitud para principiantes
52/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.