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
+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)