Fix lualatex stdin PDF gen + unit test for signed estimate PDF

GenerateEstimatePdf passed /dev/stdin as the input filename so lualatex
treats stdin as a regular input file instead of the terminal — without
it, lualatex emergency-stops after the first line of a multi-line
document (the real root cause of the production "Emergency stop", not
bera/luaotfload which were separate host-package gaps already fixed).

EstimatePdf endpoint calls GenerateEstimatePdf directly and streams the
returned FileInfo, guarding on fo.Exists. QueryAcceptanceRequest is
extracted into its own file under ViewModels/FrontOffice.

Add EstimatePdfGenerationTests: unit tests for SignatureToTikz (vector
draws of both signatures) and GenerateEstimatePdf on a devis signed by
both parties — asserts the PDF exists at the expected DestDir path, is
non-empty, and that only the PDF persists (aux/log cleaned). Skips
cleanly when lualatex is absent.

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
Paul Schneider 2026-09-22 18:33:47 +01:00
commit 35d784fdf1
Signed by: notazof
GPG key ID: AD4B9B545FBD7D12
4 changed files with 242 additions and 41 deletions

View file

@ -202,6 +202,14 @@ namespace Yavsc.Helpers
// the PDF on stdout — so the pdf lands at its final destination
// and we only clean the transient aux/log artifacts beside it.
//
// We pass "/dev/stdin" as the input filename so lualatex treats
// stdin as a regular input *file* rather than the terminal: with
// no filename argument it reads stdin in terminal mode, which
// emergency-stops after the first line of a multi-line document.
// /dev/stdin makes the full multi-line TeX compile cleanly. (The
// API host is Linux — the systemd service and lualatex dep are
// Linux-only too.)
//
// We capture stdout/stderr so a LaTeX error (missing .sty,
// missing \includegraphics target, …) is surfaced in
// GenerationErrorMessage instead of being buried in the .log
@ -218,7 +226,8 @@ namespace Yavsc.Helpers
WorkingDirectory = billdir,
FileName = "lualatex",
Arguments = $"-interaction=nonstopmode -halt-on-error"
+ $" -jobname=\"{name}\" -output-directory=\"{billdir}\"",
+ $" -jobname=\"{name}\" -output-directory=\"{billdir}\""
+ " /dev/stdin",
RedirectStandardInput = true,
RedirectStandardOutput = true,
RedirectStandardError = true,