<?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: RobustTrueTry</title>
    <description>The latest articles on DEV Community by RobustTrueTry (@robust_true_try).</description>
    <link>https://dev.to/robust_true_try</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3832871%2Ff706aec4-63af-47c0-9efb-aa3e6858ee96.png</url>
      <title>DEV Community: RobustTrueTry</title>
      <link>https://dev.to/robust_true_try</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/robust_true_try"/>
    <language>en</language>
    <item>
      <title>Why Most Internet Archive Videos Break in Your Player</title>
      <dc:creator>RobustTrueTry</dc:creator>
      <pubDate>Mon, 23 Nov 2026 22:50:09 +0000</pubDate>
      <link>https://dev.to/robust_true_try/why-most-internet-archive-videos-break-in-your-player-3bjp</link>
      <guid>https://dev.to/robust_true_try/why-most-internet-archive-videos-break-in-your-player-3bjp</guid>
      <description>&lt;p&gt;The Internet Archive holds millions of video files you can stream for free. The catch: a large fraction of them will fail in a plain &lt;code&gt;&amp;lt;video&amp;gt;&lt;/code&gt; tag or ffplay. Wrong MIME types, missing derivatives, files that are MP4 in name only.&lt;/p&gt;

&lt;p&gt;By the end of this article you'll be able to query the Archive's metadata API in Python, identify which files actually play, and stream them without downloading anything.&lt;/p&gt;

&lt;h2&gt;
  
  
  The failure you will hit
&lt;/h2&gt;

&lt;p&gt;Ask the metadata API for an item and you get a file list. It looks authoritative. It isn't.&lt;/p&gt;

&lt;p&gt;A typical item lists an original upload (an AVI, a Flash FLV, a VOB ripped from a DVD) plus auto-generated derivatives. Sometimes the derivative is missing. Sometimes the original is listed as &lt;code&gt;h.264&lt;/code&gt; but is actually something else. Your player fetches the file, buffers for a while, and fails with a generic media error.&lt;/p&gt;

&lt;p&gt;The Archive stores checksums and file sizes in metadata, but it does not guarantee a playable derivative exists. The burden of checking falls on you.&lt;/p&gt;

&lt;h2&gt;
  
  
  Query the metadata API
&lt;/h2&gt;

&lt;p&gt;Every item has a metadata endpoint that returns JSON, no authentication required for public items:&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;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;def&lt;/span&gt; &lt;span class="nf"&gt;fetch_metadata&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;identifier&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;dict&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;url&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;"https://archive.org/metadata/{identifier}"&lt;/span&gt;
    &lt;span class="k"&gt;with&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="p"&gt;.&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;url&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;30&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;resp&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;resp&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;meta&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;fetch_metadata&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"some_video_identifier"&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;f&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;meta&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;"files"&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;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&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;"name"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;f&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;"format"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;f&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;"length"&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 &lt;code&gt;files&lt;/code&gt; array is where the real work happens. Each entry carries a &lt;code&gt;format&lt;/code&gt; string like &lt;code&gt;h.264&lt;/code&gt; or &lt;code&gt;MPEG4&lt;/code&gt;, a &lt;code&gt;length&lt;/code&gt; field, and sometimes a &lt;code&gt;sha1&lt;/code&gt;. Treat all of them as claims, not facts.&lt;/p&gt;

&lt;h2&gt;
  
  
  Filter for files that actually play
&lt;/h2&gt;

&lt;p&gt;Browsers reliably play H.264 MP4 and WebM. Filter on both the format string and the file extension, then verify size so you can skip zero-byte stubs:&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;PLAYABLE&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"h.264"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"512kb/mpeg4"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"mpeg4"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"webm"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="no"&gt;OK_EXT&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;".mp4"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;".webm"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;".ogv"&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;playable_files&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;meta&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;dict&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;list&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;dict&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;server&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;meta&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"server"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="n"&gt;directory&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;meta&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"dir"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="n"&gt;out&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="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;meta&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;"files"&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="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;f&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;"name"&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="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;f&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;"format"&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="nf"&gt;lower&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&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;PLAYABLE&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;continue&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;lower&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;endswith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;OK_EXT&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;continue&lt;/span&gt;
        &lt;span class="n"&gt;size&lt;/span&gt; &lt;span class="o"&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;f&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;"size"&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="ow"&gt;or&lt;/span&gt; &lt;span class="mi"&gt;0&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;size&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;continue&lt;/span&gt;
        &lt;span class="n"&gt;f&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="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"https://{server}{directory}/{urllib.request.quote(name)}"&lt;/span&gt;
        &lt;span class="n"&gt;out&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&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;out&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two details matter here. The &lt;code&gt;server&lt;/code&gt; and &lt;code&gt;dir&lt;/code&gt; fields tell you where the item lives; the Archive moves items between nodes, so hardcoding &lt;code&gt;ia*.us.archive.org&lt;/code&gt; breaks. And &lt;code&gt;length&lt;/code&gt; in these entries is often a string like &lt;code&gt;"1234.5"&lt;/code&gt; or &lt;code&gt;"20:34"&lt;/code&gt;, so parse defensively.&lt;/p&gt;

&lt;h2&gt;
  
  
  Probe the file before you trust it
&lt;/h2&gt;

&lt;p&gt;Format strings still lie. If you need certainty, run &lt;code&gt;ffprobe&lt;/code&gt; against the streamed URL. It reads only enough bytes to map the container, so you never download the whole file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ffprobe -v error -select_streams v:0 \
  -show_entries &lt;span class="nv"&gt;stream&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;codec_name,width,height \
  -of json &lt;span class="s2"&gt;"https://archive.org/download/ID/file.mp4"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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;subprocess&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;probe&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;dict&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="n"&gt;cmd&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="s2"&gt;"ffprobe"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"-v"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"error"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"-select_streams"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"v:0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"-show_entries"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"stream=codec_name,width,height"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"-of"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"json"&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="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;out&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;subprocess&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cmd&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;capture_output&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                             &lt;span class="n"&gt;timeout&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;check&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;streams&lt;/span&gt; &lt;span class="o"&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;loads&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;out&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;stdout&lt;/span&gt;&lt;span class="p"&gt;)&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;"streams"&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;return&lt;/span&gt; &lt;span class="n"&gt;streams&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="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;streams&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="kc"&gt;None&lt;/span&gt;
    &lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;subprocess&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;CalledProcessError&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;subprocess&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;TimeoutExpired&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="kc"&gt;None&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If &lt;code&gt;probe&lt;/code&gt; returns &lt;code&gt;None&lt;/code&gt;, fall back to the next candidate file in the list. This one check is the difference between a playlist that plays end to end and one that stalls on every third item.&lt;/p&gt;

&lt;h2&gt;
  
  
  Stream without downloading
&lt;/h2&gt;

&lt;p&gt;The Archive supports HTTP range requests on most files. That means you can point &lt;code&gt;ffmpeg&lt;/code&gt;, VLC, or a plain &lt;code&gt;&amp;lt;video&amp;gt;&lt;/code&gt; tag at the URL directly. For server-side playout, pipe ffprobe-verified URLs into ffmpeg:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ffmpeg -re -i &lt;span class="s2"&gt;"https://archive.org/download/ID/file.mp4"&lt;/span&gt; \
  -c:v libx264 -preset veryfast -f flv rtmp://localhost/live/stream
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;-re&lt;/code&gt; flag makes ffmpeg read at native frame rate, which is what you want for a live-style playout rather than burning through the file as fast as it can decode.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tradeoffs worth knowing
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Approach&lt;/th&gt;
&lt;th&gt;Tradeoff&lt;/th&gt;
&lt;th&gt;Use when&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Trust format strings&lt;/td&gt;
&lt;td&gt;Fast, fails silently on bad files&lt;/td&gt;
&lt;td&gt;Browsing, tolerance for skips&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ffprobe every file&lt;/td&gt;
&lt;td&gt;Reliable, adds a network round trip&lt;/td&gt;
&lt;td&gt;Playlists, automated playout&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Download locally&lt;/td&gt;
&lt;td&gt;Bulletproof, slow and heavy&lt;/td&gt;
&lt;td&gt;Permanent collections&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Other failure modes to plan for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Some items are access-restricted or lending-only; the metadata call succeeds but the file returns a 403.&lt;/li&gt;
&lt;li&gt;Derivatives lag behind new uploads, sometimes for days.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;files&lt;/code&gt; can list hundreds of entries for multi-part items; sort by &lt;code&gt;name&lt;/code&gt; to keep disc order.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Cache metadata responses. Items change rarely, and polite clients keep the Archive fast for everyone.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The metadata API's &lt;code&gt;format&lt;/code&gt; field is a claim; verify playability with ffprobe before adding a file to any playlist.&lt;/li&gt;
&lt;li&gt;Build file URLs from the item's own &lt;code&gt;server&lt;/code&gt; and &lt;code&gt;dir&lt;/code&gt; fields, never a hardcoded host.&lt;/li&gt;
&lt;li&gt;HTTP range requests let you stream and probe without downloading, which keeps checks cheap.&lt;/li&gt;
&lt;li&gt;Handle 403s and missing derivatives explicitly; both are common and neither shows up in the file listing.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Source
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://spelunkr.tv" rel="noopener noreferrer"&gt;Free alternative TV network built from the Internet Archive's forgotten videos&lt;/a&gt; -- the source project inspired this piece; I added the metadata API mechanics, playability filtering, and streaming failure modes it doesn't cover.&lt;/p&gt;

&lt;h2&gt;
  
  
  Support this work
&lt;/h2&gt;

&lt;p&gt;These write-ups are researched and published with no paywall, sponsor, or tracking. If one saved you an afternoon, a small tip keeps them coming.&lt;/p&gt;

&lt;p&gt;USDT, USDC or USDD · TRC-20 (Tron)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;TFTNsfyomKrnUutRjBTGVULp19ByW29KbY
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>python</category>
      <category>automation</category>
    </item>
    <item>
      <title>Encryption orders, AI fixes, and reproducible systems</title>
      <dc:creator>RobustTrueTry</dc:creator>
      <pubDate>Fri, 20 Nov 2026 06:30:44 +0000</pubDate>
      <link>https://dev.to/robust_true_try/encryption-orders-ai-fixes-and-reproducible-systems-40fm</link>
      <guid>https://dev.to/robust_true_try/encryption-orders-ai-fixes-and-reproducible-systems-40fm</guid>
      <description>&lt;p&gt;This week's stories share a theme of trust in software: who can read your data, who writes your code, and whether you can re-run a failure. Several come from GitHub's own engineering blog, which is unusually candid about what its pilots actually changed. Taken together, they describe an industry quietly rebuilding the parts of development it used to take for granted.&lt;/p&gt;

&lt;h2&gt;
  
  
  The UK confirms its secret Apple encryption order
&lt;/h2&gt;

&lt;p&gt;The UK government has publicly confirmed that it served Apple a secret order concerning encryption, after legal pressure forced the admission. The order itself remains largely undisclosed, so the technical details are still not public.&lt;/p&gt;

&lt;p&gt;For developers building end-to-end encrypted products, this is a concrete reminder that cryptography is not only a technical choice. Jurisdictions can compel capabilities, and one market's rules can reshape a feature for users everywhere.&lt;/p&gt;

&lt;p&gt;If you ship encryption, review your legal exposure in each market and document which keys live where. Security and platform teams should track how this case interacts with similar frameworks in other countries.&lt;/p&gt;

&lt;p&gt;Source: &lt;a href="https://macanorak.com/uk-government-forced-to-admit-it-issued-apple-a-secret-encryption-order/" rel="noopener noreferrer"&gt;UK government forced to admit it issued Apple a secret encryption order&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Claude contributes to two black hole physics results
&lt;/h2&gt;

&lt;p&gt;Anthropic reports that Claude contributed to resolving two open problems in the physics of black holes, working alongside researchers rather than replacing them.&lt;/p&gt;

&lt;p&gt;The interesting signal for developers is not the physics itself. It is evidence that large language models can hold a useful intermediate role in exploratory work, where the bottleneck is testing many hypotheses quickly.&lt;/p&gt;

&lt;p&gt;If you build tooling around models, this supports workflows where the model drafts and a human verifies. Anyone evaluating AI for research-adjacent tasks should read the methodology before drawing conclusions.&lt;/p&gt;

&lt;p&gt;Source: &lt;a href="https://www.anthropic.com/research/claude-black-hole-physics" rel="noopener noreferrer"&gt;Claude solves two open problems in the physics of black holes&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  GitHub ships Replica and an accessibility framework
&lt;/h2&gt;

