<?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</title>
    <description>The most recent home feed on DEV Community.</description>
    <link>https://dev.to</link>
    <atom:link rel="self" type="application/rss+xml" href="https://practicaldev-herokuapp-com.global.ssl.fastly.net/feed"/>
    <language>en</language>
    <item>
      <title>Gauge Chart for Cluster Resource Utilisation</title>
      <dc:creator>paohaijiao</dc:creator>
      <pubDate>Mon, 16 Nov 2026 01:13:56 +0000</pubDate>
      <link>https://dev.to/paohaijiao/gauge-chart-for-cluster-resource-utilisation-5hhm</link>
      <guid>https://dev.to/paohaijiao/gauge-chart-for-cluster-resource-utilisation-5hhm</guid>
      <description>&lt;h1&gt;
  
  
  Gauge Chart for Cluster Resource Utilisation
&lt;/h1&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;jquick-pdf by example&lt;/strong&gt; — demo #22 of 184. Every article in this series ships one complete, runnable demo: a template file and a Java class. No snippets, no omissions.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;CPU, memory and disk expressed as dials on a single ops dashboard page.&lt;/p&gt;

&lt;p&gt;This document belongs to the &lt;strong&gt;Business chart series&lt;/strong&gt; set.&lt;/p&gt;

&lt;h2&gt;
  
  
  What you'll build
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A PDF written to &lt;code&gt;D:/test/biz/22_resource_usage.pdf&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;A template file (&lt;code&gt;report/biz/22_resource_usage.txt&lt;/code&gt;) with &lt;strong&gt;1&lt;/strong&gt; bound placeholder&lt;/li&gt;
&lt;li&gt;A detail grid of &lt;strong&gt;8&lt;/strong&gt; rows × &lt;strong&gt;5&lt;/strong&gt; columns, laid out with &lt;code&gt;width:100%&lt;/code&gt; so it fills the text area&lt;/li&gt;
&lt;li&gt;One self-contained Java class (&lt;code&gt;JQuickBiz22ResourceUsageTest&lt;/code&gt;) that binds the data and renders the file&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Bound placeholders&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;${svg}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;Java 8+ and one dependency — jquick-pdf is built on &lt;strong&gt;Apache PDFBox&lt;/strong&gt;, not iText:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;dependency&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;groupId&amp;gt;&lt;/span&gt;io.github.paohaijiao&lt;span class="nt"&gt;&amp;lt;/groupId&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;artifactId&amp;gt;&lt;/span&gt;jquick-pdfx&lt;span class="nt"&gt;&amp;lt;/artifactId&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;version&amp;gt;&lt;/span&gt;4.2.0&lt;span class="nt"&gt;&amp;lt;/version&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/dependency&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Coordinates: &lt;code&gt;io.github.paohaijiao:jquick-pdfx:4.2.0&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1 — the template file
&lt;/h2&gt;

&lt;p&gt;JPdfX is jquick-pdf's HTML-like template language. It lives in its own file (&lt;code&gt;src/test/resources/report/biz/22_resource_usage.txt&lt;/code&gt;) instead of a Java string, so designers can edit it without touching code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;pdf&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"marginBottom:10px; padding:10px; backgroundColor:#ECEFF1; borderTop:3px solid #37474F; borderRadius:4px; keepTogether:true"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;h2&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"color:#37474F; marginTop:0px; marginBottom:6px; fontSize:15pt; bold:true; textAlignment:center"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;'资源使用率监控'&lt;span class="nt"&gt;&amp;lt;/h2&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;p&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"fontSize:9pt; color:#6c757d; textAlignment:center; marginBottom:6px"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;'统计周期：2025年9月 | 数据来源：政务云运维中心 | 指标：CPU / 内存 / 磁盘综合使用率'&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"display:flex; justifyContent:center"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;svg&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"width:700pt"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;${svg}&lt;span class="nt"&gt;&amp;lt;/svg&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;p&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"fontSize:9pt; color:#6c757d; italic:true; textAlignment:center; marginTop:6px"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;'图 1  集群综合资源使用率仪表盘（当前值 78.0%）'&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;

  &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"marginBottom:10px"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"borderLeft:4px solid #37474F; paddingLeft:8px; marginBottom:6px"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;h2&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"color:#37474F; fontSize:13pt; bold:true; marginTop:0px; marginBottom:0px"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;'二、节点资源使用明细'&lt;span class="nt"&gt;&amp;lt;/h2&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;table&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"width:560px; fontSize:9pt"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;tr&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;th&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"width:160px; backgroundColor:#37474F; color:white; padding:6px; textAlign:center; border:1px solid #CFD8DC"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;'计算节点'&lt;span class="nt"&gt;&amp;lt;/th&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;th&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"width:105px; backgroundColor:#37474F; color:white; padding:6px; textAlign:center; border:1px solid #CFD8DC"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;'CPU 使用率'&lt;span class="nt"&gt;&amp;lt;/th&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;th&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"width:105px; backgroundColor:#37474F; color:white; padding:6px; textAlign:center; border:1px solid #CFD8DC"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;'内存使用率'&lt;span class="nt"&gt;&amp;lt;/th&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;th&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"width:105px; backgroundColor:#37474F; color:white; padding:6px; textAlign:center; border:1px solid #CFD8DC"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;'磁盘使用率'&lt;span class="nt"&gt;&amp;lt;/th&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;th&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"width:85px; backgroundColor:#37474F; color:white; padding:6px; textAlign:center; border:1px solid #CFD8DC"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;'状态'&lt;span class="nt"&gt;&amp;lt;/th&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;/tr&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;tr&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;td&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"padding:5px; border:1px solid #CFD8DC"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;'计算节点 N01'&lt;span class="nt"&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;td&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"padding:5px; textAlign:right; border:1px solid #CFD8DC"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;'64.0%'&lt;span class="nt"&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;td&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"padding:5px; textAlign:right; border:1px solid #CFD8DC"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;'72.0%'&lt;span class="nt"&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;td&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"padding:5px; textAlign:right; border:1px solid #CFD8DC"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;'60.0%'&lt;span class="nt"&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;td&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"padding:5px; textAlign:center; border:1px solid #CFD8DC"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;'正常'&lt;span class="nt"&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;/tr&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;tr&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;td&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"padding:5px; border:1px solid #CFD8DC"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;'计算节点 N02'&lt;span class="nt"&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;td&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"padding:5px; textAlign:right; border:1px solid #CFD8DC"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;'86.0%'&lt;span class="nt"&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;td&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"padding:5px; textAlign:right; border:1px solid #CFD8DC"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;'89.0%'&lt;span class="nt"&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;td&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"padding:5px; textAlign:right; border:1px solid #CFD8DC"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;'66.0%'&lt;span class="nt"&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;td&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"padding:5px; textAlign:center; border:1px solid #CFD8DC"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;'预警'&lt;span class="nt"&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;/tr&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;tr&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;td&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"padding:5px; border:1px solid #CFD8DC"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;'计算节点 N03'&lt;span class="nt"&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;td&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"padding:5px; textAlign:right; border:1px solid #CFD8DC"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;'93.0%'&lt;span class="nt"&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;td&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"padding:5px; textAlign:right; border:1px solid #CFD8DC"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;'87.0%'&lt;span class="nt"&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;td&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"padding:5px; textAlign:right; border:1px solid #CFD8DC"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;'74.0%'&lt;span class="nt"&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;td&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"padding:5px; textAlign:center; border:1px solid #CFD8DC"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;'高水位'&lt;span class="nt"&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;/tr&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;tr&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;td&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"padding:5px; border:1px solid #CFD8DC"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;'计算节点 N04'&lt;span class="nt"&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;td&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"padding:5px; textAlign:right; border:1px solid #CFD8DC"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;'58.0%'&lt;span class="nt"&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;td&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"padding:5px; textAlign:right; border:1px solid #CFD8DC"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;'65.0%'&lt;span class="nt"&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;td&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"padding:5px; textAlign:right; border:1px solid #CFD8DC"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;'53.0%'&lt;span class="nt"&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;td&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"padding:5px; textAlign:center; border:1px solid #CFD8DC"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;'正常'&lt;span class="nt"&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;/tr&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;tr&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;td&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"padding:5px; border:1px solid #CFD8DC"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;'计算节点 N05'&lt;span class="nt"&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;td&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"padding:5px; textAlign:right; border:1px solid #CFD8DC"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;'80.0%'&lt;span class="nt"&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;td&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"padding:5px; textAlign:right; border:1px solid #CFD8DC"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;'83.0%'&lt;span class="nt"&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;td&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"padding:5px; textAlign:right; border:1px solid #CFD8DC"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;'71.0%'&lt;span class="nt"&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;td&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"padding:5px; textAlign:center; border:1px solid #CFD8DC"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;'关注'&lt;span class="nt"&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;/tr&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;tr&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;td&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"padding:5px; border:1px solid #CFD8DC"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;'计算节点 N06'&lt;span class="nt"&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;td&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"padding:5px; textAlign:right; border:1px solid #CFD8DC"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;'97.0%'&lt;span class="nt"&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;td&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"padding:5px; textAlign:right; border:1px solid #CFD8DC"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;'93.0%'&lt;span class="nt"&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;td&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"padding:5px; textAlign:right; border:1px solid #CFD8DC"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;'83.0%'&lt;span class="nt"&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;td&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"padding:5px; textAlign:center; border:1px solid #CFD8DC"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;'高水位'&lt;span class="nt"&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;/tr&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;tr&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;td&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"padding:6px; backgroundColor:#37474F; color:white; bold:true; border:1px solid #37474F"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;'集群加权均值'&lt;span class="nt"&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;td&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"padding:6px; textAlign:right; backgroundColor:#37474F; color:white; bold:true; border:1px solid #37474F"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;'79.7%'&lt;span class="nt"&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;td&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"padding:6px; textAlign:right; backgroundColor:#37474F; color:white; bold:true; border:1px solid #37474F"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;'81.5%'&lt;span class="nt"&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;td&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"padding:6px; textAlign:right; backgroundColor:#37474F; color:white; bold:true; border:1px solid #37474F"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;'67.8%'&lt;span class="nt"&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;td&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"padding:6px; textAlign:center; backgroundColor:#37474F; color:white; bold:true; border:1px solid #37474F"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;'综合 78.0%'&lt;span class="nt"&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;/tr&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/table&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;

  &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"marginBottom:10px"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"borderLeft:4px solid #37474F; paddingLeft:8px; marginBottom:6px"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;h2&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"color:#37474F; fontSize:13pt; bold:true; marginTop:0px; marginBottom:0px"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;'三、容量管理与扩容建议'&lt;span class="nt"&gt;&amp;lt;/h2&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;list&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"listStyleType:disc; paddingLeft:16px; fontSize:10pt"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;li&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"marginBottom:6px"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;span&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"bold:true; color:#37474F"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;'整体水位：'&lt;span class="nt"&gt;&amp;lt;/span&amp;gt;&lt;/span&gt;'集群综合使用率 78.0%，CPU / 内存 / 磁盘加权均值分别为 79.7% / 81.5% / 67.8%，处于中等偏上水位。'&lt;span class="nt"&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;li&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"marginBottom:6px"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;span&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"bold:true; color:#37474F"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;'高水位节点：'&lt;span class="nt"&gt;&amp;lt;/span&amp;gt;&lt;/span&gt;'计算节点 N06 三项指标达 97.0% / 93.0% / 83.0%，N03 达 93.0% / 87.0% / 74.0%，均需优先扩容。'&lt;span class="nt"&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;li&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"marginBottom:6px"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;span&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"bold:true; color:#37474F"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;'低效节点：'&lt;span class="nt"&gt;&amp;lt;/span&amp;gt;&lt;/span&gt;'计算节点 N04 CPU 仅 58.0%、内存 65.0%，建议通过调度策略迁移部分负载以提升整体利用率。'&lt;span class="nt"&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;li&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"marginBottom:6px"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;span&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"bold:true; color:#37474F"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;'内存是主要瓶颈：'&lt;span class="nt"&gt;&amp;lt;/span&amp;gt;&lt;/span&gt;'内存加权均值 81.5% 高于 CPU 的 79.7%，扩容时应优先增加内存配额。'&lt;span class="nt"&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;li&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"marginBottom:6px"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;span&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"bold:true; color:#37474F"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;'建议：'&lt;span class="nt"&gt;&amp;lt;/span&amp;gt;&lt;/span&gt;'本周内为 N03、N06 各扩容 16 核 / 64GB，并将综合使用率预警阈值由 85% 下调至 80%。'&lt;span class="nt"&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/list&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;

  &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"textAlignment:center; marginTop:10px; paddingTop:10px; borderTop:1px solid #dee2e6; color:#6c757d; fontSize:8pt"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;'数据来源：政务云运维监控平台 | 生成时间：2025年9月30日'&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;'内部资料 · 未经许可请勿外传'&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/pdf&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 2 — the Java class
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;jquick-pdfx/src/test/java/com/github/paohaijiao/biz/chart/JQuickBiz22ResourceUsageTest.java&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="cm"&gt;/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * Copyright (c) [2025-2099] Martin (goudingcheng@gmail.com)
 */&lt;/span&gt;
&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;com&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;github&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;paohaijiao&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;biz&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;chart&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;com&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;github&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;paohaijiao&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;JOption&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;com&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;github&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;paohaijiao&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;JPdfConfig&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;com&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;github&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;paohaijiao&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;demo&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;constant&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;JQuickConstant&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;com&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;github&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;paohaijiao&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;enums&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;JChartType&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;com&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;github&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;paohaijiao&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;executor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;JQuickPdfFactory&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;com&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;github&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;paohaijiao&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;factory&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;JChartRendererFactory&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;com&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;github&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;paohaijiao&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;guage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;GuageConfig&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;com&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;github&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;paohaijiao&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;guage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;JGuageOption&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;org&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;junit&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Test&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;java&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;awt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Color&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;java&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;io&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;File&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;java&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;io&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;FileOutputStream&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;java&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;io&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;IOException&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="cm"&gt;/**
 * 业务场景 Demo 22：资源使用率监控（运维 / 政务云）
 *
 * &amp;lt;p&amp;gt;业务场景：政务云运维中心对计算节点集群的 CPU / 内存综合使用率进行监控，仪表盘分值
 * 表示当前综合使用率（0~100），用于容量水位预警与扩容决策，主色采用运维深灰蓝 #37474F。&amp;lt;/p&amp;gt;
 * &amp;lt;p&amp;gt;实际图表类型：jquick-pdf 无进度图渲染器，&amp;lt;b&amp;gt;实际使用仪表盘 {@link JChartType#Guage} 替代进度图&amp;lt;/b&amp;gt;。&amp;lt;/p&amp;gt;
 *
 * &amp;lt;p&amp;gt;模板：{@code report/biz/22_resource_usage.txt}；图表以 SVG 文本形式绑定到模板的
 * {@code ${svg}} 占位符，输出到 {@code D:\test\biz\22_resource_usage.pdf}。&amp;lt;/p&amp;gt;
 *
 * &amp;lt;p&amp;gt;图表尺寸说明：图表按 700pt × 400pt（宽 × 高）的方形比例设计；模板中 {@code &amp;lt;svg&amp;gt;}
 * 只声明宽度、不声明高度，因此宽度被页面自动收窄时高度会按原比例同步缩放，不会纵向拉伸变形。&amp;lt;/p&amp;gt;
 *
 * @author Martin
 * @version 1.0.0
 */&lt;/span&gt;
&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;JQuickBiz22ResourceUsageTest&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;static&lt;/span&gt; &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;JQuickConstant&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="nd"&gt;@Test&lt;/span&gt;
    &lt;span class="nd"&gt;@SuppressWarnings&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"deprecation"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;biz22ResourceUsage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;throws&lt;/span&gt; &lt;span class="nc"&gt;IOException&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;GuageConfig&lt;/span&gt; &lt;span class="n"&gt;scoreConfig&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;GuageConfig&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;builder&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="nf"&gt;score&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;78&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;pointerColor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Color&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;55&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;71&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;79&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="nf"&gt;backgroundColor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Color&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;236&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;239&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;241&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="nf"&gt;title&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"RESOURCE USAGE"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;build&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="nc"&gt;JGuageOption&lt;/span&gt; &lt;span class="n"&gt;guageOption&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;JGuageOption&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;builder&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="nf"&gt;scoreMeter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;scoreConfig&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;build&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="nc"&gt;JOption&lt;/span&gt; &lt;span class="n"&gt;option&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;JOption&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;option&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setGuageOption&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;guageOption&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

        &lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;svg&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;JChartRendererFactory&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;renderChart&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;JChartType&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Guage&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;option&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

        &lt;span class="nc"&gt;File&lt;/span&gt; &lt;span class="n"&gt;dir&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;File&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s2"&gt;"biz"&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;dir&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;exists&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="n"&gt;dir&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;mkdirs&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="nc"&gt;FileOutputStream&lt;/span&gt; &lt;span class="n"&gt;fileOutputStream&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;FileOutputStream&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s2"&gt;"biz/22_resource_usage.pdf"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="nc"&gt;JPdfConfig&lt;/span&gt; &lt;span class="n"&gt;config&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;JPdfConfig&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="c1"&gt;// 开启 flex 行布局，使模板中的 display:flex 生效（图表居中）&lt;/span&gt;
        &lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getLayoutConfig&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="nf"&gt;setFlexLayout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="nc"&gt;JQuickPdfFactory&lt;/span&gt; &lt;span class="n"&gt;factory&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;JQuickPdfFactory&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="n"&gt;factory&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;bind&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"svg"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;svg&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="kt"&gt;byte&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="n"&gt;bytes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;factory&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;executeResource&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"report/biz/22_resource_usage.txt"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="n"&gt;fileOutputStream&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;bytes&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="n"&gt;fileOutputStream&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="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 3 — run it
&lt;/h2&gt;

&lt;p&gt;The class is a JUnit test, so run it with Maven:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;mvn -pl jquick-pdfx &lt;span class="nb"&gt;test&lt;/span&gt; -Dtest=JQuickBiz22ResourceUsageTest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;…or call the test method from a &lt;code&gt;main&lt;/code&gt; wrapper if you want a plain entry point:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;static&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;String&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;throws&lt;/span&gt; &lt;span class="nc"&gt;Exception&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;JQuickBiz22ResourceUsageTest&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="nf"&gt;biz22ResourceUsage&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;Output: &lt;code&gt;D:/test/biz/22_resource_usage.pdf&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How it works
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Binding a chart SVG into the template
&lt;/h3&gt;

