Files
texrra-engine/docs/NATIVE_BOX_DIAGNOSTICS.md

10 KiB
Raw Permalink Blame History

Native box/list diagnostics — 2026-11-01

2026-11-03 最新:W3-S2完整验收1330/0、CLI36。真实mark/marks 节点保留展开token、类别/字体与打印依赖;447组盒对的894个完整showbox精确通过。 通用控制序列先按真实^^表示计长度/换行,高字节长mark的两通道和返回码1均独立 对照。新增mark输入帧后,CLI上下文48作业全部精确一致。原复合数学诊断与 交互式恢复边界仍保留;kernel530/full入口pdfoutput/fmt=false。下文为历史。

2026-11-03 最新:W3-S1原始列表/规则/盒转移完整验收1318/0。 段落行诊断由实际 raw NativeBox 派生,规则的 running 尺寸、位移、拆盒/lastbox 与真实 display dlist 子类型均保留;252个完整showbox和166页DVI独立通过。 G1早已完整验收;下面paused/首次showbox差异等记录均为历史。kernel现530 maxdepth,完整入口仍pdfoutput,格式未启动;部分compound数学诊断仍明确失败。

2026-11-02 更新:G1 与 W1-S1–S7及W2-S1累积完整验收 1266 / 0、CLI28,见 P2-M1 进度 与 原始字节输入。 原样 kernel 仍529 overfullrule,完整入口仍 pdfoutput;格式尚未启动成功。 原生语言/断字已接通,W1字体单位与连字重构依赖W2。 整数TFM底座已验收,继续动态字体接线, 页面等W3–W7仍未完成。 以下较早验收和边界属于历史记录,以最新状态为准。

Subsequent P1-T1 acceptance, 2026-11-02: native sfcode adds actual scoped character codes and named spaceskip/xspaceskip nodes. The first-showbox blank-line discrepancy below is now fixed by actual job-entry output/channel state and verified in six CLI combinations; all 1204 workspace tests and prior gates pass. G1 input context/errorcontextlines/show/showthe remain paused/incomplete. Earlier audit and scope below are historical.

Additional audit, 2026-11-02: a first showbox in a fresh job with no prior message and tracingonline<=0 has one fewer blank line before OK in native output than actual TeX. The previously accepted five-show fixture does not cover this initial channel state. No output normalization hides the mismatch. It remains open under G1, along with real input context/errorcontextlines and basic show/showthe. The implementation and the original scoped acceptance below are unchanged by this audit.

Route-D now consumes showboxbreadth/showboxdepth in real recursive showbox inspection. It retains original node semantics while constructing/packing native material, rather than inferring TeX lists from painted coordinates. There is no v1/string fallback, template rule, font replacement or runtime TeX subprocess.

Owned semantics and state

NativeBox keeps its original horizontal diagnostic nodes before glue setting converts material to frozen paint items. Native vertical lists retain named baseline/line/par/display glue, and paragraph lines retain actual selected material, unadjusted left/right/fill skips and their real glue setting. DiagnosticBox contains semantic dimensions/setting/children only; it never recursively duplicates a nested box's painted contents. Twelve nested box copies roundtrip through bounded JSON without exponential paint/diagnostic cross-copying. Rendering continues to use the existing measured content.

Supported nodes include real nested hbox/vbox/vtop, characters/raw font slots, ligatures and their components, implicit/explicit kerns, glue and all orders, named parameter glue, penalties, discretionaries/pre-break lists, indentation, rules (including running width), paragraph line boxes and simple math characters/boundaries. The printer uses actual dimensions, shifts and glue ratios. It follows TeX's five-item fallback for nonpositive breadth, per-list etc. truncation, negative-depth root suppression and child [] markers; these rules do not change the stored parameter values.

The two parameters have genuine INITEX zero defaults and scoped/global/ globaldefs/arithmetic/the semantics (62 typed parameters total). Showbox reads the actual register without moving/copying its contents, ending a paragraph, changing dimensions or repacking. It operates in supported current modes, including inspection of an old register while its replacement is being built. It terminates current character joining, so f-showbox-i cannot become fi.

Font display identifiers track TeX's latest real font definition, even when a resource is reused or a local selector subsequently goes out of scope. Let or selection alone does not rename the resource. Physical font identity and resource-owned hyphen/skew integers remain unchanged. Escape/newline handling, protected ^^ byte notation, ligature components, physical 79-column wrapping and glue-set formatting are verified against actual INITEX output.

The new diagnostics exposed and corrected genuine state details:

  • Restricted hboxes do not insert implicit discretionary nodes after a literal hyphen; ordinary paragraphs still do. Explicit discretionary commands keep their real restricted-mode behavior.
  • Selected paragraph discretionary nodes remain in the line as an empty node, before any moved pre-break glyph. Diagnostic lines retain this real material.
  • Actual INITEX newlinechar is zero; the native INITEX profile now initializes it correctly. The convenience non-INITEX bootstrap policy is unchanged.