&lt;p&gt;GitHub announced two new open source projects: Replica and the Open Source Accessibility Framework. Replica targets collaboration, while the framework addresses inclusion in open source communities.&lt;/p&gt;

&lt;p&gt;Maintainers know that contribution pipelines leak talent at the onboarding step. Tooling that lowers the cost of joining a project tends to pay back in review burden, not only in goodwill.&lt;/p&gt;

&lt;p&gt;Community leads should evaluate whether either project fits their onboarding flow. The framework is most relevant to projects large enough to have formal governance.&lt;/p&gt;

&lt;p&gt;Source: &lt;a href="https://github.blog/open-source/maintainers/the-best-things-in-open-source-are-built-together/" rel="noopener noreferrer"&gt;The best things in open source are built together&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  AI bug findings become fixable reports for maintainers
&lt;/h2&gt;

&lt;p&gt;GitHub and Microsoft ran a pilot called Codename MDASH across six widely used open source projects. They converted thousands of raw AI findings into 99 checked, private reports, each with a suggested fix. Maintainers have already fixed more than half.&lt;/p&gt;

&lt;p&gt;The number that matters is the conversion rate. Raw AI output floods maintainers with low-signal issues, while triaged reports with patches match how maintainers actually work.&lt;/p&gt;

&lt;p&gt;If you run static analysis or AI review on a large codebase, this is the pattern to copy: verify before you report, and prefer a fix over a finding. Teams evaluating AI code-quality tools should ask vendors how they handle false positives.&lt;/p&gt;

&lt;p&gt;Source: &lt;a href="https://github.blog/open-source/maintainers/maintainers-dont-need-more-ai-bug-reports-they-need-fixes/" rel="noopener noreferrer"&gt;Maintainers don't need more AI bug reports. They need fixes.&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Agent sessions gain a protocol that follows you
&lt;/h2&gt;

&lt;p&gt;GitHub published the open Agent Host Protocol, designed to let agent sessions continue across editors, applications, phones, and the cloud.&lt;/p&gt;

&lt;p&gt;Agent tooling currently locks a session into whichever editor or CLI started it. A protocol that externalizes session state makes handoffs between tools possible, which matters as agents take on longer tasks.&lt;/p&gt;

&lt;p&gt;Developers building agents should read the protocol before inventing a session format. Even if you do not adopt it, the boundary it draws between agent, host, and client is a useful design reference.&lt;/p&gt;

&lt;p&gt;Source: &lt;a href="https://github.blog/engineering/engineering-principles/building-the-agent-host-protocol-for-sessions-that-continue-across-devices/" rel="noopener noreferrer"&gt;Building the Agent Host Protocol for sessions that continue across devices&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Deterministic simulation makes distributed bugs reproducible
&lt;/h2&gt;

&lt;p&gt;Unmesh Joshi's article on Martin Fowler's site describes deterministic simulation testing for distributed systems. It replaces real clocks, networks, and storage with simulated components driven by a single-threaded execution loop, so failures and latency spikes become reproducible. The running example is a quorum key-value store, with Java code from Tickloom.&lt;/p&gt;

&lt;p&gt;Distributed bugs are expensive because the same fault produces different traces on each run. Determinism removes that variable: a failing test fails the same way every time, which is what you need for debugging and regression coverage.&lt;/p&gt;

&lt;p&gt;Backend and platform engineers should try the technique on one service where flaky tests are a chronic problem. The article is a solid starting point even if you never adopt Tickloom itself.&lt;/p&gt;

&lt;p&gt;Source: &lt;a href="https://martinfowler.com/articles/deterministic-simulation-testing.html" rel="noopener noreferrer"&gt;Deterministic Simulation Testing&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Rust's parallel compiler frontend reaches nightly
&lt;/h2&gt;

&lt;p&gt;The Rust compiler has parallelized its backend through LLVM for years, but the frontend, which includes type checking and borrow checking, has run on a single thread. Nightly now enables the parallel frontend by default so the team can find remaining issues before stabilization.&lt;/p&gt;

&lt;p&gt;Faster compilation changes how you work: incremental rebuilds matter less, and large crate graphs become cheaper. The frontend was opt-in on nightly for three years and the stabilization timeline slipped, so treat this as progress rather than a finished feature.&lt;/p&gt;

&lt;p&gt;If you are on nightly, expect some churn and file issues for any regression. Everyone else can watch for stabilization, which will land once the remaining bugs are out.&lt;/p&gt;

&lt;p&gt;Source: &lt;a href="https://blog.rust-lang.org/2026/11/16/enabling-parallel-frontend-on-nightly/" rel="noopener noreferrer"&gt;Enabling the parallel frontend on nightly&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I'd watch next
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Whether the UK order's details surface on appeal, and how Apple responds in other markets.&lt;/li&gt;
&lt;li&gt;Stabilization of Rust's parallel frontend and its measured impact on clean builds.&lt;/li&gt;
&lt;li&gt;Adoption of the Agent Host Protocol beyond GitHub's own tools.&lt;/li&gt;
&lt;li&gt;Follow-up data from the MDASH pilot on which fix categories maintainers accept.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Support this work
&lt;/h2&gt;

&lt;p&gt;These write-ups are researched and published with no paywall, sponsor, or tracking. If one saved you an afternoon, a small tip keeps them coming.&lt;/p&gt;

&lt;p&gt;USDT, USDC or USDD · TRC-20 (Tron)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;TFTNsfyomKrnUutRjBTGVULp19ByW29KbY
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>news</category>
      <category>programming</category>
      <category>ai</category>
      <category>security</category>
    </item>
    <item>
      <title>Check Your NGINX HTTP/2 Config Before Attackers Do</title>
      <dc:creator>RobustTrueTry</dc:creator>
      <pubDate>Wed, 18 Nov 2026 21:02:41 +0000</pubDate>
      <link>https://dev.to/robust_true_try/check-your-nginx-http2-config-before-attackers-do-2e5k</link>
      <guid>https://dev.to/robust_true_try/check-your-nginx-http2-config-before-attackers-do-2e5k</guid>
      <description>&lt;p&gt;Two critical remote code execution vulnerabilities in NGINX, tracked as CVE-2026-123633 and CVE-2026-123007, were disclosed on November 18. Both require HTTP/2 to be enabled, and neither needs authentication. An attacker who reaches the port can potentially run code on the server itself.&lt;/p&gt;

&lt;p&gt;Your application code can be flawless and it will not matter. The bug lives in the web server in front of it.&lt;/p&gt;

&lt;p&gt;By the end of this article you will know how to inventory your NGINX deployments for HTTP/2, decide between patching and disabling HTTP/2, and set up detection for exploitation attempts.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the bugs actually are
&lt;/h2&gt;

&lt;p&gt;CVE-2026-123633 is a use-after-free in the HTTP/2 request handling path. A use-after-free means the server keeps using memory that has already been released, and an attacker can shape heap contents so that reused memory contains their own data.&lt;/p&gt;

&lt;p&gt;CVE-2026-123007 is an integer underflow that dates back to NGINX 1.9.5, released in 2015. An underflow lets a length field wrap around to a huge value, which corrupts memory downstream. Researchers showed code execution on a server serving nothing but static files. No backend, no third-party modules.&lt;/p&gt;

&lt;p&gt;Both are rated CVSS 4.0 9.2. F5 shipped fixes on November 18, so the immediate job is finding your exposure.&lt;/p&gt;

&lt;h2&gt;
  
  
  Find every server with HTTP/2 on
&lt;/h2&gt;

&lt;p&gt;Most teams enable HTTP/2 with one line and forget about it. Run this across your fleet to list listening NGINX processes and whether each advertises HTTP/2:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Which servers expose h2 on the wire?&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; host &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nv"&gt;$(&lt;/span&gt;cat hosts.txt&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
  &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"== $host =="&lt;/span&gt;
  curl -sI --http2 &lt;span class="s2"&gt;"https://$host/"&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; head -n 1
  grep -rn &lt;span class="s1"&gt;'listen .*http2'&lt;/span&gt; &lt;span class="s2"&gt;"$host:/etc/nginx/"&lt;/span&gt; 2&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;/dev/null &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"no http2 in config"&lt;/span&gt;
&lt;span class="k"&gt;done&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Also check gRPC. The &lt;code&gt;grpc_*&lt;/code&gt; directives imply an HTTP/2 listener even when your &lt;code&gt;listen&lt;/code&gt; lines do not mention it. Config-as-code repositories are another place to grep, because a Terraform or Ansible module may turn HTTP/2 on somewhere you never looked.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;grep -rn &lt;span class="s1"&gt;'http2\|grpc_listen'&lt;/span&gt; infra/ charts/ playbooks/ &lt;span class="o"&gt;|&lt;/span&gt; grep -v vendor
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Expect surprises. Edge load balancers frequently terminate TLS with HTTP/2 enabled by default, and those count as exposed if they run a vulnerable NGINX version.&lt;/p&gt;

&lt;h2&gt;
  
  
  Patch, or disable HTTP/2
&lt;/h2&gt;

&lt;p&gt;Patching is the real fix. Disabling HTTP/2 is the stopgap when you cannot roll out quickly.&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;Tradeoff&lt;/th&gt;
&lt;th&gt;When to use&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Upgrade NGINX&lt;/td&gt;
&lt;td&gt;Only reliable fix; needs rollout coordination&lt;/td&gt;
&lt;td&gt;Always, eventually&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Disable HTTP/2&lt;/td&gt;
&lt;td&gt;Kills the attack surface but loses multiplexing and header compression&lt;/td&gt;
&lt;td&gt;Same-day mitigation&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Block at the LB&lt;/td&gt;
&lt;td&gt;Fast, but only works if every path to the server forces HTTP/1.1&lt;/td&gt;
&lt;td&gt;When you control the edge&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Disabling HTTP/2 means browsers fall back to HTTP/1.1. Most sites tolerate that fine. If you serve heavy gRPC traffic, you cannot disable HTTP/2 without breaking clients, so patching is your only option and should jump the queue.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight nginx"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Before
&lt;/span&gt;&lt;span class="n"&gt;listen&lt;/span&gt; &lt;span class="mi"&gt;443&lt;/span&gt; &lt;span class="n"&gt;ssl&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;http2&lt;/span&gt; &lt;span class="n"&gt;on&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;# Emergency mitigation: HTTP/1.1 only
&lt;/span&gt;&lt;span class="n"&gt;listen&lt;/span&gt; &lt;span class="mi"&gt;443&lt;/span&gt; &lt;span class="n"&gt;ssl&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;# http2 disabled until the patched build is deployed
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note the modern syntax: since NGINX 1.25.1, &lt;code&gt;http2&lt;/code&gt; is a standalone directive rather than a flag on &lt;code&gt;listen&lt;/code&gt;. Older configs still use &lt;code&gt;listen 443 ssl http2;&lt;/code&gt;, so grep for both forms.&lt;/p&gt;

&lt;p&gt;After upgrading, verify the running binary, not just the package version:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;nginx -v
nginx -T 2&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;/dev/null &lt;span class="o"&gt;|&lt;/span&gt; grep -E &lt;span class="s1"&gt;'http2|listen'&lt;/span&gt;
systemctl restart nginx  &lt;span class="c"&gt;# workers keep old code until reload or restart&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A package upgrade without a restart is a classic miss. The old workers keep serving traffic on the vulnerable code for hours or days.&lt;/p&gt;

&lt;h2&gt;
  
  
  What exploitation looks like in logs
&lt;/h2&gt;

&lt;p&gt;Memory corruption bugs rarely leave clean traces, but watch for these signals in &lt;code&gt;error.log&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Worker process segfaults or aborts, often repeated.&lt;/li&gt;
&lt;li&gt;HTTP/2 connection resets clustered in time from a small set of source IPs.&lt;/li&gt;
&lt;li&gt;Unexpected child processes or new binaries near the NGINX prefix.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Workers dying unexpectedly is the loudest signal&lt;/span&gt;
journalctl -u nginx --since &lt;span class="s2"&gt;"24 hours ago"&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; grep -iE &lt;span class="s1"&gt;'signal|segfault|core'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A crash does not prove exploitation, but a crash followed by an outbound connection from the nginx worker does. If you see that, isolate the host and pull the core dump before anything else.&lt;/p&gt;

&lt;h2&gt;
  
  
  The part that should change your roadmap