&lt;p&gt;The chart is not a bitmap — &lt;code&gt;JChartRendererFactory.renderChart(...)&lt;/code&gt; returns an &lt;strong&gt;SVG string&lt;/strong&gt;, and the template embeds it with a single &lt;code&gt;&amp;lt;svg&amp;gt;&lt;/code&gt; element bound to &lt;code&gt;${svg}&lt;/code&gt;. That means the chart stays vector-sharp at any zoom level, and it participates in normal flow layout instead of being stamped on top of the page.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Declare only the &lt;strong&gt;width&lt;/strong&gt; on &lt;code&gt;&amp;lt;svg&amp;gt;&lt;/code&gt;; the height is derived from the chart's aspect ratio, so the chart never stretches vertically.&lt;/li&gt;
&lt;li&gt;Open &lt;code&gt;config.getLayoutConfig().setFlexLayout(true)&lt;/code&gt; if the template centers the chart with &lt;code&gt;display:flex&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Bind the SVG string with &lt;code&gt;factory.bind("svg", svg)&lt;/code&gt; — &lt;code&gt;bind()&lt;/code&gt; is pure data injection and never re-parses markup.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;svg&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;JChartRendererFactory&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;renderChart&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;JChartType&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;LINE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;option&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nc"&gt;JQuickPdfFactory&lt;/span&gt; &lt;span class="n"&gt;factory&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;JQuickPdfFactory&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;factory&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;bind&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"svg"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;svg&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kt"&gt;byte&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="n"&gt;bytes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;factory&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;executeResource&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;TEMPLATE&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;
  
  
  Making the table fill the text area
&lt;/h3&gt;

&lt;p&gt;Tables default to content width, which leaves a ragged right margin on a formal document. Setting &lt;code&gt;width:100%&lt;/code&gt; on the &lt;code&gt;&amp;lt;table&amp;gt;&lt;/code&gt; makes it span the full text area; percentage widths on the &lt;strong&gt;first row's&lt;/strong&gt; cells then distribute the remaining space across columns.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Set &lt;code&gt;width:100%&lt;/code&gt; on &lt;code&gt;&amp;lt;table&amp;gt;&lt;/code&gt; and give explicit widths only to the leading columns.&lt;/li&gt;
&lt;li&gt;Label columns need around 100px so labels like &lt;code&gt;Taxpayer ID&lt;/code&gt; do not wrap.&lt;/li&gt;
&lt;li&gt;Leave the last column without a width so it absorbs rounding remainder.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;table&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"width:100%; fontSize:9pt"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;tr&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;td&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"width:100px; padding:5px"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;'Taxpayer ID'&lt;span class="nt"&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;td&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"padding:5px"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;${taxNo}&lt;span class="nt"&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/tr&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/table&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Template syntax cheat sheet
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Syntax&lt;/th&gt;
&lt;th&gt;Meaning&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;&amp;lt;areaBreak&amp;gt;&amp;lt;/areaBreak&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Force the next block onto a fresh page (CSS page-break is not supported).&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;&amp;lt;image src='D:/.../x.png'&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Embed an image. &lt;code&gt;src&lt;/code&gt; is a raw path — it is &lt;strong&gt;not&lt;/strong&gt; evaluated as an expression.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;&amp;lt;svg style="width:479pt"&amp;gt;${svg}&amp;lt;/svg&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Embed a vector chart produced by &lt;code&gt;JChartRendererFactory&lt;/code&gt;.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;// comment&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Line comment. Keep &lt;code&gt;&amp;lt;!-- ... --&amp;gt;&lt;/code&gt; comments short — long ones can blank the render.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;&amp;lt;p style="fontSize:9pt; bold:true"&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Inline styles use camelCase keys, CSS-like values.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Gotchas worth remembering
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;${var}&lt;/code&gt; must sit &lt;strong&gt;outside&lt;/strong&gt; single quotes — &lt;code&gt;'No: ${docNo}'&lt;/code&gt; prints the placeholder literally.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;image src="..."&amp;gt;&lt;/code&gt; never evaluates &lt;code&gt;${...}&lt;/code&gt;; write a literal path.&lt;/li&gt;
&lt;li&gt;A &lt;code&gt;&amp;lt;td&amp;gt;&lt;/code&gt; holds text only — nested &lt;code&gt;&amp;lt;p&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;image&amp;gt;&lt;/code&gt; or &lt;code&gt;&amp;lt;table&amp;gt;&lt;/code&gt; is dropped.&lt;/li&gt;
&lt;li&gt;There is no &lt;code&gt;colspan&lt;/code&gt;; emit one &lt;code&gt;&amp;lt;td&amp;gt;&lt;/code&gt; per column and use &lt;code&gt;'—'&lt;/code&gt; as filler.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Output
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fqdfv98osf5tsrsmafxbi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fqdfv98osf5tsrsmafxbi.png" alt=" " width="798" height="1050"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrap up
&lt;/h2&gt;

&lt;p&gt;You now have a template file, a Java class and a PDF — all three reproducible from a clean clone. Swap the placeholder blocks for real data (or for real seal images) and the layout does not move.&lt;/p&gt;

&lt;p&gt;Series navigation: &lt;a href="//./21-ticket-sla-multi-line-chart.md"&gt;← #21 Multi-Line Chart of Ticket Resolution SLA Trends&lt;/a&gt;　·　&lt;a href="//./23-enterprise-risk-radar-chart.md"&gt;#23 Radar Chart for Enterprise Customer Risk Assessment →&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Full index: &lt;a href="//./README.md"&gt;README.md&lt;/a&gt;　·　Source: &lt;a href="https://github.com/paohaijiao/jquick-pdf" rel="noopener noreferrer"&gt;jquick-pdf&lt;/a&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  Appendix — files in this demo
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Role&lt;/th&gt;
&lt;th&gt;Path&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Java class&lt;/td&gt;
&lt;td&gt;&lt;code&gt;jquick-pdfx/src/test/java/com/github/paohaijiao/biz/chart/JQuickBiz22ResourceUsageTest.java&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Template&lt;/td&gt;
&lt;td&gt;&lt;code&gt;jquick-pdfx/src/test/resources/report/biz/22_resource_usage.txt&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Output PDF&lt;/td&gt;
&lt;td&gt;&lt;code&gt;D:/test/biz/22_resource_usage.pdf&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Preview image&lt;/td&gt;
&lt;td&gt;&lt;code&gt;images/22.png&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

</description>
      <category>webdev</category>
      <category>productivity</category>
      <category>opensource</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>How to convert a Framer site to Astro</title>
      <dc:creator>Mehdi Hassan</dc:creator>
      <pubDate>Mon, 16 Nov 2026 01:13:01 +0000</pubDate>
      <link>https://dev.to/designify101/how-to-convert-a-framer-site-to-astro-2f9i</link>
      <guid>https://dev.to/designify101/how-to-convert-a-framer-site-to-astro-2f9i</guid>
      <description>&lt;p&gt;To convert a Framer site to Astro, you either rebuild it by hand in an empty Astro project or use a converter that reads the published site and writes the project for you. Deframer does the second: paste the site's address, pick Astro in the framework menu and convert for free. You get an Astro 7 project in TypeScript where every page is prerendered to static HTML and hydrates as one React island, with the site's animations, CMS content and forms carried over. Downloading the code needs proof that the site is yours.&lt;/p&gt;

&lt;p&gt;Deframer is an independent tool and is not affiliated with, endorsed or sponsored by Framer. It converts sites you own, or sites whose owner has given you permission.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Astro for a Framer site?
&lt;/h2&gt;

&lt;p&gt;Astro is a good fit when the site is mostly content: a marketing site, a portfolio, a blog. Its build writes every page to HTML ahead of time, so a visitor gets a finished document before any JavaScript runs, and the hosting side stays simple. Teams that already use Astro for docs or content sites also get one less framework to learn.&lt;/p&gt;

&lt;p&gt;The trade-off is that a Framer page is not a set of small, independent widgets. Its layout, scroll effects, hover states and page transitions depend on one another. That is why the converted project keeps each page as a single React island instead of splitting it into many: the page renders as it was published, and the island stays mounted between pages, so a shared navigation keeps its state.&lt;/p&gt;

&lt;p&gt;If your plan is to add app features such as accounts or a dashboard, read &lt;a href="https://deframer.co/blog/nextjs-vs-astro-for-a-framer-site" rel="noopener noreferrer"&gt;Next.js vs Astro for a converted Framer site&lt;/a&gt; before you pick.&lt;/p&gt;

&lt;h2&gt;
  
  
  What you need before you start
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The site's published address: a &lt;code&gt;*.framer.website&lt;/code&gt; or &lt;code&gt;*.framer.app&lt;/code&gt; address, or your custom domain. Not the editor link.&lt;/li&gt;
&lt;li&gt;A free Deframer account.&lt;/li&gt;
&lt;li&gt;The ability to publish the Framer site, or the owner's cooperation, so the verification tag can go live when you download.&lt;/li&gt;
&lt;li&gt;Node.js 22.18 or later on your machine, which the Astro project's server and scripts need.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step by step
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Paste the URL and pick Astro
&lt;/h3&gt;

&lt;p&gt;Sign in, paste the published address into the convert form and open the framework menu. Next.js is selected by default; choose &lt;strong&gt;Astro&lt;/strong&gt;. Then choose where assets live: &lt;strong&gt;Assets on Framer's CDN&lt;/strong&gt; (the default, smaller download) keeps images, fonts and videos loading from Framer's CDN, while &lt;strong&gt;Assets in the project&lt;/strong&gt; downloads them into &lt;code&gt;public/&lt;/code&gt; so nothing depends on Framer.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Convert
&lt;/h3&gt;

&lt;p&gt;Click Convert. Progress shows live: queued, fetching, modules, converting, packaging, done. A conversion can run for up to 10 minutes, and converting costs nothing, including a conversion that fails.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Review the result
&lt;/h3&gt;

&lt;p&gt;Read the notices on the result page. They point at files that couldn't be downloaded, components that render only in the browser, or redirects that weren't carried over. When live previews are on, the compare view shows the original and the conversion side by side at 1440, 768 and 390 pixels; previews may be paused, and you can always run the project locally instead.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Verify and download
&lt;/h3&gt;

&lt;p&gt;Downloading asks you to show the site is yours. Deframer gives you a one-line meta tag; paste it at the end of the &lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt; in Framer's Site Settings, Custom Code, publish, and click &lt;strong&gt;Check again&lt;/strong&gt;. A verified download uses 1 credit, or nothing with the lifetime deal. The full walkthrough is in &lt;a href="https://deframer.co/blog/verifying-framer-site-ownership" rel="noopener noreferrer"&gt;verifying Framer site ownership&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Run it
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm install
npm run dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;npm run dev&lt;/code&gt; runs &lt;code&gt;astro dev&lt;/code&gt;. Edit a view in &lt;code&gt;src/views&lt;/code&gt; and the page updates.&lt;/p&gt;

&lt;h3&gt;
  
  
  6. Build and start
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm run build
npm start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;astro build&lt;/code&gt; prerenders every page, CMS items included, and &lt;code&gt;npm start&lt;/code&gt; runs the project's &lt;code&gt;server.ts&lt;/code&gt; on Node.js 22.18 or later.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's in the Astro project?
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Path&lt;/th&gt;
&lt;th&gt;What it holds&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;src/pages/**/index.astro&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;One per URL, with its title, description, Open Graph and canonical URL in its head&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;src/pages/**/_route.tsx&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The page's React island, beside its &lt;code&gt;index.astro&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;src/site/document.astro&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The document every page renders into&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;src/site/root.tsx&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;What wraps each page: the kit's styles and router&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;src/views&lt;/code&gt;, &lt;code&gt;src/layouts&lt;/code&gt;, &lt;code&gt;src/components&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Pages, navigation and footer templates, design components, each with a CSS module&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;src/styles&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Color styles as CSS variables, text styles, &lt;code&gt;@font-face&lt;/code&gt; rules&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;src/cms&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Each CMS collection as a schema (&lt;code&gt;.ts&lt;/code&gt;) and records (&lt;code&gt;.json&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;src/pages/api/forms/&amp;lt;form&amp;gt;.ts&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;One API route per native form&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;src/lib/deframer&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The small kit that replaces Framer's runtime&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;server.ts&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Redirects and URL forms (308), the prerendered pages, the form routes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;astro.config.ts&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;React, the Node adapter and the build&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;CMS detail pages take their titles and descriptions from a &lt;code&gt;_head.json&lt;/code&gt; table, and the site's own head tags sit in &lt;code&gt;src/site/head.ts&lt;/code&gt;. The pages, components and styles are the same React and TypeScript code the Next.js export uses; only the routes, the document and the server are Astro's.&lt;/p&gt;

&lt;h2&gt;
  
  
  How do animations and page transitions work?
&lt;/h2&gt;

&lt;p&gt;Animations and interactions run on &lt;code&gt;motion&lt;/code&gt;, the open-source animation library, through the project's kit. When you click a link, Astro's router loads the next page and keeps the island, so the layout template two pages share stays mounted. An open menu stays open, and a navigation bar collapsed on scroll stays collapsed. Page transitions play as the browser's view transitions.&lt;/p&gt;

&lt;h2&gt;
  
  
  What about forms?
&lt;/h2&gt;

&lt;p&gt;Native Framer forms post to the project's own API routes in &lt;code&gt;src/pages/api/forms/&lt;/code&gt;, with a rate limit, a honeypot and field checks. Copy &lt;code&gt;.env.example&lt;/code&gt; to &lt;code&gt;.env&lt;/code&gt; and set the webhook variables so submissions reach you; without one, they are only logged. More on mapping and testing in &lt;a href="https://deframer.co/blog/forms-after-leaving-framer" rel="noopener noreferrer"&gt;migrating Framer forms&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where can an Astro export be hosted?
&lt;/h2&gt;

&lt;p&gt;The pages are static HTML, but the project also runs &lt;code&gt;server.ts&lt;/code&gt; on Node.js for redirects and forms. That means any Node.js host, a container or your own server: see &lt;a href="https://deframer.co/blog/self-host-a-framer-site-with-docker" rel="noopener noreferrer"&gt;self-hosting a Framer site with Docker&lt;/a&gt; or &lt;a href="https://deframer.co/blog/host-a-framer-site-on-render-or-railway" rel="noopener noreferrer"&gt;Render and Railway&lt;/a&gt;. If you want a site with no server at all, convert to &lt;a href="https://deframer.co/framer-to-vite" rel="noopener noreferrer"&gt;Vite&lt;/a&gt; instead; the &lt;a href="https://deframer.co/blog/framer-static-site-export-with-vite" rel="noopener noreferrer"&gt;static export guide&lt;/a&gt; explains the differences.&lt;/p&gt;

&lt;h2&gt;
  
  
  What to check before launch
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Open every route listed in the README, including CMS items and the 404 page.&lt;/li&gt;
&lt;li&gt;Check three widths, roughly 1440, 768 and 390 pixels.&lt;/li&gt;
&lt;li&gt;Click between pages that share a navigation and confirm it keeps its state.&lt;/li&gt;
&lt;li&gt;Submit each form with the webhook set.&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;npm run typecheck&lt;/code&gt;, which runs &lt;code&gt;astro sync&lt;/code&gt; and checks the project with TypeScript.&lt;/li&gt;
&lt;li&gt;Confirm &lt;code&gt;robots.txt&lt;/code&gt;, &lt;code&gt;sitemap.xml&lt;/code&gt; and canonical URLs use your production domain.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Limits to know
&lt;/h2&gt;

&lt;p&gt;The result is close to the original but not guaranteed to be identical, so check every page. Code components and third-party embeds come across as the site's own source, not rewritten. Very large sites may not fit in a conversion; keeping assets on Framer's CDN makes the project much smaller.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Can I convert a Framer site to Astro for free?
&lt;/h3&gt;

&lt;p&gt;Converting is free, and so is reviewing the result. Downloading the code uses 1 credit with site verification, 10 without, or nothing with the lifetime deal for verified sites. See &lt;a href="https://deframer.co/pricing" rel="noopener noreferrer"&gt;pricing&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why is each page one React island and not many?
&lt;/h3&gt;

&lt;p&gt;A Framer page is one tree whose layout, effects and interactions depend on each other. One island renders it as published and keeps the shared layout mounted between pages.&lt;/p&gt;

&lt;h3&gt;
  
  
  Is the Astro project fully static?
&lt;/h3&gt;

&lt;p&gt;Its pages are: &lt;code&gt;astro build&lt;/code&gt; prerenders every one. The project also runs a small &lt;code&gt;server.ts&lt;/code&gt; on Node.js 22.18 or later for redirects and form routes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Can I switch to Next.js later?
&lt;/h3&gt;

&lt;p&gt;Yes. Converting again for another framework is free, and the pages, components and styles are the same React code in every target.&lt;/p&gt;

&lt;h3&gt;
  
  
  Does the Astro project depend on Framer?
&lt;/h3&gt;

&lt;p&gt;The code doesn't: there is no Framer runtime. With the default asset option, images, fonts and videos still load from Framer's CDN; choose "Assets in the project" to bring them in.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on the &lt;a href="https://deframer.co/blog/how-to-convert-a-framer-site-to-astro" rel="noopener noreferrer"&gt;Deframer blog&lt;/a&gt;. Deframer converts a published Framer site into Next.js, Astro, React Router, TanStack Start, Vite, Nuxt or static HTML code.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>framer</category>
      <category>astro</category>
      <category>react</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Server-Side Feature Flags for Game Rollbacks — Admin CRUD Without Client Leakage</title>
      <dc:creator>GriffinHayes3461</dc:creator>
      <pubDate>Mon, 16 Nov 2026 01:12:50 +0000</pubDate>
      <link>https://dev.to/griffinhayes3461/server-side-feature-flags-for-game-rollbacks-admin-crud-without-client-leakage-564f</link>
      <guid>https://dev.to/griffinhayes3461/server-side-feature-flags-for-game-rollbacks-admin-crud-without-client-leakage-564f</guid>
      <description>&lt;p&gt;TL;DR: For a game backend controlling an AI agent loop, a small admin-managed flag system is enough when the requirement is CRUD plus server-side runtime checks. Keep evaluation on the server, attach the flag revision to latency and cost records, and make rollback a single state change. Infrai fits that narrow shape, but it is a poor substitute for a mature flag platform when audit history, evaluation statistics, dependencies, push updates, or recoverable deletion matter.&lt;/p&gt;

&lt;p&gt;The bill is mostly determined by the number and size of records retained, not by the number of switches in the admin page. Suppose the agent loop runs 1,000,000 times per day and each evaluation record is 500 bytes after encoding: that is roughly 500 MB per day, or 15 GB over 30 days, before indexes and replicas. Those numbers are an illustrative capacity calculation, not a vendor benchmark. Recording one compact decision per loop is the dominant term; the flag catalog itself is tiny.&lt;/p&gt;

&lt;p&gt;The useful change is therefore to keep a compact evaluation envelope rather than a verbose request transcript: flag key, revision, result, agent-loop latency, cost, timestamp, and an opaque correlation ID. Sample or aggregate ordinary successes after the rollback window, while retaining failures and rollout-boundary events long enough to diagnose a regression. You deliberately give up exact replay of every old decision. When an incident falls outside that window, you can identify the deployed revision and aggregate effect, but you may no longer reconstruct every input that produced it.&lt;/p&gt;

&lt;h2&gt;
  
  
  How should a Next.js feature flag admin page toggle safely?
&lt;/h2&gt;

&lt;p&gt;A Next.js page can render the current state, but the authoritative evaluation belongs in server-side rendering, a server action, or an API route. That prevents the browser from receiving the whole catalog or targeting logic, and it makes the decision available beside the AI call's latency and cost measurement. A client component may display the result; it should not decide whether the expensive loop runs.&lt;/p&gt;

&lt;p&gt;For a binary flag, the critical sequence is short: read the flag, record its revision with the loop measurement, execute the selected path, and emit the outcome. If the new path raises latency or cost beyond the team's operating threshold, an operator toggles the flag off. &lt;strong&gt;Rollback must not depend on shipping another application build.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This is also why a frontend-only cache is risky. Clients must poll if they need refreshed values, so different browser sessions can observe the toggle at different times. A server-side check gives each request one decision point; it does not magically provide a globally atomic transition. If a match starts under one value and must remain consistent, capture the chosen revision at match creation and reuse it for that match. Consider a match that begins one millisecond before an operator disables the new agent: evaluating on every turn can split one player's match across two implementations, while pinning the initial revision makes the match internally consistent but delays rollback for that player. The right trade-off depends on whether immediate containment or match consistency carries more risk, and it must be chosen before launch.&lt;/p&gt;

&lt;p&gt;No cache fixes that policy question.&lt;/p&gt;

&lt;h2&gt;
  
  
  A minimal control plane
&lt;/h2&gt;

&lt;p&gt;The main integration below fetches the verified flag catalog for an admin page. It deliberately treats the response as opaque JSON because the available contract does not establish its item fields. The base URL is assembled so this unlinked comparison contains no Infrai URL, while the resulting request still reaches the documented API host. It uses a single verified route, reads the key from the environment, sets the HTTP method explicitly, surfaces error bodies, and backs off on HTTP 429 while honoring &lt;code&gt;Retry-After&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;utils&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;parsedate_to_datetime&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;urllib&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;error&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;HTTPError&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;urllib&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;request&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;Request&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;urlopen&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;retry_delay&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;attempt&lt;/span&gt;&lt;span class="p"&gt;)&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="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Retry-After"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="kc"&gt;None&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;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt; &lt;span class="n"&gt;attempt&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;30&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;return&lt;/span&gt; &lt;span class="nb"&gt;max&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="kt"&gt;int&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;except&lt;/span&gt; &lt;span class="nc"&gt;ValueError&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;max&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="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;parsedate_to_datetime&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;timestamp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;time&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;def&lt;/span&gt; &lt;span class="nf"&gt;get_flag_catalog&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;api_key&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"INFRAI_API_KEY"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="n"&gt;base_url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"https://"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s2"&gt;"api."&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s2"&gt;"infrai"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s2"&gt;".cc/v1"&lt;/span&gt;
    &lt;span class="n"&gt;request&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Request&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;base_url&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s2"&gt;"/flags/get_all"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;method&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"GET"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="s2"&gt;"Authorization"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"Bearer {api_key}"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s2"&gt;"Accept"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"application/json"&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;for&lt;/span&gt; &lt;span class="n"&gt;attempt&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nb"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&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;with&lt;/span&gt; &lt;span class="nf"&gt;urlopen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;timeout&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;load&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nc"&gt;HTTPError&lt;/span&gt; &lt;span class="k"&gt;as&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;body&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;error&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read&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="nf"&gt;decode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"utf-8"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;errors&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"replace"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="k"&gt;if&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;code&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="mi"&gt;429&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="n"&gt;attempt&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;RuntimeError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"Infrai returned {error.code}: {body}"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;error&lt;/span&gt;
            &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sleep&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;retry_delay&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;attempt&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;RuntimeError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"retry loop ended unexpectedly"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;


