<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: miaoduitw-creator</title>
    <description>The latest articles on DEV Community by miaoduitw-creator (@miaoduitwcreator).</description>
    <link>https://dev.to/miaoduitwcreator</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4273155%2F7cba8d86-4a46-4404-846d-1172ca6b0f51.png</url>
      <title>DEV Community: miaoduitw-creator</title>
      <link>https://dev.to/miaoduitwcreator</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/miaoduitwcreator"/>
    <language>en</language>
    <item>
      <title>Stop LLMs From Hallucinating Invoice Math in n8n: A Free Deterministic BigInt Guardrail Blueprint</title>
      <dc:creator>miaoduitw-creator</dc:creator>
      <pubDate>Mon, 30 Nov 2026 04:00:11 +0000</pubDate>
      <link>https://dev.to/miaoduitwcreator/stop-llms-from-hallucinating-invoice-math-in-n8n-a-free-deterministic-bigint-guardrail-blueprint-30n7</link>
      <guid>https://dev.to/miaoduitwcreator/stop-llms-from-hallucinating-invoice-math-in-n8n-a-free-deterministic-bigint-guardrail-blueprint-30n7</guid>
      <description>&lt;p&gt;If you have built an automated Accounts Payable workflow in &lt;strong&gt;n8n&lt;/strong&gt; or &lt;strong&gt;Make.com&lt;/strong&gt; (Email PDF → OpenAI/Claude/Mistral OCR → Google Sheets / ERP), you have probably run into the quietest bug in production AI automation:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;LLMs are great at reading unstructured invoices, and terrible at exact arithmetic.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In real B2B invoices, an LLM will confidently output JSON like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;quantity: 3&lt;/code&gt;, &lt;code&gt;unit_price: 19.99&lt;/code&gt;, &lt;code&gt;line_total: 65.00&lt;/code&gt; &lt;em&gt;(Actual math: &lt;code&gt;$59.97&lt;/code&gt; — a &lt;code&gt;+$5.03&lt;/code&gt; hallucination that cascades into wrong tax and wrong grand total)&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;Silently dropping the minus sign on accounting credit notes like &lt;code&gt;(50.00)&lt;/code&gt;, turning a &lt;code&gt;-$50&lt;/code&gt; discount into &lt;code&gt;+$50&lt;/code&gt; (a &lt;code&gt;$100&lt;/code&gt; overpayment error)&lt;/li&gt;