&lt;/h2&gt;

&lt;p&gt;Multiple independent teams found these same bugs within weeks of each other, after they sat in the code for years. The researchers attribute that convergence to AI-assisted code analysis making deep memory-safety bugs reachable in practice. The takeaway for engineering teams is blunt: a vulnerability being hard to find is no longer a security strategy.&lt;/p&gt;

&lt;p&gt;That shifts the practical metric from "are we patched" to "how fast can we patch." If your last NGINX rollout took three weeks, that lead time is now part of your risk model. Pre-build the patched image, keep an emergency HTTP/2-off config tested, and know which services cannot tolerate that mitigation before the next disclosure, not during it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;CVE-2026-123633 (use-after-free) and CVE-2026-123007 (integer underflow) both require HTTP/2 enabled and neither requires authentication, so inventory your HTTP/2 listeners today.&lt;/li&gt;
&lt;li&gt;Disabling HTTP/2 is a valid stopgap, but it breaks gRPC traffic, so gRPC-heavy services must patch first.&lt;/li&gt;
&lt;li&gt;Restart NGINX workers after upgrading; a package install alone leaves the vulnerable code running.&lt;/li&gt;
&lt;li&gt;Watch for worker segfaults in &lt;code&gt;error.log&lt;/code&gt; followed by unexpected outbound traffic as evidence of exploitation attempts.&lt;/li&gt;
&lt;li&gt;Treat time-to-patch as a security metric, because long-standing bugs are now being found by multiple parties at once.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Source
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.wiz.io/blog/nginx-http2-rce-vulnerabilities" rel="noopener noreferrer"&gt;Unauthenticated remote code execution in Nginx&lt;/a&gt; — this article adds practical inventory commands, a mitigation tradeoff comparison, log-based detection signals, and rollout pitfalls the original advisory does not cover.&lt;/p&gt;

&lt;h2&gt;
  
  
  Support this work
&lt;/h2&gt;

&lt;p&gt;These write-ups are researched and published with no paywall, sponsor, or tracking. If one saved you an afternoon, a small tip keeps them coming.&lt;/p&gt;

&lt;p&gt;USDT, USDC or USDD · TRC-20 (Tron)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;TFTNsfyomKrnUutRjBTGVULp19ByW29KbY
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>nginx</category>
      <category>infosec</category>
      <category>devops</category>
      <category>programming</category>
    </item>
    <item>
      <title>Cached Row Heights Lie: Stale ResizeObserver Measurements</title>
      <dc:creator>RobustTrueTry</dc:creator>
      <pubDate>Tue, 17 Nov 2026 21:28:08 +0000</pubDate>
      <link>https://dev.to/robust_true_try/cached-row-heights-lie-stale-resizeobserver-measurements-5ha2</link>
      <guid>https://dev.to/robust_true_try/cached-row-heights-lie-stale-resizeobserver-measurements-5ha2</guid>
      <description>&lt;p&gt;In my earlier post on per-item ResizeObserver feedback loops, the fix was to measure once at row creation and stop observing. That stops the loop, but it opens a quieter problem: every measurement you cache can go stale, and stale measurements fail far from where they were taken.&lt;/p&gt;

&lt;p&gt;By the end of this post you'll know the three failure modes of cached row heights, how &lt;code&gt;content-visibility&lt;/code&gt; changes the picture, and a reconciliation pass you can drop into most virtualizers.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where stale heights actually show up
&lt;/h2&gt;

&lt;p&gt;A cached height is only wrong if the row's content changes after you measure it. In practice that happens constantly:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fonts finish loading and line heights shift by a pixel or two.&lt;/li&gt;
&lt;li&gt;Images without a fixed aspect ratio resolve and reflow the row.&lt;/li&gt;
&lt;li&gt;A diff viewer collapses whitespace or expands a wrapped line on toggle.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The nasty part is that the symptom appears rows away from the cause. You cache row 412's height at 80px, the font loads, its true height becomes 92px, and the scrollbar jumps the moment the user scrolls past row 400. No error, no warning, just a scroll position that lies.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why content-visibility is not a free fix
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;content-visibility: auto&lt;/code&gt; tells the browser to skip rendering offscreen subtrees while keeping a size estimate (&lt;code&gt;contain-intrinsic-size&lt;/code&gt;) for them. It looks like it solves measurement entirely:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.row&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;content-visibility&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;auto&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;contain-intrinsic-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;auto&lt;/span&gt; &lt;span class="mi"&gt;80px&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 &lt;code&gt;auto&lt;/code&gt; keyword in &lt;code&gt;contain-intrinsic-size&lt;/code&gt; is the important part. Once a row has actually rendered once, the browser remembers its real size and uses that estimate when it leaves the viewport. You get a self-correcting cache for free.&lt;/p&gt;

&lt;p&gt;But it only corrects rows that have been rendered. Rows below the fold still use your 80px guess, so total scroll height is wrong until the user has visited everything. If your virtualizer reads &lt;code&gt;offsetTop&lt;/code&gt; of an unrendered row to decide what to paint, you are back to lying measurements — the browser just owns the cache now, and you cannot invalidate it.&lt;/p&gt;

&lt;p&gt;The rule that has held up for me: use &lt;code&gt;content-visibility&lt;/code&gt; when you render everything and only want to skip paint work. Use an explicit virtualizer when you need accurate total height before rows are seen.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reconcile measurements on demand
&lt;/h2&gt;

&lt;p&gt;The pattern that survived production for me is a two-tier cache. Trust the cached height for layout, but reconcile whenever a row enters the viewport for real:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;cache&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Map&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;// id -&amp;gt; height&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;measure&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="n"&gt;el&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;h&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;el&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;offsetHeight&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;old&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;cache&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="n"&gt;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="n"&gt;old&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="n"&gt;h&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;cache&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set&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="n"&gt;h&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;old&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="kc"&gt;undefined&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nf"&gt;scheduleTotalHeightUpdate&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;return&lt;/span&gt; &lt;span class="n"&gt;h&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice the check is &lt;code&gt;old !== undefined&lt;/code&gt;, not just a change. The first measurement of a row seeds the cache; only subsequent differences mean content shifted, and only those need a scrollbar recompute. Skipping the recompute on first measure is what keeps this from becoming the feedback loop from the previous post.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keep the observer, shrink its job
&lt;/h2&gt;

&lt;p&gt;You can keep a single ResizeObserver — the danger was per-item callbacks mutating layout, not observation itself. Restrict it to one sentinel row and re-measure the rest against a shared trigger:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;ro&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;ResizeObserver&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;entries&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="k"&gt;for&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;entry&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="n"&gt;entries&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;id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;entry&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="n"&gt;dataset&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;rowId&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nf"&gt;reconcile&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="n"&gt;entry&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;contentRect&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;height&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="c1"&gt;// Observe only rows currently painted by the virtualizer.&lt;/span&gt;
&lt;span class="c1"&gt;// Unobserve on recycle. Never write layout in this callback.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two constraints make this safe. Observe only rows that are actually on screen, so the callback volume stays bounded by viewport size. And never set any style or size inside the callback — schedule it with &lt;code&gt;requestAnimationFrame&lt;/code&gt; so a resize cannot trigger a resize within the same frame.&lt;/p&gt;

&lt;h2&gt;
  
  
  The edge case that still bites: scroll anchoring
&lt;/h2&gt;

&lt;p&gt;When a row above the viewport changes height, browsers with scroll anchoring (Chrome, Firefox) try to keep the visible content stable by adjusting &lt;code&gt;scrollTop&lt;/code&gt;. If your virtualizer also adjusts &lt;code&gt;scrollTop&lt;/code&gt; during reconciliation, the two corrections stack and the user sees a small hop.&lt;/p&gt;

&lt;p&gt;The fix is to set &lt;code&gt;overflow-anchor: none&lt;/code&gt; on your scrolling container and do the anchor compensation yourself inside the same rAF batch as your height update:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.scroller&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;overflow-anchor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;none&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;Owning the compensation means one correction per frame instead of two fighting ones. It is a small CSS line with a surprisingly large effect on perceived smoothness.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Cached row heights go stale on font load, image load, and any row-internal state change, so plan a reconciliation path from day one.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;content-visibility: auto&lt;/code&gt; with &lt;code&gt;contain-intrinsic-size: auto Npx&lt;/code&gt; self-corrects rendered rows but cannot help a virtualizer that needs accurate heights for unseen rows.&lt;/li&gt;
&lt;li&gt;A single shared ResizeObserver is fine if you observe only painted rows and never write layout in its callback.&lt;/li&gt;
&lt;li&gt;Disable native scroll anchoring on virtualized containers and do anchor compensation in the same frame as your height update.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Source
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://dev.to/robust_true_try/your-per-item-resizeobserver-is-a-layout-feedback-loop-29n1"&gt;Your Per-Item ResizeObserver Is a Layout Feedback Loop&lt;/a&gt; — this follow-up covers stale cached measurements, &lt;code&gt;content-visibility&lt;/code&gt; tradeoffs, a reconciliation pattern, and scroll anchoring, none of which the original post addressed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Support this work
&lt;/h2&gt;

&lt;p&gt;These write-ups are researched and published with no paywall, sponsor, or tracking. If one saved you an afternoon, a small tip keeps them coming.&lt;/p&gt;

&lt;p&gt;USDT, USDC or USDD · TRC-20 (Tron)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;TFTNsfyomKrnUutRjBTGVULp19ByW29KbY
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>python</category>
      <category>automation</category>
    </item>
    <item>
      <title>Your Per-Item ResizeObserver Is a Layout Feedback Loop</title>
      <dc:creator>RobustTrueTry</dc:creator>
      <pubDate>Mon, 16 Nov 2026 21:26:38 +0000</pubDate>
      <link>https://dev.to/robust_true_try/your-per-item-resizeobserver-is-a-layout-feedback-loop-29n1</link>
      <guid>https://dev.to/robust_true_try/your-per-item-resizeobserver-is-a-layout-feedback-loop-29n1</guid>
      <description>&lt;p&gt;Every virtualized list with variable-height rows eventually meets the same bug: you add a ResizeObserver to each row so you can measure it, write the measured height back into your layout state, and the page starts fighting the user's scroll. GitHub's diff-surface rebuild hit exactly this, and their fix generalizes to any large list. By the end you will know how to detect the feedback loop, how to batch measurements, and how to anchor height corrections so they don't move content under the cursor.&lt;/p&gt;

&lt;h2&gt;
  
  
  The feedback loop, concretely
&lt;/h2&gt;

&lt;p&gt;Here is the pattern. You virtualize a list, so each row needs a measured height. You attach a ResizeObserver per row and write the height into your virtualizer's state:&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="c1"&gt;// The trap: measurement triggers layout, layout triggers measurement&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;observer&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;ResizeObserver&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;entries&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="k"&gt;for&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;entry&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="n"&gt;entries&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;row&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;rowsById&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="n"&gt;entry&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="n"&gt;dataset&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="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;row&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;virtualizer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setSize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;row&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="n"&gt;entry&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;contentRect&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;height&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="c1"&gt;// setSize invalidates layout -&amp;gt; rows re-render -&amp;gt; sizes change again&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="n"&gt;rows&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="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;el&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;observer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;observe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;el&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 works fine at fifty rows and degrades at ten thousand. Every height write invalidates layout, which re-renders rows, which fires observers again. The cost grows with every mounted block, and the user sees it as jank while scrolling.&lt;/p&gt;

&lt;h2&gt;
  
  
  Separate the deterministic from the dynamic
&lt;/h2&gt;

&lt;p&gt;GitHub's diff surface contains two things that behave differently. Code rows have a fixed height for a given font size, so you can compute their geometry up front and never measure them. Comments, reply composers, and collapsible sections do not. Their height depends on content, open state, and container width.&lt;/p&gt;

&lt;p&gt;Split them:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;total height = fixed-height items (computed)
             + Σ dynamic block heights (measured)
             + scroll padding
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Most lists have this structure once you look for it. A chat transcript has message text (variable) plus one-line system entries (fixed). A settings page has sections (variable) plus uniform rows (fixed). Compute everything you can; measure only what you must.&lt;/p&gt;

&lt;p&gt;Key the dynamic blocks by identity, not pixel position, and track a fingerprint of everything that changes height: content, open state, and measured width. You only need to re-measure when the fingerprint changes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Batch measurements on idle
&lt;/h2&gt;