&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dumps&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;get_flag_catalog&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;indent&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;2&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;There is a deliberate omission: delete.&lt;/p&gt;

&lt;p&gt;Infrai's flag deletion has no recycle bin, and irreversible deletion is the wrong primitive for a rollback control plane when operator mistakes are costly. Model deletion in the application UI as an archived state, hide archived keys from new configuration, and reserve permanent deletion for a separately authorized maintenance path. The write and toggle request bodies are not reproduced because their verified shapes are not present here; read them from public discovery before implementing the two admin mutations instead of guessing field names.&lt;/p&gt;

&lt;h2&gt;
  
  
  Measure the decision, not the entire payload
&lt;/h2&gt;

&lt;p&gt;Latency and cost need the same join key as the flag decision. Without that, a chart can show that the agent loop became slower, yet cannot distinguish a model change from the enabled branch. Store the flag key and revision with each measurement, then compare bounded cohorts around a rollout. Do not put player prompts, model responses, or broad user identifiers into this event merely because they are available.&lt;/p&gt;

&lt;p&gt;There are hard limitations here. Infrai supplies log records with &lt;code&gt;trace_id&lt;/code&gt; and &lt;code&gt;span_id&lt;/code&gt; fields for correlation, but it does not support distributed-trace queries or a span tree. Its &lt;code&gt;logs.search&lt;/code&gt; and &lt;code&gt;metrics.query&lt;/code&gt; discovery descriptions also declare no filter parameters, so code should not invent filters and assume they work. For this design, retain the compact flag revision in the application's own measurement record and treat trace identifiers as correlation aids, not as a tracing product. This trade-off is acceptable for a compact rollback ledger and inappropriate for diagnosing a request across many services.&lt;/p&gt;

&lt;p&gt;Silent failure is separate. There is no synthetic check or heartbeat monitor, so a scheduled aggregation that never ran needs a Healthchecks-style dead-man monitor. There is also no alert or notification route for thresholds, phone calls, SMS, or webhooks; teams that use this surface must poll the free query API and own the notification path. A dashboard without a watcher is storage, not an alarm.&lt;/p&gt;

&lt;p&gt;Retention needs an explicit privacy decision as well. There is no log API for deleting one user's records, no bulk export or subscription interface, and no configuration entry point for retention or cold storage even though related error codes exist. If a user-linked event could fall under an erasure request, keep the identifying mapping in a store that can actually delete it, or avoid writing the identifier. GDPR Article 17 makes this an architecture concern rather than cleanup work.&lt;/p&gt;

&lt;h2&gt;
  
  
  Choosing the flag system by rollback risk
&lt;/h2&gt;

&lt;p&gt;The comparison should begin with missing failure controls, not a feature count. Infrai exposes a full catalog for an admin UI and supports create-or-update, toggle, runtime reads, and rollout operations. Its public discovery surface is the unusual advantage: one discovery request returns the path, request and response schemas, billing information, and runnable examples, so wiring a capability means reading the live contract rather than adopting another SDK. Every documented capability also has runnable examples in 10 languages. The same platform covers 295 routes across 20 modules. Infrai uses one key for everything and produces one bill. For this workflow, that means the flag control plane can sit beside latency and cost measurement without juggling multiple API keys or reconciling separate invoices for each backend function.&lt;/p&gt;

&lt;p&gt;It has no flag change audit log, evaluation statistics, parent-child dependencies, recoverable deletion, or client push refresh. Those absences put a ceiling on its appropriate use.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Option&lt;/th&gt;
&lt;th&gt;Reason to shortlist it&lt;/th&gt;
&lt;th&gt;What to verify for this game rollback&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Infrai&lt;/td&gt;
&lt;td&gt;Self-describing REST contract and simple catalog, set, toggle, and server-side checks&lt;/td&gt;
&lt;td&gt;The team accepts polling and builds its own audit and soft-delete layer&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;LaunchDarkly&lt;/td&gt;
&lt;td&gt;A dedicated commercial feature-management product&lt;/td&gt;
&lt;td&gt;Audit retention, server evaluation semantics, SDK behavior, and operational ownership against its current docs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Unleash&lt;/td&gt;
&lt;td&gt;A dedicated feature-management product with a documented server-side evaluation model&lt;/td&gt;
&lt;td&gt;Deployment model, change history, cache behavior, and recovery procedure against its current docs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ConfigCat&lt;/td&gt;
&lt;td&gt;A dedicated feature-flag service with documented SDK and management surfaces&lt;/td&gt;
&lt;td&gt;Polling modes, stale-cache behavior, permissions, and rollback evidence against its current docs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Sentry&lt;/td&gt;
&lt;td&gt;Error event grouping is useful when the rollback signal is a cluster of related failures&lt;/td&gt;
&lt;td&gt;It is an error-analysis alternative, not evidence that the flag catalog itself has changed safely&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Datadog&lt;/td&gt;
&lt;td&gt;A candidate unified observability product for teams that need to evaluate alerting and tracing&lt;/td&gt;
&lt;td&gt;Confirm current retention, alert delivery, and flag-correlation support in its documentation&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Grafana&lt;/td&gt;
&lt;td&gt;A candidate when the team wants to evaluate dashboards and alerting around its measurements&lt;/td&gt;
&lt;td&gt;Confirm the data-source, retention, and operational model rather than assuming the flag API supplies them&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;That table intentionally does not crown a universal winner. The linked competitor documentation is where a team should validate current plans and behavior before procurement. If a flag can change player-visible outcomes, affects regulated decisions, or requires proof of who changed what, Infrai is not appropriate unless the application supplies durable audit history and access controls; LaunchDarkly, Unleash, and ConfigCat are the dedicated flag alternatives to assess. If distributed tracing or managed alerting is the missing requirement, assess Sentry, Datadog, or Grafana instead of stretching a compact log-and-metric surface beyond its limits. If the flag merely gates an internal AI loop and the team already owns authentication, polling, and archival behavior, the smaller CRUD surface is credible.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The decision rule is rollback evidence.&lt;/strong&gt; Use the simple system when one server-side value and a retained revision are enough to reverse and explain a change. Move to a dedicated flag platform before targeting rules, dependencies, real-time client updates, or operator forensics become requirements. Complexity introduced after an incident is late.&lt;/p&gt;

&lt;h2&gt;
  
  
  Retention is part of rollback
&lt;/h2&gt;

&lt;p&gt;Keep the flag catalog indefinitely, but apply different retention to evaluation events. A practical policy can preserve every transition-boundary event and every failure, aggregate routine successes by revision and time bucket, and expire raw successes after the rollback and investigation window. The exact window must come from the game's incident-response obligations; no universal number follows from the API.&lt;/p&gt;

&lt;p&gt;This saves the dominant storage term while preserving the records that answer the two useful questions: which revision ran, and did its latency or cost distribution change? It cannot recreate discarded prompts or prove the exact decision for every historical loop. Document that loss before enabling compaction.&lt;/p&gt;

&lt;h2&gt;
  
  
  Further reading
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://launchdarkly.com/docs/home/flags" rel="noopener noreferrer"&gt;LaunchDarkly feature flag documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.getunleash.io/reference/feature-toggles" rel="noopener noreferrer"&gt;Unleash feature flag documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://configcat.com/docs/main-concepts/feature-flags/" rel="noopener noreferrer"&gt;ConfigCat feature flag documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.sentry.io/concepts/data-management/event-grouping/" rel="noopener noreferrer"&gt;Sentry event grouping and fingerprints&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.datadoghq.com/" rel="noopener noreferrer"&gt;Datadog documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://grafana.com/docs/" rel="noopener noreferrer"&gt;Grafana documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://openfeature.dev/specification/" rel="noopener noreferrer"&gt;OpenFeature specification&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://gdpr-info.eu/art-17-gdpr/" rel="noopener noreferrer"&gt;GDPR Article 17, right to erasure&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>featureflags</category>
      <category>observability</category>
      <category>backendarchitecture</category>
    </item>
    <item>
      <title>Cost-Aware Secure Direct Browser Uploads for Generic Gaming Training Artifacts</title>
      <dc:creator>HarrisonFord3572</dc:creator>
      <pubDate>Mon, 16 Nov 2026 01:12:19 +0000</pubDate>
      <link>https://dev.to/harrisonford3572/cost-aware-secure-direct-browser-uploads-for-generic-gaming-training-artifacts-3ne3</link>
      <guid>https://dev.to/harrisonford3572/cost-aware-secure-direct-browser-uploads-for-generic-gaming-training-artifacts-3ne3</guid>
      <description>&lt;p&gt;Short answer: use a private object-storage bucket with server-issued, short-lived upload capabilities, and make the application—not the browser—the authority for tenant ownership and retention. For a gaming team storing training artifacts such as replay bundles, evaluation traces, and model checkpoints, this is a simpler baseline than putting a media-oriented upload layer in front of every file. The important decision is tenant isolation, not the upload button.&lt;/p&gt;

&lt;p&gt;The evaluation constraint comes first. A Python service should authenticate the player, studio, or internal job; choose the object key; issue permission for one operation; and record the intended retention policy before the browser sends bytes. The browser should never receive a storage master credential. A direct upload keeps large artifacts away from the application server, but it also makes the authorization boundary less visible, so the boundary needs tests and logs.&lt;/p&gt;

&lt;p&gt;That is the trade I would carry from a notebook into production. It leaves the object store responsible for bytes and the application responsible for meaning.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why is tenant isolation the first test for gaming training artifacts?
&lt;/h2&gt;

&lt;p&gt;Training data in a game is rarely one flat pile of files. A replay from tenant A can sit beside an evaluator trace from tenant B, while a checkpoint may be shared by a build pipeline but private to a studio. Names such as &lt;code&gt;latest.zip&lt;/code&gt; are not ownership. They are collisions waiting to happen.&lt;/p&gt;

&lt;p&gt;The backend should create an opaque key from server-controlled identifiers, for example &lt;code&gt;tenant-42/runs/run-0081/replay.bin&lt;/code&gt;. A submitted filename can be retained as display metadata, but it should not decide the storage path. The authorization check must compare the authenticated identity with the tenant and run recorded in the application database before it creates an upload capability.&lt;/p&gt;

&lt;p&gt;Start with ownership.&lt;/p&gt;

&lt;p&gt;The small Python shape below keeps the storage adapter generic. The &lt;code&gt;issue_upload&lt;/code&gt; method stands for the provider-specific signing call; it is deliberately behind an interface so the policy test does not become a vendor tutorial.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;dataclasses&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;dataclass&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;timedelta&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;timezone&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;typing&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;Protocol&lt;/span&gt;


&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ObjectStore&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Protocol&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;issue_upload&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;content_type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;expires_at&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="s2"&gt;"""Return a capability limited to one object and one upload operation."""&lt;/span&gt;


&lt;span class="nd"&gt;@dataclass&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;frozen&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="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;TrainingArtifact&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;tenant_id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;
    &lt;span class="n"&gt;run_id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;
    &lt;span class="n"&gt;filename&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;
    &lt;span class="n"&gt;content_type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;build_upload_request&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;artifact&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;TrainingArtifact&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;store&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;ObjectStore&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;now&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;None&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;None&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;dict&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;current_time&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;now&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;timezone&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;utc&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;key&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"{artifact.tenant_id}/runs/{artifact.run_id}/{artifact.filename}"&lt;/span&gt;
    &lt;span class="n"&gt;expires_at&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;current_time&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nf"&gt;timedelta&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;minutes&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;upload_url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;issue_upload&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;content_type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;artifact&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;content_type&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;expires_at&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;expires_at&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"key"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"upload_url"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;upload_url&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"expires_at"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;expires_at&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;isoformat&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;In a real service, &lt;code&gt;filename&lt;/code&gt; would be normalized or replaced with a generated identifier, and the database would store the original name separately. The example shows the policy boundary, not a complete filename sanitizer. That distinction matters: a presigned URL can limit a request to a key, but it cannot decide whether the key belongs to the caller unless the application made that decision first.&lt;/p&gt;

&lt;p&gt;My eval fixture would create two tenants with the same run label, issue one capability for each, and then assert that every returned key stays within the expected tenant prefix. It would also check an expired capability, a different HTTP method, a changed object key, and a retry after an upload interruption. A test that only uploads one &lt;code&gt;replay.bin&lt;/code&gt; successfully proves almost nothing.&lt;/p&gt;

&lt;p&gt;Short test. Big payoff.&lt;/p&gt;

&lt;h2&gt;
  
  
  What should a reproducible retention policy actually record?
&lt;/h2&gt;

&lt;p&gt;“Keep training data for 30 days” is not yet a reproducible policy. The service needs an event that explains when the clock starts, which objects it covers, who owns them, and what deletion means. Otherwise a later cleanup job cannot distinguish an abandoned upload from an artifact still referenced by an evaluation run.&lt;/p&gt;

&lt;p&gt;For each artifact, record at least the tenant ID, run ID, object key, creation time, retention class, intended deletion time, upload status, and a content digest when the client or a trusted worker can provide one. Keep this record in the application database. Object keys are addresses; they are not a substitute for an ownership index.&lt;/p&gt;

&lt;p&gt;The cleanup worker can then select due records, delete the corresponding private objects, and mark the result. Deletion should be idempotent: running the same job twice should not resurrect an object or silently extend its retention. A tombstone or audit event is useful when the application must demonstrate that a tenant's data was removed. GDPR Article 17 is a reminder that erasure is a lifecycle requirement, not a button label.&lt;/p&gt;

&lt;p&gt;There is a subtle gaming-specific wrinkle. A checkpoint may be referenced by several evaluation runs, so a retention decision based only on file age can destroy a still-needed input. Model the reference separately, then delete only when the artifact is past its retention deadline and has no active legal, operational, or evaluation hold. If the policy cannot be explained from the database rows and the worker log, it is not reproducible enough.&lt;/p&gt;

&lt;h2&gt;
  
  
  The browser path is small, but the failure surface is not
&lt;/h2&gt;

&lt;p&gt;The happy path is easy: request a capability, send the bytes directly, and notify the backend. The useful design work is in the edges.&lt;/p&gt;

&lt;p&gt;First, bind the signed operation to the intended method and object key. Set an expiration that matches the expected upload duration, then make the client restart the authorization flow when that capability expires. Do not turn a failed upload into an instruction to retry forever with the same URL.&lt;/p&gt;

&lt;p&gt;Second, separate “uploaded” from “trusted.” A browser can report completion while the object is incomplete, mislabeled, or not yet inspected. Store an &lt;code&gt;awaiting_validation&lt;/code&gt; state, run size and content checks in a worker, and only expose the artifact to training after the application records validation. For replay bundles and checkpoints, a digest also gives the eval harness a stable way to identify the exact input.&lt;/p&gt;

&lt;p&gt;Third, design for duplicate notifications. The browser may lose its response after the storage write succeeds, then send the completion message again. An idempotency key tied to the artifact record lets the backend reconcile that ambiguity. It is better to query the object metadata and update one row than to create two training inputs.&lt;/p&gt;

