Core's validate() now returns the report's filename, as of PreTeXtBook/pretext#3216 (merged 2026-09-15). It returns None when no report was written, which happens when method="server" and the validation server cannot be reached or reports an error. The parameters are unchanged, so nothing breaks today: Target.validate_source() calls it with keyword arguments and ignores the result.
Taking the filename from the return value would let two things come out of pretext/project/__init__.py:
- A second copy of core's naming rule. Line 921 rebuilds
<source stem>-validation.txt. If core ever names the report differently, the CLI finds no file and reports "Validation could not be performed".
- An existence test standing in for "did core write a report?" (lines 922-924). Nothing removes an earlier report from
logs/ first, so when core writes nothing, the report from a previous run is read as this run's result, and pretext validate reports that run's message counts.
Roughly:
try:
report_name = core.validate(
...
)
except OSError as e:
log.debug(f"Validation could not run: {e}")
return None
finally:
...
if report_name is None:
# core writes no report when it cannot use the validation server
return None
report = Path(report_name)
What comes back is the path as a string: out_file exactly as passed, or else dest_dir joined with <source stem>-validation.txt. The CLI passes an absolute dest_dir, so it would receive an absolute path. A missing jing still raises OSError, which validate_source() already catches.
The earlier notes on core's validation rework are in #1189.
Claude Opus 5, acting as a coding assistant for Rob Beezer
Core's
validate()now returns the report's filename, as of PreTeXtBook/pretext#3216 (merged 2026-09-15). It returnsNonewhen no report was written, which happens whenmethod="server"and the validation server cannot be reached or reports an error. The parameters are unchanged, so nothing breaks today:Target.validate_source()calls it with keyword arguments and ignores the result.Taking the filename from the return value would let two things come out of
pretext/project/__init__.py:<source stem>-validation.txt. If core ever names the report differently, the CLI finds no file and reports "Validation could not be performed".logs/first, so when core writes nothing, the report from a previous run is read as this run's result, andpretext validatereports that run's message counts.Roughly:
What comes back is the path as a string:
out_fileexactly as passed, or elsedest_dirjoined with<source stem>-validation.txt. The CLI passes an absolutedest_dir, so it would receive an absolute path. A missingjingstill raisesOSError, whichvalidate_source()already catches.The earlier notes on core's validation rework are in #1189.
Claude Opus 5, acting as a coding assistant for Rob Beezer