&lt;p&gt;One observer per block, each writing synchronously, is the trap. Keep the observers but demote them to flagging. Collect dirty flags, then drain them in one batched pass, gated on requestIdleCallback:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;dirty&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&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="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;ResizeObserver&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;entries&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="k"&gt;for&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;e&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="n"&gt;entries&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;dirty&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&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="n"&gt;dataset&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="p"&gt;;&lt;/span&gt;
  &lt;span class="nf"&gt;scheduleMeasure&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="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;scheduleMeasure&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;scheduled&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="n"&gt;scheduled&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="nf"&gt;requestIdleCallback&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;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;scheduled&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&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;targets&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="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dirty&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;withinViewportRange&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nf"&gt;measureAll&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;targets&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// one layout pass, not one per block&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;Two details matter. First, scope the pass to blocks near the viewport; measuring everything on the page defeats the point. Second, apply all corrections in a single pass so the layout invalidates once instead of once per row.&lt;/p&gt;

&lt;h2&gt;
  
  
  Anchor corrections to what the reader sees
&lt;/h2&gt;

&lt;p&gt;A batched measurement still has a cost: heights change after you have already rendered. If you absorb those changes into the top of the list, content jumps under the reader's cursor. That jump is the classic symptom that makes people distrust virtualization.&lt;/p&gt;

&lt;p&gt;Instead, anchor the correction. When a block above the viewport changes height, adjust the scroll offset by the same amount. When a block below changes, let the layout absorb it. The code on the screen stays put; the math under it changes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;applyHeights&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;corrections&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;viewportTop&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;aboveDelta&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;belowDelta&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;const&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="n"&gt;delta&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="n"&gt;corrections&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;heights&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set&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="n"&gt;delta&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;heights&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="n"&gt;id&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="nf"&gt;blockEnd&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="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="n"&gt;viewportTop&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;aboveDelta&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;delta&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="n"&gt;belowDelta&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;delta&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;aboveDelta&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;scrollTop&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;aboveDelta&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;
  
  
  Keep one synchronous escape hatch
&lt;/h2&gt;

&lt;p&gt;Some interactions cannot tolerate a delayed correction. When a user toggles a collapsible section or opens a reply composer, the content below must move in the same frame or it looks broken. GitHub keeps a frame-synchronous path for exactly those cases: the toggle writes its height immediately, everything else waits for the idle pass.&lt;/p&gt;

&lt;p&gt;The rule is easy to state: user-initiated dimension changes are synchronous, passive measurement is batched. If you find yourself making exceptions for rendering, you have reintroduced the loop.&lt;/p&gt;

&lt;h2&gt;
  
  
  Test the invariant, not the vibe
&lt;/h2&gt;

&lt;p&gt;Layout regressions are silent. The fix that survives code review today is the one that regresses next quarter. Encode the invariant as a CI budget against a synthetic fixture with thousands of variable-height rows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Total computed height matches a golden value for the fixture.&lt;/li&gt;
&lt;li&gt;Scroll-anchored corrections never shift content under a scripted scroll position.&lt;/li&gt;
&lt;li&gt;A scripted scroll of the whole fixture fires at most N batched measurement passes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;GitHub pairs this with an automated driver that runs the real app through a scripted flow, cold and warm, and reads an on-disk log so an agent can spot regressions without anyone at the keyboard. You can start smaller: one fixture, one assertion, in CI.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;One ResizeObserver per item writing heights back into layout is a feedback loop whose cost scales with mounted item count.&lt;/li&gt;
&lt;li&gt;Split your list into fixed-height items you compute and variable-height blocks you measure, keyed by identity plus a fingerprint of content, open state, and width.&lt;/li&gt;
&lt;li&gt;Batch measurements into a single idle-gated pass scoped near the viewport, and anchor corrections so content under the reader never moves.&lt;/li&gt;
&lt;li&gt;User-initiated toggles get a synchronous correction; passive re-measurement does not.&lt;/li&gt;
&lt;li&gt;Turn the invariant into a CI budget on a synthetic large-list fixture, because layout regressions will not show up in any test you wrote for behavior.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Source
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.infoq.com/news/2026/11/github-pull-requests-rebuild/?utm_campaign=infoq_content&amp;amp;utm_source=infoq&amp;amp;utm_medium=feed&amp;amp;utm_term=global" rel="noopener noreferrer"&gt;GitHub Rebuilds the Copilot App's Diff Surface to Open Million-Line Pull Requests Without Jank&lt;/a&gt; -- I added the generalized pattern, working JavaScript for the batching and scroll-anchoring, and the testing strategy the source only gestures at.&lt;/p&gt;

&lt;h2&gt;
  
  
  Support this work
&lt;/h2&gt;

&lt;p&gt;These write-ups are researched and published with no paywall, sponsor, or tracking. If one saved you an afternoon, a small tip keeps them coming.&lt;/p&gt;

&lt;p&gt;USDT, USDC or USDD · TRC-20 (Tron)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;TFTNsfyomKrnUutRjBTGVULp19ByW29KbY
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>webdev</category>
      <category>performance</category>
      <category>frontend</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Your AI-Generated Code Has No License</title>
      <dc:creator>RobustTrueTry</dc:creator>
      <pubDate>Sun, 15 Nov 2026 21:44:56 +0000</pubDate>
      <link>https://dev.to/robust_true_try/your-ai-generated-code-has-no-license-2edl</link>
      <guid>https://dev.to/robust_true_try/your-ai-generated-code-has-no-license-2edl</guid>
      <description>&lt;p&gt;Your team pastes AI-generated code into production every day. That code arrives with no license, no copyright header, and no author. The argument that all AI-generated code should be open source is interesting, but it describes a world that does not exist yet. Until it does, your project decides what happens to unlicensed code by default.&lt;/p&gt;

&lt;p&gt;By the end of this article you will know how to check what your AI tools actually promise, how to record the origin of generated code, and how to write a policy that holds up in a code review.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why missing provenance bites later
&lt;/h2&gt;

&lt;p&gt;When a human contributes to your MIT-licensed repo, the commit carries a name and the project's license covers the contribution. When Copilot or a coding agent generates a function, neither applies. The code is a suggestion from a model trained on public repositories of mixed licenses.&lt;/p&gt;

&lt;p&gt;Two failure modes follow from this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A security audit asks where a suspicious function came from, and nobody can say.&lt;/li&gt;
&lt;li&gt;A lawyer reviews your codebase before an acquisition and finds thousands of lines with unclear origin.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Neither failure is about whether the model copied GPL code verbatim. Both are about your inability to answer questions about your own codebase.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the tools actually promise
&lt;/h2&gt;

&lt;p&gt;The major assistants differ in what they guarantee, and the differences matter more than the open source debate. Read the terms before you rely on any of them.&lt;/p&gt;

&lt;p&gt;GitHub Copilot offers a commercial indemnity for paying customers who enable the relevant setting, plus a duplication filter that blocks suggestions matching public code. Google's Gemini Code Assist and Amazon Q Developer make their own distinct claims about training data and indemnification. These policies change. Check each vendor's current documentation rather than trusting a blog post, including this one.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Tool approach&lt;/th&gt;
&lt;th&gt;Tradeoff&lt;/th&gt;
&lt;th&gt;Fits when&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Indemnified commercial assistant&lt;/td&gt;
&lt;td&gt;Cost, vendor lock-in&lt;/td&gt;
&lt;td&gt;Regulated or acquisition-bound codebases&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Self-hosted open model&lt;/td&gt;
&lt;td&gt;You own the output and the risk&lt;/td&gt;
&lt;td&gt;Strict data controls, sensitive repos&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Generic chatbot copy-paste&lt;/td&gt;
&lt;td&gt;No guarantee at all&lt;/td&gt;
&lt;td&gt;Prototypes, never shipped code&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The last row is the common one, and it is the risky one.&lt;/p&gt;

&lt;h2&gt;
  
  
  Make provenance a habit, not a policy
&lt;/h2&gt;

&lt;p&gt;A policy nobody can follow in the editor is useless. The cheapest working approach: mark generated code at commit time and keep the marking mechanical.&lt;/p&gt;

&lt;p&gt;A simple convention is a commit trailer your tooling can grep for:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Record AI assistance in the commit itself&lt;/span&gt;
git commit -m &lt;span class="s2"&gt;"Add retry logic for webhook delivery"&lt;/span&gt; \
  -m &lt;span class="s2"&gt;"Assisted-by: claude-code"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Git trailers are machine-readable key-value pairs that land in the commit object. You can then audit history without reading a single diff:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Count commits with recorded AI assistance&lt;/span&gt;
git log --format=&lt;span class="s2"&gt;"%(trailers:key=Assisted-by,valueonly)"&lt;/span&gt; \
  &lt;span class="o"&gt;|&lt;/span&gt; grep -c .
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This costs one line per commit and survives branch rebases better than code comments do.&lt;/p&gt;

&lt;h2&gt;
  
  
  Enforce it where people actually commit
&lt;/h2&gt;

&lt;p&gt;Manual conventions decay in weeks. Enforce the convention with a &lt;code&gt;pre-commit&lt;/code&gt; hook so the check runs before the commit exists:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# .pre-commit-config.yaml
&lt;/span&gt;&lt;span class="na"&gt;repos&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;repo&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;local&lt;/span&gt;
    &lt;span class="na"&gt;hooks&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ai-provenance&lt;/span&gt;
        &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;require Assisted-by trailer when flagged&lt;/span&gt;
        &lt;span class="na"&gt;entry&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;scripts/check-ai-provenance.sh&lt;/span&gt;
        &lt;span class="na"&gt;language&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;system&lt;/span&gt;
        &lt;span class="na"&gt;stages&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;commit-msg&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The script inspects the diff for large blocks of new code and the commit message for the trailer. It exists to start a conversation, not to block work: a developer who used an assistant but skipped the trailer fixes the message and proceeds.&lt;/p&gt;

&lt;p&gt;Keep the threshold generous. A hook that fires on every commit gets disabled in a day.&lt;/p&gt;

&lt;h2&gt;
  
  
  What your LICENSE file cannot do
&lt;/h2&gt;

&lt;p&gt;Some teams respond by adding a clause to the project license about AI-generated code. This rarely holds. Your license governs what others may do with your code. It does not establish that you hold copyright in code a model produced, because copyright requires human authorship in most jurisdictions and purely generated output may not qualify.&lt;/p&gt;

&lt;p&gt;The practical consequence: substantial AI-generated code may sit in your repo with no enforceable copyright on your side. That is usually fine for internal tools. It matters when you license a library commercially or need to defend the codebase in a dispute. For that path, require meaningful human modification of generated code before it ships, and keep the &lt;code&gt;Assisted-by&lt;/code&gt; trail so you can show what you changed.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this means for the open source argument
&lt;/h2&gt;

&lt;p&gt;The case for open-sourcing AI-generated code has a real kernel: models train on open source, so the output owes something back. But it skips the nearer problem. Teams ship unlicensed, undocumented-origin code right now, and no license applies until someone chooses one and records it.&lt;/p&gt;

&lt;p&gt;Start smaller than a manifesto. Pick one assistant with terms you understand. Add the trailer convention. Enforce it with a hook. That gives you a codebase where every line has an answer to "where did this come from" -- which is the property the open source argument is really reaching for.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;AI-generated code arrives with no license and no author, so ownership questions get answered by default rather than by choice.&lt;/li&gt;
&lt;li&gt;Vendor policies on training data and indemnification differ and change; check current terms before relying on them.&lt;/li&gt;
&lt;li&gt;Git trailers like &lt;code&gt;Assisted-by: &amp;lt;tool&amp;gt;&lt;/code&gt; give you a grep-able provenance record for one line of effort per commit.&lt;/li&gt;
&lt;li&gt;Enforce provenance with a &lt;code&gt;pre-commit&lt;/code&gt; commit-msg hook, and keep its threshold generous so people do not disable it.&lt;/li&gt;
&lt;li&gt;Adding AI clauses to your LICENSE file does not establish copyright; require meaningful human modification for code you need to defend.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Source
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://jakub.jankiewicz.org/blog/ai-code-open-source/" rel="noopener noreferrer"&gt;All AI-generated code should be Open Source&lt;/a&gt; argues the normative case for open sourcing AI output. This article adds the practitioner's side: concrete provenance conventions, enforcement tooling, and the licensing failure modes the original does not cover.&lt;/p&gt;

&lt;h2&gt;
  
  
  Support this work
&lt;/h2&gt;