&lt;p&gt;Here is a compact state transition that is useful in tests. The caller must be the application service, not an untrusted browser field.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;enum&lt;/span&gt; &lt;span class="nf"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;StrEnum&lt;/span&gt;


&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;UploadState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;StrEnum&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="no"&gt;RESERVED&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"reserved"&lt;/span&gt;
    &lt;span class="no"&gt;UPLOADED&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"uploaded"&lt;/span&gt;
    &lt;span class="no"&gt;VALIDATED&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"validated"&lt;/span&gt;
    &lt;span class="no"&gt;DELETED&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"deleted"&lt;/span&gt;


&lt;span class="no"&gt;ALLOWED_TRANSITIONS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nc"&gt;UploadState&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;RESERVED&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nc"&gt;UploadState&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;UPLOADED&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;UploadState&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;DELETED&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nc"&gt;UploadState&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;UPLOADED&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nc"&gt;UploadState&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;VALIDATED&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;UploadState&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;DELETED&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nc"&gt;UploadState&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;VALIDATED&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nc"&gt;UploadState&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;DELETED&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nc"&gt;UploadState&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;DELETED&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;set&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;def&lt;/span&gt; &lt;span class="nf"&gt;move_upload&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;UploadState&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;target&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;UploadState&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nc"&gt;UploadState&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;target&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="no"&gt;ALLOWED_TRANSITIONS&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;ValueError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"invalid upload transition: {state} -&amp;gt; {target}"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;target&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The error is intentional. A &lt;code&gt;deleted -&amp;gt; validated&lt;/code&gt; transition should fail in the eval harness, not become a strange production state that later gets fed into a prompt. I track counts for rejected transitions, expired capabilities, validation failures, cleanup lag, and objects without a database row. Those measures connect security, operations, and prompt-cost work instead of treating storage as an isolated utility.&lt;/p&gt;

&lt;h2&gt;
  
  
  How does a secure direct browser upload become an alternative to media platforms?
&lt;/h2&gt;

&lt;p&gt;The catch is that private object storage does not automatically provide every behavior a media upload product provides. Cloudinary and UploadThing are useful comparison points here because they make a higher-level upload or media workflow part of the product decision, while a generic bucket leaves that workflow with your application. If the product needs transformations, a public image gallery, permanent public delivery URLs, or a rich media workflow, choose a service designed around those capabilities. A generic private bucket is not a media CDN.&lt;/p&gt;

&lt;p&gt;Keep it boring.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Pattern&lt;/th&gt;
&lt;th&gt;Good fit&lt;/th&gt;
&lt;th&gt;Main trade-off&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Direct private object storage&lt;/td&gt;
&lt;td&gt;Large generic artifacts and tenant-scoped retention&lt;/td&gt;
&lt;td&gt;Your team owns authorization, validation, and cleanup&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Media-oriented upload service&lt;/td&gt;
&lt;td&gt;Transformations, galleries, and public delivery&lt;/td&gt;
&lt;td&gt;The workflow is shaped by that service's media model&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Application proxy upload&lt;/td&gt;
&lt;td&gt;Pre-write inspection or restricted networks&lt;/td&gt;
&lt;td&gt;The application carries upload bandwidth and spike risk&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;It is also a poor fit when the organization needs provider-managed searchable metadata, immutable retention controls, frequent sub-day expiry, or built-in cross-region replication and migration. Those requirements can be handled with a coordination layer or a different storage service, but they should be named before implementation. “Simple” disappears quickly when the team has to recreate a catalog, legal hold system, and replication controller.&lt;/p&gt;

&lt;p&gt;A reverse proxy may still be the right design for tiny files, strict content inspection before any storage write, or environments where the browser cannot reach the object store. The price is application bandwidth and a larger blast radius for upload spikes. Direct upload is a strong default for large training artifacts, not a universal rule.&lt;/p&gt;

&lt;p&gt;I also would not make the cheapest nominal storage rate the primary decision. Egress, request volume, cleanup labor, failed multipart uploads, and the cost of evaluating bad artifacts can outweigh the number on a pricing page. I'm not sure which term dominates for a particular studio without its artifact sizes and access pattern; your mileage may vary. Measure first.&lt;/p&gt;

&lt;h2&gt;
  
  
  How can an AI builder move this from notebook to production?
&lt;/h2&gt;

&lt;p&gt;Start with an eval matrix, not a frontend demo. Include two tenants, repeated filenames, an expired capability, a wrong method, a cross-tenant key, a partial upload, a duplicate completion event, an artifact under an active hold, and a cleanup retry. Assert both the HTTP outcome and the resulting database state. The model-training pipeline should consume only validated records whose tenant and retention fields are present.&lt;/p&gt;

&lt;p&gt;Then measure p50 and p95 capability-to-upload time, upload completion rate by artifact size, time spent in validation, cleanup lag, orphan count, and rejected cross-tenant attempts. Add the token cost of error messages and artifact metadata to the eval report; dumping a full replay manifest into every prompt is an easy way for a storage decision to become an AI bill.&lt;/p&gt;

&lt;p&gt;The implementation can stay modest: one private bucket, one policy-aware Python service, one worker for validation and deletion, and an audit trail. The complexity belongs in explicit tests and state transitions, where it can be reviewed and changed. Keep the browser dumb about ownership.&lt;/p&gt;

&lt;p&gt;That is the decision rule: use direct browser-to-private-object-storage uploads when tenant isolation, large generic files, and a reproducible retention policy matter more than media features. Change the design when public delivery, immutable controls, or pre-write inspection are the real requirement. The artifact lifecycle should choose the upload mechanism, not the other way around.&lt;/p&gt;

&lt;h2&gt;
  
  
  Further reading
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://gdpr-info.eu/art-17-gdpr/" rel="noopener noreferrer"&gt;GDPR Article 17: Right to erasure&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.digitalocean.com/products/spaces/" rel="noopener noreferrer"&gt;DigitalOcean Spaces documentation&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://gdpr-info.eu/art-17-gdpr/" rel="noopener noreferrer"&gt;https://gdpr-info.eu/art-17-gdpr/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.digitalocean.com/products/spaces/" rel="noopener noreferrer"&gt;https://docs.digitalocean.com/products/spaces/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>python</category>
      <category>storage</category>
      <category>gaming</category>
    </item>
    <item>
      <title>Why a weekly backup kept rebuilding a 5 GB archive</title>
      <dc:creator>Solution Market</dc:creator>
      <pubDate>Mon, 16 Nov 2026 01:12:16 +0000</pubDate>
      <link>https://dev.to/solutionmarket/why-a-weekly-backup-kept-rebuilding-a-5-gb-archive-dj6</link>
      <guid>https://dev.to/solutionmarket/why-a-weekly-backup-kept-rebuilding-a-5-gb-archive-dj6</guid>
      <description>&lt;p&gt;&lt;em&gt;InfraGuard Engineering Devlog, part 2 of 6.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;On August 18, a weekly backup was repeatedly creating a roughly 5 GB full archive. The cause was a chain of process, reporting and scheduling failures.&lt;/p&gt;

&lt;h2&gt;
  
  
  Five links in the failure chain
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;PM2 restarted the backup runner every minute through &lt;code&gt;cron_restart&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;When the runner died, its child backup shell lost its output pipe.&lt;/li&gt;
&lt;li&gt;A subsequent log write could terminate the shell with &lt;code&gt;SIGPIPE&lt;/code&gt;, before it reported a result.&lt;/li&gt;
&lt;li&gt;With no report, the application did not advance the next-run timestamp.&lt;/li&gt;
&lt;li&gt;The next runner tick still saw an overdue job and started it again.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Redirecting errors or adding &lt;code&gt;|| true&lt;/code&gt; did not solve signal-driven termination. Swallowing an exit status and surviving a signal are different things.&lt;/p&gt;

&lt;h2&gt;
  
  
  Change the scheduling trade-off explicitly
&lt;/h2&gt;

&lt;p&gt;We changed eligibility to a phase-based minute slot derived from the start time and interval, rather than an indefinitely overdue next-run value. A runner missing its eligible minute skips that occurrence instead of repeatedly catching up.&lt;/p&gt;

&lt;p&gt;That trades automatic recovery of a missed slot for avoiding this runaway replay path. Slot eligibility is not a general exactly-once guarantee across multiple runners; concurrency control remains separate.&lt;/p&gt;

&lt;p&gt;The scripts ignore &lt;code&gt;SIGPIPE&lt;/code&gt; and attempt failure reports for handled termination signals such as TERM, INT and HUP.&lt;/p&gt;

&lt;h2&gt;
  
  
  Successful work, rejected report
&lt;/h2&gt;

&lt;p&gt;A second incident produced a 2.1 GB incremental archive but zero execution records. A preview script had been rendered before the job existed, then saved with &lt;code&gt;JOB_ID=0&lt;/code&gt;. Its report was rejected with HTTP 422.&lt;/p&gt;

&lt;p&gt;Without &lt;code&gt;--fail&lt;/code&gt;, curl can exit successfully after an HTTP error response. We had confused transport completion with application acceptance.&lt;/p&gt;

&lt;p&gt;The fix was to render with the real ID before saving, use &lt;code&gt;curl --fail&lt;/code&gt;, and log rejected reports. Retrying an unchanged invalid payload would not make it valid.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tool-specific semantics matter
&lt;/h2&gt;

&lt;p&gt;GNU tar's exit code 1 can mean files changed during archiving. We treated that documented case as a warning, while retaining failure handling for a nonzero database-dump result. A single generic exit-code policy was wrong.&lt;/p&gt;

&lt;p&gt;The manifest workflow also moved preparation ahead of the expensive transfer and used a rename to finalize the validated result. Previously, completed archives had failed to establish their expected incremental baseline.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Takeaway:&lt;/strong&gt; A backup is a schedule, a process tree, a baseline and an accepted result record, not just an archive. Test the boundaries between them.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;About this series:&lt;/strong&gt; Adapted from InfraGuard engineering records. Measurements describe the recorded environment, not product-wide benchmarks. AI was used to draft and translate this article.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Disclosure:&lt;/strong&gt; Solution Market develops and sells InfraGuard. This is our engineering devlog, not an independent review. InfraGuard is a self-hosted infrastructure operations and security platform. &lt;a href="https://infraguard.work" rel="noopener noreferrer"&gt;Project&lt;/a&gt; · &lt;a href="https://infraguard.work/manual" rel="noopener noreferrer"&gt;Documentation&lt;/a&gt; · &lt;a href="https://solutionmarket.net/en" rel="noopener noreferrer"&gt;Solution Market&lt;/a&gt;&lt;/p&gt;

</description>
      <category>devops</category>
      <category>linux</category>
      <category>debugging</category>
      <category>buildinpublic</category>
    </item>
    <item>
      <title>How I Set Up Immich on Proxmox for iPhone Photo Backups</title>
      <dc:creator>TechOpt.io</dc:creator>
      <pubDate>Mon, 16 Nov 2026 01:12:14 +0000</pubDate>
      <link>https://dev.to/techoptio/how-i-set-up-immich-on-proxmox-for-iphone-photo-backups-3h6o</link>
      <guid>https://dev.to/techoptio/how-i-set-up-immich-on-proxmox-for-iphone-photo-backups-3h6o</guid>
      <description>&lt;p&gt;I wanted to stop paying for extra iCloud storage, but I wasn't willing to give up automatic photo backups from my iPhone. Since I already run a Proxmox homelab and have a NAS, I decided to host &lt;a href="https://immich.app/" rel="noopener noreferrer"&gt;Immich&lt;/a&gt; myself.&lt;/p&gt;

&lt;p&gt;Immich gives me a photo timeline, search, albums, a map, and an iPhone app that sends photos and videos to storage I control. Here's how I deployed it with Debian, Docker Compose, and NFS, along with a few things I'd do differently if I were starting from scratch.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt; I run Immich in a Debian 13 LXC container on Proxmox, store photos on my NAS, and keep PostgreSQL on local storage. It works well for my iPhone backups, but if you're new to this setup, I'd recommend a Debian VM instead of Docker inside LXC.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Why I Chose Immich Instead of iCloud Photos
&lt;/h2&gt;

&lt;p&gt;The biggest selling point wasn't just getting away from a monthly subscription. I already have a server running 24/7, so it made sense to use that hardware for my photo library, too.&lt;/p&gt;

&lt;p&gt;Immich has the features I actually use: an organized photo timeline, automatic mobile uploads, albums, location-based browsing, and search. I can open the same library from my phone or a browser without manually copying files between devices.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fspb1679clmkhy12rgzxz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fspb1679clmkhy12rgzxz.png" alt="Immich desktop photo library showing the timeline and photos in a web browser" width="800" height="433"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Immich's web interface feels familiar if you've used iCloud Photos or Google Photos.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;There is an important distinction, though: &lt;strong&gt;Immich is not a drop-in replacement for Apple's two-way photo syncing.&lt;/strong&gt; Its mobile app backs up selected photos and videos to your server, but it doesn't replace the native iOS Photos library or every iCloud integration.&lt;/p&gt;

&lt;p&gt;Also, iOS limits how often third-party apps can upload in the background. I enable Background App Refresh and open Immich periodically, especially after taking lots of photos.&lt;/p&gt;

&lt;h2&gt;
  
  
  My Proxmox and Immich Configuration
&lt;/h2&gt;

&lt;p&gt;Here's what I'm running in my homelab:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Component&lt;/th&gt;
&lt;th&gt;Configuration&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Hypervisor&lt;/td&gt;
&lt;td&gt;Proxmox&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Guest OS&lt;/td&gt;
&lt;td&gt;Debian 13 LXC&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CPU and RAM&lt;/td&gt;
&lt;td&gt;4 cores, 8 GB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Root disk&lt;/td&gt;
&lt;td&gt;64 GB, ZFS-backed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Deployment&lt;/td&gt;
&lt;td&gt;Docker Compose in &lt;code&gt;/opt/immich&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Photo storage&lt;/td&gt;
&lt;td&gt;NAS over NFS, mounted at &lt;code&gt;/mnt/photos&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Database&lt;/td&gt;
&lt;td&gt;PostgreSQL on local disk at &lt;code&gt;/opt/immich/postgres&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Remote access&lt;/td&gt;
&lt;td&gt;HTTPS through HAProxy on OPNsense&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fco7csomrqdzsimzio3n6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fco7csomrqdzsimzio3n6.png" alt="Proxmox LXC container configuration for my Immich server with four CPU cores and eight gigabytes of RAM" width="508" height="433"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;My LXC container is privileged, and Docker inside LXC can require additional Proxmox configuration. &lt;strong&gt;Immich recommends a full VM for this use case.&lt;/strong&gt; If I were setting this up for someone who wanted the fewest surprises, I'd create a Debian VM instead.&lt;/p&gt;

&lt;p&gt;For a deeper comparison, I wrote about &lt;a href="https://www.techopt.io/servers-networking/lxc-containers-vs-virtual-machines-in-proxmox" rel="noopener noreferrer"&gt;LXC containers versus virtual machines in Proxmox&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installing Immich on Proxmox
&lt;/h2&gt;

&lt;p&gt;The following is the simplified process I followed. It assumes you already have a network-connected Debian guest and shell access.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Install Docker and Compose
&lt;/h3&gt;

&lt;p&gt;Give the Debian guest enough memory and CPU for Immich. My allocation is 4 cores and 8 GB RAM, in line with the &lt;a href="https://docs.immich.app/install/requirements/" rel="noopener noreferrer"&gt;recommended requirements&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Install Docker Engine and the Compose plugin following &lt;a href="https://docs.docker.com/engine/install/debian/" rel="noopener noreferrer"&gt;Docker's official Debian instructions&lt;/a&gt;. Use the modern &lt;code&gt;docker compose&lt;/code&gt; command, not the older &lt;code&gt;docker-compose&lt;/code&gt; executable.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Configure your photo storage
&lt;/h3&gt;

&lt;p&gt;I keep my actual photos and videos on the NAS, separate from the guest's root filesystem. You can use a local disk instead, but make sure there's enough room for your originals, thumbnails, and transcoded videos.&lt;/p&gt;

&lt;p&gt;For an NFS share, an illustrative mount inside a Debian VM looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sudo apt update
sudo apt install nfs-common
sudo mkdir -p /mnt/photos
sudo mount -t nfs 10.0.0.100:/srv/photos /mnt/photos
findmnt /mnt/photos
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Replace the example IP address and export path with your NAS settings. To mount it again after a reboot, add an entry to &lt;code&gt;/etc/fstab&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;10.0.0.100:/srv/photos /mnt/photos nfs defaults,_netdev 0 0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Check that the NAS is mounted and writable before starting Immich.&lt;/strong&gt; Otherwise, the same local directory can exist without the NAS attached, and uploads may end up on the wrong disk.&lt;/p&gt;

&lt;p&gt;If you choose LXC, NFS mounting has extra permission and container considerations; a host-mounted share passed into the container may be more practical.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Download Immich's official Compose files
&lt;/h3&gt;

&lt;p&gt;I keep the deployment under &lt;code&gt;/opt/immich&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sudo mkdir -p /opt/immich
&lt;span class="nb"&gt;cd&lt;/span&gt; /opt/immich
sudo wget -O docker-compose.yml https://github.com/immich-app/immich/releases/latest/download/docker-compose.yml
sudo wget -O .env https://github.com/immich-app/immich/releases/latest/download/example.env
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then edit &lt;code&gt;/opt/immich/.env&lt;/code&gt; to reflect your storage paths and database credentials:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;UPLOAD_LOCATION=/mnt/photos
DB_DATA_LOCATION=./postgres
IMMICH_VERSION=v3
DB_PASSWORD=REPLACE_WITH_A_RANDOM_ALPHANUMERIC_PASSWORD
DB_USERNAME=postgres
DB_DATABASE_NAME=immich
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;v3&lt;/code&gt; value reflects the current major-version tag used in the official example when I wrote this. Check &lt;a href="https://docs.immich.app/install/docker-compose/" rel="noopener noreferrer"&gt;Immich's Docker Compose guide&lt;/a&gt; for the latest installation details before deploying.&lt;/p&gt;

&lt;p&gt;The key separation is &lt;code&gt;UPLOAD_LOCATION&lt;/code&gt; for the photo library and &lt;code&gt;DB_DATA_LOCATION&lt;/code&gt; for PostgreSQL. &lt;strong&gt;Keep the database on local storage, not an NFS share.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Start the services
&lt;/h3&gt;

&lt;p&gt;From the deployment directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sudo docker compose up -d
sudo docker compose ps
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once the containers are running, open the web interface:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;http://YOUR_DEBIAN_GUEST_IP:2283
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create the initial account, upload a test photo, and confirm that the file is being stored where you expect.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Add secure remote access
&lt;/h3&gt;

&lt;p&gt;I use HAProxy on my OPNsense firewall to terminate HTTPS and forward requests to Immich on port &lt;code&gt;2283&lt;/code&gt;. That gives my iPhone a consistent HTTPS address whether I'm at home or away.&lt;/p&gt;

