From e4d2073eeb5bbeb33fa15e3d19e6a87a6fa047a1 Mon Sep 17 00:00:00 2001
From: rafa
Date: Mon, 3 Aug 2026 09:40:18 -0400
Subject: [PATCH] fix(tts): exclude donations and accounting entries
---
scripts/fea_post_io.php | 2 ++
scripts/minimax_tts.py | 10 +++++++++-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/scripts/fea_post_io.php b/scripts/fea_post_io.php
index ab8579b..66e8bb4 100644
--- a/scripts/fea_post_io.php
+++ b/scripts/fea_post_io.php
@@ -24,6 +24,8 @@ if ($action === 'get') {
'title' => $p->post_title,
'content' => $p->post_content,
'status' => $p->post_status,
+ 'post_type' => $p->post_type,
+ 'post_name' => $p->post_name,
'author' => (int)$p->post_author,
], JSON_UNESCAPED_UNICODE));
exit(0);
diff --git a/scripts/minimax_tts.py b/scripts/minimax_tts.py
index 39faad1..24124d5 100644
--- a/scripts/minimax_tts.py
+++ b/scripts/minimax_tts.py
@@ -93,7 +93,15 @@ def get_post_text(pid):
check=True, capture_output=True)
subprocess.run(["docker", "cp", f"{CONTAINER}:/tmp/fea_es.json", "/tmp/fea_es.json"], check=True)
d = json.load(open("/tmp/fea_es.json"))
- raw = re.sub(r"(?i)
|
|", "\n", d["content"])
+ # Hard gate: pages and operational/accounting entries are never TTS input.
+ # This also protects explicit --ids queues, which bypass author-backlog SQL.
+ raw_content = d.get("content", "")
+ blocked_markers = ("fea-don-wrap", "fea-ledger", "Haz tu donación")
+ if d.get("post_type") != "post":
+ raise ValueError(f"post #{pid} no es un artÃculo (post_type={d.get('post_type')!r}); TTS excluido")
+ if d.get("post_name") == "numeros" or any(marker in raw_content for marker in blocked_markers):
+ raise ValueError(f"post #{pid} es contenido de cuentas/donaciones; TTS excluido")
+ raw = re.sub(r"(?i)|
|", "\n", raw_content)
raw = re.sub(r"<[^>]+>", "", raw)
raw = re.sub(r"\[[^\]]+\]", "", raw)
raw = html.unescape(raw)