feat(seo): fijar vocabulario de tags ES en el autofill
Build & Deploy ResearchOwl / build-and-push (push) Successful in 6s
Build & Deploy ResearchOwl / build-and-push (push) Successful in 6s
Cierra el TODO de ALLOWED_TAGS: el allow-list ES son los 6 tags del núcleo vivo de zonadeexclusion (Admin API, 2026-07-03), espejo de la lista EN confirmada: uap, desclasificados, casos-militares, casos-clasicos, investigacion, casos-espana. Quedan fuera la cola de tags de 1 post que el modelo inventó antes de constreñir y el duplicado investigacion-2 (colisión de mayúsculas en Ghost). La regla anti-legacy 'never use "investigacion"' del prompt pasa a ser solo-EN: en ES ese slug es el tag canónico del allow-list. Tests de las funciones puras (_coerce, _system_prompt) por idioma. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
b872d00efc
commit
19efc70539
@@ -0,0 +1,39 @@
|
||||
from src.seo.autofill import ALLOWED_TAGS, DEFAULT_TAG, _coerce, _system_prompt
|
||||
|
||||
BASE = {
|
||||
"meta_title": "t",
|
||||
"meta_description": "d",
|
||||
"custom_excerpt": "e",
|
||||
"image_query": "q",
|
||||
"image_context": "c",
|
||||
}
|
||||
|
||||
|
||||
def test_coerce_es_drops_invented_tags():
|
||||
obj = dict(BASE, tags=["uap", "humanoides", "Desclasificados", "investigacion-2"])
|
||||
out = _coerce(obj, "es")
|
||||
assert out["tags"] == ["uap", "desclasificados"]
|
||||
|
||||
|
||||
def test_coerce_es_falls_back_to_default():
|
||||
obj = dict(BASE, tags=["pentagono", "encuentros-cercanos"])
|
||||
out = _coerce(obj, "es")
|
||||
assert out["tags"] == [DEFAULT_TAG["es"]]
|
||||
|
||||
|
||||
def test_coerce_en_still_constrained():
|
||||
obj = dict(BASE, tags=["uap", "investigacion"])
|
||||
out = _coerce(obj, "en")
|
||||
assert out["tags"] == ["uap"]
|
||||
|
||||
|
||||
def test_system_prompt_lists_allowed_tags_per_lang():
|
||||
es = _system_prompt("es")
|
||||
en = _system_prompt("en")
|
||||
for tag in ALLOWED_TAGS["es"]:
|
||||
assert tag in es
|
||||
# La regla anti-legacy 'never use "investigacion"' es solo para EN: en ES
|
||||
# "investigacion" es el tag canónico del allow-list.
|
||||
assert 'never use "investigacion"' in en
|
||||
assert 'never use "investigacion"' not in es
|
||||
assert "ONLY from this exact list" in es
|
||||
Reference in New Issue
Block a user