&lt;p&gt;These write-ups are researched and published with no paywall, sponsor, or tracking. If one saved you an afternoon, a small tip keeps them coming.&lt;/p&gt;

&lt;p&gt;USDT, USDC or USDD · TRC-20 (Tron)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;TFTNsfyomKrnUutRjBTGVULp19ByW29KbY
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>python</category>
      <category>automation</category>
    </item>
    <item>
      <title>When GitHub Goes Down, Your CI Shouldn't Go With It</title>
      <dc:creator>RobustTrueTry</dc:creator>
      <pubDate>Fri, 13 Nov 2026 22:30:53 +0000</pubDate>
      <link>https://dev.to/robust_true_try/when-github-goes-down-your-ci-shouldnt-go-with-it-2mm1</link>
      <guid>https://dev.to/robust_true_try/when-github-goes-down-your-ci-shouldnt-go-with-it-2mm1</guid>
      <description>&lt;p&gt;GitHub publishes monthly availability reports, and every report lists incidents that degraded real services. If your pipeline clones, fetches, or calls GitHub blindly, each of those incidents becomes your outage too.&lt;/p&gt;

&lt;p&gt;By the end of this article you'll be able to poll the status API, fail fast with a clear message, and design jobs that survive short API brownouts.&lt;/p&gt;

&lt;h2&gt;
  
  
  The real failure mode
&lt;/h2&gt;

&lt;p&gt;Most teams treat GitHub as a single dependency. A checkout fails, the job fails, the whole run fails. But the status API, &lt;code&gt;git&lt;/code&gt; operations, and the REST API fail independently. An incident in one surface doesn't have to stall every job.&lt;/p&gt;

&lt;p&gt;The escape route has three parts:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Detect the incident before wasting runner minutes&lt;/li&gt;
&lt;li&gt;Distinguish "GitHub is broken" from "our workflow is broken"&lt;/li&gt;
&lt;li&gt;Reduce how many steps touch the network at all&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Query the status API first
&lt;/h2&gt;

&lt;p&gt;GitHub exposes a machine-readable status feed that returns per-component health. Check it before running expensive setup.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -sf https://www.githubstatus.com/api/v2/status.json \
  &lt;span class="o"&gt;|&lt;/span&gt; python3 -c &lt;span class="s2"&gt;"
import json, sys
s = json.load(sys.stdin)['status']
print(s['indicator'])
"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;indicator&lt;/code&gt; field is one of &lt;code&gt;none&lt;/code&gt;, &lt;code&gt;minor&lt;/code&gt;, &lt;code&gt;major&lt;/code&gt;, or &lt;code&gt;critical&lt;/code&gt;. Treat anything above &lt;code&gt;none&lt;/code&gt; as a signal to change behavior, not necessarily to abort.&lt;/p&gt;

&lt;p&gt;A small gate step in GitHub Actions makes this decision explicit:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;jobs&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;health-gate&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;runs-on&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ubuntu-latest&lt;/span&gt;
    &lt;span class="na"&gt;outputs&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;degraded&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ steps.check.outputs.degraded }}&lt;/span&gt;
    &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;check&lt;/span&gt;
        &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt;
          &lt;span class="s"&gt;indicator=$(curl -sf https://www.githubstatus.com/api/v2/status.json \&lt;/span&gt;
            &lt;span class="p"&gt;|&lt;/span&gt; &lt;span class="s"&gt;jq -r '.status.indicator')&lt;/span&gt;
          &lt;span class="s"&gt;if [ "$indicator" = "none" ]; then&lt;/span&gt;
            &lt;span class="s"&gt;echo "degraded=false" &amp;gt;&amp;gt; "$GITHUB_OUTPUT"&lt;/span&gt;
          &lt;span class="s"&gt;else&lt;/span&gt;
            &lt;span class="s"&gt;echo "degraded=true" &amp;gt;&amp;gt; "$GITHUB_OUTPUT"&lt;/span&gt;
          &lt;span class="s"&gt;fi&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Downstream jobs read &lt;code&gt;needs.health-gate.outputs.degraded&lt;/code&gt; and choose a fast, cheap path instead of retrying into a wall.&lt;/p&gt;

&lt;h2&gt;
  
  
  Decide what to do, per job
&lt;/h2&gt;

&lt;p&gt;Skipping everything is rarely right. Deploys touching GitHub Packages should pause. Tests that only need cached dependencies can still run.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Job type&lt;/th&gt;
&lt;th&gt;During a major incident&lt;/th&gt;
&lt;th&gt;Why&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Unit tests with cached deps&lt;/td&gt;
&lt;td&gt;Run&lt;/td&gt;
&lt;td&gt;No GitHub calls at runtime&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Clone-heavy integration tests&lt;/td&gt;
&lt;td&gt;Defer&lt;/td&gt;
&lt;td&gt;Checkout is the failing surface&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Deploys that publish packages&lt;/td&gt;
&lt;td&gt;Block&lt;/td&gt;
&lt;td&gt;Partial publishes are worse than none&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Docs builds&lt;/td&gt;
&lt;td&gt;Skip&lt;/td&gt;
&lt;td&gt;Low value during an incident&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The point is not the specific rows. The point is that you made the decision once, in code, instead of paging someone to decide it at 3 a.m.&lt;/p&gt;

&lt;h2&gt;
  
  
  Cut GitHub out of the hot path
&lt;/h2&gt;

&lt;p&gt;The strongest fix is reducing dependence in the first place.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Pin and cache dependencies with &lt;code&gt;actions/cache&lt;/code&gt; and a lockfile so test jobs never hit a registry on a warm run&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;actions/checkout&lt;/code&gt; with &lt;code&gt;fetch-depth: 1&lt;/code&gt; unless you genuinely need history&lt;/li&gt;
&lt;li&gt;Mirror critical container images to a registry you control, such as GHCR plus a fallback mirror&lt;/li&gt;
&lt;li&gt;Avoid calling the REST API in workflow steps when a local &lt;code&gt;git&lt;/code&gt; command answers the same question&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each of these shrinks the set of jobs that an API incident can touch.&lt;/p&gt;

&lt;h2&gt;
  
  
  Retry the right way
&lt;/h2&gt;

&lt;p&gt;When you must call the GitHub API, retry only transient failures and respect the headers the API already gives you. The REST API returns &lt;code&gt;Retry-After&lt;/code&gt; on rate-limit responses; honoring it beats inventing your own backoff curve.&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;time&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;gh_get&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="n"&gt;token&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;max_tries&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="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 {token}"&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/vnd.github+json"&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="n"&gt;max_tries&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;resp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;requests&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="n"&gt;url&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="n"&gt;headers&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;if&lt;/span&gt; &lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status_code&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;403&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="s2"&gt;"Retry-After"&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;resp&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="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="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;resp&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="s2"&gt;"Retry-After"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="k"&gt;continue&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status_code&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;502&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;503&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;attempt&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;max_tries&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;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="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="k"&gt;continue&lt;/span&gt;
        &lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;raise_for_status&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;resp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&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="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"GitHub API unavailable after {max_tries} tries: {url}"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Retries on 502 and 503 cover the transient degradation that availability reports describe. A 404 should fail immediately; retrying it just hides a real bug in your URL.&lt;/p&gt;

&lt;h2&gt;
  
  
  What still goes wrong
&lt;/h2&gt;

&lt;p&gt;The status API itself can lag behind reality, and component-level status can look green while one region struggles. So keep a second signal: if more than a few consecutive jobs fail at checkout across unrelated repositories, suspect the platform, not your code.&lt;/p&gt;

&lt;p&gt;Also watch out for over-broad gates. If your gate skips every job on a &lt;code&gt;minor&lt;/code&gt; indicator, a routine degraded-performance notice silently stops your release train. Tie the response level to job type, as in the table above.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;GitHub's availability reports are a reminder that the platform fails in parts; your pipeline should too.&lt;/li&gt;
&lt;li&gt;Check the status API in a gate job and branch on the &lt;code&gt;indicator&lt;/code&gt; value instead of letting failures surface as opaque checkout errors.&lt;/li&gt;
&lt;li&gt;Retry only transient errors (502, 503, rate limits with &lt;code&gt;Retry-After&lt;/code&gt;) and fail fast on everything else.&lt;/li&gt;
&lt;li&gt;Cache dependencies, shallow-clone, and mirror critical artifacts so fewer jobs depend on GitHub being healthy at run time.&lt;/li&gt;
&lt;li&gt;Rehearse the degraded path once a quarter; a gate you have never run during a real incident is untested code.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Source
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.blog/news-insights/company-news/github-availability-report-october-2026/" rel="noopener noreferrer"&gt;GitHub availability report: October 2026&lt;/a&gt; documents the incidents that motivated this; I added the status-API gate, retry policy, and pipeline design patterns the report leaves out.&lt;/p&gt;

&lt;h2&gt;
  
  
  Support this work
&lt;/h2&gt;

&lt;p&gt;These write-ups are researched and published with no paywall, sponsor, or tracking. If one saved you an afternoon, a small tip keeps them coming.&lt;/p&gt;

&lt;p&gt;USDT, USDC or USDD · TRC-20 (Tron)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;TFTNsfyomKrnUutRjBTGVULp19ByW29KbY
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>python</category>
      <category>automation</category>
    </item>
    <item>
      <title>This week: Git security fixes, agent skills, and running AI at scale</title>
      <dc:creator>RobustTrueTry</dc:creator>
      <pubDate>Fri, 13 Nov 2026 05:28:31 +0000</pubDate>
      <link>https://dev.to/robust_true_try/this-week-git-security-fixes-agent-skills-and-running-ai-at-scale-2g0j</link>
      <guid>https://dev.to/robust_true_try/this-week-git-security-fixes-agent-skills-and-running-ai-at-scale-2g0j</guid>
      <description>&lt;p&gt;This week's stories circle one theme: making AI agents dependable in real engineering work. Git shipped security fixes you should install now. GitHub published its October availability report and a guide to portable agent skills. Martin Fowler's site contributed three pieces on glossaries, test contracts, and durable execution for long-running agents, plus notes on the new Technology Radar.&lt;/p&gt;

&lt;h2&gt;
  
  
  Git patches six vulnerabilities in recursive clones and merges
&lt;/h2&gt;

&lt;p&gt;Git released updates addressing six security vulnerabilities. The affected areas include recursive clones, reference handling, merges, binary patches, and imports.&lt;/p&gt;

&lt;p&gt;Because Git runs on virtually every developer machine and CI runner, these bugs expose a wide surface. A malicious repository could potentially trigger them during routine clone or merge operations.&lt;/p&gt;

&lt;p&gt;Check which version your systems run and upgrade to the patched release. Pay attention to CI images and build agents, which teams update less often than workstations.&lt;/p&gt;

&lt;p&gt;Source: &lt;a href="https://github.blog/open-source/git/git-security-vulnerabilities-announced-7/" rel="noopener noreferrer"&gt;Git security vulnerabilities announced&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  GitHub reports eight incidents for October
&lt;/h2&gt;

&lt;p&gt;GitHub's monthly availability report covers eight incidents that degraded service performance during October.&lt;/p&gt;

&lt;p&gt;These reports are worth more than a skim. They show which subsystems fail most often, and they help you decide how much redundancy your workflows need around GitHub-dependent automation.&lt;/p&gt;

&lt;p&gt;If your pipeline assumes GitHub is always up, read the incident details and consider how your jobs behave during degraded performance, not just full outages.&lt;/p&gt;

&lt;p&gt;Source: &lt;a href="https://github.blog/news-insights/company-news/github-availability-report-october-2026/" rel="noopener noreferrer"&gt;GitHub availability report: October 2026&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Agent skills make repeatable work portable across hosts
&lt;/h2&gt;

&lt;p&gt;GitHub published a practical guide to agent skills: files that capture repeatable engineering work so agents can review and reuse them. The key split is that skills travel, while tools, project context, and permissions stay specific to the host that runs the agent.&lt;/p&gt;

&lt;p&gt;This separation matters if you support several agents or editors. You write the skill once instead of duplicating prompts and instructions per tool.&lt;/p&gt;

&lt;p&gt;If your team keeps rebuilding the same prompts for common tasks, the guide is worth reading. Treat skills like code: version them and review changes.&lt;/p&gt;

&lt;p&gt;Source: &lt;a href="https://github.blog/ai-and-ml/github-copilot/build-once-run-on-any-agent-a-practical-guide-to-agent-skills/" rel="noopener noreferrer"&gt;Build once, run on any agent: A practical guide to agent skills&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Generated glossaries teach LLMs your domain vocabulary
&lt;/h2&gt;

