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

feat(ci): mechanical module-boundary enforcement (eslint-plugin-boundaries/dependency-cruiser + madge) (CA-03)

Abierto
#254 0 comentarios 0 reacciones 0 asignados Ver en GitHub
tooling validation-loop
Lenguaje dominante
TypeScript
Estrellas
146
Forks
46
Merge medio
3 d 10 h
PR fusionados (30 d)
24

Descripción

> **This is a finding from https://github.com/krokoko/cairn** (action item **CA-03**).

### Component

Tooling / CI

### Describe the feature

Add **mechanical module-boundary enforcement** that encodes the `AGENTS.md` routing table as code, using `eslint-plugin-boundaries` or `dependency-cruiser`, plus `madge --circular` for circular-dependency detection. Start the boundary rules in **warn** mode, snapshot the current baseline, then flip to **error** once the baseline is clean.

Boundaries to enforce (from `AGENTS.md`):

- Handler layer (`cdk/src/handlers/`) can't import stack/construct internals (`cdk/src/stacks/`, `cdk/src/constructs/`).
- CLI (`cli/src/`) can't import CDK internals.
- No circular dependencies anywhere.

### Use case

The `AGENTS.md` layering rules are **prose, not mechanically enforced** (AI007 / AI003). Nothing stops an agent — or a human — from introducing an import that violates the intended architecture, and circular dependencies go undetected. A boundary linter turns the routing table into a binding fitness function that catches architectural drift at PR time instead of in review.

### Proposed solution

1. Add `eslint-plugin-boundaries` (or `dependency-cruiser`) to `cdk` / `cli` and encode the `AGENTS.md` routing table as boundary rules.
2. Add `madge --circular` as a fast check (pre-commit + CI).
3. Land the rules in **warn** mode; record the current violation baseline.
4. Once the baseline is clean, flip to **error** and add to the required `build` check.

### Acceptance criteria

- [ ] Boundary rules encode the `AGENTS.md` routing table (handler↛stack/construct internals; CLI↛CDK internals).
- [ ] `madge --circular` runs in pre-commit and CI; zero circular deps in the clean baseline.
- [ ] Rules start in **warn**; baseline violations are documented.
- [ ] A follow-up flips clean rules to **error** in the required `build` check.
- [ ] Remediation text on failures is agent-targeted (what to fix, not just what failed).

### Other information

Source reports: `readiness-roadmap.md`, `verification-strategy.md` (§"Architecture Fitness Functions", maturity 0→3), `ai-smells-gates-report.md` (AI003/AI007). Effort: **S–M**. Calibrate permissively — agents route around hard blockers, so introduce the error line only after the code is behind it. Per ADR-003 this issue needs the `approved` label before work begins.

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Empieza leyendo AGENTS.md y las secciones de arquitectura de readiness-roadmap.md y verification-strategy.md. Inspecciona las importaciones en cdk/src/handlers/, cdk/src/stacks/, cdk/src/constructs/ y cli/src/, y luego ejecuta madge --circular para establecer la línea base. Se considera terminado cuando las reglas de límites y la comprobación de dependencias circulares se ejecuten en pre-commit y CI, con advertencias documentadas, texto de remediación y un camino hacia la obligatoriedad del build.

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

Evaluación

Stack tecnológico
eslint, typescript
Área
build-system, ci-cd, tooling
Tipo de issue
Nueva funcionalidad
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Tranquilo
Claridad
Bastante claro
Aptitud para principiantes
48/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.