These are construction/profile fixes, not diagnostic text substitutions.

Output and intentional show status

Event::ShowBox retains index, raw breadth/depth, source span, destination and formatted body. Library consumers may inspect the event or attach the optional live observer. Explicit file/write I/O remains mandatory and unchanged. CLI Files routes bodies to the real transcript only when tracingonline<=0, otherwise to transcript and terminal. The OK confirmation reaches both, with its transcript hint on the terminal only. TeX's resumed two-channel newline uses either stream's pending-line state; this matters after a log-only display following a message. Sink failures propagate and protect existing PDFs.

Show commands intentionally continue execution under the native noninteractive policy. The CLI finishes real I/O and PDF export, then returns status 1 for intentional show diagnostics, as observed from pdfTeX nonstop mode. It does not print a fabricated native error or treat a source/I/O error as a successful show job. Fatal execution/lowering failures retain the existing PDF protection. This is not interactive recovery or a complete TeX history/interaction profile.

Acceptance

Four new core integration tests cover 152 actual INITEX recursive box/list, breadth/depth/glue cases, 24 exact paragraph-list cases, 24 byte-printer cases, aliases/global font names, scopes, non-destructive inspection, trusted JSON, deep copies, source dependencies, observer failures and output capacity. Only supported actual semantics are compared; no coordinate-based tree is fabricated to satisfy the oracle.

A new CLI integration test checks real channel contents, ordering, cross-stream newlines, nonzero show status with continued PDF output, byte-identical native PDF versus a control job, and failed-log protection. There are now 17 CLI tests (native_execution 12, native_job_io 5).

Frozen full workspace: 1200 passed / 0 failed. Release, fmt/diff and every prior native/Math D gate pass. The new release diagnostic fixture has five exact show bodies, only intentional OK messages and exit codes [1,1]. Both native/reference PDFs have one page / 19 words in identical order; max word-box errors xMin 0.004315, xMax 0.005262, yMin 0.000722 and yMax 0.001078bp, below the unchanged 0.02bp gate. Its final raster was inspected.

The prior eight word-box PDF gates, full delimiter/accent/128-slot ink gates, 452 delimiter DVI, 438 accent DVI/28 mutable-hyphen, 2816 slot predicates +4 font queries, 61 missing-character diagnostics/267 raw-slot, 58 display vlist/ 36 page/24 state, 100 interline vlist/64 page, 205 box, 119 paragraph, 117 math list/88 break, 90 token, 101 quantity, 12 filesystem and actual shipout-I/O/ pack-state comparisons remain green. Math D remains three pages, rule y error +0.1035625bp and identical 144dpi formula ink bounds.

cargo test -p texrra-tex-core --offline --test execution_diagnostics -- --nocapture
cargo test --offline --test native_job_io
cargo test --workspace --offline -- --test-threads=1
cargo build --release --offline
python3 scripts/check-native-diagnostics.py --binary target/release/texrra \
  --output-dir /tmp/texrra-native-diagnostics/diagnostic-pdf \
  --json /tmp/texrra-native-diagnostics/diagnostic-pdf/audit.json

Final evidence: /tmp/texrra-native-diagnostics/ contains accepted-core.log, accepted-cli.log, accepted-workspace.log, accepted-release.log, diagnostic-pdf/ PDF/raster/audit JSON, previous PDF/ink audits, format-probe-final.json and math-regression.json. Early failed raw-node/printer/channel probes are retained separately. The dedicated diagnostic-job gate requires exact show status/body and rejects other errors; previous status-zero/PDF gates were not weakened.

Real boundary and explicit limitations

The unchanged entry-SHA-pinned LaTeX2e 2025-11-01 now passes showboxbreadth and showboxdepth at 524/525 and stops at latex.ltx:526:1, missing errorcontextlines. Actual auxiliary time/date I/O and original directory checks still run; format_boot_passed=false. No source, guard or version constant was changed.

Next preserve real input/macro expansion context and consume errorcontextlines in actual error/context printing. Do not register an unused flag. Showlists, showthe/show, full interaction/error recovery and source-context output remain open. Compound math boxes and math glue subtype diagnostics require retained native math hlist/vlist structure; expanding such unsupported material errors. A genuine depth/breadth cutoff can suppress traversal, as in TeX, but an empty invented box/list is never emitted for unsupported contents. Their existing measured math rendering remains available independently of inspection.

General fonts/NFSS/VF/map/Unicode shaping, complete math/operator/alignment coverage, native page/output/shipout/whatsits, full format closure/dump/load and realtime checkpoints remain open. HTTP/project endpoints have not migrated; the Nimbus/SFTT versus Liberation template font gap persists. The Unicode-scalar mouth still does not certify pdfTeX UTF-8 byte-input conformance.