feat(enrichers): vendoring de funciones Python por enricher (issue 0033b)

Cada enricher con `lang: python` y `uses_functions` no vacio ahora
puede empaquetar las funciones del registry que necesita en
`<enricher>/_vendored/`. El run.py importa de ahi en lugar de
`<registry_root>/python/functions/`, lo que hace al binario
distribuible sin dependencia de un fn_registry montado.

Cambios:

1. tools/vendor_enricher_python.sh
   - Lee `uses_functions` del manifest (filtrando IDs `*_py_*`).
   - Resuelve `file_path` desde registry.db.
   - Copia recursivamente con expansion transitiva: si un fichero
     vendorizado importa siblings del mismo dominio, los siblings
     tambien se copian (resuelve el caso `extract_iocs.py` que
     importa 7 modulos hermanos).
   - Genera `.vendor.lock` con `<id>  <sha256>  <src_path>` por
     funcion declarada para auditoria.
   - Idempotente — si todos los hashes coinciden, no rehace nada.

2. Manifests actualizados con `uses_functions`:
   - fetch_webpage:        normalize_url + html_to_markdown
   - extract_links:        extract_urls
   - extract_text_entities: extract_iocs

3. run.py de los 3 enrichers afectados: importan de `_vendored/`
   si existe, fallback a `<registry_root>/python/functions/` en
   modo dev (mantiene los tests pytest funcionando).

4. app.md: anade `cryptography` a python_runtime_deps porque el
   blob `cybersecurity.cybersecurity` lo importa al top.

5. Tests:
   - test_vendor_script.py — 6 tests del script: layout correcto,
     transitive siblings, lock con SHA256, idempotencia, modulos
     importables en aislamiento.
   - 16 tests de enrichers existentes pasan via vendoring (no usan
     registry_root porque _vendored/ tiene prioridad).

6. Issue 0033b movido a issues/completed/.

Tests: 32/32 verde (16 enrichers + 6 dispatcher + 4 runtime + 6
vendor).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-03 00:20:41 +02:00
parent 4ef6a5f7db
commit ee0d26ce2d
17 changed files with 368 additions and 18 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
---
id: 0001
title: Chat con Claude sobre el grafo
status: pending
status: completed
priority: high
created: 2026-04-30
---
@@ -1,7 +1,7 @@
---
id: 0003
title: Enricher web — descargar URL/dominio y extraer texto
status: pending
status: completed
priority: medium
created: 2026-04-30
---
+1 -1
View File
@@ -1,7 +1,7 @@
---
id: 0026
title: Sistema de jobs — enrichers asincronos en background
status: in_progress
status: completed
priority: high
created: 2026-05-01
blocks: [0027, 0028, 0029, 0030]
+1 -1
View File
@@ -1,7 +1,7 @@
---
id: 0027
title: Tipo Webpage + cache de documentos descargados
status: pending
status: completed
priority: high
created: 2026-05-01
depends_on: [0026]
@@ -1,7 +1,7 @@
---
id: 0028
title: Enricher fetch_webpage (MVP end-to-end)
status: pending
status: completed
priority: high
created: 2026-05-01
depends_on: [0026, 0027]
@@ -1,7 +1,7 @@
---
id: 0028b
title: Enrichers extract_domain, extract_links, extract_text_entities
status: pending
status: completed
priority: high
created: 2026-05-01
depends_on: [0028]
@@ -1,7 +1,7 @@
---
id: 0031
title: Layout estable al recargar — auto-save, halo placement, sin fit, physics off
status: in_progress
status: completed
priority: high
created: 2026-05-01
related_to: [0026]
@@ -1,9 +1,10 @@
---
id: 0033b
title: Vendoring de funciones Python por enricher
status: pending
status: completed
priority: high
created: 2026-05-02
completed: 2026-05-03
depends_on: [0033]
---