A translation that failed validation three times is written to disk anyway
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Anfängerfreundlichkeit
- 85/100
- Issue-Typ
- Bug
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Bereich
- internationalization, testing
Rechercherichtung
Lies die Wiederholungs- und Validierungsschleife in scripts/translate.py:182-186, insbesondere den for…else-Zweig und den anschließenden Schreibvorgang. Führe zunächst die Reproduktion aus dem Issue aus, um zu bestätigen, dass die fehlgeschlagene Übersetzung weiterhin geschrieben wird. Die Korrektur ist abgeschlossen, wenn drei Validierungsfehler den Schreibvorgang verhindern und der Befehl einen Fehler meldet.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
A translation that failed validation three times is written to disk anyway
Code: scripts/translate.py:186 (as of 05e6df7e906c)
- A translation that failed validation three times is written to disk anyway
- File: scripts/translate.py:182-186
- Feature: LLM translation pipeline (retry/validation loop in translate_page)
- Symptom: log prints Translation failed ... after 3 attempts then Saving translation to ...; the rejected text lands on disk and the command exits 0 — runtime-verified: FILE WRITTEN AFTER 3 FAILED CHECKS: True 'traduccion rota\n'.
- Root cause: the for…else branch at :182-183 only prints; control falls through to out_path.write_text(out_content) at :186.
- Impact: a translation the tool itself rejected is committed and PR'd by the CI "Create pull request" step with green CI; the only signal is a log line.
- Fix shape: raise (or return) before the write in the for…else branch at scripts/translate.py:182-186.
Reproduction
import sys, types, tempfile, os; sys.path.insert(0, "/Volumes/docker-ssd/Migration/Development/audits/campaign/work/r0003")
from pathlib import Path
for n in ("typer", "github", "pydantic_ai", "rich"): sys.modules[n] = types.ModuleType(n)
T = sys.modules["typer"]; T.Typer = lambda: type("T", (), {"command": lambda s, f=None, **k: f or (lambda g: g)})(); T.Option = T.Argument = lambda **k: None
sys.modules["rich"].print = print; sys.modules["github"].Github = lambda *a, **k: None
sys.modules["pydantic_ai"].Agent = lambda *a, **k: type("A", (), {"run_sync": lambda s, p: type("R", (), {"output": "traduccion rota"})()})()
from scripts import translate
tmp = tempfile.mkdtemp(); os.chdir(tmp); Path("docs/en/docs").mkdir(parents=True); Path("docs/en/docs/index.md").write_text("# Hi\n"); Path("docs/es").mkdir(parents=True); Path("docs/es/llm-prompt.md").write_text("")
translate.get_langs = lambda: {"es": "Spanish"}; translate.check_translation = lambda **k: (_ for _ in ()).throw(ValueError("boom"))
translate.translate_page(language="es", en_path=Path("docs/en/docs/index.md"))
print("FILE WRITTEN AFTER 3 FAILED CHECKS:", Path("docs/es/docs/index.md").exists(), repr(Path("docs/es/docs/index.md").read_text() if Path("docs/es/docs/index.md").exists() else ""))
/tmp/r0003venv/bin/python zzcampaign_repro-2.py → exit 0
Translating docs/en/docs/index.md to es (Spanish)
Running agent for docs/es/docs/index.md (attempt 1/3)
Translation check failed on attempt 1/3: boom
Running agent for docs/es/docs/index.md (attempt 2/3)
Translation check failed on attempt 2/3: boom
Running agent for docs/es/docs/index.md (attempt 3/3)
Translation check failed on attempt 3/3: boom
Translation failed for docs/es/docs/index.md after 3 attempts
Saving translation to docs/es/docs/index.md
FILE WRITTEN AFTER 3 FAILED CHECKS: True 'traduccion rota\n'
Environment
fastapi/fastapi@05e6df7e906c, Python- Found by a multi-lens automated audit; the snippet above was executed against this commit before filing.
- Vorherrschende Sprache
- Python
- Sterne
- 105k
- Forks
- 10.4k
- Ø Merge
- 13 Std. 23 Min.
- Gemergte PRs (30 T.)
- 95
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus fastapi/fastapi
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 88/100
Maintainer antworten meist innerhalb von 1 Tag
-
IssssamOffen
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 1/100
Maintainer antworten meist innerhalb von 1 Tag
-
🚀 RoadmapOffen
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 15/100
fastapi/fastapi#10370 · 5 Kommentare · 46 Reaktionen ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in fastapi/fastapi
Ähnliche Issues
-
documentation good first issue help wanted
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 90/100
-
documentation good first issue help wanted
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 88/100
-
documentation good first issue help wanted
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
-
good first issue help wanted
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
-
good first issue help wanted team:gis
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 82/100
Bongriyoundeng/sim_world#51 ·
Maintainer antworten meist innerhalb von 1 Tag