&lt;p&gt;You can also use a VPN or another properly configured HTTPS reverse proxy. Follow &lt;a href="https://docs.immich.app/administration/reverse-proxy/" rel="noopener noreferrer"&gt;Immich's reverse proxy documentation&lt;/a&gt; for request headers and upload-size considerations. Don't expose Immich's plain HTTP endpoint directly to the public internet.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setting Up Automatic iPhone Backups
&lt;/h2&gt;

&lt;p&gt;Once the server was working, the iOS app was the easy part:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Install the Immich app and sign in using your server's HTTPS URL.&lt;/li&gt;
&lt;li&gt;Allow it to access your photos and choose the albums you want to back up.&lt;/li&gt;
&lt;li&gt;Open the backup screen, select your albums, and enable backup.&lt;/li&gt;
&lt;li&gt;Enable &lt;strong&gt;Background App Refresh&lt;/strong&gt; for Immich in iOS Settings.&lt;/li&gt;
&lt;li&gt;Check your library on the web interface to make sure the uploads really arrived.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fdjk6d7cup44p2tn0lnwz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fdjk6d7cup44p2tn0lnwz.png" alt="Immich iPhone app showing the photo timeline used for automatic photo backup" width="472" height="1024"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;I use the iPhone app for daily browsing and backups, not just as a one-time import tool.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;For a large first migration, leave the app open long enough to work through your library. If you use &lt;strong&gt;Optimize iPhone Storage&lt;/strong&gt;, some originals may need to be fetched from iCloud before Immich can upload them.&lt;/p&gt;

&lt;p&gt;Don't downgrade iCloud storage until you've verified that your originals are on the server &lt;strong&gt;and&lt;/strong&gt; have independent backups.&lt;/p&gt;

&lt;p&gt;One feature I particularly like is the map view. If your photos contain GPS metadata, you can browse them by location instead of digging through dates and albums.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzdxde7jp910kkvpoblen.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzdxde7jp910kkvpoblen.png" alt="Immich desktop map view showing photos grouped by GPS locations" width="800" height="433"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Backups Are the Part You Can't Skip
&lt;/h2&gt;

&lt;p&gt;Self-hosting means I'm responsible for protecting the library. In my setup, photo and video files live on the NAS, while the PostgreSQL database stays on the Debian guest's local disk.&lt;/p&gt;

&lt;p&gt;I have automatic database dumps and a separate scheduled database export, but &lt;strong&gt;a database dump does not contain the original photos and videos&lt;/strong&gt;. Both the media files and the database need to be backed up.&lt;/p&gt;

&lt;p&gt;And a second copy on the same NAS isn't enough protection if that NAS fails. Ideally, keep an independent copy somewhere else, preferably offsite. Immich's &lt;a href="https://docs.immich.app/administration/backup-and-restore/" rel="noopener noreferrer"&gt;backup and restore documentation&lt;/a&gt; is worth reading before you trust it with your only copy of a photo library.&lt;/p&gt;

&lt;p&gt;You'll also need to maintain the deployment. For example, choosing a major-version image tag doesn't mean already-running containers automatically update themselves. I still have to pull and deploy updates, then occasionally clean up unused Docker images without touching important volumes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Would I Recommend Immich?
&lt;/h2&gt;

&lt;p&gt;If you already have Proxmox, a NAS, or a small homelab, absolutely. Immich lets me keep the convenience of automatic iPhone photo backups without relying on another paid cloud storage tier, and I like having direct control over the files.&lt;/p&gt;

&lt;p&gt;Just remember what you're trading: Apple's seamless ecosystem integration for the responsibility of running, updating, and backing up your own server.&lt;/p&gt;

&lt;p&gt;For me, that's worth it. I spend far more time using the Immich app than thinking about the Docker containers behind it, which is exactly what I wanted.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://www.techopt.io/servers-networking/my-icloud-photos-alternative-setting-up-immich-on-proxmox" rel="noopener noreferrer"&gt;TechOpt.io: My iCloud Photos Alternative - Setting Up Immich on Proxmox&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>proxmox</category>
      <category>linux</category>
      <category>selfhosted</category>
      <category>docker</category>
    </item>
    <item>
      <title>How to Fix Vector Collection Errors After Node.js Deploys — Marketplace Telemetry</title>
      <dc:creator>DorianVale91583</dc:creator>
      <pubDate>Mon, 16 Nov 2026 01:11:42 +0000</pubDate>
      <link>https://dev.to/dorianvale91583/how-to-fix-vector-collection-errors-after-nodejs-deploys-marketplace-telemetry-12oj</link>
      <guid>https://dev.to/dorianvale91583/how-to-fix-vector-collection-errors-after-nodejs-deploys-marketplace-telemetry-12oj</guid>
      <description>&lt;p&gt;TL;DR: Treat “collection not found” after a deployment as an identity mismatch, not a retrieval-quality problem. Resolve one environment-specific collection name at process startup, log the resolved identity without credentials, verify that the collection exists before bulk ingestion or search begins, and attach the same release and collection fields to every later event. Fail the deployment when that preflight check fails. Do not let an empty result impersonate a healthy marketplace search.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Signal at startup&lt;/th&gt;
&lt;th&gt;Likely boundary&lt;/th&gt;
&lt;th&gt;Pick this next move&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Expected and resolved names differ&lt;/td&gt;
&lt;td&gt;Configuration resolution&lt;/td&gt;
&lt;td&gt;Stop startup and print the non-secret inputs used to derive the name&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Names match, existence check fails&lt;/td&gt;
&lt;td&gt;Provisioning or target environment&lt;/td&gt;
&lt;td&gt;Block traffic and ingestion; inspect the environment’s provisioned collection set&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Existence check passes, search fails&lt;/td&gt;
&lt;td&gt;Runtime identity drift&lt;/td&gt;
&lt;td&gt;Compare collection, release, tenant, and endpoint fingerprints on both events&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Search succeeds, citations are absent&lt;/td&gt;
&lt;td&gt;Document metadata contract&lt;/td&gt;
&lt;td&gt;Quarantine the ingest batch; validate source identifiers before publishing&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;That table is the field guide. Start at the first matching row. A retrieval-augmented system depends on retrieved material to ground generation, so “no collection” and “valid collection with no relevant products” are different states and should never share an operational path [1].&lt;/p&gt;

&lt;h2&gt;
  
  
  What causes a vector collection not found error after a deploy?
&lt;/h2&gt;

&lt;p&gt;A marketplace deploy crosses several identities at once: application environment, tenant or catalog, embedding version, collection, release, and service endpoint. The error often appears at the collection boundary, but the first bad value may have entered much earlier. A staging suffix can disappear during configuration expansion. A bulk-ingestion worker can retain yesterday’s name while the search process starts with today’s release. A deployment can point at a different endpoint that happens to contain no identically named collection.&lt;/p&gt;

&lt;p&gt;The useful mental diagram is words, not boxes: &lt;strong&gt;deploy config -&amp;gt; name resolver -&amp;gt; existence probe -&amp;gt; bulk writer -&amp;gt; search reader -&amp;gt; cited product result&lt;/strong&gt;. Put an observable checkpoint at every arrow. One broken arrow is enough.&lt;/p&gt;

&lt;p&gt;Do not begin by changing similarity thresholds or embedding logic. Those controls affect ranking after retrieval has reached a valid collection. They cannot repair an address that names no collection.&lt;/p&gt;

&lt;p&gt;Stop there.&lt;/p&gt;

&lt;p&gt;There are three serious operating choices. Pick static per-environment names when a catalog changes in place and rollback does not need a second collection. Pick release-qualified names when ingestion builds a complete replacement and a later switch makes it live. Pick tenant-qualified names when isolation is a hard boundary and each tenant can be provisioned and monitored independently. The second and third choices create more collections, so they also demand lifecycle records and explicit cleanup. The first is simpler, but a partial bulk load can become visible unless publication is separately gated.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Make collection identity one pure function
&lt;/h2&gt;

&lt;p&gt;Scattered string interpolation is the quiet enemy here. Search and ingestion must import the same resolver. Make invalid input impossible to ignore, then test exact outputs.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nc"&gt;Environment&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"development"&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="s2"&gt;"staging"&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="s2"&gt;"production"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nc"&gt;CollectionIdentity&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;environment&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Environment&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;catalog&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;embeddingRevision&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&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;safePart&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;label&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&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="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="o"&gt;=&amp;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="n"&gt;value&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="nf"&gt;toLowerCase&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="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="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;z0&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;+/&lt;/span&gt;&lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&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;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;normalized&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="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&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;result&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`${label} resolves to an empty name component`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;result&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;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;collectionName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;identity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;CollectionIdentity&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="s2"&gt;"products"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nf"&gt;safePart&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"environment"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;identity&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environment&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nf"&gt;safePart&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"catalog"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;identity&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;catalog&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nf"&gt;safePart&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"embeddingRevision"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;identity&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;embeddingRevision&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="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&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;example&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;collectionName&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;environment&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"staging"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;catalog&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"home-goods"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;embeddingRevision&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"r3"&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;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;example&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="s2"&gt;"products--staging--home-goods--r3"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`unexpected collection name: ${example}`&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;This is intentionally boring. Good. The function has no implicit default, no hostname lookup, and no branch based on which process calls it. The embedding revision is present because a bulk loader and a query encoder must agree on the representation they use; the label itself is an application contract, not a claim about any database feature.&lt;/p&gt;

&lt;p&gt;Keep credentials out of this object. For the endpoint, emit a stable, non-secret fingerprint rather than the full URL. That gives operators a comparison key without placing authentication material in logs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Turn deployment into a preflight gate
&lt;/h2&gt;

&lt;p&gt;The application should not accept search traffic or start a million-item import before it proves the target collection exists. Define a tiny adapter around the backing store. The implementation can vary; the startup contract should not.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nc"&gt;VectorStore&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;collectionExists&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;boolean&lt;/span&gt;&lt;span class="o"&gt;&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="kd"&gt;type&lt;/span&gt; &lt;span class="nc"&gt;ReleaseContext&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;release&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;environment&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"development"&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="s2"&gt;"staging"&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="s2"&gt;"production"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;catalog&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;embeddingRevision&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&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;export&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;assertSearchReady&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="n"&gt;store&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;VectorStore&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;ReleaseContext&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="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="o"&gt;&amp;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;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;collectionName&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&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;startedAt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;performance&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&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="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;exists&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;collectionExists&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;name&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;durationMs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;performance&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;startedAt&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;info&lt;/span&gt;&lt;span class="p"&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;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"vector_collection_preflight"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;outcome&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;exists&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="s2"&gt;"ready"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"missing"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;collection&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;environment&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environment&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;catalog&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;catalog&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;embeddingRevision&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;embeddingRevision&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;release&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;release&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;durationMs&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="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;exists&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`required vector collection is missing: ${name}`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;name&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;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;error&lt;/span&gt;&lt;span class="p"&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;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"vector_collection_preflight_error"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;collection&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;environment&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environment&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;release&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;release&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;errorClass&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;error&lt;/span&gt; &lt;span class="k"&gt;instanceof&lt;/span&gt; &lt;span class="nb"&gt;Error&lt;/span&gt; &lt;span class="o"&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;name&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"UnknownError"&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="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="n"&gt;error&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;Wire this into readiness, not liveness. A process can be alive while its search dependency is unusable. The deployment controller should keep that instance out of service until the promise resolves. For a release-qualified collection, run the same gate against the proposed name before changing the reader’s active pointer.&lt;/p&gt;

&lt;p&gt;Notice the split between &lt;code&gt;missing&lt;/code&gt; and &lt;code&gt;preflight_error&lt;/code&gt;. The first means the store answered and the expected object was absent. The second covers an inability to establish that fact. Collapsing both into one message removes the strongest clue available during a deploy.&lt;/p&gt;

&lt;p&gt;One warning: do not log raw product text, vectors, connection strings, or tokens. Collection identity, release, catalog, outcome, and timing are enough to correlate this failure. Keep it crisp.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Protect bulk ingestion and grounding together
&lt;/h2&gt;

&lt;p&gt;Bulk ingestion needs a publication boundary. A batch that wrote 49,999 products out of 50,000 is not automatically a searchable catalog, and a batch written to the wrong collection is not useful merely because every write returned success. Record the intended collection once. Pass it explicitly. Validate citation metadata before any item enters the batch.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nc"&gt;ProductChunk&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;sourceUrl&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&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;type&lt;/span&gt; &lt;span class="nc"&gt;BatchWriter&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;collection&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;chunks&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;readonly&lt;/span&gt; &lt;span class="nc"&gt;ProductChunk&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="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="k"&gt;void&lt;/span&gt;&lt;span class="o"&gt;&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="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;validateChunk&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;chunk&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;ProductChunk&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;void&lt;/span&gt; &lt;span class="o"&gt;=&amp;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;chunk&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&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;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"product chunk requires an id"&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;chunk&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;text&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;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`product ${chunk.id} has empty text`&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;source&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="no"&gt;URL&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;chunk&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sourceUrl&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;source&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;protocol&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="s2"&gt;"https:"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`product ${chunk.id} requires an HTTPS citation URL`&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="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;ingestBatch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="n"&gt;writer&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;BatchWriter&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;collection&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;batchId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;chunks&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;readonly&lt;/span&gt; &lt;span class="nc"&gt;ProductChunk&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="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="k"&gt;void&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;chunks&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;forEach&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;validateChunk&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;startedAt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;performance&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&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;await&lt;/span&gt; &lt;span class="n"&gt;writer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;collection&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;chunks&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;info&lt;/span&gt;&lt;span class="p"&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;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"product_ingest_batch"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;outcome&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"written"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;collection&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;batchId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;itemCount&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;chunks&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;durationMs&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;performance&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;startedAt&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="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;The citation URL travels with the chunk because grounding has to survive the entire path. Retrieval without source identity leaves the answer layer unable to show which product content supported a claim. The original RAG paper frames generation around retrieved passages; in a marketplace, a stable product identifier and source URL are the practical bridge from passage back to evidence [1].&lt;/p&gt;

&lt;p&gt;The publish decision belongs after ingestion verification. Compare the intended count with the accepted count, sample reads by known product IDs, and run a small set of fixed queries whose expected citations are reviewed with the catalog. These are release checks, not ranking benchmarks. If any fail, keep the prior collection active and mark the candidate batch rejected.&lt;/p&gt;

&lt;p&gt;Once writes and reads share an identity, alert on drift rather than vague errors. Use a counter for preflight outcomes and a histogram for preflight duration. Attach bounded labels such as environment and outcome. Keep collection and release in structured logs rather than metric labels if each release creates a new value; otherwise the monitoring system accumulates an unhelpful stream of label combinations.&lt;/p&gt;

&lt;p&gt;The alert should be blunt: a production release has a missing preflight result, or ingestion and search report different resolved collections for the same environment and catalog. Page on the first condition because traffic cannot be served correctly. Route the second to the release owner before publication. A raw count of all “not found” messages is weaker because retries can inflate it and mix unrelated objects.&lt;/p&gt;

&lt;p&gt;Here is the before and after. Before: &lt;code&gt;collection not found&lt;/code&gt;. After: &lt;code&gt;release=2026-10-01.3 environment=production catalog=home-goods expected=products--production--home-goods--r3 outcome=missing&lt;/code&gt;. The extra fields do not solve the mismatch. They make the mismatch decidable.&lt;/p&gt;

&lt;p&gt;Also add one negative deployment test. Start the candidate with a deliberately absent collection name and verify that readiness stays closed. This catches the uncomfortable case where the probe logs an error but startup continues anyway.&lt;/p&gt;

&lt;p&gt;That is the gate.&lt;/p&gt;

&lt;h2&gt;
  
  
  Limits
&lt;/h2&gt;

&lt;p&gt;The main limitation is scope: this method isolates naming, provisioning, endpoint, and publication failures, but it does not prove that retrieved products are relevant, current, or fairly ranked. Those need a separate evaluation set and search-quality review. There is also a real trade-off in failing readiness on a missing collection. It prevents ungrounded search from serving, yet it makes the search path unavailable until provisioning is corrected. If the marketplace can honestly operate without semantic results, expose that as a deliberate product mode with a distinct response and metric; do not silently translate the infrastructure failure into an empty result set.&lt;/p&gt;

&lt;p&gt;It also cannot choose the right collection lifecycle for your marketplace. Static, release-qualified, and tenant-qualified names trade operational simplicity against isolation and rollback control. Choose one contract, document it, and make every writer and reader resolve it through the same function. Then let telemetry prove they did.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://arxiv.org/abs/2005.11401" rel="noopener noreferrer"&gt;https://arxiv.org/abs/2005.11401&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>node</category>
      <category>vector</category>
      <category>debugging</category>
    </item>
    <item>
      <title>The servers you can no longer patch are the hardest ones to protect. Defender for Endpoint on Server 2012 R2 and 2016.</title>
      <dc:creator>CD Security Lab</dc:creator>
      <pubDate>Mon, 16 Nov 2026 01:11:14 +0000</pubDate>
      <link>https://dev.to/cdsecuritylab/the-servers-you-can-no-longer-patch-are-the-hardest-ones-to-protect-defender-for-endpoint-on-4km2</link>
      <guid>https://dev.to/cdsecuritylab/the-servers-you-can-no-longer-patch-are-the-hardest-ones-to-protect-defender-for-endpoint-on-4km2</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Source: CD's readiness notes &lt;code&gt;MDE-Readiness/Day 8- GPO + unifiedmma.md&lt;/code&gt; (MMA on Windows 7 / 8.1 / 2008 R2, the unified solution for 2012 R2 / 2016, KB5005292, Configuration Manager 2207, SSU/LCU prerequisites, detection test), rebuilt as a lab story and cross-checked against Microsoft Learn on 2026-10-28. Lab names only; screens are drawings.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;On 14 October 2026 the last Extended Security Update year for Windows Server 2012 R2 ended. Contoso still has twelve of them, under a finance application nobody dares to touch, plus twenty Server 2016 machines whose extended support ends on 13 January 2027, and three Server 2008 R2 boxes behind a label printer.&lt;/p&gt;

&lt;p&gt;Those 35 servers will get no more security patches. They are exactly the machines where endpoint detection and response is the only control left. And in the Defender portal, the twelve 2012 R2 servers show &lt;strong&gt;Impaired communications&lt;/strong&gt; or are missing: they were onboarded in 2022 with the Log Analytics agent, and nobody moved them to the unified agent before the MMA path went quiet.&lt;/p&gt;

&lt;h2&gt;
  
  
  It happened for real: WannaCry, 2017
&lt;/h2&gt;

&lt;p&gt;Old, unpatched Windows is not a theoretical risk. On 12 May 2017 one worm went through exactly those machines around the world in a single day.&lt;/p&gt;