&lt;li&gt;Tripping over IEEE-754 floating-point drift (&lt;code&gt;0.1 + 0.2 = 0.30000000000000004&lt;/code&gt;) or mixing 0-decimal currencies (&lt;code&gt;JPY&lt;/code&gt;, &lt;code&gt;TWD&lt;/code&gt;) with 2-decimal currencies (&lt;code&gt;USD&lt;/code&gt;, &lt;code&gt;EUR&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Asking a second LLM prompt to "double-check the math" burns tokens and still hallucinates.&lt;/p&gt;




&lt;h3&gt;
  
  
  The Fix: Put a Zero-Scraping Deterministic Guardrail Node Between Your LLM and Your ERP
&lt;/h3&gt;

&lt;p&gt;Instead of maintaining fragile custom JS Code nodes for every client workflow, we packaged two stateless, pure-compute, zero-scraping MCP / API tools on Apify Store—plus &lt;strong&gt;free MIT-licensed n8n &amp;amp; Make.com workflow JSON blueprints&lt;/strong&gt; you can import in 10 seconds:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Structured Invoice &amp;amp; PO Deterministic Validator&lt;/strong&gt; (&lt;code&gt;$0.004 / invoice&lt;/code&gt; Pay-Per-Event, zero proxy cost)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Runs exact &lt;code&gt;BigInt&lt;/code&gt; minor-unit integer math across every line item, subtotal, tax-inclusive/exclusive calculation, discount, and grand total.&lt;/li&gt;
&lt;li&gt;Detects duplicate OCR lines, reversed dates, and validates EU/UK VAT, US EIN, and Taiwan GUI / ROC dates.&lt;/li&gt;
&lt;li&gt;Returns machine-readable diff codes (&lt;code&gt;hallucinationDetected&lt;/code&gt;, &lt;code&gt;expected&lt;/code&gt;, &lt;code&gt;actual&lt;/code&gt;, &lt;code&gt;delta&lt;/code&gt;) plus an auto-corrected &lt;code&gt;normalizedInvoice&lt;/code&gt; JSON.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Live 3-second example catching 4 cascading LLM math errors&lt;/strong&gt;: &lt;a href="https://apify.com/snowy_divide_r1t/structured-invoice-line-validator/examples/catch-llm-math-hallucinations-in-b2b-invoice-live-example" rel="noopener noreferrer"&gt;https://apify.com/snowy_divide_r1t/structured-invoice-line-validator/examples/catch-llm-math-hallucinations-in-b2b-invoice-live-example&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Apify Store page&lt;/strong&gt;: &lt;a href="https://apify.com/snowy_divide_r1t/structured-invoice-line-validator" rel="noopener noreferrer"&gt;https://apify.com/snowy_divide_r1t/structured-invoice-line-validator&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;RAG Table-Aware Markdown &amp;amp; HTML Chunker&lt;/strong&gt; (&lt;code&gt;$0.002 / document&lt;/code&gt; Pay-Per-Event)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fixes the #2 silent killer in AI automation: naive character splitters slicing financial and pricing tables mid-row so downstream chunks lose their column headers.&lt;/li&gt;
&lt;li&gt;Splits oversized tables strictly along row boundaries, &lt;strong&gt;auto-repeats the original table header row&lt;/strong&gt; on every continuation chunk (&lt;code&gt;tableSplitPart: "1/N"&lt;/code&gt;), injects &lt;code&gt;H1 &amp;gt; H2 &amp;gt; H3&lt;/code&gt; heading breadcrumbs, and calculates CJK + English token counts (&lt;code&gt;o200k&lt;/code&gt;, &lt;code&gt;cl100k&lt;/code&gt;, &lt;code&gt;claude&lt;/code&gt;, &lt;code&gt;gemini&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Live financial Markdown table example&lt;/strong&gt;: &lt;a href="https://apify.com/snowy_divide_r1t/rag-table-aware-chunker/examples/split-financial-markdown-report-without-breaking-tables" rel="noopener noreferrer"&gt;https://apify.com/snowy_divide_r1t/rag-table-aware-chunker/examples/split-financial-markdown-report-without-breaking-tables&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Apify Store page&lt;/strong&gt;: &lt;a href="https://apify.com/snowy_divide_r1t/rag-table-aware-chunker" rel="noopener noreferrer"&gt;https://apify.com/snowy_divide_r1t/rag-table-aware-chunker&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;




&lt;h3&gt;
  
  
  Free Ready-to-Import n8n &amp;amp; Make Blueprints (MIT License)
&lt;/h3&gt;

&lt;p&gt;All templates are open-source with zero hardcoded credentials:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;n8n Invoice OCR + Deterministic Audit Guardrail JSON&lt;/strong&gt;: &lt;a href="https://mcp.miaodui.workers.dev/templates/n8n-invoice-ocr-deterministic-audit.json" rel="noopener noreferrer"&gt;https://mcp.miaodui.workers.dev/templates/n8n-invoice-ocr-deterministic-audit.json&lt;/a&gt;

&lt;ul&gt;
&lt;li&gt;Flow: &lt;code&gt;Webhook / PDF OCR → LLM Extract → Deterministic BigInt Audit → IF hallucinationDetected → Slack Alert / Clean Google Sheets &amp;amp; ERP&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;n8n Table-Safe RAG Ingestion JSON&lt;/strong&gt;: &lt;a href="https://mcp.miaodui.workers.dev/templates/n8n-rag-table-safe-chunking.json" rel="noopener noreferrer"&gt;https://mcp.miaodui.workers.dev/templates/n8n-rag-table-safe-chunking.json&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Make.com HTTP + Router Blueprint &amp;amp; MCP Config JSON&lt;/strong&gt;: &lt;a href="https://mcp.miaodui.workers.dev/templates/make-invoice-audit-and-mcp-config.json" rel="noopener noreferrer"&gt;https://mcp.miaodui.workers.dev/templates/make-invoice-audit-and-mcp-config.json&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GitHub Template Repository (MIT)&lt;/strong&gt;: &lt;a href="https://github.com/miaoduitw-creator/miaodui-mcp-templates" rel="noopener noreferrer"&gt;https://github.com/miaoduitw-creator/miaodui-mcp-templates&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  Use Directly Inside Claude Desktop or Cursor via MCP
&lt;/h3&gt;

&lt;p&gt;Both tools also work natively as MCP tools through &lt;code&gt;@apify/actors-mcp-server&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"mcpServers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"miaodui-pure-compute"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"npx"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"args"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="s2"&gt;"-y"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"@apify/actors-mcp-server"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"--actors"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"snowy_divide_r1t/structured-invoice-line-validator,snowy_divide_r1t/rag-table-aware-chunker"&lt;/span&gt;
      &lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"env"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nl"&gt;"APIFY_TOKEN"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&amp;lt;apify-api-token&amp;gt;"&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Try Both Algorithms Live in Your Browser (Zero Login, Zero Data Uploaded)
&lt;/h3&gt;

&lt;p&gt;Before wiring anything into n8n or Make, you can test messy invoice JSON or complex Markdown/HTML tables 100% client-side in our interactive sandbox:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://mcp.miaodui.workers.dev/" rel="noopener noreferrer"&gt;https://mcp.miaodui.workers.dev/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you run AI automation workflows for finance or RAG pipelines, what other "messy LLM output → strict deterministic JSON" edge cases keep breaking your automations?&lt;/p&gt;

</description>
      <category>ai</category>
      <category>n8n</category>
      <category>mcp</category>
      <category>automation</category>
    </item>
    <item>
      <title>How I Built a 200MB Streaming JSONL Eval Diff Viewer for VS Code and Cursor With Zero Runtime Dependencies</title>
      <dc:creator>miaoduitw-creator</dc:creator>
      <pubDate>Mon, 30 Nov 2026 03:39:31 +0000</pubDate>
      <link>https://dev.to/miaoduitwcreator/how-i-built-a-200mb-streaming-jsonl-eval-diff-viewer-for-vs-code-and-cursor-with-zero-runtime-3926</link>
      <guid>https://dev.to/miaoduitwcreator/how-i-built-a-200mb-streaming-jsonl-eval-diff-viewer-for-vs-code-and-cursor-with-zero-runtime-3926</guid>
      <description>&lt;p&gt;When you iterate on LLM prompts, RAG pipelines, or local model quantizations, your most important artifact is usually two boring &lt;code&gt;.jsonl&lt;/code&gt; files: &lt;code&gt;baseline.jsonl&lt;/code&gt; and &lt;code&gt;candidate.jsonl&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Yet inspecting what actually regressed between those two files inside an editor is surprisingly painful:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Webview OOM freezes&lt;/strong&gt;: Naive extensions &lt;code&gt;fs.readFileSync()&lt;/code&gt; a 120MB JSONL file, &lt;code&gt;JSON.parse()&lt;/code&gt; every row, and shove the entire array into &lt;code&gt;webview.postMessage()&lt;/code&gt;. The renderer stalls or crashes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dirty real-world logs&lt;/strong&gt;: Long eval runs crash mid-write, leaving trailing truncated JSON lines or blank lines. Standard parsers throw on line 4,812 and refuse to render the other 4,811 valid cases.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;XSS inside eval datasets&lt;/strong&gt;: Safety and red-team benchmarks routinely contain &lt;code&gt;&amp;lt;script&amp;gt;alert("xss")&amp;lt;/script&amp;gt;&lt;/code&gt; payloads in prompts and completions. Dropping raw eval text into an HTML report or Webview is an instant security bug.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cloud privacy blockers&lt;/strong&gt;: Many teams working on healthcare, finance, or internal enterprise tools simply cannot upload customer prompts to hosted cloud eval dashboards.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;To solve this for my own workflow, I built &lt;strong&gt;EvalDiff&lt;/strong&gt; (&lt;code&gt;v0.2.0&lt;/code&gt;)—a 100% local, strictly read-only extension for Cursor, Windsurf, VSCodium, Antigravity, and VS Code with &lt;strong&gt;zero third-party runtime npm dependencies&lt;/strong&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Live interactive preview: &lt;a href="https://evaldiff.miaodui.workers.dev/" rel="noopener noreferrer"&gt;https://evaldiff.miaodui.workers.dev/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;MIT source code: &lt;a href="https://github.com/miaoduitw-creator/evaldiff-workbench" rel="noopener noreferrer"&gt;https://github.com/miaoduitw-creator/evaldiff-workbench&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Open VSX install: &lt;a href="https://open-vsx.org/extension/miaodui/evaldiff-workbench" rel="noopener noreferrer"&gt;https://open-vsx.org/extension/miaodui/evaldiff-workbench&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here are the four concrete engineering patterns that made it fast, safe, and crash-proof.&lt;/p&gt;




&lt;h3&gt;
  
  
  1. Streaming Line-by-Line With Three Circuit Breakers
&lt;/h3&gt;

&lt;p&gt;Instead of buffering an entire file into memory, &lt;code&gt;src/diffEngine.js&lt;/code&gt; uses only Node.js built-ins (&lt;code&gt;fs.createReadStream&lt;/code&gt; and &lt;code&gt;readline&lt;/code&gt;) with three explicit safety guards:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Pre-read file size guard (&lt;code&gt;maxFileSizeMB&lt;/code&gt;, default 200MB)&lt;/strong&gt; via &lt;code&gt;fs.promises.stat&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Per-field character truncation (&lt;code&gt;maxFieldChars&lt;/code&gt;, default 8,000 chars)&lt;/strong&gt; so a single 2MB retrieved document does not blow up the heap.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Buffered memory circuit breaker (&lt;code&gt;maxBufferedBytes&lt;/code&gt;, default 64MB)&lt;/strong&gt; that cleanly closes the stream instead of triggering V8 OOM.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;stream&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;fs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;createReadStream&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;filePath&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;encoding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'utf8'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;highWaterMark&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;64&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;1024&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;rl&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;readline&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;createInterface&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;input&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;stream&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;crlfDelay&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;Infinity&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="n"&gt;rl&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;totalLines&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;trimmed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;trim&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;trimmed&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;blankLines&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="k"&gt;continue&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;parsed&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;parsed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;trimmed&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;parseErr&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;malformedCount&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="n"&gt;malformedLines&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;lineNumber&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;totalLines&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;rawPreview&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;trimmed&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;slice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;160&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;error&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;parseErr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="k"&gt;continue&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;normalized&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;normalizeRecord&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;parsed&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;totalLines&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;maxFieldChars&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;recBytes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;estimateRecordBytes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;normalized&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;bufferedBytes&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;recBytes&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;maxBufferedBytes&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;records&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;truncated&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="n"&gt;truncationReason&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'MEMORY_LIMIT'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="n"&gt;bufferedBytes&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;recBytes&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;records&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;normalized&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;finally&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;rl&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;close&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;stream&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;destroy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice two details:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Corrupted lines never abort the diff—they are isolated with exact line numbers and a 160-char preview.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;finally&lt;/code&gt; block guarantees file descriptors are closed immediately if the memory circuit breaker trips.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  2. Extension Host Owns the Dataset; Webview Gets 50 Rows at a Time
&lt;/h3&gt;

&lt;p&gt;A common VS Code extension anti-pattern is sending the full parsed array to the Webview and filtering in browser JS. In EvalDiff, all filtering (&lt;code&gt;status: regression | improvement | unchanged | added | removed&lt;/code&gt;), keyword search, sorting (&lt;code&gt;regressionFirst&lt;/code&gt;), and human review state stay inside the Extension Host.&lt;/p&gt;

&lt;p&gt;The Webview only sends tiny query messages (&lt;code&gt;{ status: 'regression', search: 'SELECT', page: 1 }&lt;/code&gt;) and receives:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;One lightweight KPI &lt;code&gt;summary&lt;/code&gt; object (&amp;lt; 2KB)&lt;/li&gt;
&lt;li&gt;Exactly one paginated slice (&lt;code&gt;50&lt;/code&gt; cases by default)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When the panel closes (&lt;code&gt;panel.onDidDispose&lt;/code&gt;), the Extension Host drops its reference immediately so GC reclaims memory.&lt;/p&gt;




&lt;h3&gt;
  
  
  3. Strictly Read-Only Data Safety + Strict XSS Escaping
&lt;/h3&gt;

&lt;p&gt;Unlike generic data tools that open local SQLite databases in read-write mode (risking WAL locks or file corruption), EvalDiff never opens source &lt;code&gt;.jsonl&lt;/code&gt; files for writing. Our unit test suite verifies SHA-256 hashes of both input files before and after diffing to prove zero bytes changed.&lt;/p&gt;

&lt;p&gt;Human Pass/Fail review annotations live separately in VS Code &lt;code&gt;context.workspaceState&lt;/code&gt;, keyed by a SHA-1 hash of the file pair.&lt;/p&gt;

&lt;p&gt;Meanwhile, both the Webview UI and exported standalone HTML audit reports lock down a strict nonce CSP (&lt;code&gt;default-src 'none'; style-src 'unsafe-inline'; script-src 'nonce-...'&lt;/code&gt;) and escape every dynamic field:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;escapeHtml&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="kc"&gt;undefined&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s1"&gt;''&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nb"&gt;String&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;/&amp;amp;/&lt;/span&gt;&lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'&amp;amp;amp;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;/&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'&amp;amp;lt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;/&amp;gt;/&lt;/span&gt;&lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'&amp;amp;gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="s2"&gt;"/g, '&amp;amp;quot;')
    .replace(/'/g, '&amp;amp;#39;');
}
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  4. Schema-Agnostic Auto-Detection Across Eval Frameworks
&lt;/h3&gt;

&lt;p&gt;AI teams rarely agree on JSONL column names. OpenAI Evals writes &lt;code&gt;sample_id&lt;/code&gt; + &lt;code&gt;messages&lt;/code&gt; + &lt;code&gt;completion&lt;/code&gt;, Promptfoo often exports &lt;code&gt;case_id&lt;/code&gt; + &lt;code&gt;response&lt;/code&gt; + &lt;code&gt;duration_ms&lt;/code&gt;, and custom Python scripts use &lt;code&gt;score&lt;/code&gt; or boolean &lt;code&gt;passed&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Instead of forcing users to write a YAML mapping config, &lt;code&gt;normalizeRecord&lt;/code&gt; resolves common aliases in priority order—even flattening OpenAI &lt;code&gt;messages&lt;/code&gt; arrays and summing &lt;code&gt;usage.prompt_tokens + usage.completion_tokens&lt;/code&gt; when &lt;code&gt;total_tokens&lt;/code&gt; is absent.&lt;/p&gt;

&lt;p&gt;If you want framework-specific setup notes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;OpenAI Evals guide: &lt;a href="https://evaldiff.miaodui.workers.dev/openai-evals-jsonl-viewer" rel="noopener noreferrer"&gt;https://evaldiff.miaodui.workers.dev/openai-evals-jsonl-viewer&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Promptfoo local diff guide: &lt;a href="https://evaldiff.miaodui.workers.dev/promptfoo-regression-diff" rel="noopener noreferrer"&gt;https://evaldiff.miaodui.workers.dev/promptfoo-regression-diff&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Offline alternative to cloud eval SaaS: &lt;a href="https://evaldiff.miaodui.workers.dev/langsmith-offline-alternative" rel="noopener noreferrer"&gt;https://evaldiff.miaodui.workers.dev/langsmith-offline-alternative&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  5. Zero-Telemetry Offline-First Licensing
&lt;/h3&gt;

&lt;p&gt;For monetization, I wanted an honest split that never compromises offline privacy:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Free (MIT Core)&lt;/strong&gt;: Unlimited single-file &lt;code&gt;.jsonl&lt;/code&gt; inspection, side-by-side diff up to 100 cases with KPI summary, malformed line diagnostics, local Pass/Fail review, and one-click Markdown PR summary copy.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pro via Polar.sh&lt;/strong&gt; (&lt;a href="https://buy.polar.sh/polar_cl_nMSyyPwti0sOEmPtdC78FyS0rcU7BnEvuJz0f3VQXpq" rel="noopener noreferrer"&gt;Solo $29/yr&lt;/a&gt; | &lt;a href="https://buy.polar.sh/polar_cl_mOSAPBcVhNeTAbunDHuWjUvrujdvKykymqEDk2nmSat" rel="noopener noreferrer"&gt;Team 5-Seat $99/yr&lt;/a&gt;): Unlimited dataset diffing and one-click export of standalone offline HTML/CSV regression audit reports.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;License activation uses Polar's public Customer Portal endpoint (&lt;code&gt;POST /v1/customer-portal/license-keys/activate&lt;/code&gt;) with no private tokens in the extension—and it only fires when a user explicitly runs &lt;code&gt;EvalDiff: Activate Pro License Key&lt;/code&gt;. After activation, the license state is cached in VS Code &lt;code&gt;globalState&lt;/code&gt;, so everyday usage remains 100% offline.&lt;/p&gt;




&lt;h3&gt;
  
  
  Try It Locally in 10 Seconds
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/miaoduitw-creator/evaldiff-workbench.git
&lt;span class="nb"&gt;cd&lt;/span&gt; evaldiff-workbench
npm &lt;span class="nb"&gt;test&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;All 12 unit tests (streaming fault tolerance, read-only SHA-256 verification, regression math, OOM circuit breakers, XSS escaping, and mocked Polar license lifecycle) run on Node's built-in &lt;code&gt;node:test&lt;/code&gt; runner with zero &lt;code&gt;npm install&lt;/code&gt; step.&lt;/p&gt;

&lt;p&gt;Or install directly from Open VSX for Cursor / Windsurf / VSCodium / Antigravity:&lt;br&gt;
&lt;a href="https://open-vsx.org/extension/miaodui/evaldiff-workbench" rel="noopener noreferrer"&gt;https://open-vsx.org/extension/miaodui/evaldiff-workbench&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>vscode</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
