62 lines
2.8 KiB
YAML
62 lines
2.8 KiB
YAML
schema: spec-driven
|
|
|
|
context: |
|
|
Componente: Golden Path "rest-api/python" (Coralware Cove IDP)
|
|
Tipo: Shape de aplicación tenant — FastAPI stateless puro (sin BD)
|
|
Repo Gitea generado: idp-templates/template-rest-api-python
|
|
Audiencia consumidora: tenants externos en tier free-trial / startup
|
|
Gobernanza: openspec interno de Coralware — NO se sincroniza al repo
|
|
Gitea ni llega al repo del cliente.
|
|
|
|
Stack del shape:
|
|
- Python 3.12 + FastAPI + Uvicorn
|
|
- Sin persistencia (BD opcional via web-backend/python si se requiere)
|
|
- Helm chart minimal (Deployment + Service + Ingress (networking.k8s.io/v1, NGINX) + NetworkPolicy)
|
|
- CI: Gitea Actions invocando reusable workflow ADR-038 + helm-deploy
|
|
|
|
Diferencias con web-backend/python:
|
|
- SIN alembic, SIN claim-mariadb.yaml, SIN Job pre-upgrade
|
|
- SIN testcontainers (tests sin Docker)
|
|
- SIN ServiceMonitor por default (tier free-trial sin Prometheus)
|
|
- Tests apuntan a probar el endpoint, no a cubrir un dominio rico
|
|
- Helm chart sin hooks; rollout directo
|
|
|
|
Convenciones obligatorias del shape:
|
|
- Endpoints fijos: /health, /docs, /openapi.json, /metrics
|
|
- /health retorna {status: "ok"} (sin chequeo de DB)
|
|
- Labels: app.kubernetes.io/name=<APP_NAME>, idp.coralware.cloud/tier,
|
|
idp.coralware.cloud/tenant-id, idp.coralware.cloud/golden-path=rest-api,
|
|
idp.coralware.cloud/golden-path-lang=python
|
|
- SecurityContext: runAsNonRoot=true, runAsUser=1001, readOnlyRootFilesystem=true,
|
|
drop ALL caps, allowPrivilegeEscalation=false
|
|
- Imagen: registry.coralsafety.com/tenant-<id>/<APP_NAME>:<tag>
|
|
- Pipeline ADR-038: black → ruff → bandit → pytest --cov 80 → buildkit → trivy
|
|
- Coverage threshold del shape: 80%
|
|
|
|
ADRs relacionados:
|
|
- ADR-027 — Golden Paths Fase 5
|
|
- ADR-029 — API standards (R-007 correlation_id)
|
|
- ADR-038 — CI estándar reusable workflow Python
|
|
- ADR-053 — Anatomía del shape web-backend/python (referencia)
|
|
|
|
Tier por default:
|
|
- free-trial: 1 réplica, sin add-ons, namespace tenant-<id>-apps
|
|
- startup+: puede escalar réplicas hasta tope del tier
|
|
|
|
rules:
|
|
proposal:
|
|
- Incluir sección "Non-goals" — qué NO entrega el shape
|
|
- Si el cambio agrega persistencia, valorar promover a web-backend/python
|
|
en lugar de complicar este shape
|
|
- Referenciar ADRs y golden paths cuando aplique
|
|
design:
|
|
- Documentar variables de entorno consumidas (LOG_LEVEL, CORRELATION_ID_HEADER,
|
|
KEYCLOAK_ISSUER opcional)
|
|
- Comportamiento fail-safe: errores de upstream no crashean la app
|
|
- Si el cambio toca el flujo CI/CD, actualizar flowchart Mermaid de specs/main.md
|
|
ANTES de tocar el workflow YAML
|
|
tasks:
|
|
- shapeVersion en coralware-shape.yaml sigue semver
|
|
- Mantener exclusión de openspec/ en el sync a Gitea
|
|
- Validar render server-side de placeholders por repo-provisioner
|