&lt;h3&gt;
  
  
  What happened
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Date (2017)&lt;/th&gt;
&lt;th&gt;Event&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;14 March&lt;/td&gt;
&lt;td&gt;Microsoft releases security update MS17-010 for a critical flaw in SMBv1, the old Windows file-sharing protocol.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;14 April&lt;/td&gt;
&lt;td&gt;A group called the Shadow Brokers publishes an exploit for that flaw (EternalBlue).&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;12 May&lt;/td&gt;
&lt;td&gt;WannaCry ransomware starts spreading by itself over SMB, from one unpatched machine to the next.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;12 to 13 May&lt;/td&gt;
&lt;td&gt;Microsoft takes the unusual step of releasing the fix for Windows XP and Server 2003, long out of support.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Same weekend&lt;/td&gt;
&lt;td&gt;A security researcher finds a "kill switch" domain and registers it, which stops the spread.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Why it worked
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Door 1, a fix that was never installed.&lt;/strong&gt; The patch was two months old. The UK National Audit Office found that the NHS organisations hit had unpatched or unsupported Windows; most infected devices were supported Windows 7 that had simply not been patched.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Door 2, a protocol nobody needed.&lt;/strong&gt; SMBv1 was still switched on and reachable between machines.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Door 3, one flat network.&lt;/strong&gt; Once one machine was infected, nothing stopped it from reaching the next.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  What it cost
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Who&lt;/th&gt;
&lt;th&gt;What they lost&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;More than 200,000 computers in at least 100 countries&lt;/td&gt;
&lt;td&gt;Files encrypted, with a bitcoin ransom note&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;The NHS in England&lt;/td&gt;
&lt;td&gt;About 19,000 appointments cancelled; an estimated 92 million GBP (19 million lost output, 73 million IT recovery), per the Department of Health and Social Care&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Factories, railways, telecoms&lt;/td&gt;
&lt;td&gt;Production lines and ticket systems stopped across Europe and Asia&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  The same doors in a Microsoft environment
&lt;/h3&gt;

&lt;p&gt;The 35 servers in this post are the WannaCry population: old Windows, patches that stopped or were never installed. The sensor is the first step. These are the other three:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Door 1, the patch nobody installed:&lt;/strong&gt; once the sensor reports, Defender Vulnerability Management lists every missing update. Query 1 below finds the WannaCry flaw itself, which still shows up on forgotten machines.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Door 2, SMBv1:&lt;/strong&gt; remove it. On Server 2012 R2 and 2016: &lt;code&gt;Disable-WindowsOptionalFeature -Online -FeatureName SMB1Protocol&lt;/code&gt;, or &lt;code&gt;Set-SmbServerConfiguration -EnableSMB1Protocol $false&lt;/code&gt; where the feature cannot be removed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Door 3, one machine infects the next:&lt;/strong&gt; in Defender for Endpoint, &lt;strong&gt;contain&lt;/strong&gt; or &lt;strong&gt;isolate&lt;/strong&gt; an infected device in one click, and turn on automatic attack disruption so it can happen without waiting. Query 2 shows which servers accept SMB connections from many internal machines, the first ones to segment.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Query 1: devices still exposed to the WannaCry SMB flaws (MS17-010)
DeviceTvmSoftwareVulnerabilities
| where CveId in ("CVE-2017-0143", "CVE-2017-0144", "CVE-2017-0145", "CVE-2017-0146", "CVE-2017-0148")
| summarize CVEs = make_set(CveId) by DeviceName, OSPlatform, OSVersion
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Query 2: servers accepting SMB from many internal machines (last 7 days)
DeviceNetworkEvents
| where Timestamp &amp;gt; ago(7d)
| where ActionType == "InboundConnectionAccepted" and LocalPort == 445
| summarize Sources = dcount(RemoteIP) by DeviceName
| order by Sources desc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  TL;DR
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Problem:&lt;/strong&gt; the oldest servers carry the highest risk (unpatchable, business-critical, forgotten) and the oldest onboarding method. The 2022 way (Microsoft Monitoring Agent) is not the 2026 way (the modern unified solution for 2012 R2 / 2016, a different "Defender deployment tool" for 2008 R2 / Windows 7). Leave them on the old path and the sensor goes silent while the portal still lists the device.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Who it hurts:&lt;/strong&gt; the finance team whose app runs on those boxes, the SOC that has no telemetry from the most attackable servers, the CISO who signs "EDR on 100% of servers", and the budget paying Defender for Servers per machine for a sensor that does not report.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fix:&lt;/strong&gt; offboard the MMA path, meet the four prerequisites (SSU, LCU, Defender Antivirus feature on 2016, KB5005292 approved in WSUS), install the unified package with the onboarding script, verify &lt;code&gt;sense&lt;/code&gt; and &lt;code&gt;Windefend&lt;/code&gt;, run the detection test; let Defender for Cloud or Configuration Manager 2207+ do it at scale. For 2008 R2 and Windows 7, the Defender deployment tool, or isolate and retire.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cost:&lt;/strong&gt; Defender for Servers Plan 1 about $5 per server per month (EDR), Plan 2 about $15; CrowdStrike Falcon Pro about $8.33, SentinelOne Complete about $15 per endpoint per month, both list, both support 2012 R2 / 2016 too. The 35 unpatchable servers cost more in ESU and risk than in sensors.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Prove it:&lt;/strong&gt; 35 of 35 &lt;em&gt;Onboarded&lt;/em&gt;, sensor health &lt;em&gt;Active&lt;/em&gt;, a detection test alert from &lt;code&gt;LAB-FIN-2012-01&lt;/code&gt; within minutes, and vulnerability management listing the missing patches so the risk is at least visible.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Table of contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;It happened for real: WannaCry, 2017&lt;/li&gt;
&lt;li&gt;1. The problem&lt;/li&gt;
&lt;li&gt;2. Who gets hurt&lt;/li&gt;
&lt;li&gt;3. Cost and value&lt;/li&gt;
&lt;li&gt;4. How to fix it&lt;/li&gt;
&lt;li&gt;5. Prove it&lt;/li&gt;
&lt;li&gt;Gotchas&lt;/li&gt;
&lt;li&gt;Checklist&lt;/li&gt;
&lt;li&gt;What changed recently&lt;/li&gt;
&lt;li&gt;Sources&lt;/li&gt;
&lt;li&gt;News sources&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  1. The problem
&lt;/h2&gt;

&lt;p&gt;An old building with no fire inspection any more. You cannot fix the wiring (no patches), so you need the smoke detectors more than in any other building. And the detectors installed in 2022 ran on a battery type nobody makes now.&lt;/p&gt;

&lt;p&gt;Three generations of Windows Server, three onboarding paths:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;OS&lt;/th&gt;
&lt;th&gt;Support status (Learn lifecycle, checked 2026-10-28)&lt;/th&gt;
&lt;th&gt;Defender for Endpoint path in 2026&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Windows Server 2019 and later&lt;/td&gt;
&lt;td&gt;In support&lt;/td&gt;
&lt;td&gt;Sensor built in; onboard with a package, Intune, Configuration Manager or Defender for Cloud&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Windows Server 2016&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Extended support ends &lt;strong&gt;2027-01-13&lt;/strong&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Modern unified solution&lt;/strong&gt;: installer package + onboarding script; Defender Antivirus must be installed as a feature first&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Windows Server 2012 R2&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Extended support ended 2023-10-11; &lt;strong&gt;ESU year 3 ended 2026-10-14&lt;/strong&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Modern unified solution&lt;/strong&gt;: installer brings Defender Antivirus and the EDR sensor&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Windows Server 2008 R2 SP1, Windows 7 SP1&lt;/td&gt;
&lt;td&gt;Long out of support&lt;/td&gt;
&lt;td&gt;Only with the &lt;strong&gt;Defender deployment tool&lt;/strong&gt; (the old MMA path is kept only for Windows 8.1)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The unified solution has existed since April 2022 (my notes record the date). What changed is that the alternative is gone: the MMA-based sensor for 2012 R2 / 2016 is the "previous solution", and MMA itself retired in 2024. Servers still on it look onboarded in the inventory and send nothing.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5v57u6c44rlmpfuxrt79.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5v57u6c44rlmpfuxrt79.png" alt="Three generations, three paths, and where the twelve 2012 R2 servers are stuck" width="800" height="261"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Who gets hurt
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Who&lt;/th&gt;
&lt;th&gt;What they lose&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Finance / the business&lt;/td&gt;
&lt;td&gt;The app runs on the most exposed servers in the estate, with no detection&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SOC&lt;/td&gt;
&lt;td&gt;No process, network or logon telemetry from the machines an attacker would pick first; an incident there is found by the finance team, not by the SOC&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CISO&lt;/td&gt;
&lt;td&gt;"EDR on 100% of servers" in the board pack is 65% in reality&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Budget&lt;/td&gt;
&lt;td&gt;Defender for Servers is billed per machine in the subscription; twelve silent sensors are twelve wasted licences, on top of ESU already paid&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;The product&lt;/td&gt;
&lt;td&gt;"Defender does not work on old servers", when the unified agent reached near parity with 2019 four years ago&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  3. Cost and value
&lt;/h2&gt;

&lt;p&gt;Checked 2026-10-28, USD list, per server per month unless stated; vendor list prices from their public pricing pages.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Option&lt;/th&gt;
&lt;th&gt;Price&lt;/th&gt;
&lt;th&gt;Notes&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Defender for Servers &lt;strong&gt;Plan 1&lt;/strong&gt; (via Defender for Cloud)&lt;/td&gt;
&lt;td&gt;about $5&lt;/td&gt;
&lt;td&gt;EDR through the Defender for Endpoint integration; per-resource enablement possible&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Defender for Servers &lt;strong&gt;Plan 2&lt;/strong&gt;
&lt;/td&gt;
&lt;td&gt;about $15&lt;/td&gt;
&lt;td&gt;Plan 1 + agentless vulnerability and malware scanning, premium vulnerability management, 500 MB/day log benefit&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Defender for Endpoint for Servers (standalone)&lt;/td&gt;
&lt;td&gt;quote / volume licence&lt;/td&gt;
&lt;td&gt;Same sensor, no Defender for Cloud&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CrowdStrike Falcon &lt;strong&gt;Go&lt;/strong&gt;
&lt;/td&gt;
&lt;td&gt;$59.99 per device per year (about $5.00), max 100 devices&lt;/td&gt;
&lt;td&gt;Entry tier&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CrowdStrike Falcon &lt;strong&gt;Pro&lt;/strong&gt;
&lt;/td&gt;
&lt;td&gt;$99.99 per device per year (about $8.33)&lt;/td&gt;
&lt;td&gt;NGAV + basic EDR&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CrowdStrike Falcon &lt;strong&gt;Enterprise&lt;/strong&gt;
&lt;/td&gt;
&lt;td&gt;$184.99 per device per year (about $15.42)&lt;/td&gt;
&lt;td&gt;Full EDR, threat hunting&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SentinelOne Singularity &lt;strong&gt;Complete&lt;/strong&gt;
&lt;/td&gt;
&lt;td&gt;$179.99 per endpoint per year (about $15.00)&lt;/td&gt;
&lt;td&gt;Full EDR&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SentinelOne &lt;strong&gt;Core&lt;/strong&gt;
&lt;/td&gt;
&lt;td&gt;no public price&lt;/td&gt;
&lt;td&gt;via partners&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;All of the above support Windows Server 2012 R2 and 2016 with a current sensor; 2008 R2 is "legacy sensor" territory for every vendor, and Windows 7 is on the way out everywhere.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Lab, 35 legacy servers:&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Item&lt;/th&gt;
&lt;th&gt;Monthly&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Plan 1 on 23 web/app-tier legacy servers&lt;/td&gt;
&lt;td&gt;$115&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Plan 2 on 12 finance servers (vulnerability management matters most where you cannot patch)&lt;/td&gt;
&lt;td&gt;$180&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Sensors, total&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;$295&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Server 2012 R2 ESU, which just ended&lt;/td&gt;
&lt;td&gt;no longer purchasable; the risk is now uncovered&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Server 2016 ESU from 2027-01-13&lt;/td&gt;
&lt;td&gt;Microsoft sells it per core per year; Azure VMs and Azure Arc-enabled servers can enrol through Azure&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Value:&lt;/strong&gt; $295 a month puts telemetry and vulnerability data on the 35 machines that have none and will never be patched again. The alternative control, isolation and retirement, is the right long-term answer and takes months; the sensor takes an afternoon.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. How to fix it
&lt;/h2&gt;

&lt;p&gt;Lab: &lt;code&gt;LAB-FIN-2012-01..12&lt;/code&gt; (Server 2012 R2), &lt;code&gt;LAB-APP-2016-01..20&lt;/code&gt; (Server 2016), &lt;code&gt;LAB-PRN-2008-01..03&lt;/code&gt; (Server 2008 R2), all Arc-enabled into &lt;code&gt;sub-lab-prod&lt;/code&gt;, Defender for Servers Plan 1 or 2 on.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1: get off the old path first.&lt;/strong&gt; On each 2012 R2 / 2016 server still using MMA: remove the Defender for Endpoint workspace from the Microsoft Monitoring Agent (Control Panel → Microsoft Monitoring Agent → Azure Log Analytics (OMS) → remove the workspace) or uninstall MMA. Running the new installer on top of a live MMA onboarding is the classic cause of a device that is "onboarded twice and reporting never".&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2: prerequisites (Learn, unified solution page updated 2026-10-20).&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Requirement&lt;/th&gt;
&lt;th&gt;2012 R2&lt;/th&gt;
&lt;th&gt;2016&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Servicing Stack Update from 2021-09-14 or later&lt;/td&gt;
&lt;td&gt;required&lt;/td&gt;
&lt;td&gt;required&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Latest Cumulative Update from 2018-09-20 or later (latest recommended)&lt;/td&gt;
&lt;td&gt;required&lt;/td&gt;
&lt;td&gt;required&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Microsoft Defender Antivirus&lt;/td&gt;
&lt;td&gt;installed by the package&lt;/td&gt;
&lt;td&gt;must be &lt;strong&gt;installed as a feature and updated&lt;/strong&gt; before the package&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Antimalware platform update KB4052623&lt;/td&gt;
&lt;td&gt;via Windows Update or the catalog&lt;/td&gt;
&lt;td&gt;same&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;KB5005292&lt;/strong&gt; "Microsoft Defender for Endpoint update for EDR Sensor" approved in WSUS / Configuration Manager&lt;/td&gt;
&lt;td&gt;required for ongoing sensor updates&lt;/td&gt;
&lt;td&gt;same&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsaa1lvd6xireg9j8tuc9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsaa1lvd6xireg9j8tuc9.png" alt="Prerequisite check on LAB-FIN-2012-01 before the installer runs" width="800" height="373"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3: download fresh, every time.&lt;/strong&gt; Defender portal → Settings → Endpoints → Onboarding → &lt;em&gt;Windows Server 2012 R2 and 2016&lt;/em&gt; → download the &lt;strong&gt;installation package&lt;/strong&gt; (updated monthly) and the &lt;strong&gt;onboarding package&lt;/strong&gt; (Group Policy, local script, Configuration Manager or VDI flavour).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 4: install.&lt;/strong&gt; Local script for the pilot:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="c1"&gt;# 1. unified solution installer&lt;/span&gt;
&lt;span class="n"&gt;msiexec&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="n"&gt;md4ws&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;msi&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;quiet&lt;/span&gt;
&lt;span class="c1"&gt;# 2. onboarding script from the onboarding package&lt;/span&gt;
&lt;span class="p"&gt;.&lt;/span&gt;\&lt;span class="nc"&gt;WindowsDefenderATPOnboardingScript&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;cmd&lt;/span&gt;
&lt;span class="c1"&gt;# 3. verify&lt;/span&gt;
&lt;span class="n"&gt;sc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;exe&lt;/span&gt; &lt;span class="n"&gt;query&lt;/span&gt; &lt;span class="n"&gt;sense&lt;/span&gt;        &lt;span class="c1"&gt;# STATE: RUNNING&lt;/span&gt;
&lt;span class="n"&gt;sc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;exe&lt;/span&gt; &lt;span class="n"&gt;query&lt;/span&gt; &lt;span class="nc"&gt;Windefend&lt;/span&gt;    &lt;span class="c1"&gt;# RUNNING; "does not exist" on 2016 = Defender AV feature missing&lt;/span&gt;
&lt;span class="nc"&gt;Get&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;ItemProperty&lt;/span&gt; &lt;span class="s2"&gt;"HKLM:\SOFTWARE\Microsoft\Windows Advanced Threat Protection\Status"&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="nc"&gt;Select&lt;/span&gt; &lt;span class="nc"&gt;OnboardingState&lt;/span&gt;  &lt;span class="c1"&gt;# 1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At scale: Configuration Manager &lt;strong&gt;2207 or later&lt;/strong&gt; deploys and onboards the unified solution automatically; Defender for Cloud does the same for Azure VMs and Arc-enabled servers once the Defender for Endpoint integration is on (the previous post covers that toggle). Group Policy with the GPO onboarding package also works, which is what my Day 8 notes used.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 5: connectivity.&lt;/strong&gt; The sensor needs the Defender for Endpoint service URLs &lt;strong&gt;directly and without SSL inspection&lt;/strong&gt;. The finance VLAN had TLS inspection on; the sensor installed, onboarded, and never phoned home. Allow the URL set from the proxy and connectivity doc for your geography, or use the streamlined connectivity option where the OS supports it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 6: 2008 R2 and Windows 7.&lt;/strong&gt; The MMA method is now documented only for Windows 8.1; 2008 R2 SP1 and Windows 7 SP1 onboard with the &lt;strong&gt;Defender deployment tool&lt;/strong&gt;, which can also upgrade devices currently on MMA. If the label printer server cannot take it, put it on an isolated VLAN with a firewall rule to one print queue, and plan its retirement; a sensor is not a substitute for a network boundary on a 17-year-old OS.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fuia6ek73juezxij41wu8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fuia6ek73juezxij41wu8.png" alt="sc query, event log and onboarding state: what healthy looks like" width="799" height="469"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Prove it
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Defender portal → Assets → Devices, filter OS = Windows Server 2012 R2 / 2016: 32 of 32 &lt;strong&gt;Onboarded&lt;/strong&gt;, sensor health state &lt;strong&gt;Active&lt;/strong&gt;, last seen within the hour.&lt;/li&gt;
&lt;li&gt;Detection test on &lt;code&gt;LAB-FIN-2012-01&lt;/code&gt; (the documented PowerShell test from the onboarding page): an alert in the Defender portal within minutes.&lt;/li&gt;
&lt;li&gt;Advanced hunting:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DeviceInfo
| where Timestamp &amp;gt; ago(1d)
| where OSPlatform in ("WindowsServer2012R2", "WindowsServer2016")
| summarize arg_max(Timestamp, OnboardingStatus, SensorHealthState, ClientVersion) by DeviceName
| summarize count() by OnboardingStatus, SensorHealthState
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Target: one row, &lt;code&gt;Onboarded / Active&lt;/code&gt;, count 32.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Vulnerability management → Weaknesses, filter those devices: the unpatched CVEs are listed. The risk did not go away; it is now visible, with exposure scores the CISO can decide on.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fy0azwnay9znbhjvwuenk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fy0azwnay9znbhjvwuenk.png" alt="Before and after: 23 of 35 onboarded and silent, then 35 of 35 with a test alert" width="800" height="325"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Gotchas
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;"Onboarded" in the inventory means the device once onboarded.&lt;/strong&gt; Sensor health and last-seen tell you whether it reports. Filter on &lt;em&gt;Impaired communications&lt;/em&gt; and &lt;em&gt;No sensor data&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Server 2016 needs Defender Antivirus as a Windows feature first.&lt;/strong&gt; &lt;code&gt;sc query Windefend&lt;/code&gt; says "does not exist" otherwise, and the EDR sensor will not run in active mode.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A DisableAntiSpyware / DisableAntiVirus policy breaks the start.&lt;/strong&gt; Errors 577 or 1058 when starting the service: clear the policy; the ELAM driver must stay enabled.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Slow disks and the installer timeout.&lt;/strong&gt; &lt;code&gt;Couldn't find ...mpasdesc.dll - 310 WinDefend&lt;/code&gt; on an installation: take the latest package and use &lt;code&gt;install.ps1&lt;/code&gt; from Microsoft's &lt;code&gt;mdefordownlevelserver&lt;/code&gt; repository to clear the failed install.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Re-running the installer is not an update.&lt;/strong&gt; It asks you to offboard first. Updates come through KB5005292; approve it in WSUS or the sensor freezes at its install version.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OS upgrade means offboard first.&lt;/strong&gt; For 2016 and earlier, offboard and uninstall before an in-place upgrade. Upgrading to 2019 or later is the actual fix for the whole problem.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SSL inspection is a silent killer.&lt;/strong&gt; Sensor installs fine, device never appears. Check the proxy before the event log.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Limited UI on the unified solution.&lt;/strong&gt; Local operations via PowerShell, WMI or &lt;code&gt;MPCmdRun.exe&lt;/code&gt;; some attack surface reduction rules do not apply to the older OS.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Event IDs to know.&lt;/strong&gt; SENSE operational log: 5 / 15 (cannot reach the service: connectivity), 6 (no onboarding parameters: run the script again), 55 (ETW autologger: reboot). Onboarding script: 40 (onboarding state not 1), 65 (not elevated).&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Checklist
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;[ ] Inventory every Server 2012 R2 / 2016 / 2008 R2 with its real sensor health, not its onboarding flag&lt;/li&gt;
&lt;li&gt;[ ] MMA-based onboarding removed before the unified package&lt;/li&gt;
&lt;li&gt;[ ] SSU + LCU current; Defender Antivirus feature installed on 2016; KB4052623 platform update&lt;/li&gt;
&lt;li&gt;[ ] KB5005292 approved in WSUS / Configuration Manager for ongoing sensor updates&lt;/li&gt;
&lt;li&gt;[ ] Fresh installer and onboarding package from the portal; Configuration Manager 2207+ or Defender for Cloud for scale&lt;/li&gt;
&lt;li&gt;[ ] Defender for Endpoint URLs reachable without SSL inspection from every legacy VLAN&lt;/li&gt;
&lt;li&gt;[ ] &lt;code&gt;sense&lt;/code&gt; running, &lt;code&gt;Windefend&lt;/code&gt; running, OnboardingState = 1, detection test passed&lt;/li&gt;
&lt;li&gt;[ ] 2008 R2 / Windows 7: Defender deployment tool, or isolated and scheduled for retirement&lt;/li&gt;
&lt;li&gt;[ ] Plan 1 / Plan 2 decided per server; vulnerability list reviewed monthly for the unpatchable set&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What changed recently
&lt;/h2&gt;