&lt;p&gt;Martin Fowler describes using an LLM to build a glossary of an organization's specialized terms, then feeding that glossary to any LLM working in that domain. The source material can be documents, emails, and chat logs; most organizations already generate enough text.&lt;/p&gt;

&lt;p&gt;The interesting detail is that the generator should flag two things: terms new to the model, and familiar terms used in unfamiliar ways. The second category causes the most confusion, because the model confidently applies its default meaning.&lt;/p&gt;

&lt;p&gt;If your team uses LLMs against internal systems or domain-specific processes, this is a cheap way to cut misinterpretation. Start with your existing documentation.&lt;/p&gt;

&lt;p&gt;Source: &lt;a href="https://martinfowler.com/bliki/GeneratedGlossary.html" rel="noopener noreferrer"&gt;Bliki: Generated Glossary&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Put the human-AI contract in test data, not test code
&lt;/h2&gt;

&lt;p&gt;Matteo Vaccari argues that when AI writes both production and test code, developers become the code's customers. So customer tests, not developer tests, become the primary contract between humans and AI. Moving that contract into test data rather than test code makes it harder for a coding agent to quietly weaken it.&lt;/p&gt;

&lt;p&gt;The economics changed too. Domain-specific language parsers and custom test runners used to be expensive to build and maintain. AI makes them cheap enough to justify.&lt;/p&gt;

&lt;p&gt;If you review AI-generated code, ask what stops the agent from editing its own tests. Data-driven test definitions are one concrete answer.&lt;/p&gt;

&lt;p&gt;Source: &lt;a href="https://martinfowler.com/articles/tests-as-data.html" rel="noopener noreferrer"&gt;Tests as data: ensuring AI-generated code does what we want&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The Technology Radar flags the gap between pilot and operating model
&lt;/h2&gt;

&lt;p&gt;The November Thoughtworks Technology Radar is out, heavy on AI blips from the last six months. Chris Ford's accompanying article covers the macro trends.&lt;/p&gt;

&lt;p&gt;The sharpest point: a small enthusiastic team can make agents work because they share context, a budget, and a mental model, and review each other's output in person. Two hundred people cannot. At scale, new questions appear: how teams share context, what the token spend looks like, how to handle increased review load, what agents may read and change, and who owns the harness everyone depends on.&lt;/p&gt;

&lt;p&gt;If you are moving from an agent pilot to a wider rollout, read the radar article and use those questions as your checklist.&lt;/p&gt;

&lt;p&gt;Source: &lt;a href="https://martinfowler.com/fragments/2026-11-10.html" rel="noopener noreferrer"&gt;Fragments: November 10&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Durable execution keeps long-horizon agents on track
&lt;/h2&gt;

&lt;p&gt;Kiran Prakash explains durable execution, an emerging pattern for agents that run for days or weeks and interact with people and external systems. The runtime records the result of each step that touches the outside world. On failure, the program reruns, skips completed steps, and rebuilds its state from the record.&lt;/p&gt;

&lt;p&gt;This addresses a real gap. A crash on day three of a week-long task should not mean starting over. The model resembles workflow engines, applied to agent loops.&lt;/p&gt;

&lt;p&gt;If you build agents that outlive a single request, evaluate whether your runtime persists step results. Frameworks built on this idea are worth comparing before you write your own recovery logic.&lt;/p&gt;

&lt;p&gt;Source: &lt;a href="https://martinfowler.com/articles/durable-execution-agents.html" rel="noopener noreferrer"&gt;Long-horizon agents and durable execution&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I'd watch next
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Which subsystems recur across GitHub's monthly incident reports, and whether degradation handling becomes a standard part of CI design.&lt;/li&gt;
&lt;li&gt;Whether agent skills converge on a shared format or stay host-specific.&lt;/li&gt;
&lt;li&gt;How durable execution support lands in mainstream agent frameworks, since recovery is the hard part of long-running tasks.&lt;/li&gt;
&lt;li&gt;The specific fixes in the new Git release, especially anything affecting clone behavior in CI pipelines.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Support this work
&lt;/h2&gt;

&lt;p&gt;These write-ups are researched and published with no paywall, sponsor, or tracking. If one saved you an afternoon, a small tip keeps them coming.&lt;/p&gt;

&lt;p&gt;USDT, USDC or USDD · TRC-20 (Tron)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;TFTNsfyomKrnUutRjBTGVULp19ByW29KbY
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>news</category>
      <category>programming</category>
      <category>ai</category>
    </item>
    <item>
      <title>Why LinkedIn Outgrew Argo CD and What It Means for Your GitOps</title>
      <dc:creator>RobustTrueTry</dc:creator>
      <pubDate>Thu, 12 Nov 2026 21:59:57 +0000</pubDate>
      <link>https://dev.to/robust_true_try/why-linkedin-outgrew-argo-cd-and-what-it-means-for-your-gitops-1nj1</link>
      <guid>https://dev.to/robust_true_try/why-linkedin-outgrew-argo-cd-and-what-it-means-for-your-gitops-1nj1</guid>
      <description>&lt;p&gt;LinkedIn recently replaced Argo CD with a custom GitOps engine that deploys across more than 250 Kubernetes clusters and handles over 100,000 deployments a week. The scale is unusual, but the underlying friction is not. Teams running dozens of clusters against one Argo CD instance eventually hit the same walls: reconciliation lag, app sprawl, and webhooks that stop telling the truth.&lt;/p&gt;

&lt;p&gt;By the end of this article you will know which limits you will actually hit, how to push them back, and when a custom controller is genuinely justified.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where vanilla Argo CD strains first
&lt;/h2&gt;

&lt;p&gt;Argo CD watches Git repositories and reconciles cluster state against them. The strain shows up in three predictable places as you grow:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Application count.&lt;/strong&gt; Each Application object is a controller reconcile target. Past a few thousand, the controller's reconcile queue slows down and drift detection lags behind commits.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Webhook fan-out.&lt;/strong&gt; One commit to a shared config repo can touch hundreds of Applications. The GitHub or GitLab webhook updates them, but the controller processes them serially enough that perceived sync time grows.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;API server load.&lt;/strong&gt; Every Application, every Refresh annotation, every status write lands on the cluster's etcd through the Kubernetes API. This couples your delivery system's health to your control plane's headroom.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;None of these are bugs. They are the cost of a generic reconciler that treats every Application the same.&lt;/p&gt;

&lt;h2&gt;
  
  
  Measure before you migrate
&lt;/h2&gt;

&lt;p&gt;Most teams that think they outgrew Argo CD have outgrown their repository layout instead. Before anything else, measure it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# How many Applications does the controller actually manage?&lt;/span&gt;
kubectl get applications.argoproj.io -A --no-headers &lt;span class="o"&gt;|&lt;/span&gt; wc -l

&lt;span class="c"&gt;# Reconciliation health: look for long queues in the controller logs&lt;/span&gt;
kubectl logs -n argocd deploy/argocd-application-controller \
  &lt;span class="o"&gt;|&lt;/span&gt; grep -i &lt;span class="s2"&gt;"reconcile"&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; tail -20
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If drift detection runs minutes behind a merged PR, note the delta. If it is under your team's tolerance, you have a config problem, not a platform problem.&lt;/p&gt;

&lt;h2&gt;
  
  
  The AppProject and ApplicationSet fixes
&lt;/h2&gt;

&lt;p&gt;The biggest win costs nothing: split monorepos. When one commit touches a manifest shared by 800 services, Argo CD re-evaluates all of them. Splitting per-team or per-service repos shrinks the blast radius of every push.&lt;/p&gt;

&lt;p&gt;Then use &lt;strong&gt;ApplicationSet&lt;/strong&gt; to generate Applications from templates instead of hand-authoring thousands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;argoproj.io/v1alpha1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ApplicationSet&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;payments&lt;/span&gt;
  &lt;span class="na"&gt;namespace&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;argocd&lt;/span&gt;
&lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;generators&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;list&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;elements&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
          &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;cluster&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;eu-west&lt;/span&gt;
            &lt;span class="na"&gt;env&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;prod&lt;/span&gt;
          &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;cluster&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;us-east&lt;/span&gt;
            &lt;span class="na"&gt;env&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;prod&lt;/span&gt;
  &lt;span class="na"&gt;template&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'payments-{{cluster}}'&lt;/span&gt;
    &lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;project&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;payments&lt;/span&gt;
      &lt;span class="na"&gt;source&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;repoURL&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;https://git.example.com/platform/payments.git&lt;/span&gt;
        &lt;span class="na"&gt;targetRevision&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;HEAD&lt;/span&gt;
        &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'deploy/{{cluster}}'&lt;/span&gt;
      &lt;span class="na"&gt;destination&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;server&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;https://kubernetes.default.svc&lt;/span&gt;
      &lt;span class="na"&gt;syncPolicy&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;automated&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;prune&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
          &lt;span class="na"&gt;selfHeal&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is the same idea LinkedIn's engine implements natively: treat a deployment as a rendered output over services and clusters, not a pile of individual objects.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sharding and what it buys you
&lt;/h2&gt;

&lt;p&gt;If one controller still can't keep up, Argo CD supports sharding the Application controller across clusters. Each shard reconciles a subset, so reconcile throughput scales roughly with shard count.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# In the argocd-cmd-params-cm ConfigMap&lt;/span&gt;
controller.shard.replicas: &lt;span class="s2"&gt;"4"&lt;/span&gt;
controller.sharding.algorithm: &lt;span class="s2"&gt;"consistent-hashing"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Sharding fixes throughput, not sprawl. A shard still holds every Application's status in memory for its clusters, and you now run a real distributed system for your CD tool.&lt;/p&gt;

&lt;h2&gt;
  
  
  When a custom engine is actually justified
&lt;/h2&gt;

&lt;p&gt;LinkedIn's move makes sense because their requirements are unusual: multi-tenant deployment isolation, org-wide policy enforcement, and progress reporting integrated with internal tooling across hundreds of clusters. A generic tool fights you at that point.&lt;/p&gt;

&lt;p&gt;Use this rough decision table:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Situation&lt;/th&gt;
&lt;th&gt;Approach&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Slow reconciliation, few clusters&lt;/td&gt;
&lt;td&gt;Repo layout plus tuned controller settings&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Thousands of Applications, one control plane&lt;/td&gt;
&lt;td&gt;ApplicationSets plus controller sharding&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Hard multi-tenant or compliance requirements baked into deploy flow&lt;/td&gt;
&lt;td&gt;Consider a custom reconciler&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Occasional webhook delays&lt;/td&gt;
&lt;td&gt;Check Git provider delivery, not Argo CD&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;If you do build your own, keep the GitOps contract: Git is the source of truth, the controller converges on it, and drift is reported rather than silently corrected. You can rewrite the engine without rewriting the workflow.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Argo CD's limits at scale are reconcile throughput and API load, not correctness; measure both before concluding you need a replacement.&lt;/li&gt;
&lt;li&gt;Splitting repositories and using ApplicationSets removes most of the fan-out pain at a fraction of the cost of a custom engine.&lt;/li&gt;
&lt;li&gt;Controller sharding scales reconcile throughput across clusters but turns your CD tool into a distributed system you must operate.&lt;/li&gt;
&lt;li&gt;A custom GitOps engine is justified when deployment policy, isolation, and reporting requirements are core product features, as they are at LinkedIn's scale.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Source
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.infoq.com/news/2026/11/kubernetes-argocd-linkedin/?utm_campaign=infoq_content&amp;amp;utm_source=infoq&amp;amp;utm_medium=feed&amp;amp;utm_term=global" rel="noopener noreferrer"&gt;LinkedIn Replaces Argo CD with a Custom GitOps Engine for Kubernetes Deployments&lt;/a&gt; — this article adds the failure modes, measurement steps, and configuration-level mitigations the announcement leaves out.&lt;/p&gt;

&lt;h2&gt;
  
  
  Support this work
&lt;/h2&gt;

&lt;p&gt;These write-ups are researched and published with no paywall, sponsor, or tracking. If one saved you an afternoon, a small tip keeps them coming.&lt;/p&gt;

