A progress stage that may not happen: a binding load, whose dispatcher both finds the binding and runs it, where
Perl opens (Loading <path>... once FindFile found the .ltxml (Core/Mouth/Binding.pm:31, Package.pm:2336).
Its (stage... prints before the first line logged inside it (print_deferred_notes) or at its end if it
happened, so what it triggers nests inside it (#945); a stage that did not happen and logged nothing leaves no
trace (one that logged a line and then declined still shows its note).
The whole diagnostic tally of this thread: the REPORT plus the gates
that live beside it — the consecutive-error runaway tracker, the
too-many-errors latch and the Fatal-line dedupe. A discarded speculative
scope (logger::DiagnosticsHold) restores all of them together, so the
errors it dropped can neither count nor trip a cap that would then mute the
document’s own errors.
What an Error says. Boxed there so that a Result costs a pointer: the interpreter’s hottest calls
(read_token, read_x_token, an argument’s read) return Results, and at this struct’s size each went through
stack memory instead of registers (clippy::result_large_err).
Perl local $LaTeXML::IGNORE_ERRORS = 1 as a scope: ignores diagnostics
while alive and restores the previous state on drop — panic-safe, unlike a
manual restore after the probed call.
A thread-portable snapshot of the REPORT’s integer status counters
(everything EXCEPT the arena-SymStr-keyed undefined/missing maps,
whose keys are interner ids local to one thread’s arena). Used to forward a
worker thread’s diagnostic tally back to the main thread: REPORT is
per-thread, so an Error!/Warn! raised on a spawned post-processing
worker increments only that worker’s counters and is invisible to the
main-thread status_code unless merged here. See
crate::util::logger::capture / crate::util::logger::replay_captured.
The log-output suppression flag set for a scope (set_suppress_log_output) and put back as it was when the
guard is dropped — at the scope’s end, on an early return or while a panic unwinds — so a scope that fails cannot
leave the thread’s later conversions silent (a speculative title-page run, sect05.rs
title_page_probe_run, under cortex_worker’s per-paper catch_unwind).
The state key of a box whose measure a binding approximates, its value the box’s name: a breakable tcolorbox set
as one box (tcolorbox_sty.rs, Perl tcolorbox.sty.ltxml:21). Read by approximated_measure.
Threshold for “same error fired this many times in a row → bail.”
Set well above any legitimate same-error pattern (a paper with
500+ identical errors would already be near-useless output) but
well below the 10000 MAX_ERRORS cap so runaway papers don’t
accumulate huge noise logs. Empirically, the pathological
\tabalign-in-math-mode runaway hits >9000 consecutive same
errors; this catches that at 500 instead. The threshold was
tightened from an initial 2000 after verifying no test in the
1112-test suite exceeds it.
Where an arithmetic overflow (tex.web §104, §460; etex.ch scan_expr), an Error as TeX’s (OXIDIZED_DESIGN #519),
is a Warning: inside a measure a binding approximates (APPROXIMATED_MEASURE) the size is ours, not the
author’s (DG 2026-11-13). The detail naming the box, and whether it is the box’s first overflow (its Warning; the
ones it cascades into an Info), or None outside one.
Perl CheckDebuggable (Common/Error.pm L483-492), at the end of a run: name the --debug features no loaded
module declared. Tests the declaration, not its description (KNOWN_PERL_ERRORS #1224).
Drop the warnings held for a source that never reached its report (its archive unpacked, then its job failed before
the session): a persistent worker’s next paper must not log them as its own. Called as each archive is unpacked.
Build a status message matching Perl’s getStatusMessage().
Format: “N warnings; M errors; K fatal error; L undefined macros[\foo, \bar]; P missing
files[x.sty]” Returns “No obvious problems” when no issues detected.
The canonical machine-readable conversion-status line, Status:conversion:N.
One shared probe for the LATEXML_DEBUG_FATAL diagnostics (first-fatal
backtrace, gullet pushback dump, recent-token ring). LazyLock-cached so hot
paths pay a single bool test, and a single seam if the env contract grows
(PR #249 review P3-13).
Would an un-featured Debug-status record actually reach the log right now? True only
under --verbose (util/logger.rsdebug_all; a --debug feature does not admit them)
AND output is not suppressed.
The Debug! macro gates message construction on this: the 2026-08-23
audit measured up to ~26% of a build-bound conversion spent serializing
node_to_string subtrees into Debug! messages that emit_record then
discarded (PERFORMANCE.md, Open levers P0). An atomic load + thread-local
read — cheap enough for token-frequency call sites.
See emit_info. Unlike the Error! macro this cannot escalate by
returning — there is no Err channel in the contexts it serves — so
when the error count or the consecutive-error count crosses its cap it
emits the Fatal:TooManyErrors record and latches the sticky fatal
instead: the run continues (its caller has no unwind path) but the
conversion’s verdict and status code report the fatal honestly.
See emit_info. Latches the sticky fatal and emits the canonical
Fatal:<category>:<object> line — NEVER suppressed (see emit_record).
The CALLER owns any early-exit control flow (e.g. latexml_post’s
Fatal! returns its own PostError after this) — a fatal, unlike an
error, needs no cap bookkeeping.
The single diagnostic vehicle, function form — for contexts that cannot
use the Error!/Warn!/Info! macros because those are return-based
(Error! escalates to Fatal!, which return Err(...)s, so it only
typechecks in Result<_, error::Error> functions).
The ONE emission primitive every diagnostic flows through (DRY pass,
user directive 2026-08-02): count on the emitting thread’s REPORT,
then log with the pre-formatted target, respecting output suppression —
EXCEPT for Error and Fatal records, which are emitted UNCONDITIONALLY
(user decision 2026-08-03): frameworks such as cortex aggregate success
rates from Error:/Fatal: lines, so muting either would hide exactly
the signal they measure. Suppression mutes Debug/Info/Warning only.
The MacroDiagGuard marks the emission so the logger backend does not
count it a second time.
Perl: $LaTeXML::DEBUG{$name} = 1 — called by the CLI per --debug NAME. Raises the log floor to Debug
so the feature’s records pass; un-featured ones stay --verbose’s (util/logger.rsDEBUG_ALL).
Whether Error records are dropped: after any Fatal (Perl Error returns at Common/Error.pm:362), or once the error
cap or a resource Fatal latched (those latch under an ignoring scope too).
Latch the too-many-errors state: emit_record drops further Error-level
records until the next conversion resets the report. Set by the
TooManyErrors Fatal paths (the Error! macro cap and emit_error’s
latch); cleared in reset_consecutive_error_tracker.
Logs and counts the warnings held for the session (warn_at_session_start), into the log now bound. The
report’s reset does it; a run that never resets it (an XML input’s post-processing) calls it once its log is bound.
Add a worker thread’s ReportCounts into the current (main) thread’s
REPORT. Only the integer counts + the sticky fatal flag are merged; the
arena-keyed undefined/missing maps are NOT (a worker has its own
thread-local arena, so those keys are not portable).
A diagnostic’s what field as the log line carries it: without leading blanks, and fallback when that leaves
nothing. A field of spaces (an \@latex@error prefix whose indent expanded, 2606.13031) leaves Error:latex:
followed by blanks, which a log reader keyed on Error:<category>:<what> misses; Perl prints it as it is. Trailing
blanks stay, as Perl’s (mycls) Class mycls Warning (OXIDIZED_DESIGN #1175).
Record an error signature; returns the new consecutive count.
Call from the Error! macro after note_status. Resets count to 1
on a different signature, increments on a match.
The error cap’s bookkeeping after one counted Error (key = category:object): at the crossing of MAX_ERRORS or
of the consecutive-error limit, latch TooManyErrors and emit its Fatal (Perl Error.pm L362-372). Shared by
emit_error and a replayed deferred error (logger.rs DeferredDiagnostics).
Count a diagnostic record observed by the logger backend, unless it was
emitted by a macro (already counted at raise time) or the report is
mid-borrow (a raw log call from inside a report_mut! scope must not
panic the conversion over a tally increment — matching the logger’s own
try_borrow discipline for LOG_BUFFER).
Run f (which resets the string arena) while preserving REPORT’s
undefined and missing tallies: their SymStr keys are materialized to
owned strings before f and re-interned into the fresh arena afterwards, so
get_status_message / conversion_verdict remain byte-identical after
dropping the core engine’s arena between core and post-processing.
Record a fatal into the resource-fatal latch — only Timeout-target fatals
with payload-free categories are kept (the latch exists for resource
fatals; payload-carrying ErrorCategory variants are not cloneable and
are never resource-class).
Clear the arena-SymStr-keyed report maps (undefined, missing). MUST be
called whenever the arena is reset (see crate::reset_thread_engine): their
keys are arena interner ids, so after arena::reset() a stale key resolves to
whatever string now occupies that id — e.g. a \special_relax family-token
name — producing phantom “undefined macro” reports across conversions.
Clear the log-output suppression flag, the progress notes’ silence (SilenceProgressNotesGuard;
reset_thread_engine) and any DeferredNote a panic left: a fresh conversion on a reused thread logs.
Overwrite the current thread’s REPORT counters with a prior snapshot.
The isolation primitive for RECURSIVE/auxiliary digestions whose
diagnostics must not count against the document (Perl analog: the
recursive MakeBibliography session keeps its tally out of the outer
document). Pair with set_suppress_log_output so neither the lines
nor the counts leak: snapshot -> suppress -> digest -> restore.
The consecutive-error cap’s Fatal once the error cap latched (a TooManyErrors Fatal line, the total cap’s or the
runaway’s, is printed and counted): an Err marked logged, so no sink prints a line for it; the run’s status is
the latched Fatal’s.
Perl $LaTeXML::IGNORE_ERRORS (Common/Error.pm L362/L380/L396: Error,
Warn and Info all return if $LaTeXML::IGNORE_ERRORS): inside a probing
scope every diagnostic is dropped WHOLE — neither its line nor its count —
so the log and the status can never disagree about it. This is the only
sanctioned way to silence a scope; muting lines while keeping counts (or
the reverse) is exactly the log/status inconsistency the pipeline must not
produce. Returns the previous value; restore it on every exit path.
The digestion’s end has taken the latched error cap’s Fatal (core_interface::finish_digestion_fatal, OD #251): an
Error! of the phases after it (the build of what was kept, the rewrites, the math) no longer raises it again, as
Perl’s Error returns before its cap test once a Fatal set IGNORE_ERRORS (Common/Error.pm:362, :372). Until then
the re-raise ends a digestion that swallowed the Fatal, our stand-in for the input hardYankProcessing empties.
Take (and clear) the latched resource fatal, if any. Returns the
structured Error so a boundary that received only a flattened string can
propagate the real thing.
Unlatch the latched resource fatal when it is a runaway limit of the expansion in progress — the pushback, a
recursion — for a run the document never makes, discarded with it (title_page_probe_run). A limit of the
conversion stays latched as the document’s: its deadline, its memory budget, its token budget, its conditional
ids. (The token count itself does not carry past the failed run: reading_from_mouth’s error path resets the
gullet’s progress, gullet.rs.) Whether it was one.
A Fatal a script binding catches is the script’s to handle (DG 2026-11-14, OD #1028): when it set the mute, the
later Errors print again; a Fatal the script lets through mutes them at its sink’s log_fatal.
A Warning raised before its conversion’s report starts (a source archive is unpacked, a command-line option is
checked, before the session): held, then logged and counted by the next initialize_report on this thread, or
by log_session_warnings where post-processing opens the log of a run that has no report reset.