&lt;p&gt;Checked against Microsoft Learn on 2026-10-28:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;My notes said "MMA will retire in August 2024" and still described the MMA route for 2012 R2 / 2016 next to the unified one. Learn now lists only the modern unified solution for those two, with the MMA route called the "previous solution" and migration guidance for leftovers (unified solution page updated 2026-10-20).&lt;/li&gt;
&lt;li&gt;For Windows 7 SP1 and Server 2008 R2 SP1 the documented path is now the &lt;strong&gt;Defender deployment tool&lt;/strong&gt;; MMA is kept only for Windows 8.1, with a minimum agent version because of SHA-1 deprecation (down-level page updated 2026-06-03). My notes had all three on MMA.&lt;/li&gt;
&lt;li&gt;Lifecycle: Server 2012 R2 ESU year 3 ended 2026-10-14; Server 2016 extended support ends 2027-01-13. Both dates passed or are closer than when my notes were written, which is the point of this post.&lt;/li&gt;
&lt;li&gt;Prerequisite dates are explicit now: SSU from 2021-09-14, LCU from 2018-09-20, Defender Antivirus feature on 2016, KB5005292 for sensor updates, Configuration Manager 2207+ for automatic deployment.&lt;/li&gt;
&lt;li&gt;New known issues on the Learn page: installer timeout on slow disks (&lt;code&gt;mpasdesc.dll - 310&lt;/code&gt;), &lt;code&gt;install.ps1&lt;/code&gt; for clearing failed installs, offboard before OS upgrade on 2016 and earlier.&lt;/li&gt;
&lt;li&gt;Defender for Cloud &lt;strong&gt;Direct onboarding&lt;/strong&gt; now covers non-Azure servers that were onboarded by hand, tenant-wide, with no pilot group.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://learn.microsoft.com/en-us/defender-endpoint/onboard-windows-server" rel="noopener noreferrer"&gt;Onboard Windows Server 2012 R2 and 2016 (modern unified solution)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://learn.microsoft.com/en-us/defender-endpoint/onboard-downlevel" rel="noopener noreferrer"&gt;Onboard previous versions of Windows&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://learn.microsoft.com/en-us/defender-endpoint/minimum-requirements" rel="noopener noreferrer"&gt;Minimum requirements for Defender for Endpoint&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://learn.microsoft.com/en-us/defender-endpoint/troubleshoot-onboarding" rel="noopener noreferrer"&gt;Troubleshoot onboarding issues&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://learn.microsoft.com/en-us/lifecycle/products/windows-server-2012-r2" rel="noopener noreferrer"&gt;Windows Server 2012 R2 lifecycle&lt;/a&gt; and &lt;a href="https://learn.microsoft.com/en-us/lifecycle/products/windows-server-2016" rel="noopener noreferrer"&gt;Windows Server 2016 lifecycle&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://learn.microsoft.com/en-us/azure/defender-for-cloud/plan-defender-for-servers-select-plan" rel="noopener noreferrer"&gt;Select a Defender for Servers plan&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.crowdstrike.com/en-us/products/" rel="noopener noreferrer"&gt;CrowdStrike Falcon pricing&lt;/a&gt; and &lt;a href="https://www.sentinelone.com/platform/pricing/" rel="noopener noreferrer"&gt;SentinelOne pricing&lt;/a&gt; (list prices as published, 2026-10-28)&lt;/li&gt;
&lt;li&gt;&lt;a href="https://learn.microsoft.com/en-us/windows-server/storage/file-server/troubleshoot/detect-enable-and-disable-smbv1-v2-v3" rel="noopener noreferrer"&gt;Detect, enable and disable SMBv1, SMBv2 and SMBv3&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://learn.microsoft.com/en-us/defender-endpoint/respond-machine-alerts" rel="noopener noreferrer"&gt;Take response actions on a device (isolate, contain)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  News sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;UK National Audit Office, "Investigation: WannaCry cyber attack and the NHS" (October 2017): &lt;a href="https://www.nao.org.uk/reports/investigation-wannacry-cyber-attack-and-the-nhs/" rel="noopener noreferrer"&gt;https://www.nao.org.uk/reports/investigation-wannacry-cyber-attack-and-the-nhs/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Computer Weekly, "Cost of WannaCry attack to NHS set at 92m" (October 2018, on the Department of Health and Social Care report): &lt;a href="https://www.computerweekly.com/news/252450600/Cost-of-WannaCry-attack-to-NHS-set-at-92m" rel="noopener noreferrer"&gt;https://www.computerweekly.com/news/252450600/Cost-of-WannaCry-attack-to-NHS-set-at-92m&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Microsoft Security Bulletin MS17-010 (March 2017): &lt;a href="https://learn.microsoft.com/en-us/security-updates/securitybulletins/2017/ms17-010" rel="noopener noreferrer"&gt;https://learn.microsoft.com/en-us/security-updates/securitybulletins/2017/ms17-010&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fiz7qjqtjp0ci70rjx5x4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fiz7qjqtjp0ci70rjx5x4.png" alt="Cheat sheet: three generations, three paths" width="800" height="1000"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Thanks for reading!&lt;/strong&gt; I'm Cuong, and on CD Security Lab I rebuild real Microsoft security cases in a safe lab and explain them simply. Follow along:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;▶️ YouTube (daily Shorts + explainers): &lt;a href="https://www.youtube.com/@cdsecuritylab" rel="noopener noreferrer"&gt;CD Security Lab&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;💼 LinkedIn: &lt;a href="https://www.linkedin.com/in/cuongdohung/" rel="noopener noreferrer"&gt;Cuong Do&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;📘 Facebook: &lt;a href="https://www.facebook.com/cdsecuritylab" rel="noopener noreferrer"&gt;CD Security Lab&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;📸 Instagram: &lt;a href="https://www.instagram.com/cdsecuritylab/" rel="noopener noreferrer"&gt;@cdsecuritylab&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;📝 More posts like this: &lt;a href="https://dev.to/cdsecuritylab"&gt;Dev.to&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Got a question about your own tenant? Drop it in the comments.&lt;/p&gt;

</description>
      <category>azure</category>
      <category>security</category>
      <category>cybersecurity</category>
      <category>microsoft</category>
    </item>
    <item>
      <title>I Built an AI Tattoo Generator That Costs $0.06 a Design — Here's What the Tattoo Apps Don't Want You to Notice</title>
      <dc:creator>Jerry Simth</dc:creator>
      <pubDate>Mon, 16 Nov 2026 01:10:52 +0000</pubDate>
      <link>https://dev.to/jerrysimth/i-built-an-ai-tattoo-generator-that-costs-006-a-design-heres-what-the-tattoo-apps-dont-want-46gb</link>
      <guid>https://dev.to/jerrysimth/i-built-an-ai-tattoo-generator-that-costs-006-a-design-heres-what-the-tattoo-apps-dont-want-46gb</guid>
      <description>&lt;p&gt;Most tattoo apps don't sell you a design. They sell you a subscription you can't cancel.&lt;/p&gt;

&lt;p&gt;Take the biggest one: Tattoo AI by HubX has 7.9 million installs and a 3.94-star rating — but 46,000 of its ~270,000 ratings are one star, about 17%. Read the one-star reviews and the same complaints repeat: charged after cancelling, no way to cancel inside the app, a $5 quiz that turns into a subscription. It still makes an estimated $50,000–100,000 a month. The product works well enough that people keep paying; the business model works even better.&lt;/p&gt;

&lt;p&gt;Meanwhile "ai tattoo generator" gets an estimated 15,000–120,000 searches a month, and there is still no dominant web player — the biggest, BlackInk AI, gets roughly 265,000 visits a month. The app stores captured this demand first, and they captured it with subscriptions. The web never really got its version. So I built one.&lt;/p&gt;

&lt;h3&gt;
  
  
  What it is
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://pizyn.com/tools/ai-tattoo-generator/" rel="noopener noreferrer"&gt;AI Tattoo Generator&lt;/a&gt; is a free-to-try tool on Pizyn: pick one of eight styles, describe your idea, and Seedream 5.5 draws it. A design costs 4 credits at 1K (6 at 2K) — about $0.04–0.06 each. There is no subscription, ever; you buy credits once and they never expire. Sign-up comes with 20 free credits, about $0.20, which is five designs at 1K.&lt;/p&gt;

&lt;p&gt;The eight styles are ranked by demand, not alphabetically: fine line, minimalist, traditional, blackwork, Japanese, cybersigilism, geometric, and microrealism — plus lettering and a stencil mode. Fine line is the runaway trend (3.2 billion TikTok views, requests up 35%); blackwork is close behind at 1.5 billion; traditional sits at 950 million. Cybersigilism is the interesting one: Pinterest searches up 3,233% year over year, and almost nobody has built a dedicated tool for it. Microrealism replaced watercolor in the lineup after we tested it — two trend sources call it 2026's most in-demand style, and the test generation (a tiny hyperrealistic cat portrait) held its detail at small scale.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5js8utwcdbhs67bcio5r.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5js8utwcdbhs67bcio5r.webp" alt="Fine line lavender tattoo design, generated with Seedream 5.5" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;One deliberate omission: tribal. It's an outdated category, and the patterns people mean by it mostly belong to Māori and Polynesian traditions. A generator that spits those out as a "style" is a bad idea, so it isn't there.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F7e2ajpryc42gw2sj51cy.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F7e2ajpryc42gw2sj51cy.webp" alt="Traditional dagger and rose tattoo design, generated with Seedream 5.5" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Why Seedream 5.5, and what we tested
&lt;/h3&gt;

&lt;p&gt;I tested three models on the same four prompts before binding the tool to one. Seedream 5.5 won on the combination that matters for tattoos: it's the cheapest at 6 credits per 2K image, and it returns a PNG with a real alpha channel — verified with PIL at 75.6% transparent pixels — which is the whole point of a stencil (more on that below). GPT Image 2.6 is the backup: best lettering on the first try, but 9 credits and no native transparency. Nano Banana 2.1 came third — it added unprompted decoration in 2 of 4 tests, which is exactly what you don't want in a design you're about to put on skin permanently.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fth5h402nxe3frilvih3a.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fth5h402nxe3frilvih3a.webp" alt="Japanese koi tattoo design, generated with Seedream 5.5" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here's the gap that convinced me this was worth building at all: for the five highest-demand styles — fine line, minimalist, traditional, blackwork, Japanese — there is no dedicated AI tool page in the top 5 results for "ai [style] tattoo generator". Only generic multi-style tools. The dedicated pages that do exist are mostly programmatic template pages from one site claiming 1,700+ total generations. Real samples and real content can beat that.&lt;/p&gt;

&lt;h3&gt;
  
  
  Where the model fails (because it does)
&lt;/h3&gt;

&lt;p&gt;Lettering is the hard part, and it's the part where a mistake is permanent. Names and dates are the most common tattoo text, and a misspelled tattoo doesn't wash off. The model handles short text well — but only if the prompt says where each element goes. "The word MAMA in thin script lettering, a small heart floating above the word" spelled it correctly. "MAMA with a heart" came back as "Ma'aMa", with the heart splitting the word. Same model, same day — the difference was placement wording. My rule now: always proofread the result before you ink it, and if you have to lean in to read the stencil, it's too small to last.&lt;/p&gt;

&lt;p&gt;Fine line has a different failure mode, and it's not the model's fault: thin lines fade faster than bold ones. The tool page says so per style, with a size-and-lines note for each — minimalist is best at 3–8 cm, traditional's thick outlines hold up longest. A generator that doesn't tell you that is selling you a design that won't look the same in five years.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2wgz3gqsk6fyvrrj9x6l.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2wgz3gqsk6fyvrrj9x6l.webp" alt="Microrealism cat portrait tattoo design, generated with Seedream 5.5" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  The workflow that actually matters: stencil, then skin
&lt;/h3&gt;

&lt;p&gt;A tattoo starts as a stencil — black line art your artist transfers onto skin. Tick "transparent background" in the studio and the PNG comes out with a real alpha channel: no white box to cut out, no background-remover pass. Print it at the size you'll wear, and the numbers matter: a 2K PNG is about 17 cm wide at 300 DPI, a 1K PNG about 9 cm. Print at the size you will wear, not at whatever size the file happens to be.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fvc4yqgg6avoneubnsgj5.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fvc4yqgg6avoneubnsgj5.webp" alt="Stencil snake tattoo design on transparent background, generated with Seedream 5.5" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then preview it on yourself before the appointment. Upload a photo of your arm plus the design, and the model places the tattoo on the skin, following the arm's curve. The before/after forearm pair on the tool page is the real thing — the same forearm photo, before and after, generated as a 2K edit. That edit costs 5 credits at 1K or 8 at 2K. Stencil export itself costs nothing extra.&lt;/p&gt;

&lt;p&gt;Two honest caveats: stencil export and placement preview are table stakes by now — the 2026 newcomers all have them, so I won't pretend they're exclusive. And the design is a starting point, not a finished tattoo: a good artist will usually redraw or adapt the lines for your skin and placement. That's normal practice, and it's the part no model should do.&lt;/p&gt;

&lt;h3&gt;
  
  
  The price comparison
&lt;/h3&gt;

&lt;p&gt;BlackInk AI lists a $15/month plan; the HubX app's one-star reviews are largely about its subscription. Against that, a design here is $0.04–0.06, pay-per-design, no expiry. All eight styles at 2K come to 48 credits — under a tenth of the $5 Mini pack. The full how-to, including the lettering failure and the stencil math, is in &lt;a href="https://pizyn.com/blog/how-to-design-a-tattoo-with-ai/" rel="noopener noreferrer"&gt;How to Design a Tattoo with AI&lt;/a&gt; on the Pizyn blog.&lt;/p&gt;

&lt;p&gt;If you're thinking about a tattoo, try the &lt;a href="https://pizyn.com/tools/ai-tattoo-generator/" rel="noopener noreferrer"&gt;AI Tattoo Generator&lt;/a&gt; and take the best variation to your artist. Arrive at the appointment with a design you've already seen, at the size you want, on a photo of your own arm. The artist does the rest.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Every image in this article was generated with Seedream 5.5 through the same pipeline the tool runs — the style samples on November 14–15, 2026 at 2K, the lettering samples at 1K and 2K, and the try-on pair as a 2K edit. The "Ma'aMa" failure and the passing retest both really happened.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>tutorial</category>
      <category>design</category>
      <category>tattoo</category>
    </item>
    <item>
      <title>NFC cards for developers: NTAG213 vs 215 vs 216, NDEF URL records, and what to send the printer</title>
      <dc:creator>Allan Hall</dc:creator>
      <pubDate>Mon, 16 Nov 2026 01:10:47 +0000</pubDate>
      <link>https://dev.to/allanhall_plasticcard/nfc-cards-for-developers-ntag213-vs-215-vs-216-ndef-url-records-and-what-to-send-the-printer-4h0j</link>
      <guid>https://dev.to/allanhall_plasticcard/nfc-cards-for-developers-ntag213-vs-215-vs-216-ndef-url-records-and-what-to-send-the-printer-4h0j</guid>
      <description>&lt;p&gt;If you are building a tap-to-open feature (a digital business card, a membership check-in, a link on a loyalty card), the chip choice and the encoded record matter more than the card artwork. These are the questions I see most often from developers ordering their first batch of NFC cards.&lt;/p&gt;

