aws-samples / aws-samples/sample-autonomous-cloud-coding-agents
enhancement(registry): fail closed consistently on malformed record payloads
- Lenguaje dominante
- TypeScript
- Estrellas
- 143
- Forks
- 46
- Merge medio
- 3 d 10 h
- PR fusionados (30 d)
- 24
Descripción
## Context
Follow-up from the final review of PR #779.
The TypeScript and Python Agent Registry adapters do not handle malformed or out-of-band record payloads consistently. These cases are uncommon, but the registry contract is intended to fail closed rather than leak raw parser errors or let one corrupt record disrupt an entire namespace.
## Problems
- TypeScript eagerly extracts every record returned by `listRecords`. A malformed JSON payload throws a raw `SyntaxError`, so one corrupt record can prevent resolution or immutability checks for otherwise healthy records in the same namespace.
- Python's CUSTOM path handles a missing `data` key but not an explicit `null`; `json.loads(None)` raises `TypeError`, which the resolution boundary does not catch.
- Corrupt SKILL frontmatter can silently erase publisher provenance through `parseSkillPublisher`.
- Registry status values are currently coerced into `RegistryStatus` without runtime validation.
## Desired behavior
- Resolving a selected record with an unreadable payload fails with the port-owned `REMOVED` error rather than a raw parser exception.
- An unrelated corrupt record does not prevent healthy records in the same namespace from resolving.
- A corrupt record at matching coordinates must not bypass publish immutability.
- TypeScript and Python adapters apply equivalent fail-closed behavior for CUSTOM, MCP, and SKILL payloads, including explicit null values.
- Publisher provenance and unknown status handling are explicit rather than silently discarded or coerced.
## Tests
Add direct tests for:
- Malformed and explicit-null CUSTOM/MCP bodies.
- Corrupt and duplicate-key SKILL frontmatter supplied directly to the read-side parser.
- A healthy record coexisting with an unrelated corrupt record.
- A corrupt record at the same publish coordinates.
- Unknown service status values.
## References
- PR #779
- `cdk/src/handlers/shared/registry/agent-registry-client.ts`
- `agent/src/registry/agent_registry_client.py`
Guía de contribución
Línea de trabajo
Empieza leyendo cdk/src/handlers/shared/registry/agent-registry-client.ts y agent/src/registry/agent_registry_client.py; después revisa el PR #779 para conocer los límites actuales del registro. Añade las pruebas directas indicadas para los casos malformados, null, corruptos, de claves duplicadas, de registros duplicados y de estado desconocido. Se considera terminado cuando ambos adaptadores fallan de forma cerrada y equivalente, conservan la procedencia del publisher, aíslan la corrupción no relacionada y hacen cumplir la inmutabilidad en las coordenadas coincidentes.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- python, typescript
- Área
- api, backend, security
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Activo
- Claridad
- Bastante claro
- Aptitud para principiantes
- 48/100