&lt;p&gt;USDT, USDC or USDD · TRC-20 (Tron)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;TFTNsfyomKrnUutRjBTGVULp19ByW29KbY
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>kubernetes</category>
      <category>devops</category>
      <category>gitops</category>
      <category>argocd</category>
    </item>
    <item>
      <title>Your AI Agent Pipeline Wastes Tokens on the Wrong Tiles</title>
      <dc:creator>RobustTrueTry</dc:creator>
      <pubDate>Wed, 11 Nov 2026 21:16:25 +0000</pubDate>
      <link>https://dev.to/robust_true_try/your-ai-agent-pipeline-wastes-tokens-on-the-wrong-tiles-1mj4</link>
      <guid>https://dev.to/robust_true_try/your-ai-agent-pipeline-wastes-tokens-on-the-wrong-tiles-1mj4</guid>
      <description>&lt;p&gt;The viral Maya pyramid story sounds like a win for AI agents. A team pointed dozens of agents at NASA LiDAR data and found a structure in days. The unglamorous part is why it worked at all: they did not let agents read the whole forest. They triaged tiles first, then spent expensive model calls on candidates.&lt;/p&gt;

&lt;p&gt;By the end of this article you'll be able to structure a multi-agent scan over a large raster dataset without burning your token budget on empty ground.&lt;/p&gt;

&lt;h2&gt;
  
  
  Naive agents scan everything
&lt;/h2&gt;

&lt;p&gt;The obvious approach: tile the LiDAR hillshade into images, ask a vision model "is there a structure here?", repeat for every tile. For a survey area of a few hundred square kilometers at 1-meter resolution, that's millions of tiles.&lt;/p&gt;

&lt;p&gt;At even a modest per-call cost, that multiplies into real money and days of wall time. Worse, most tiles contain nothing but trees. Terrain-derived products like hillshade or digital surface model (DSM) difference rasters make features visible, but they don't reduce how many tiles you inspect.&lt;/p&gt;

&lt;p&gt;The fix is a funnel. Cheap filters eliminate the boring 99% before any agent sees a pixel.&lt;/p&gt;

&lt;h2&gt;
  
  
  Build a funnel, not a swarm
&lt;/h2&gt;

&lt;p&gt;A practical pipeline has three stages:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1. Compute terrain derivatives (slope, hillshade, openneas)
2. Score every tile with a cheap local filter
3. Send only high-scoring tiles to vision agents
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Stage 2 is where most articles go vague. You don't need a model for it. Simple raster statistics catch most archaeological candidates: unusually flat platforms on slopes, regular geometric edges, local elevation anomalies.&lt;/p&gt;

&lt;h2&gt;
  
  
  Score tiles with raster statistics
&lt;/h2&gt;

&lt;p&gt;Here's a working scorer using &lt;code&gt;rasterio&lt;/code&gt; and &lt;code&gt;numpy&lt;/code&gt;. It flags tiles that are flat relative to their surroundings, a signature of platforms and plazas:&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;numpy&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;rasterio&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;rasterio&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;windows&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;Window&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;tile_score&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="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;col&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;size&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;512&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="s2"&gt;"""Score one tile: high means flat plateau inside rough terrain."""&lt;/span&gt;
    &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="n"&gt;rasterio&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;open&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="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;src&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;win&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Window&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;col&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;size&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;size&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;elev&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;src&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="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;window&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;win&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;astype&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"float32"&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;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;isnan&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;elev&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;all&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;return&lt;/span&gt; &lt;span class="mf"&gt;0.0&lt;/span&gt;

    &lt;span class="n"&gt;grad&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;abs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;gradient&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;elev&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;interior&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;grad&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;size&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="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;size&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="n"&gt;size&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="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;size&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="n"&gt;border&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;grad&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;mean&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;interior&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;mean&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# Flat interior + steep surroundings = candidate platform&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kt"&gt;float&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;clip&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;interior&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;mean&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="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;border&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="kc"&gt;None&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 runs in milliseconds per tile on a laptop. Sort all tiles by score, keep the top percentile, and only now invoke the expensive step.&lt;/p&gt;

&lt;h2&gt;
  
  
  Point agents only at candidates
&lt;/h2&gt;

&lt;p&gt;With a candidate list, the agent stage becomes affordable. Each agent gets one tile image plus a prompt asking for structured output, not prose:&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="no"&gt;PROMPT&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"""Classify this hillshade tile.
Respond with JSON only:
{"structure": "platform"|"terrace"|"none",
 "confidence": 0.0-1.0,
 "reason": "one sentence"}
"""&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;classify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tile_png&lt;/span&gt;&lt;span class="p"&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;client&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="n"&gt;resp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"claude-sonnet-4-5"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;max_tokens&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;messages&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="s2"&gt;"role"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"user"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s2"&gt;"content"&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="s2"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"image"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"source"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                    &lt;span class="s2"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"base64"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                    &lt;span class="s2"&gt;"media_type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"image/png"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                    &lt;span class="s2"&gt;"data"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;tile_png&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="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="s2"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"text"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"text"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;PROMPT&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;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;loads&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;content&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="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Structured JSON makes the next stage mechanical: rank by confidence, cluster nearby hits, and route the top clusters to human review. Many agents in parallel help here, but the parallelism is over a shortlist, not the whole raster.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where multi-agent setups fail
&lt;/h2&gt;

&lt;p&gt;Three failure modes show up in every large-agent run I've reviewed:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Correlated false positives.&lt;/strong&gt; Agents agree with each other because they share the same model and prompt. One confident wrong call about a logging terrace gets echoed by ten agents. Break the correlation by varying prompts or using two different models on the shortlist.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Prompt drift across long runs.&lt;/strong&gt; Agents editing shared state or re-prompting each other accumulate context. Freeze the prompt per stage and version it like code.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Edge-tile artifacts.&lt;/strong&gt; Features straddle tile boundaries and get split into two unconvincing halves. Score and classify overlapping tiles, then merge by coordinate before trusting any "none" verdict.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That last one matters most. A pyramid straddling four tiles looks like nothing on any one of them. Overlap by 15-20% and dedupe hits.&lt;/p&gt;

&lt;h2&gt;
  
  
  Validate before you celebrate
&lt;/h2&gt;

&lt;p&gt;A confident agent verdict is a lead, not a discovery. Before claiming anything:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Check the raw DEM (digital elevation model), not just the hillshade, for a consistent closed form.&lt;/li&gt;
&lt;li&gt;Compare against existing surveys and satellite imagery for modern explanations: roads, quarries, logging.&lt;/li&gt;
&lt;li&gt;Get eyes on the ground or a field archaeologist's review.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The source story earned its headline because humans verified the candidate. Keep that step.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Never send a full raster to vision agents; score tiles with cheap raster statistics first and spend model calls on the top percentile.&lt;/li&gt;
&lt;li&gt;Overlap tiles by 15-20% so features on boundaries survive classification, then merge hits by coordinate.&lt;/li&gt;
&lt;li&gt;Run multiple agents on candidates only, and vary prompts or models so their errors aren't correlated.&lt;/li&gt;
&lt;li&gt;Treat every agent hit as a lead for human verification, never as a finding.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Source
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://pietromiotti.com/latest/maya-site/?maya" rel="noopener noreferrer"&gt;Google SWE points 48 AI agents at NASA Lidar, finds unmapped Maya pyramid in 72h&lt;/a&gt; — I added the concrete tiled pipeline, a runnable scoring function, and the failure modes the source story skips.&lt;/p&gt;

&lt;h2&gt;
  
  
  Support this work
&lt;/h2&gt;

&lt;p&gt;These write-ups are researched and published with no paywall, sponsor, or tracking. If one saved you an afternoon, a small tip keeps them coming.&lt;/p&gt;

&lt;p&gt;USDT, USDC or USDD · TRC-20 (Tron)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;TFTNsfyomKrnUutRjBTGVULp19ByW29KbY
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>python</category>
      <category>automation</category>
    </item>
    <item>
      <title>AI Code Feels Done Until You Refactor It</title>
      <dc:creator>RobustTrueTry</dc:creator>
      <pubDate>Tue, 10 Nov 2026 21:55:23 +0000</pubDate>
      <link>https://dev.to/robust_true_try/ai-code-feels-done-until-you-refactor-it-565d</link>
      <guid>https://dev.to/robust_true_try/ai-code-feels-done-until-you-refactor-it-565d</guid>
      <description>&lt;p&gt;AI-generated code passes review because it looks finished. Then a teammate renames a field, changes an API response, or adds a parameter, and the code breaks in ways its tests never caught. The problem is not that the code is wrong today. It is that nobody, including the model, holds its assumptions in their head.&lt;/p&gt;

&lt;p&gt;By the end of this article you will know the three failure modes that make AI code fragile, how to spot each one in review, and how to enforce two of them automatically in CI.&lt;/p&gt;

&lt;h2&gt;
  
  
  The real defect is hidden coupling
&lt;/h2&gt;

&lt;p&gt;When a large language model writes a function, it optimizes for the prompt, not for your architecture. It reaches for the fastest path to working output: direct field access, hardcoded strings, a second copy of a helper that already exists three directories away.&lt;/p&gt;

&lt;p&gt;That code works on day one. It fails on day thirty, when the schema changes and the duplicated helper in &lt;code&gt;utils/billing.py&lt;/code&gt; does not get updated because nobody knew it existed.&lt;/p&gt;

&lt;p&gt;Fragility is not a style issue. It is the gap between what the code does and what your team can safely change.&lt;/p&gt;

&lt;h2&gt;
  
  
  Three failure modes to check in review
&lt;/h2&gt;

&lt;p&gt;Most fragile AI code falls into one of these buckets:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Divergent duplicates&lt;/strong&gt;: the model re-implements logic that exists elsewhere, and the two copies drift.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Invented APIs&lt;/strong&gt;: it calls methods or config keys that look plausible but do not exist in your stack, hidden behind a &lt;code&gt;try/except&lt;/code&gt; that silently swallows the failure.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Absent contracts&lt;/strong&gt;: it skips type hints, validation, and error paths because the happy path was all the prompt asked for.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The first two are mechanical. You do not need a human to catch them.&lt;/p&gt;

&lt;h2&gt;
  
  
  Block duplicates with a CI check
&lt;/h2&gt;

&lt;p&gt;A copy-paste detector finds the re-implemented helper before merge. &lt;code&gt;jscpd&lt;/code&gt; works across most languages and installs as a single dev dependency.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# .github/workflows/duplication.yml
&lt;/span&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;duplication&lt;/span&gt;
&lt;span class="na"&gt;on&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;pull_request&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="na"&gt;jobs&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;scan&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;runs-on&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ubuntu-latest&lt;/span&gt;
    &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;actions/checkout@v4&lt;/span&gt;
      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;npx jscpd src --min-tokens 40 --reporters consoleFull --fail-on-duplication&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;--min-tokens 40&lt;/code&gt; threshold matters. Set it too low and you flag every data class. At 40 tokens you catch real copied logic, which is exactly what the model produces when your prompt says "add a function that formats invoices."&lt;/p&gt;

&lt;h2&gt;
  
  
  Catch invented APIs with type checking
&lt;/h2&gt;

&lt;p&gt;The silent-&lt;code&gt;except&lt;/code&gt; failure mode dies the moment your types are strict. A call to &lt;code&gt;user.profile.settings.theme&lt;/code&gt; fails &lt;code&gt;mypy&lt;/code&gt; if &lt;code&gt;profile&lt;/code&gt; can be &lt;code&gt;None&lt;/code&gt;, and fails outright if the attribute does not exist.&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="c1"&gt;# What the model writes&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_theme&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;user&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;return&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;profile&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;settings&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;theme&lt;/span&gt;
    &lt;span class="k"&gt;except&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;return&lt;/span&gt; &lt;span class="s2"&gt;"default"&lt;/span&gt;

&lt;span class="c1"&gt;# What mypy forces&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_theme&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;User&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="n"&gt;settings&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;profile&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;settings&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;profile&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="kc"&gt;None&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;settings&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;theme&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;settings&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="s2"&gt;"default"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The refactored version is explicit about every fallback. When the &lt;code&gt;settings&lt;/code&gt; shape changes, the type checker tells you exactly where to look. Add &lt;code&gt;mypy --strict src&lt;/code&gt; to CI and invented attributes become build failures, not runtime surprises.&lt;/p&gt;

&lt;h2&gt;
  
  
  Write prompts that name your contracts
&lt;/h2&gt;

&lt;p&gt;Review gates catch the damage after it exists. You can reduce it at the source. The single highest-leverage change to your prompts is pasting the relevant types and existing helpers into the context.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Use the `format_invoice` helper in src/utils/billing.py.
Here is the Invoice type and the helper's signature: [...]
Do not add new dependencies.
Return early on missing fields; no broad except blocks.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A model with your real signatures in context has no reason to invent an API or duplicate a helper. A model without them will guess, and the guess will look confident.&lt;/p&gt;