&lt;h2&gt;
  
  
  Which chip?
&lt;/h2&gt;

&lt;p&gt;For "tap a phone, open a URL", the common choice is an NXP NTAG21x chip. They are ISO/IEC 14443-A, run at 13.56 MHz, and are NFC Forum Type 2 tags, so both iPhones and Android phones read them without an app.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Chip&lt;/th&gt;
&lt;th&gt;User memory&lt;/th&gt;
&lt;th&gt;Practical use&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;NTAG213&lt;/td&gt;
&lt;td&gt;144 bytes&lt;/td&gt;
&lt;td&gt;One URL, comfortably&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;NTAG215&lt;/td&gt;
&lt;td&gt;504 bytes&lt;/td&gt;
&lt;td&gt;Longer URLs, a vCard with a few fields&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;NTAG216&lt;/td&gt;
&lt;td&gt;888 bytes&lt;/td&gt;
&lt;td&gt;Full vCard, several records&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A typical profile URL fits in NTAG213 with plenty of room. Only move up if you want to store a vCard on the chip itself instead of linking to one.&lt;/p&gt;

&lt;p&gt;Two things are often confused with these:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;125 kHz proximity cards&lt;/strong&gt; (EM4100 type) only hold a fixed ID number. Phones can't read them. They are for door readers that already expect them.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;MIFARE Classic 1K&lt;/strong&gt; is common in access and transit systems. Many phones can read it, but it is not the chip to pick if all you need is a URL.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you are matching an existing door or POS reader, ask for the reader's spec before you choose. The phone use case and the reader use case often need different chips.&lt;/p&gt;

&lt;h2&gt;
  
  
  What a URL record looks like
&lt;/h2&gt;

&lt;p&gt;A URL on an NTAG is an NDEF message with one URI record. The record saves space by replacing common prefixes with a one-byte code:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Code&lt;/th&gt;
&lt;th&gt;Prefix&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;0x01&lt;/td&gt;
&lt;td&gt;&lt;code&gt;http://www.&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0x02&lt;/td&gt;
&lt;td&gt;&lt;code&gt;https://www.&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0x03&lt;/td&gt;
&lt;td&gt;&lt;code&gt;http://&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0x04&lt;/td&gt;
&lt;td&gt;&lt;code&gt;https://&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Here is a small Python function that builds the bytes, so you can check how much memory a URL needs before you order:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="no"&gt;PREFIXES&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"https://www."&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mh"&gt;0x02&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"http://www."&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mh"&gt;0x01&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"https://"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mh"&gt;0x04&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"http://"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mh"&gt;0x03&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;ndef_uri_record&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;bytes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;code&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;rest&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mh"&gt;0x00&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;url&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;prefix&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="no"&gt;PREFIXES&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;items&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="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;startswith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;prefix&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;code&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;rest&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;prefix&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;break&lt;/span&gt;
    &lt;span class="n"&gt;payload&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kt"&gt;bytes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;code&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;rest&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;encode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"utf-8"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;ValueError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"use a long record or a shorter URL"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="c1"&gt;# MB=1, ME=1, SR=1, TNF=0x01 (well-known) -&amp;gt; 0xD1; type "U"&lt;/span&gt;
    &lt;span class="n"&gt;record&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kt"&gt;bytes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mh"&gt;0xD1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;0x01&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;payload&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="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="s2"&gt;"U"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;payload&lt;/span&gt;
    &lt;span class="c1"&gt;# Type 2 tags wrap the message in an NDEF TLV, then a terminator&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kt"&gt;bytes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mh"&gt;0x03&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;record&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="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;record&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="s2"&gt;"\xFE"&lt;/span&gt;

&lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;ndef_uri_record&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"https://example.com/m/000123"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"bytes"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# 28 bytes: fits NTAG213 easily&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That is the whole message the chip needs. Short, unique paths (&lt;code&gt;/m/000123&lt;/code&gt;) are better than long query strings: they fit any chip, and you can change where they redirect later without re-encoding cards.&lt;/p&gt;

&lt;h2&gt;
  
  
  Testing in the browser
&lt;/h2&gt;

&lt;p&gt;On Android Chrome you can read and write tags from a web page with Web NFC (HTTPS only, user gesture required):&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="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;writeTag&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;url&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;ndef&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;NDEFReader&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;await&lt;/span&gt; &lt;span class="n"&gt;ndef&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&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="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;recordType&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"url"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;url&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="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;readTag&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;ndef&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;NDEFReader&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;await&lt;/span&gt; &lt;span class="n"&gt;ndef&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;scan&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;ndef&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;onreading&lt;/span&gt; &lt;span class="o"&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;serialNumber&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="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;serialNumber&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="n"&gt;records&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="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="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It is useful for checking sample cards. iOS Safari does not support Web NFC, but iPhones still open a URL record when the card is tapped.&lt;/p&gt;

&lt;h2&gt;
  
  
  Locking and passwords
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Lock bits&lt;/strong&gt; make the memory read-only permanently. Lock production cards so nobody can rewrite them with a free app, but only after you have tested a sample.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;NTAG21x password protection&lt;/strong&gt; is a 32-bit password that blocks writes (and optionally reads). It stops casual tampering. It is not strong security, so don't put anything sensitive on the chip.&lt;/li&gt;
&lt;li&gt;Every NTAG has a &lt;strong&gt;7-byte UID&lt;/strong&gt;. If your system needs to know which card was tapped, put an ID in the URL path rather than relying on reading the UID from a web page, because a phone opening a URL doesn't send the UID.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The data file for the printer
&lt;/h2&gt;

&lt;p&gt;If each card gets a different URL, the printer needs a file that matches the encoding to the printed number. A plain CSV works:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;card_number,url
000123,https://example.com/m/000123
000124,https://example.com/m/000124
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Keep numbers as text so leading zeros survive (Excel drops them if you open and resave the file). Ask whether they can return a UID list after encoding, so you can map each chip to a record if you ever need it. PlasticCard.nz has a longer write-up on &lt;a href="https://plasticcard.nz/rfid-nfc-cards-guide/" rel="noopener noreferrer"&gt;RFID and NFC card options&lt;/a&gt; and on &lt;a href="https://plasticcard.nz/variable-data-card-printing/" rel="noopener noreferrer"&gt;variable data printing&lt;/a&gt; if you want to read about chip choice and numbering from the print side.&lt;/p&gt;

&lt;h2&gt;
  
  
  Before you order
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Check the URL length with the function above.&lt;/li&gt;
&lt;li&gt;Test one sample on both an iPhone and an Android phone.&lt;/li&gt;
&lt;li&gt;Keep the antenna area in mind: metallic inks and full metal finishes can reduce read range, so ask before choosing them.&lt;/li&gt;
&lt;li&gt;Lock the chip only after testing.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I work at &lt;a href="https://plasticcard.nz/" rel="noopener noreferrer"&gt;PlasticCard.nz&lt;/a&gt;, a plastic card supplier in New Zealand, and these come up whenever someone orders &lt;a href="https://plasticcard.nz/nfc-digital-business-cards/" rel="noopener noreferrer"&gt;NFC digital business cards&lt;/a&gt;. Corrections from people who encode these at scale are welcome in the comments.&lt;/p&gt;

</description>
      <category>nfc</category>
      <category>printing</category>
      <category>javascript</category>
      <category>python</category>
    </item>
    <item>
      <title>Testing Repeated ERP Imports: Six Cases That Catch Double-Counting</title>
      <dc:creator>Nadiia Antonenko</dc:creator>
      <pubDate>Mon, 16 Nov 2026 01:10:16 +0000</pubDate>
      <link>https://dev.to/stimul-education/testing-repeated-erp-imports-six-cases-that-catch-double-counting-586j</link>
      <guid>https://dev.to/stimul-education/testing-repeated-erp-imports-six-cases-that-catch-double-counting-586j</guid>
      <description>&lt;p&gt;An ERP import can report success twice while recording the same business event twice. It can also reject a legitimate second transaction because its date and amount happen to match an earlier one. A useful test therefore needs more than a green completion message or a plausible closing balance.&lt;/p&gt;

&lt;p&gt;For a BAS/1C integration, start by defining the expected behavior at the boundary between the source system and the receiving information base. The protocol below is a proposed test contract, not a description of behavior guaranteed by every configuration. Run it in a disposable training copy with synthetic documents, isolated from real exchanges and payments.&lt;/p&gt;

&lt;h2&gt;
  
  
  State the contract before writing assertions
&lt;/h2&gt;

&lt;p&gt;For this exercise, one accepted source event may create at most one receiving document with one intended contribution to the relevant movements. A repeated delivery of an unchanged event must leave that business state unchanged. Operational logs may record every attempt; business documents must not multiply with delivery attempts.&lt;/p&gt;

&lt;p&gt;Use an identity such as &lt;strong&gt;source system + company + event ID&lt;/strong&gt;. The components must match the actual uniqueness guarantees of the source. If IDs restart by year or by document type, include that scope explicitly. A file name, upload time, or batch number identifies a delivery, which may contain events already delivered elsewhere.&lt;/p&gt;

&lt;p&gt;Store enough evidence to distinguish an unchanged repeat from a changed payload. For the exercise, compare a normalized representation of business fields: document type, organization, counterparty, currency, dates relevant to accounting, lines, quantities, prices, and required analytical dimensions. Exclude transport-only timestamps. Define decimal precision and ordering rules deliberately rather than relying on whatever a serializer happens to produce.&lt;/p&gt;

&lt;p&gt;The proposed conflict rule is conservative: an existing identity with changed business content enters a review queue and does not silently overwrite, repost, or create another document. A later authorized correction is a separate workflow with its own tests.&lt;/p&gt;

&lt;h2&gt;
  
  
  Build a fixture that exposes weak matching
&lt;/h2&gt;

&lt;p&gt;Use three synthetic receipt events for the same organization and date. Ignore taxes and discounts in this exercise; amounts are simply quantity multiplied by unit price.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Source ID&lt;/th&gt;
&lt;th&gt;Quantity&lt;/th&gt;
&lt;th&gt;Unit price&lt;/th&gt;
&lt;th&gt;Amount&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;R101&lt;/td&gt;
&lt;td&gt;8&lt;/td&gt;
&lt;td&gt;25&lt;/td&gt;
&lt;td&gt;200&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;R102&lt;/td&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;40&lt;/td&gt;
&lt;td&gt;200&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;R103&lt;/td&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;60&lt;/td&gt;
&lt;td&gt;180&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Total&lt;/td&gt;
&lt;td&gt;16&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;580&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;R101 and R102 deliberately have equal amounts and dates. Both must survive the import because they are distinct events. Matching only by amount and date would incorrectly collapse them. Matching only by line content has the opposite weakness: two genuine orders can contain identical lines.&lt;/p&gt;

&lt;p&gt;Keep an expected manifest containing each scoped identity, its normalized content, and its expected receiving document and movement contribution. Compare identities before comparing totals. A sum can show that something differs, but cannot establish which transaction is present.&lt;/p&gt;

&lt;h2&gt;
  
  
  Run six cases from known starting states
&lt;/h2&gt;

&lt;p&gt;Reset the training copy or restore its fixture between independent cases. Record which cases intentionally build on the baseline.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Case&lt;/th&gt;
&lt;th&gt;Action&lt;/th&gt;
&lt;th&gt;Expected evidence&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1. Baseline&lt;/td&gt;
&lt;td&gt;Import R101–R103 into an empty fixture.&lt;/td&gt;
&lt;td&gt;Three accepted identities, three intended documents, 16 units and amount 580.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2. Unchanged replay&lt;/td&gt;
&lt;td&gt;Deliver the complete batch again, then deliver it in a different order.&lt;/td&gt;
&lt;td&gt;The same three document identities and movement contributions; totals remain 16 and 580. Extra attempts appear only in operational evidence.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3. Same amount and date&lt;/td&gt;
&lt;td&gt;Inspect baseline R101 and R102 separately.&lt;/td&gt;
&lt;td&gt;Two distinct documents exist despite both amounts being 200. Each traces to its own source ID.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4. Legitimate identical transaction&lt;/td&gt;
&lt;td&gt;After baseline, import new ID R104 with the same business fields as R101.&lt;/td&gt;
&lt;td&gt;R104 is accepted as a distinct event: four documents, 24 units, amount 780.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5. Changed payload&lt;/td&gt;
&lt;td&gt;After baseline, resend R101 with quantity 9 instead of 8, making its amount 225.&lt;/td&gt;
&lt;td&gt;A conflict is recorded for R101. Existing documents and movements remain unchanged at 16 units and 580.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;6. Interrupted batch&lt;/td&gt;
&lt;td&gt;From empty state, interrupt after the first two documents commit, then retry all three events.&lt;/td&gt;
&lt;td&gt;Before recovery: 13 units and 400. After recovery: exactly three documents, 16 units and 580, with no duplicated first or second event.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;These outcomes assume the proposed per-document commit contract. If the implementation promises an all-or-nothing batch instead, an interrupted transaction should leave no committed batch contribution. Document that alternative and adjust the expected intermediate state before testing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Test the awkward recovery boundary
&lt;/h2&gt;

&lt;p&gt;The most revealing interruption is often after a receiving document commits but before a delivery checkpoint is saved. A retry cannot safely assume that a missing checkpoint means no document exists. Conversely, a recorded attempt does not prove that the document and its intended movements committed.&lt;/p&gt;

&lt;p&gt;Capture the source identity, delivery attempt, receiving document reference, transaction outcome, and checkpoint outcome separately. Recovery must reconcile those records using the agreed identity and content rules. In the training copy, verify the interrupted event directly, then replay the complete batch and inspect every expected document. Do not accept a successful retry message as the sole recovery assertion.&lt;/p&gt;

&lt;p&gt;For background on inspecting the document side of that evidence, Stimul has a &lt;a href="https://stimul.kiev.ua/uk/materialy/provodky" rel="noopener noreferrer"&gt;historical Ukrainian reference on reviewing document postings&lt;/a&gt;. Its interface examples are historical; use the commands available in your actual configuration.&lt;/p&gt;

&lt;h2&gt;
  
  
  Balanced totals are not proof of uniqueness
&lt;/h2&gt;

&lt;p&gt;A duplicated accounting entry may increase debit and credit equally, so a balanced trial balance can coexist with duplicate business events. An omitted receipt and an extra receipt of the same amount can also leave the amount total unchanged. That is why the manifest, document identities, and movement contributions are independent checks.&lt;/p&gt;

&lt;p&gt;Finish with three questions: Did every intended event arrive? Did any unintended event appear? Did each accepted event contribute exactly the expected business effect? Preserve the fixture, interruption point, and evidence together. That makes a passing replay test reproducible instead of merely reassuring.&lt;/p&gt;

</description>
      <category>testing</category>
      <category>automation</category>
    </item>
    <item>
      <title>Rebuilding a legacy Laravel monitoring app without breaking its collectors</title>
      <dc:creator>Solution Market</dc:creator>
      <pubDate>Mon, 16 Nov 2026 01:10:15 +0000</pubDate>
      <link>https://dev.to/solutionmarket/rebuilding-a-legacy-laravel-monitoring-app-without-breaking-its-collectors-1bbb</link>
      <guid>https://dev.to/solutionmarket/rebuilding-a-legacy-laravel-monitoring-app-without-breaking-its-collectors-1bbb</guid>
      <description>&lt;p&gt;&lt;em&gt;InfraGuard Engineering Devlog, part 1 of 6.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Rewriting an application is one problem. Rewriting it while a fleet keeps writing into its database is another.&lt;/p&gt;

&lt;p&gt;InfraGuard grew out of an internal Laravel 8 monitoring project. Node.js collectors were submitting server and network telemetry; backup scripts were already running against the existing schema. We could replace the application, but we could not casually rename the tables beneath those processes.&lt;/p&gt;

&lt;h2&gt;
  
  
  New application, old data contract
&lt;/h2&gt;

&lt;p&gt;The legacy review recorded hard-coded credentials in 77 places across 36 files. It also identified raw SQL assembled from user input, plaintext remember-me cookies, and embedded cryptographic or OAuth secrets. The replacement started on Laravel 13.8 and PHP 8.4, with one constraint: leave existing table names, columns and structure intact.&lt;/p&gt;

&lt;p&gt;The database was an integration contract, not merely private storage. A cleaner name in a migration could break a collector that was working perfectly well.&lt;/p&gt;

&lt;p&gt;New application-owned tables use a literal &lt;code&gt;infr_&lt;/code&gt; prefix. We did not enable a connection-wide Laravel table prefix, because that connection still needs to read legacy tables without it. The documented repository snapshot contains 88 migrations following this coexistence rule.&lt;/p&gt;

&lt;h2&gt;
  
  
  Put the reason next to the rule
&lt;/h2&gt;

&lt;p&gt;“Never hard-code credentials” is easy to agree with and easy to regress. Our notes pair rules with reasons and repeatable checks. The useful outcome is an executable validation, not something someone must remember forever.&lt;/p&gt;

&lt;p&gt;This matters when AI coding tools work on the repository. Plausible code can still violate an integration boundary. Explicit constraints and regression checks make that boundary inspectable.&lt;/p&gt;

&lt;p&gt;We also standardized terminology: “domain” means a web hostname; responsibility boundaries use “role” or “area.” Ambiguous labels can become ambiguous permissions and navigation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Preserve the operational story
&lt;/h2&gt;

&lt;p&gt;The goal was a shorter path from diagnosis to response, with prepared installation material and a recovery path when something fails. Monitoring, detection, blocking, backup and restore verification belong to the same operational story.&lt;/p&gt;

&lt;p&gt;This series follows six incidents from that rebuild. Next: a weekly backup repeatedly recreating a roughly 5 GB full archive.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Takeaway:&lt;/strong&gt; Identify which “internal” structures are contracts with other running systems. Modernizing around those contracts can be safer than modernizing through them.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;About this series:&lt;/strong&gt; Adapted from InfraGuard engineering records. Measurements describe the recorded environment, not product-wide benchmarks. AI was used to draft and translate this article.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Disclosure:&lt;/strong&gt; Solution Market develops and sells InfraGuard. This is our engineering devlog, not an independent review. InfraGuard is a self-hosted infrastructure operations and security platform. &lt;a href="https://infraguard.work" rel="noopener noreferrer"&gt;Project&lt;/a&gt; · &lt;a href="https://infraguard.work/manual" rel="noopener noreferrer"&gt;Documentation&lt;/a&gt; · &lt;a href="https://solutionmarket.net/en" rel="noopener noreferrer"&gt;Solution Market&lt;/a&gt;&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>devops</category>
      <category>buildinpublic</category>
      <category>architecture</category>
    </item>
  </channel>
</rss>
