feat(short): el prompt sabe cuánto texto cabe dibujado, y el informe grita si quedó ilegible
Build & Deploy ResearchOwl / build-and-push (push) Successful in 10s

x-fits llega vivo del contrato y se pone delante del modelo: es el único
límite que nada rechaza, porque el renderizador encoge en vez de fallar. Sin
esto el modelo escribe una cita de 58 caracteres para un hueco de 16 y se
entera cuando ya está renderizada.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
ChemaVX
2026-08-06 16:19:48 +00:00
co-authored by Claude Fable 5
parent a13c3062b6
commit 129f436fd2
5 changed files with 63 additions and 1 deletions
+18
View File
@@ -165,3 +165,21 @@ class TestNarrationWarnings:
{"kind": "narration", "text": "no voice installed"}]))
assert "1 textos recortados" in text # sólo cuenta el de dibujo
assert "🔇 no voice installed" in text
class TestSevereShrink:
"""Un recorte leve es cosmético; uno grave deja el texto ilegible justo
donde importaba. Mezclarlos entrena al lector a ignorar los dos."""
def test_a_severe_shrink_is_called_out(self):
text = _claims_message(result_with(render_warnings=[
{"template": "document_quote", "text": "“UNA CITA MUY LARGA”",
"requested": 84, "size": 20, "severe": True}]))
assert "🔴" in text and "ILEGIBLES" in text
def test_a_cosmetic_shrink_stays_quiet(self):
text = _claims_message(result_with(render_warnings=[
{"template": "scale_bars", "text": "PHYSICAL EVIDENCE",
"requested": 92, "size": 84, "severe": False}]))
assert "recortados" in text
assert "ILEGIBLES" not in text and "🔴" not in text
+24
View File
@@ -323,3 +323,27 @@ def test_narration_that_overshoots_the_target_is_flagged_as_narration():
def test_a_spec_without_narration_keeps_the_old_wording():
note = editorial_notes(spec_with(*[shot(duration=10.0) for _ in range(6)]))[0]
assert "duración total" in note and "estimada" not in note
def test_the_prompt_carries_how_much_text_actually_fits():
"""`x-fits` es el único límite que nada rechaza: si no llega al prompt, el
modelo escribe una cita de 58 caracteres para un hueco de 16."""
templates = {"document_quote": {
"type": "object", "required": ["quote_a"],
"properties": {"quote_a": {"type": "string", "minLength": 1, "x-fits": 16}}}}
described = describe_templates(templates)
assert "CABE ~16 caracteres" in described
def test_a_string_longer_than_it_fits_is_still_valid():
"""Los caracteres son un proxy de los píxeles: rechazar por ancho estimado
tiraría specs que se dibujan perfectamente."""
templates = {"radar_sweep": {
"type": "object", "additionalProperties": False, "required": ["headline"],
"properties": {"headline": {"type": "string", "minLength": 1, "x-fits": 13}}}}
doc = spec_with({"template": "radar_sweep", "duration": 25.0,
"props": {"headline": "UN TITULAR BASTANTE MAS LARGO QUE ESO"}})
validate_spec(doc, templates)