&lt;h2&gt;
  
  
  What human review still owns
&lt;/h2&gt;

&lt;p&gt;Automation cannot judge whether the code belongs in your architecture. A function can be duplication-free, fully typed, and still wrong: in the wrong layer, holding a connection it should release, or quietly coupling your billing module to your auth module.&lt;/p&gt;

&lt;p&gt;Read AI code the way you read a junior engineer's pull request: ask what assumptions it makes, and what happens when each one changes. If you cannot answer that in a minute, the code is fragile regardless of who wrote it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Fragile AI code is usually hidden coupling: duplicates, invented APIs, and missing contracts.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;jscpd&lt;/code&gt; with a ~40-token threshold catches re-implemented logic before merge.&lt;/li&gt;
&lt;li&gt;Strict type checking converts silent &lt;code&gt;except&lt;/code&gt; fallbacks into build-time failures.&lt;/li&gt;
&lt;li&gt;Pasting real types and helper names into prompts removes most of the guessing at the source.&lt;/li&gt;
&lt;li&gt;Human review should focus on architectural fit, not formatting, since machines handle the mechanical checks.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Source
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://evanxmerz.com/post/ai-usage-generates-a-fragile-codebase/" rel="noopener noreferrer"&gt;AI usage generates a fragile codebase&lt;/a&gt; -- this article builds on its core claim by naming the specific failure modes and adding CI checks and prompt patterns to address them.&lt;/p&gt;

&lt;h2&gt;
  
  
  Support this work
&lt;/h2&gt;

&lt;p&gt;These write-ups are researched and published with no paywall, sponsor, or tracking. If one saved you an afternoon, a small tip keeps them coming.&lt;/p&gt;

&lt;p&gt;USDT, USDC or USDD · TRC-20 (Tron)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;TFTNsfyomKrnUutRjBTGVULp19ByW29KbY
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>programming</category>
      <category>ai</category>
      <category>codereview</category>
      <category>webdev</category>
    </item>
    <item>
      <title>The Blocking Main Loop That Kills Browser Game Ports</title>
      <dc:creator>RobustTrueTry</dc:creator>
      <pubDate>Sun, 08 Nov 2026 00:51:53 +0000</pubDate>
      <link>https://dev.to/robust_true_try/the-blocking-main-loop-that-kills-browser-game-ports-b96</link>
      <guid>https://dev.to/robust_true_try/the-blocking-main-loop-that-kills-browser-game-ports-b96</guid>
      <description>&lt;p&gt;A 2004 Windows game now runs in a browser tab, and the impressive part is not the graphics. It is that someone untangled two decades of assumptions about how a machine runs a program. Ports like this fail in the same few places, and almost none of those failures are about raw speed.&lt;/p&gt;

&lt;p&gt;By the end you will know how to restructure a legacy game loop for the event loop, keep simulation stable across display refresh rates, and make saves survive a page refresh.&lt;/p&gt;

&lt;h2&gt;
  
  
  The main loop is the first thing that breaks
&lt;/h2&gt;

&lt;p&gt;A native game owns the process. It runs &lt;code&gt;while (running) { update(); render(); }&lt;/code&gt; and never returns. In a browser that loop holds the main thread, the tab locks up, and the browser eventually offers to kill it. The only way to keep rendering is to hand control back to the browser every frame.&lt;/p&gt;

&lt;p&gt;Emscripten's standard answer is a callback instead of a loop:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="cp"&gt;#include&lt;/span&gt; &lt;span class="cpf"&gt;&amp;lt;emscripten.h&amp;gt;&lt;/span&gt;&lt;span class="cp"&gt;
&lt;/span&gt;
&lt;span class="k"&gt;static&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;g_frames_left&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;300&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;frame&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;void&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;g_frames_left&lt;/span&gt;&lt;span class="o"&gt;--&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;emscripten_cancel_main_loop&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="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;update&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="n"&gt;render&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kt"&gt;int&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;void&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;emscripten_set_main_loop&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;frame&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;return&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;0&lt;/code&gt; means "follow the browser's vsync" rather than a fixed rate, and the trailing &lt;code&gt;1&lt;/code&gt; tells Emscripten to simulate an infinite loop so &lt;code&gt;main&lt;/code&gt; returning does not end the program. The real cost is elsewhere: your C stack unwinds and re-enters every frame, so any variable that must survive across frames has to live in static or heap storage rather than as a local.&lt;/p&gt;

&lt;p&gt;There are two other ways off the main thread, and each buys something different.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Approach&lt;/th&gt;
&lt;th&gt;How it yields&lt;/th&gt;
&lt;th&gt;Tradeoff&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;emscripten_set_main_loop&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;You restructure into a per-frame callback&lt;/td&gt;
&lt;td&gt;Smallest and fastest output, but all cross-frame state leaves the stack&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ASYNCIFY&lt;/td&gt;
&lt;td&gt;The compiler rewrites your blocking loop so it can pause&lt;/td&gt;
&lt;td&gt;Keeps the original code shape, at the cost of a larger and slower binary&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Web Worker with OffscreenCanvas&lt;/td&gt;
&lt;td&gt;The whole game runs off the main thread&lt;/td&gt;
&lt;td&gt;Real parallelism, but input, audio, and canvas setup all get harder&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Decouple simulation from the display
&lt;/h2&gt;

&lt;p&gt;Plenty of games from this era assume one &lt;code&gt;update()&lt;/code&gt; per rendered frame. That assumption breaks twice in a browser: a 144 Hz monitor runs &lt;code&gt;requestAnimationFrame&lt;/code&gt; more often than the game expects, and a backgrounded tab throttles it to nearly nothing. Tie physics to the frame and the game runs fast on some screens and in slow motion in others.&lt;/p&gt;

&lt;p&gt;The fix is a fixed-timestep accumulator with interpolation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;STEP&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// simulation always runs at 60 Hz&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;last&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&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="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;acc&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;frame&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;now&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;acc&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="nx"&gt;now&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;last&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nx"&gt;last&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;now&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="nx"&gt;acc&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;250&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nx"&gt;acc&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;250&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// cap the catch-up&lt;/span&gt;
    &lt;span class="k"&gt;while &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;acc&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="nx"&gt;STEP&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;game&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;update&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;STEP&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nx"&gt;acc&lt;/span&gt; &lt;span class="o"&gt;-=&lt;/span&gt; &lt;span class="nx"&gt;STEP&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="nx"&gt;game&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;render&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;acc&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="nx"&gt;STEP&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nf"&gt;requestAnimationFrame&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;frame&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nf"&gt;requestAnimationFrame&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;frame&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;update()&lt;/code&gt; always sees the same &lt;code&gt;dt&lt;/code&gt;, so physics and AI stay deterministic regardless of the display. &lt;code&gt;render()&lt;/code&gt; receives the leftover fraction and interpolates between the previous and current state, which is what makes movement look smooth on a refresh rate the game was never designed for.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;250&lt;/code&gt; clamp is the part most ports leave out. Without it, a tab left in the background for an hour tries to simulate an hour of gameplay the instant it regains focus. Decide deliberately whether a hidden tab should pause the simulation outright or just catch up; the clamp keeps either choice survivable.&lt;/p&gt;

&lt;h2&gt;
  
  
  Load assets without blocking the thread
&lt;/h2&gt;

&lt;p&gt;Legacy code calls &lt;code&gt;fopen&lt;/code&gt; and expects bytes to be there. Emscripten satisfies that with MEMFS, an in-memory filesystem you populate at startup:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;emcc game.o &lt;span class="nt"&gt;-o&lt;/span&gt; game.html &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--preload-file&lt;/span&gt; assets@/assets &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;-s&lt;/span&gt; &lt;span class="nv"&gt;ALLOW_MEMORY_GROWTH&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;--preload-file&lt;/code&gt; flag packs the assets into a &lt;code&gt;.data&lt;/code&gt; file fetched before &lt;code&gt;main&lt;/code&gt; runs, so the C code sees a real directory tree. Avoid the temptation to fetch files lazily with synchronous &lt;code&gt;XMLHttpRequest&lt;/code&gt; on the main thread; that path is deprecated in browsers and will fight you. If you need lazy loading, fetch asynchronously and write the bytes into MEMFS yourself, then signal the game through a callback.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keep saves across browser sessions
&lt;/h2&gt;

&lt;p&gt;An in-memory filesystem means every save vanishes on refresh. Emscripten ships IDBFS, a filesystem backed by IndexedDB, for exactly this. Mount it once during startup:&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="nx"&gt;FS&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;mkdir&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/save&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;FS&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;mount&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;IDBFS&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{},&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/save&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;FS&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;syncfs&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="nx"&gt;err&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="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nx"&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;idbfs restore failed:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="nf"&gt;startGame&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;Writes go to the in-memory copy first, so you must flush them explicitly:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="cp"&gt;#include&lt;/span&gt; &lt;span class="cpf"&gt;&amp;lt;emscripten.h&amp;gt;&lt;/span&gt;&lt;span class="cp"&gt;
&lt;/span&gt;
&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;save_progress&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;FILE&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;fopen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/save/progress.dat"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"wb"&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;f&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="n"&gt;fwrite&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;g_progress&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;sizeof&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;g_progress&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="n"&gt;fclose&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="n"&gt;EM_ASM&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;FS&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;syncfs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;err&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;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;console&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="s"&gt;"syncfs failed:"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&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 &lt;code&gt;true&lt;/code&gt; argument on startup pulls IndexedDB into memory; &lt;code&gt;false&lt;/code&gt; on save pushes memory back to IndexedDB. Forgetting the second call is the single most common reason a browser port appears to lose progress.&lt;/p&gt;

&lt;h2&gt;
  
  
  What still breaks after all that
&lt;/h2&gt;

&lt;p&gt;A few problems do not yield to the patterns above, and it helps to know them before you plan the work.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Audio needs a user gesture.&lt;/strong&gt; Browsers suspend an &lt;code&gt;AudioContext&lt;/code&gt; created on page load. Create or resume it from the first keypress or click, not during startup.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;WebGL contexts get lost.&lt;/strong&gt; When the OS reclaims the GPU, your context dies. Handle &lt;code&gt;webglcontextlost&lt;/code&gt;, stop rendering, and rebuild your GL state on &lt;code&gt;webglcontextrestored&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Keyboard input fights the page.&lt;/strong&gt; Arrow keys and space scroll the window. Call &lt;code&gt;preventDefault&lt;/code&gt; on the keys the game actually claims.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Memory budgets differ.&lt;/strong&gt; A game sized for 2004 hardware can ask for more than a mobile browser wants to hand a single tab. Test on a low-end device early.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Key takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A native &lt;code&gt;while&lt;/code&gt; loop cannot survive the browser's event loop; restructure into a per-frame callback or let ASYNCIFY pause it for you.&lt;/li&gt;
&lt;li&gt;Run simulation at a fixed timestep and interpolate rendering, so a 144 Hz screen and a throttled background tab both behave the same way.&lt;/li&gt;
&lt;li&gt;Clamp the accumulator, or a backgrounded tab will try to simulate hours of gameplay in one burst.&lt;/li&gt;
&lt;li&gt;Preload assets into MEMFS rather than reaching for synchronous requests on the main thread.&lt;/li&gt;
&lt;li&gt;Mount IDBFS and call &lt;code&gt;FS.syncfs&lt;/code&gt; on every save, or progress disappears the moment the page reloads.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Source
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://nfsu2.xyz/" rel="noopener noreferrer"&gt;Need for Speed Underground 2 online in the browser&lt;/a&gt; is the project that prompted this piece. I added the porting failure modes, the working loop and persistence code, and the tradeoff comparison the project page does not cover.&lt;/p&gt;

&lt;h2&gt;
  
  
  Support this work
&lt;/h2&gt;

&lt;p&gt;These write-ups are researched and published with no paywall, sponsor, or tracking. If one saved you an afternoon, a small tip keeps them coming.&lt;/p&gt;

&lt;p&gt;USDT, USDC or USDD · TRC-20 (Tron)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;TFTNsfyomKrnUutRjBTGVULp19ByW29KbY
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>programming</category>
      <category>javascript</category>
      <category>webassembly</category>
      <category>gamedev</category>
    </item>
  </channel>
</rss>
