chore(plan): marca Phase D (Tasks 13-16) completada

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Juan
2026-05-10 10:51:31 +02:00
co-authored by Claude Opus 4.7
parent db68164354
commit 006d781df0
+14 -14
View File
@@ -1872,7 +1872,7 @@ git commit -m "feat(registry): añade factories para registry y policy_store"
**Files:**
- Create: `core/src/agentforge_core/guardrails/base.py`
- [ ] **Step 1: Implementar**
- [x] **Step 1: Implementar**
```python
"""Interfaz Protocol del motor de guardrails."""
@@ -1905,7 +1905,7 @@ class GuardrailEngine(Protocol):
) -> list[GuardrailViolation]: ...
```
- [ ] **Step 2: Commit**
- [x] **Step 2: Commit**
```bash
git add core/src/agentforge_core/guardrails/base.py
@@ -1923,7 +1923,7 @@ git commit -m "feat(guardrails): añade Protocol GuardrailEngine"
Este es el engine más sustantivo. En lugar de depender de `guardrails.hub` (frágil para tests offline), implementamos validadores nativos que hacen lo mismo que los del hub. Presidio sí se usa para PII (es estándar industria y maneja `ES_NIF`).
- [ ] **Step 1: Test**
- [x] **Step 1: Test**
```python
"""Tests del GuardrailsAIEngine."""
@@ -2030,7 +2030,7 @@ async def test_schema_match_pasa_con_campo(
assert not [v for v in violations if v.blocked]
```
- [ ] **Step 2: Implementar `validators.py`**
- [x] **Step 2: Implementar `validators.py`**
```python
"""Validadores individuales. Cada uno devuelve list[GuardrailViolation]."""
@@ -2309,7 +2309,7 @@ def telco_safety_rules(
]
```
- [ ] **Step 3: Implementar `guardrails_ai.py`**
- [x] **Step 3: Implementar `guardrails_ai.py`**
```python
"""Engine que orquesta los validadores definidos en una PolicyDefinition."""
@@ -2418,7 +2418,7 @@ class GuardrailsAIEngine:
return violations
```
- [ ] **Step 4: Verificar y commit**
- [x] **Step 4: Verificar y commit**
```bash
pytest tests/unit/test_guardrails_ai.py -v
@@ -2436,7 +2436,7 @@ git commit -m "feat(guardrails): añade GuardrailsAIEngine + 8 validadores (PII,
- Create: `core/src/agentforge_core/guardrails/factory.py`
- Create: `tests/unit/test_guardrails_composite.py`
- [ ] **Step 1: Implementar stub `nemo.py`**
- [x] **Step 1: Implementar stub `nemo.py`**
```python
"""Stub de NeMo Guardrails. Solo se carga si GUARDRAILS_NEMO_ENABLED=true.
@@ -2498,7 +2498,7 @@ class NeMoGuardrailsEngine:
return []
```
- [ ] **Step 2: Implementar `composite.py`**
- [x] **Step 2: Implementar `composite.py`**
```python
"""Engine que ejecuta varios sub-engines en paralelo y agrega resultados."""
@@ -2537,7 +2537,7 @@ class CompositeGuardrailEngine:
return [v for sub in results for v in sub]
```
- [ ] **Step 3: Implementar `factory.py`**
- [x] **Step 3: Implementar `factory.py`**
```python
"""Factory que ensambla el GuardrailEngine según settings."""
@@ -2573,7 +2573,7 @@ def build_guardrail_engine(settings: Settings) -> GuardrailEngine:
return CompositeGuardrailEngine(engines)
```
- [ ] **Step 4: Test del composite**
- [x] **Step 4: Test del composite**
```python
"""Tests del CompositeGuardrailEngine."""
@@ -2622,7 +2622,7 @@ def test_composite_rechaza_lista_vacia() -> None:
CompositeGuardrailEngine([])
```
- [ ] **Step 5: Verificar y commit**
- [x] **Step 5: Verificar y commit**
```bash
pytest tests/unit/test_guardrails_composite.py -v
@@ -2638,7 +2638,7 @@ git commit -m "feat(guardrails): añade NeMo stub, CompositeEngine paralelo y fa
- Create: `policies/default/index.yaml`
- Create: `policies/default/versions/v1.yaml`
- [ ] **Step 1: Escribir `policies/default/versions/v1.yaml`**
- [x] **Step 1: Escribir `policies/default/versions/v1.yaml`**
```yaml
name: default
@@ -2704,7 +2704,7 @@ output_validators:
on_validator_error: fail_closed
```
- [ ] **Step 2: Escribir `policies/default/index.yaml`**
- [x] **Step 2: Escribir `policies/default/index.yaml`**
```yaml
name: default
@@ -2717,7 +2717,7 @@ versions:
active_version: v1
```
- [ ] **Step 3: Commit**
- [x] **Step 3: Commit**
```bash
git add policies/