<?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: Umut Güngör</title>
    <description>The latest articles on DEV Community by Umut Güngör (@umutgungor).</description>
    <link>https://dev.to/umutgungor</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%2F4187347%2F6c46e582-f280-43bb-91fa-2302f13603f4.jpg</url>
      <title>DEV Community: Umut Güngör</title>
      <link>https://dev.to/umutgungor</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/umutgungor"/>
    <language>en</language>
    <item>
      <title>RAG Evaluation Guide: Separate Retrieval Quality from Answer Quality (Runnable Node.js Example)</title>
      <dc:creator>Umut Güngör</dc:creator>
      <pubDate>Wed, 25 Nov 2026 20:42:13 +0000</pubDate>
      <link>https://dev.to/umutgungor/rag-evaluation-guide-separate-retrieval-quality-from-answer-quality-runnable-nodejs-example-a61</link>
      <guid>https://dev.to/umutgungor/rag-evaluation-guide-separate-retrieval-quality-from-answer-quality-runnable-nodejs-example-a61</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Original guide + downloadable runnable script:&lt;/strong&gt; &lt;a href="https://umutgungorr.com/blog/rag-evaluation-traces?lang=en" rel="noopener noreferrer"&gt;Read on umutgungorr.com&lt;/a&gt; · &lt;a href="https://umutgungorr.com/examples/rag-evaluation.mjs" rel="noopener noreferrer"&gt;Download rag-evaluation.mjs&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A runnable Node.js example covering recall, precision, answer omissions and out-of-corpus questions. Synthetic data, actual test output and limitations.&lt;/p&gt;

&lt;h2&gt;
  
  
  What are we measuring?
&lt;/h2&gt;

&lt;p&gt;RAG evaluation asks two separate questions: did retrieval find the necessary evidence, and did the answer convey the necessary information? Fluent answers can hide missing evidence; complete evidence does not guarantee a complete answer.&lt;/p&gt;

&lt;p&gt;The example was prepared and run locally on Node.js v24.19.0. It uses three synthetic documents, two questions and keyword matching, without embeddings, a vector database or an LLM. It is a small evaluation fixture, not a full RAG system or a production benchmark.&lt;/p&gt;

&lt;h2&gt;
  
  
  Dataset and expected evidence
&lt;/h2&gt;

&lt;p&gt;The release question needs two documents: build covers test/build and secrets covers the secret check. The media question needs only images. Expected document IDs and answer facts are stored in the evaluation fixtures, not read by the retrieval function.&lt;/p&gt;

&lt;p&gt;Recall is relevant evidence retrieved divided by relevant evidence expected. Precision is relevant evidence retrieved divided by all evidence retrieved. factCoverage checks only whether expected strings appear in the answer; it cannot establish semantic correctness or hallucination rates. It can miss valid paraphrases or accept a phrase inside a negation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Run the example
&lt;/h2&gt;

&lt;p&gt;Save &lt;code&gt;rag-evaluation.mjs&lt;/code&gt; from the source links and run &lt;code&gt;node rag-evaluation.mjs&lt;/code&gt; using Node.js 24. No package, account, API key or network access is needed. A failed assertion terminates the command with an error.&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;// Synthetic documents; no LLM, API key, embedding model or external request.&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;assert&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'node:assert/strict'&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;corpus&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'build'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'Yayın öncesi test ve build çalıştırılır.'&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;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'secrets'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'Yayın öncesi gizli anahtar kontrolü yapılır.'&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;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'images'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'Blog görselleri WebP biçiminde saklanır.'&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;const&lt;/span&gt; &lt;span class="n"&gt;cases&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'release'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'yayın test build gizli anahtar'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;expected&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'build'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'secrets'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;facts&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'test ve build'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'gizli anahtar'&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;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'media'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'blog görselleri'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;expected&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'images'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;facts&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'WebP'&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;const&lt;/span&gt; &lt;span class="n"&gt;tokens&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;text&lt;/span&gt; &lt;span class="o"&gt;=&amp;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="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toLocaleLowerCase&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'tr-TR'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;match&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;\&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="no"&gt;L&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;\&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="no"&gt;N&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;gu&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="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;retrieve&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;k&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;terms&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;tokens&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;query&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;corpus&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;doc&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;doc&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;score&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="nf"&gt;tokens&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;doc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="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;t&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;terms&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;has&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&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;length&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;doc&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;doc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;score&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sort&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&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;b&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;score&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;score&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;localeCompare&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&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="nf"&gt;slice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;k&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;evaluate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;docs&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;answer&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;hits&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;docs&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;doc&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;expected&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;includes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;doc&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="n"&gt;length&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;recall&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;hits&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;expected&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;precision&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;docs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="n"&gt;hits&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;docs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;factCoverage&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;facts&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;fact&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;answer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;includes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fact&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;length&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;facts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="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="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="n"&gt;cases&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="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt; &lt;span class="k"&gt;of&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="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;docs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;retrieve&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="c1"&gt;// This is evidence concatenation, NOT an LLM-generated answer.&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;evaluate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;docs&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;docs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;doc&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;doc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;' '&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s1"&gt;'release'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;assert&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;equal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;recall&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="mf"&gt;0.5&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="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="n"&gt;assert&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;equal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;recall&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="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;assert&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;equal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;precision&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="p"&gt;;&lt;/span&gt;
    &lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;case&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;item&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;k&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;retrieved&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;docs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;d&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;d&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="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;release&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;cases&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="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;fullEvidence&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;retrieve&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;release&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;incompleteAnswer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;fullEvidence&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;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;incomplete&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;evaluate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;release&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;fullEvidence&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;incompleteAnswer&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;assert&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;equal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;incomplete&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;recall&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="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;assert&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;equal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;incomplete&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;factCoverage&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;case&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'answer-omission'&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;incomplete&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;assert&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;equal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;retrieve&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'pasaport yenileme'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&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="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'PASS: retrieval, answer omission and out-of-corpus checks'&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;
  
  
  Observed results
&lt;/h2&gt;

&lt;p&gt;For the release question, k=1 retrieved only build: recall 0.5, precision 1 and factCoverage 0.5. k=2 retrieved build and secrets, giving 1 for all three ratios. Both k values returned only images for the media question. These are fixture results, not overall accuracy claims.&lt;/p&gt;

&lt;p&gt;The answer-omission case intentionally uses only the first retrieved document despite complete evidence. Recall remains 1 while factCoverage drops to 0.5, reproducing the distinction between retrieval and answer completeness. An out-of-corpus query returns no evidence; a real product still needs a separate abstention policy.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"case"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"release"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nl"&gt;"k"&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="nl"&gt;"retrieved"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"build"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nl"&gt;"recall"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mf"&gt;0.5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nl"&gt;"precision"&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="nl"&gt;"factCoverage"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mf"&gt;0.5&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"case"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"release"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nl"&gt;"k"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nl"&gt;"retrieved"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"build"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s2"&gt;"secrets"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nl"&gt;"recall"&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="nl"&gt;"precision"&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="nl"&gt;"factCoverage"&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="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"case"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"answer-omission"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nl"&gt;"recall"&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="nl"&gt;"precision"&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="nl"&gt;"factCoverage"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mf"&gt;0.5&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Moving to a real system
&lt;/h2&gt;

&lt;p&gt;Two questions cannot establish that larger k is always better. Real evaluations need varied questions, irrelevant documents, missing evidence and contradictions, alongside cost, latency and context-noise measurements. Review evidence labels and avoid tuning on the same cases used to claim success.&lt;/p&gt;

&lt;p&gt;Do not accept real LLM answers using substring matching alone. Review grounding, abstention and domain risk separately. Traces can retain document IDs and versions, but private text and credentials must not enter public logs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Your first evaluation record
&lt;/h2&gt;

&lt;p&gt;Record question ID, corpus version, expected and retrieved evidence IDs, ranks, k, answer and separate evaluation results together. Identify the failing layer, change that layer and rerun the same cases. The linked debugging guide complements this with one hypothesis per change.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Related engineering guides on umutgungorr.com:&lt;/strong&gt; &lt;a href="https://umutgungorr.com/blog/rag-evaluation-traces?lang=en" rel="noopener noreferrer"&gt;Original RAG Evaluation Guide&lt;/a&gt; | &lt;a href="https://umutgungorr.com/blog/debugging-with-hypotheses?lang=en" rel="noopener noreferrer"&gt;Debugging Shared-State Bugs with Hypotheses&lt;/a&gt; | &lt;a href="https://umutgungorr.com/blog/interfaces-for-uncertainty?lang=en" rel="noopener noreferrer"&gt;Interfaces for Uncertain Systems&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>rag</category>
      <category>node</category>
      <category>testing</category>
    </item>
    <item>
      <title>How to Compress Noisy CI/CD and Production Logs Without Losing Stack Traces or Exit Codes</title>
      <dc:creator>Umut Güngör</dc:creator>
      <pubDate>Mon, 16 Nov 2026 17:48:50 +0000</pubDate>
      <link>https://dev.to/umutgungor/how-to-compress-noisy-cicd-and-production-logs-without-losing-stack-traces-or-exit-codes-2li2</link>
      <guid>https://dev.to/umutgungor/how-to-compress-noisy-cicd-and-production-logs-without-losing-stack-traces-or-exit-codes-2li2</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Updated guide + full FAQ &amp;amp; interactive LogShrink case study:&lt;/strong&gt; &lt;a href="https://umutgungorr.com/blog/debug-production-logs-logshrink?lang=en" rel="noopener noreferrer"&gt;Read on umutgungorr.com&lt;/a&gt; · &lt;a href="https://umutgungorr.com/projects/logshrink?lang=en" rel="noopener noreferrer"&gt;Explore LogShrink architecture &amp;amp; benchmarks&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;When GitHub Actions, Docker builds, or verbose test suites emit thousands of repetitive lines, real errors get buried. Learn how to shrink piped log streams by 70–90% in constant memory while preserving stack traces and non-zero exit codes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why huge CI logs bury the one traceback you actually need
&lt;/h2&gt;

&lt;p&gt;When an integration suite (&lt;code&gt;pytest -vv&lt;/code&gt;), Docker BuildKit layer pull, or native wheel compile emits tens of thousands of repeated status lines, ANSI progress-bar redraws (&lt;code&gt;\r&lt;/code&gt;, &lt;code&gt;\x1b[K&lt;/code&gt;), or &lt;code&gt;ConnectionResetError&lt;/code&gt; retry loops, the single traceback you need disappears under megabytes of scrollback. GitHub Actions truncates oversized logs in the browser, and pasting raw output into an issue or debugging session overflows context limits.&lt;/p&gt;

&lt;p&gt;Quick workarounds like &lt;code&gt;grep -v&lt;/code&gt; or &lt;code&gt;tail -n 200&lt;/code&gt; introduce two dangerous bugs. First, naive line slicing drops surrounding diagnostic context right above the failure. Second, in standard POSIX shells, a pipe like &lt;code&gt;docker build . | grep -v ...&lt;/code&gt; returns the exit code of the rightmost filter rather than the failing build—silently turning a broken CI run &lt;strong&gt;green&lt;/strong&gt; unless &lt;code&gt;pipefail&lt;/code&gt; is enforced.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Deduplicate stdout/stderr in constant memory and preserve exit codes with pipefail
&lt;/h2&gt;

&lt;p&gt;A trustworthy log compactor follows three strict invariants: process &lt;code&gt;stdin&lt;/code&gt; line-by-line in constant $O(1)$ memory without buffering full files, strip transient ANSI redraw noise while collapsing consecutive duplicates into a single count, and let every &lt;code&gt;Traceback&lt;/code&gt;, &lt;code&gt;AssertionError&lt;/code&gt;, &lt;code&gt;panic:&lt;/code&gt;, or &lt;code&gt;FATAL&lt;/code&gt; block bypass suppression verbatim.&lt;/p&gt;

&lt;p&gt;Built purely on the Python standard library with zero third-party dependencies, &lt;code&gt;logshrink&lt;/code&gt; shrinks verbose CI and build output by &lt;strong&gt;70–90%&lt;/strong&gt; while leaving stack traces untouched. Combining it with &lt;code&gt;set -o pipefail&lt;/code&gt; (enabled by default in GitHub Actions &lt;code&gt;bash&lt;/code&gt; steps) guarantees the upstream non-zero exit code is never masked.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip install logshrink

&lt;span class="c"&gt;# 1) Shrink noisy pytest output without losing tracebacks&lt;/span&gt;
&lt;span class="nb"&gt;set&lt;/span&gt; -o pipefail &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; pytest -vv 2&lt;span class="o"&gt;&amp;gt;&amp;amp;&lt;/span&gt;1 &lt;span class="o"&gt;|&lt;/span&gt; logshrink

&lt;span class="c"&gt;# 2) Compress Docker build logs while preserving exit code 1&lt;/span&gt;
&lt;span class="nb"&gt;set&lt;/span&gt; -o pipefail &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; docker build . 2&lt;span class="o"&gt;&amp;gt;&amp;amp;&lt;/span&gt;1 &lt;span class="o"&gt;|&lt;/span&gt; logshrink

&lt;span class="c"&gt;# Sample compressed output:&lt;/span&gt;
&lt;span class="c"&gt;# [stream] Fetching Python wheels &amp;amp; compiling native extensions...&lt;/span&gt;
&lt;span class="c"&gt;#   ↳ collapsed 14,820 noisy progress/polling lines (-88%)&lt;/span&gt;
&lt;span class="c"&gt;# WARN retry #2 -&amp;gt; upstream/proxy&lt;/span&gt;
&lt;span class="c"&gt;# Traceback (most recent call last):&lt;/span&gt;
&lt;span class="c"&gt;#   File "api/webhooks.py", line 84, in verify&lt;/span&gt;
&lt;span class="c"&gt;# AssertionError: missing HMAC signature header&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 2: Triage multi-megabyte production log dumps before opening an editor
&lt;/h2&gt;

&lt;p&gt;When an incident hands you a 200 MB container or reverse-proxy log dump, streaming it through &lt;code&gt;logshrink&lt;/code&gt; into &lt;code&gt;less -R&lt;/code&gt; or a triage summary file before opening an editor cuts initial diagnosis from minutes to seconds.&lt;/p&gt;

&lt;p&gt;Once repetitive healthchecks (&lt;code&gt;GET /health 200&lt;/code&gt;) and retry storms collapse into counts, the chronological fault transition—first upstream timeout, retry cascade, and final crash—stands out immediately.&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;# Compress a downloaded CI log file in constant memory&lt;/span&gt;
cat build-failure.log &lt;span class="o"&gt;|&lt;/span&gt; logshrink &lt;span class="o"&gt;|&lt;/span&gt; less -R

&lt;span class="c"&gt;# Usage inside a critical GitHub Actions test step:&lt;/span&gt;
&lt;span class="c"&gt;# - name: Run integration suite&lt;/span&gt;
&lt;span class="c"&gt;#   shell: bash&lt;/span&gt;
&lt;span class="c"&gt;#   run: set -o pipefail &amp;amp;&amp;amp; pytest -vv 2&amp;gt;&amp;amp;1 | logshrink&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  When should you still preserve raw logs?
&lt;/h2&gt;

&lt;p&gt;Log compaction optimizes human triage and CI console readability, not forensic compliance storage. Whenever you need full per-line timestamps or audit trails, split the stream with &lt;code&gt;tee raw.log | logshrink&lt;/code&gt;—archive &lt;code&gt;raw.log&lt;/code&gt; as a CI artifact on failure while keeping the live console output concise and readable.&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;# Archive raw logs while viewing the compressed summary in CI&lt;/span&gt;
&lt;span class="nb"&gt;set&lt;/span&gt; -o pipefail &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; pytest -vv 2&lt;span class="o"&gt;&amp;gt;&amp;amp;&lt;/span&gt;1 &lt;span class="o"&gt;|&lt;/span&gt; tee raw-test.log &lt;span class="o"&gt;|&lt;/span&gt; logshrink
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Frequently Asked Questions
&lt;/h2&gt;

&lt;h3&gt;
  
  
  If I pipe my build into logshrink, could a failing CI step falsely pass green?
&lt;/h3&gt;

&lt;p&gt;Without &lt;code&gt;set -o pipefail&lt;/code&gt;, POSIX shells return the exit status of the rightmost command in a pipe. GitHub Actions enables &lt;code&gt;pipefail&lt;/code&gt; in default &lt;code&gt;bash&lt;/code&gt; steps, and prefixing &lt;code&gt;set -o pipefail &amp;amp;&amp;amp;&lt;/code&gt; makes exit-code preservation explicit across every shell.&lt;/p&gt;

&lt;h3&gt;
  
  
  Does LogShrink consume high RAM on very large (e.g., 1 GB) log files?
&lt;/h3&gt;

&lt;p&gt;No. It operates as a streaming line-by-line pass in constant memory rather than loading the entire file into RAM, so memory usage stays flat even on multi-hundred-megabyte dumps.&lt;/p&gt;

&lt;h3&gt;
  
  
  Can stack traces or panic blocks get collapsed by accident?
&lt;/h3&gt;

&lt;p&gt;No. Stack traces, runtime exceptions, and failure blocks bypass deduplication and pass through verbatim; only repetitive progress and polling noise gets collapsed.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Try LogShrink &amp;amp; see the full benchmark breakdown:&lt;/strong&gt; &lt;a href="https://umutgungorr.com/projects/logshrink?lang=en" rel="noopener noreferrer"&gt;LogShrink Project Page&lt;/a&gt; | &lt;a href="https://umutgungorr.com/blog/debug-production-logs-logshrink?lang=en" rel="noopener noreferrer"&gt;Original Guide on umutgungorr.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>devops</category>
      <category>python</category>
      <category>docker</category>
      <category>cli</category>
    </item>
    <item>
      <title>How to Catch Broken Markdown Links and Dead Anchors in GitHub Actions Before Deploy</title>
      <dc:creator>Umut Güngör</dc:creator>
      <pubDate>Mon, 16 Nov 2026 17:47:59 +0000</pubDate>
      <link>https://dev.to/umutgungor/how-to-catch-broken-markdown-links-and-dead-anchors-in-github-actions-before-deploy-4pkj</link>
      <guid>https://dev.to/umutgungor/how-to-catch-broken-markdown-links-and-dead-anchors-in-github-actions-before-deploy-4pkj</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Updated guide + full FAQ &amp;amp; DeadLinkFinder case study:&lt;/strong&gt; &lt;a href="https://umutgungorr.com/blog/github-actions-broken-links-deadlinkfinder?lang=en" rel="noopener noreferrer"&gt;Read on umutgungorr.com&lt;/a&gt; · &lt;a href="https://umutgungorr.com/projects/deadlinkfinder?lang=en" rel="noopener noreferrer"&gt;Explore DeadLinkFinder architecture&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Renamed files, moved headings, and missing images silently break developer docs. A complete guide to checking relative Markdown links, GFM &lt;code&gt;#anchors&lt;/code&gt;, and SARIF pull-request annotations in GitHub Actions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Markdown links break silently across pull requests
&lt;/h2&gt;

&lt;p&gt;When an engineer renames &lt;code&gt;docs/setup.md&lt;/code&gt; to &lt;code&gt;docs/quickstart.md&lt;/code&gt;, moves a diagram asset, or edits a heading from &lt;code&gt;## Authentication&lt;/code&gt; to &lt;code&gt;## Token Setup&lt;/code&gt;, unit tests, linters, and TypeScript builds still pass green. Standard CI gates never notice that &lt;code&gt;#authentication&lt;/code&gt; in your README now points nowhere.&lt;/p&gt;

&lt;p&gt;Traditional HTTP link crawlers introduce two chronic failures in pull requests. First, crawling only external URLs misses local relative file paths (&lt;code&gt;../guides/deploy.md&lt;/code&gt;) and GitHub Flavored Markdown (GFM) heading anchors inside an unmerged PR. Second, external &lt;code&gt;429&lt;/code&gt; rate limits and &lt;code&gt;403&lt;/code&gt; anti-bot responses make CI flaky, causing engineers to ignore or disable the check.&lt;/p&gt;

&lt;p&gt;The sustainable architecture splits link verification into two lanes: a &lt;strong&gt;zero-network offline check&lt;/strong&gt; that gates every pull request deterministically, and a &lt;strong&gt;scheduled external HTTP sweep&lt;/strong&gt; that runs weekly without blocking merges.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Verify relative files, images, and GFM #anchors offline
&lt;/h2&gt;

&lt;p&gt;GitHub's GFM heading slugification is subtler than naive lowercasing: punctuation is stripped, spaces become hyphens, Unicode letters are preserved, and duplicate headings such as a second &lt;code&gt;## Setup&lt;/code&gt; automatically receive &lt;code&gt;-1&lt;/code&gt;, &lt;code&gt;-2&lt;/code&gt; suffixes. Simple regex scripts either trigger false positives or miss broken duplicate anchors.&lt;/p&gt;

&lt;p&gt;Built purely on the Python standard library (&lt;code&gt;re&lt;/code&gt;, &lt;code&gt;pathlib&lt;/code&gt;, &lt;code&gt;difflib&lt;/code&gt;, &lt;code&gt;urllib&lt;/code&gt;), &lt;code&gt;deadlinkfinder&lt;/code&gt; scans an entire repository in milliseconds with zero network calls. It verifies relative Markdown paths, image assets, and exact GFM heading maps—and when a target breaks, &lt;code&gt;difflib&lt;/code&gt; prints an actionable 'did you mean' suggestion pointing to the renamed file or heading.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip install deadlinkfinder

&lt;span class="c"&gt;# 1) Scan local Markdown links, images, and #heading anchors offline&lt;/span&gt;
deadlinkfinder check .

&lt;span class="c"&gt;# Sample output:&lt;/span&gt;
&lt;span class="c"&gt;# FAIL README.md:42 -&amp;gt; docs/auth.md#authentication (broken anchor)&lt;/span&gt;
&lt;span class="c"&gt;#      Hint: Did you mean #token-setup?&lt;/span&gt;
&lt;span class="c"&gt;# Scanned 48 targets offline in 19ms · exit code 1&lt;/span&gt;

&lt;span class="c"&gt;# 2) Machine-readable JSON or scheduled external URL sweep&lt;/span&gt;
deadlinkfinder check docs/ --format json
deadlinkfinder check docs/ --external --timeout 8
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 2: Gate Pull Requests in GitHub Actions with SARIF v2.1.0 Annotations
&lt;/h2&gt;

&lt;p&gt;Console-only failures force reviewers to dig through workflow logs. Exporting &lt;code&gt;deadlinkfinder check . --format sarif&lt;/code&gt; into &lt;code&gt;github/codeql-action/upload-sarif@v3&lt;/code&gt; renders broken links directly inline on the Pull Request diff and inside GitHub Security → Code Scanning with stable line fingerprints.&lt;/p&gt;

&lt;p&gt;The workflow below triggers only when Markdown or docs change (&lt;code&gt;paths&lt;/code&gt; filter), requests least-privilege permissions (&lt;code&gt;contents: read&lt;/code&gt; and &lt;code&gt;security-events: write&lt;/code&gt;), uploads SARIF annotations even on failure (&lt;code&gt;if: always()&lt;/code&gt;), and blocks broken merges with exit code &lt;code&gt;1&lt;/code&gt;.&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;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Markdown Link Check&lt;/span&gt;
&lt;span class="na"&gt;on&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;pull_request&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;paths&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="s2"&gt;"**/*.md"&lt;/span&gt;
      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="s2"&gt;"docs/**"&lt;/span&gt;

&lt;span class="na"&gt;permissions&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;contents&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;read&lt;/span&gt;
  &lt;span class="na"&gt;security-events&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;write&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;offline-links&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;uses&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;actions/setup-python@v5&lt;/span&gt;
        &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;python-version&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"3.12"&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;Install DeadLinkFinder&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;pip install deadlinkfinder&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;Generate SARIF report&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;scan&lt;/span&gt;
        &lt;span class="na"&gt;continue-on-error&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;run&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;deadlinkfinder check . --format sarif &amp;gt; links.sarif&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;Upload SARIF to GitHub Code Scanning&lt;/span&gt;
        &lt;span class="na"&gt;if&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;always()&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;github/codeql-action/upload-sarif@v3&lt;/span&gt;
        &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;sarif_file&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;links.sarif&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;Enforce PR gate&lt;/span&gt;
        &lt;span class="na"&gt;if&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;steps.scan.outcome == 'failure'&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;deadlinkfinder check .&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 3: Isolate External HTTP Checks into a Weekly Scheduled Workflow
&lt;/h2&gt;

&lt;p&gt;Monitoring external references (such as third-party API docs returning 404) is still valuable, but belongs in a weekly &lt;code&gt;schedule&lt;/code&gt; workflow rather than a blocking PR check. Temporary third-party outages never stall deployments, while genuine external link rot surfaces cleanly once a week.&lt;/p&gt;

&lt;p&gt;Excluding fenced code-block placeholders (&lt;code&gt;http://localhost:3000&lt;/code&gt;, &lt;code&gt;https://example.com&lt;/code&gt;) keeps noise at zero so every non-zero exit represents a real documentation defect.&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;# Separate weekly scheduled workflow for external URL checks
&lt;/span&gt;&lt;span class="na"&gt;on&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;schedule&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;cron&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"0 7 * * 1"&lt;/span&gt; &lt;span class="c1"&gt;# Every Monday at 07:00 UTC
&lt;/span&gt;  &lt;span class="na"&gt;workflow_dispatch&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Frequently Asked Questions
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Why shouldn't I run external HTTP link checks on every pull request?
&lt;/h3&gt;

&lt;p&gt;External hosts frequently return transient 429 rate limits, 503 outages, or 403 anti-bot responses, making PR checks flaky. Run offline local file, image, and &lt;code&gt;#anchor&lt;/code&gt; checks on every PR, and move external HTTP sweeps to a weekly scheduled job.&lt;/p&gt;

&lt;h3&gt;
  
  
  Which GitHub Actions permissions are required to upload SARIF results?
&lt;/h3&gt;

&lt;p&gt;Your workflow needs &lt;code&gt;contents: read&lt;/code&gt; and &lt;code&gt;security-events: write&lt;/code&gt; under &lt;code&gt;permissions&lt;/code&gt;. GitHub Code Scanning is free for public repositories and requires GitHub Advanced Security on private repositories.&lt;/p&gt;

&lt;h3&gt;
  
  
  How are Unicode headings and duplicate Markdown headings handled?
&lt;/h3&gt;

&lt;p&gt;Following GitHub Flavored Markdown rules, Unicode letters are preserved, punctuation is stripped, and duplicate headings receive &lt;code&gt;-1&lt;/code&gt;, &lt;code&gt;-2&lt;/code&gt; suffixes. &lt;code&gt;deadlinkfinder&lt;/code&gt; implements exact GFM slugification and suggests close matches via &lt;code&gt;difflib&lt;/code&gt;.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Try DeadLinkFinder &amp;amp; see the architecture notes:&lt;/strong&gt; &lt;a href="https://umutgungorr.com/projects/deadlinkfinder?lang=en" rel="noopener noreferrer"&gt;DeadLinkFinder Project Page&lt;/a&gt; | &lt;a href="https://umutgungorr.com/blog/github-actions-broken-links-deadlinkfinder?lang=en" rel="noopener noreferrer"&gt;Original Guide on umutgungorr.com&lt;/a&gt; | &lt;a href="https://github.com/umutgungorr/deadlinkfinder" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;&lt;/p&gt;

</description>
      <category>githubactions</category>
      <category>markdown</category>
      <category>python</category>
      <category>devops</category>
    </item>
    <item>
      <title>How to Catch Missing .env Variables and .env.example Drift Before Production Deploy</title>
      <dc:creator>Umut Güngör</dc:creator>
      <pubDate>Sun, 15 Nov 2026 14:35:07 +0000</pubDate>
      <link>https://dev.to/umutgungor/how-to-catch-missing-env-variables-and-envexample-drift-before-production-deploy-1ii4</link>
      <guid>https://dev.to/umutgungor/how-to-catch-missing-env-variables-and-envexample-drift-before-production-deploy-1ii4</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Updated guide + full FAQ &amp;amp; EnvDoctor case study:&lt;/strong&gt; &lt;a href="https://umutgungorr.com/blog/env-contract-drift-envdoctor?lang=en" rel="noopener noreferrer"&gt;Read on umutgungorr.com&lt;/a&gt; · &lt;a href="https://umutgungorr.com/projects/envdoctor?lang=en" rel="noopener noreferrer"&gt;Explore EnvDoctor architecture&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;How to stop silent &lt;code&gt;.env&lt;/code&gt; vs &lt;code&gt;.env.example&lt;/code&gt; configuration drift and undocumented &lt;code&gt;os.getenv&lt;/code&gt; calls in CI/CD before a missing environment variable breaks production.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why code that passes locally crashes on deploy
&lt;/h2&gt;

&lt;p&gt;Adding a new webhook secret, cache URL, or feature flag to your local &lt;code&gt;.env&lt;/code&gt; file takes seconds. Forgetting to mirror that key into &lt;code&gt;.env.example&lt;/code&gt; and your production runtime config rarely shows up in code review because local tests read your machine's &lt;code&gt;.env&lt;/code&gt; or mocked fixtures.&lt;/p&gt;

&lt;p&gt;Once that silent drift ships to production, one of two failures occurs: the service crashes with a &lt;code&gt;KeyError&lt;/code&gt; / &lt;code&gt;undefined&lt;/code&gt; error the first time real traffic hits that branch, or worse, a fallback like &lt;code&gt;os.getenv("STRIPE_WEBHOOK_KEY", "")&lt;/code&gt; silently runs with an empty string and breaks signature verification or auth behavior.&lt;/p&gt;

&lt;p&gt;Missing keys are only half the cost. Over months, orphaned variables accumulate in &lt;code&gt;.env.example&lt;/code&gt;, new engineers cannot tell which keys are mandatory versus retired, and local onboarding slows to guesswork.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Enforce the .env ↔ .env.example contract in strict mode
&lt;/h2&gt;

&lt;p&gt;Treating &lt;code&gt;.env.example&lt;/code&gt; as an enforced build contract instead of passive documentation eliminates drift at the source. The zero-dependency Python tool &lt;code&gt;envdoctor-cli&lt;/code&gt; compares &lt;code&gt;.env&lt;/code&gt; against &lt;code&gt;.env.example&lt;/code&gt; strictly by &lt;strong&gt;key names&lt;/strong&gt;—never printing or transmitting secret values.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;envdoctor check --strict&lt;/code&gt; flags both missing keys and undocumented extras with exit code &lt;code&gt;1&lt;/code&gt;. Instead of copying lines manually—and risking accidentally pasting a real secret into &lt;code&gt;.env.example&lt;/code&gt;—running &lt;code&gt;envdoctor sync&lt;/code&gt; appends missing keys with safe empty or masked placeholders.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip install envdoctor-cli

&lt;span class="c"&gt;# 1) Strictly verify missing or extra keys between .env and .env.example&lt;/span&gt;
envdoctor check --strict

&lt;span class="c"&gt;# Sample output:&lt;/span&gt;
&lt;span class="c"&gt;# [OK]      DATABASE_URL        present in both contracts&lt;/span&gt;
&lt;span class="c"&gt;# [OK]      REDIS_PORT          present in both contracts&lt;/span&gt;
&lt;span class="c"&gt;# [MISSING] STRIPE_WEBHOOK_KEY  missing from .env.example&lt;/span&gt;
&lt;span class="c"&gt;# exit code 1&lt;/span&gt;

&lt;span class="c"&gt;# 2) Sync missing keys to .env.example without leaking secret values&lt;/span&gt;
envdoctor sync
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 2: Surface undocumented env vars in source code with Python AST
&lt;/h2&gt;

&lt;p&gt;Comparing &lt;code&gt;.env&lt;/code&gt; and &lt;code&gt;.env.example&lt;/code&gt; alone leaves a major blind spot: an engineer can add &lt;code&gt;os.getenv("NEW_WEBHOOK_SECRET")&lt;/code&gt; or &lt;code&gt;os.environ["BILLING_SIGNING_KEY"]&lt;/code&gt; in Python code without updating either file. Both env files still match, yet production has no idea that variable exists.&lt;/p&gt;

&lt;p&gt;Naive &lt;code&gt;grep&lt;/code&gt; or regex scans misfire on comments, docstrings, and unrelated strings. &lt;code&gt;envdoctor audit&lt;/code&gt; parses Python files via the standard library &lt;code&gt;ast&lt;/code&gt; module to locate real &lt;code&gt;os.getenv(...)&lt;/code&gt;, &lt;code&gt;os.environ.get(...)&lt;/code&gt;, and &lt;code&gt;os.environ[...]&lt;/code&gt; calls, reporting both undocumented code lookups and orphan keys that no module reads anymore.&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;# Audit os.getenv / os.environ usage via Python AST and emit JSON for CI&lt;/span&gt;
envdoctor audit --format json

&lt;span class="c"&gt;# Sample JSON output:&lt;/span&gt;
&lt;span class="c"&gt;# {&lt;/span&gt;
&lt;span class="c"&gt;#   "status": "drift_detected",&lt;/span&gt;
&lt;span class="c"&gt;#   "undocumented_in_code": [{"key": "STRIPE_WEBHOOK_KEY", "file": "src/billing/hooks.py", "line": 18}],&lt;/span&gt;
&lt;span class="c"&gt;#   "orphan_in_example": ["LEGACY_API_FLAG"]&lt;/span&gt;
&lt;span class="c"&gt;# }&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 3: Add a Pull Request Gate in GitHub Actions (and Multi-Env Setups)
&lt;/h2&gt;

&lt;p&gt;CI runners do not—and should not—contain production &lt;code&gt;.env&lt;/code&gt; files. On pull requests, run &lt;code&gt;envdoctor audit&lt;/code&gt; so every environment variable referenced in code is guaranteed to exist in &lt;code&gt;.env.example&lt;/code&gt;. Locally or in pre-commit hooks, run &lt;code&gt;envdoctor check --strict&lt;/code&gt; to verify your local &lt;code&gt;.env&lt;/code&gt; matches the template.&lt;/p&gt;

&lt;p&gt;In monorepos with multiple services (&lt;code&gt;services/api&lt;/code&gt;, &lt;code&gt;services/worker&lt;/code&gt;), audit each service against its own &lt;code&gt;.env.example&lt;/code&gt; so each workload documents only the minimum secrets it requires.&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;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Env Contract Audit&lt;/span&gt;
&lt;span class="na"&gt;on&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;pull_request&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;paths&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="s2"&gt;"**/*.py"&lt;/span&gt;
      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="s2"&gt;".env.example"&lt;/span&gt;

&lt;span class="na"&gt;permissions&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;contents&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;read&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;envdoctor&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;uses&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;actions/setup-python@v5&lt;/span&gt;
        &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;python-version&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"3.12"&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;Audit undocumented env vars via AST&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;pip install envdoctor-cli&lt;/span&gt;
          &lt;span class="s"&gt;envdoctor audit&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Frequently Asked Questions
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Will envdoctor sync ever leak my real secret values into .env.example?
&lt;/h3&gt;

&lt;p&gt;No. &lt;code&gt;envdoctor sync&lt;/code&gt; reads only key names that are missing from &lt;code&gt;.env.example&lt;/code&gt; and writes empty or masked placeholders—real secret values are never copied to the template.&lt;/p&gt;

&lt;h3&gt;
  
  
  How does envdoctor work in GitHub Actions where no .env file exists?
&lt;/h3&gt;

&lt;p&gt;CI does not need a &lt;code&gt;.env&lt;/code&gt; file. &lt;code&gt;envdoctor audit&lt;/code&gt; scans Python source code with AST for &lt;code&gt;os.getenv&lt;/code&gt; and &lt;code&gt;os.environ&lt;/code&gt; calls and validates them directly against the committed &lt;code&gt;.env.example&lt;/code&gt; file.&lt;/p&gt;

&lt;h3&gt;
  
  
  Can AST analysis detect dynamically constructed env var names like f-strings?
&lt;/h3&gt;

&lt;p&gt;Static AST parsing resolves string-literal keys deterministically. Dynamic expressions like &lt;code&gt;os.getenv(f"{prefix}_KEY")&lt;/code&gt; cannot be statically resolved, so centralizing configuration reads as explicit literal constants in one config module is recommended.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Try EnvDoctor &amp;amp; see the architecture notes:&lt;/strong&gt; &lt;a href="https://umutgungorr.com/projects/envdoctor?lang=en" rel="noopener noreferrer"&gt;EnvDoctor Project Page&lt;/a&gt; | &lt;a href="https://umutgungorr.com/blog/env-contract-drift-envdoctor?lang=en" rel="noopener noreferrer"&gt;Original Guide on umutgungorr.com&lt;/a&gt; | &lt;a href="https://github.com/umutgungorr/envdoctor" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;&lt;/p&gt;

</description>
      <category>devops</category>
      <category>ci</category>
      <category>beginners</category>
      <category>python</category>
    </item>
    <item>
      <title>How to Remove Leaked API Keys and .env Files from Git History (git filter-repo Guide)</title>
      <dc:creator>Umut Güngör</dc:creator>
      <pubDate>Sun, 15 Nov 2026 14:08:10 +0000</pubDate>
      <link>https://dev.to/umutgungor/how-to-remove-leaked-api-keys-and-env-files-from-git-history-git-filter-repo-guide-2pe5</link>
      <guid>https://dev.to/umutgungor/how-to-remove-leaked-api-keys-and-env-files-from-git-history-git-filter-repo-guide-2pe5</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Updated guide + full FAQ &amp;amp; TokenGuard case study:&lt;/strong&gt; &lt;a href="https://umutgungorr.com/blog/git-filter-repo-clean-leaked-secrets?lang=en" rel="noopener noreferrer"&gt;Read on umutgungorr.com&lt;/a&gt; · &lt;a href="https://umutgungorr.com/projects/tokenguard?lang=en" rel="noopener noreferrer"&gt;Explore TokenGuard architecture&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Deleting a leaked &lt;code&gt;.env&lt;/code&gt; file in a new commit leaves the secret readable in Git history. Follow the complete recovery sequence: key rotation, &lt;code&gt;git filter-repo&lt;/code&gt; scrubbing across all refs, team sync, and TokenGuard pre-commit prevention.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Revoke &amp;amp; Rotate the Exposed Key Before Scrubbing History
&lt;/h2&gt;

&lt;p&gt;The moment a &lt;code&gt;.env&lt;/code&gt; file, AWS access key, Stripe &lt;code&gt;sk_live_&lt;/code&gt; token, or private signing key is pushed to a public GitHub repository, automated credential scrapers can harvest it within seconds. Running &lt;code&gt;git rm .env&lt;/code&gt; in a follow-up commit does not erase earlier Git objects—anyone inspecting &lt;code&gt;git log -p&lt;/code&gt; or the raw commit SHA URL can still read the secret.&lt;/p&gt;

&lt;p&gt;Therefore, your first action is never rewriting Git history—it is immediately revoking and rotating the compromised credential at the provider (AWS IAM, GitHub, Stripe, Supabase, OpenAI, etc.). Rewriting history without revoking an active key only hides the leak while leaving the credential valid. Check provider audit logs between the push timestamp and revocation timestamp to confirm no unauthorized requests occurred.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Scrub the File or Secret String on a Fresh Mirror Clone with git filter-repo
&lt;/h2&gt;

&lt;p&gt;The Git project officially recommends &lt;code&gt;git-filter-repo&lt;/code&gt; over legacy &lt;code&gt;git filter-branch&lt;/code&gt; and BFG for accuracy and speed. Always perform history rewrites on a fresh &lt;code&gt;--mirror&lt;/code&gt; clone rather than your working tree so every branch and tag ref is rewritten consistently without risking uncommitted local work.&lt;/p&gt;

&lt;p&gt;There are two common recovery patterns: if an entire &lt;code&gt;.env&lt;/code&gt; file was committed by mistake, &lt;code&gt;--path .env --invert-paths&lt;/code&gt; purges every &lt;code&gt;.env&lt;/code&gt; blob from history. If a secret was hardcoded inside a real source file (&lt;code&gt;src/config.py&lt;/code&gt;), use &lt;code&gt;--replace-text secrets.txt&lt;/code&gt; so the source file stays intact while every occurrence of the secret string becomes &lt;code&gt;***REMOVED***&lt;/code&gt;. Note that &lt;code&gt;git-filter-repo&lt;/code&gt; removes the &lt;code&gt;origin&lt;/code&gt; remote by design to prevent accidental pushes—verify locally before re-adding the remote.&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;# 1) Install git-filter-repo and create a fresh mirror clone&lt;/span&gt;
pip install git-filter-repo
git clone --mirror https://github.com/OWNER/REPO.git repo-clean.git
&lt;span class="nb"&gt;cd&lt;/span&gt; repo-clean.git

&lt;span class="c"&gt;# 2a) Permanently remove a committed .env file across all history&lt;/span&gt;
git filter-repo --path .env --invert-paths

&lt;span class="c"&gt;# 2b) Or redact a specific secret string inside source files&lt;/span&gt;
&lt;span class="c"&gt;# secrets.txt line format: sk_live_EXAMPLE_KEY==&amp;gt;***REMOVED***&lt;/span&gt;
git filter-repo --replace-text ../secrets.txt

&lt;span class="c"&gt;# 3) Local verification: must return 0 matches&lt;/span&gt;
git log --all --full-history -- .env

&lt;span class="c"&gt;# 4) Re-add origin and force-push all rewritten branches and tags&lt;/span&gt;
git remote add origin https://github.com/OWNER/REPO.git
git push --force --all
git push --force --tags
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 3: GitHub Commit Caches, PR Refs &amp;amp; Safe Team Recovery
&lt;/h2&gt;

&lt;p&gt;Running &lt;code&gt;git push --force --all&lt;/code&gt; updates branch and tag heads, but GitHub can retain dangling commit objects referenced by pull requests (&lt;code&gt;refs/pull/*/head&lt;/code&gt;) or cached views. For sensitive leaks, contact GitHub Support to request a cached-commit purge, and make sure &lt;code&gt;.env&lt;/code&gt; is added to &lt;code&gt;.gitignore&lt;/code&gt; immediately.&lt;/p&gt;

&lt;p&gt;After a force-push rewrite, teammates running a normal &lt;code&gt;git pull&lt;/code&gt; can accidentally merge the old tainted history back into &lt;code&gt;main&lt;/code&gt;. Every collaborator must either re-clone or run a hard reset to the rewritten upstream branch.&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;# Reset collaborator clones to rewritten history without merging old commits&lt;/span&gt;
git fetch origin
git checkout main
git reset --hard origin/main
git reflog expire --expire=now --all
git gc --prune=now --aggressive
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 4: Block Future Leaks Before Commit with TokenGuard Pre-Commit
&lt;/h2&gt;

&lt;p&gt;Scrubbing Git history is incident remediation; the durable defense is blocking credentials before &lt;code&gt;git commit&lt;/code&gt; succeeds. My zero-dependency Python CLI TokenGuard (&lt;code&gt;tokenguard-cli&lt;/code&gt;) inspects staged diffs offline using both provider token signatures (AWS, GitHub, Stripe, JWT, PEM private keys) and Shannon entropy checks.&lt;/p&gt;

&lt;p&gt;When TokenGuard detects a secret, it masks the value in terminal output (&lt;code&gt;AKIA************&lt;/code&gt;), aborts the commit with exit code &lt;code&gt;1&lt;/code&gt;, and supports &lt;code&gt;--format sarif&lt;/code&gt; in GitHub Actions for defense-in-depth across the team.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip install tokenguard-cli

&lt;span class="c"&gt;# Scan staged files offline before commit&lt;/span&gt;
tokenguard scan --staged

&lt;span class="c"&gt;# Install automatic Git pre-commit hook&lt;/span&gt;
tokenguard install-hook
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Frequently Asked Questions
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Does running git rm --cached .env remove the secret from Git history?
&lt;/h3&gt;

&lt;p&gt;No. &lt;code&gt;git rm --cached .env&lt;/code&gt; only untracks the file for future commits while leaving earlier commit blobs intact. You must revoke the credential first and then rewrite history with &lt;code&gt;git filter-repo&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why does git filter-repo remove the origin remote automatically?
&lt;/h3&gt;

&lt;p&gt;As a safety mechanism to prevent accidentally force-pushing rewritten history before verifying the cleanup locally. After confirming &lt;code&gt;git log --all -- .env&lt;/code&gt; returns empty, re-add &lt;code&gt;origin&lt;/code&gt; and force-push.&lt;/p&gt;

&lt;h3&gt;
  
  
  Do I still need git filter-repo if I never pushed the commit?
&lt;/h3&gt;

&lt;p&gt;If the leak is only in the latest unpushed commit, &lt;code&gt;git reset --soft HEAD~1&lt;/code&gt;, unstaging &lt;code&gt;.env&lt;/code&gt;, and recommitting is enough. If it sits several commits back or across multiple local branches, &lt;code&gt;git filter-repo&lt;/code&gt; is cleaner and safer.&lt;/p&gt;

&lt;h3&gt;
  
  
  What should teammates do after I force-push rewritten history?
&lt;/h3&gt;

&lt;p&gt;They must not run a normal &lt;code&gt;git pull&lt;/code&gt;, which merges the old tainted commits back in. Everyone should run &lt;code&gt;git fetch origin &amp;amp;&amp;amp; git reset --hard origin/main&lt;/code&gt; or take a fresh clone.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Prevent future leaks with TokenGuard:&lt;/strong&gt; &lt;a href="https://umutgungorr.com/projects/tokenguard?lang=en" rel="noopener noreferrer"&gt;TokenGuard Project Page&lt;/a&gt; | &lt;a href="https://umutgungorr.com/blog/git-secret-leak-prevention-tokenguard?lang=en" rel="noopener noreferrer"&gt;TokenGuard Pre-Commit Guide&lt;/a&gt; | &lt;a href="https://umutgungorr.com/blog/git-filter-repo-clean-leaked-secrets?lang=en" rel="noopener noreferrer"&gt;Original Guide on umutgungorr.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>git</category>
      <category>security</category>
      <category>python</category>
      <category>devops</category>
    </item>
    <item>
      <title>How to Fix EADDRINUSE: Address Already in Use on Windows, Linux &amp; Docker</title>
      <dc:creator>Umut Güngör</dc:creator>
      <pubDate>Sun, 15 Nov 2026 14:06:19 +0000</pubDate>
      <link>https://dev.to/umutgungor/how-to-fix-eaddrinuse-address-already-in-use-on-windows-linux-docker-2bof</link>
      <guid>https://dev.to/umutgungor/how-to-fix-eaddrinuse-address-already-in-use-on-windows-linux-docker-2bof</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Updated guide + full FAQ &amp;amp; PortTree case study:&lt;/strong&gt; &lt;a href="https://umutgungorr.com/blog/eaddrinuse-port-conflict-fix?lang=en" rel="noopener noreferrer"&gt;Read on umutgungorr.com&lt;/a&gt; · &lt;a href="https://umutgungorr.com/projects/porttree?lang=en" rel="noopener noreferrer"&gt;Explore PortTree architecture&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A practical OS-by-OS command playbook to diagnose and cleanly resolve &lt;code&gt;EADDRINUSE&lt;/code&gt; port conflicts across Windows, Linux, macOS, WSL2, and Docker containers.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why EADDRINUSE Happens (and Why Blind kill -9 Often Fails)
&lt;/h2&gt;

&lt;p&gt;When starting a Node.js, Python (Uvicorn/Flask), Go, or Vite dev server throws &lt;code&gt;Error: listen EADDRINUSE: address already in use :::3000&lt;/code&gt; (or Python's &lt;code&gt;OSError: [Errno 98] Address already in use&lt;/code&gt;), the OS kernel is rejecting the &lt;code&gt;bind()&lt;/code&gt; syscall because another socket already owns that local IP and TCP port.&lt;/p&gt;

&lt;p&gt;The most common reflex is locating a single PID and immediately running &lt;code&gt;kill -9 &amp;lt;PID&amp;gt;&lt;/code&gt; or &lt;code&gt;taskkill /F /PID &amp;lt;PID&amp;gt;&lt;/code&gt;. That blind kill fails in three common scenarios: a supervisor (nodemon, PM2, Vite watcher, systemd, or an IDE debugger) immediately respawns the child process; the port is actually forwarded by &lt;code&gt;docker-proxy&lt;/code&gt; for a running container; or the process is a shared local service such as PostgreSQL or Redis that you should not terminate abruptly.&lt;/p&gt;

&lt;p&gt;The reliable triage sequence is always the same: inspect the exact bound address (&lt;code&gt;127.0.0.1&lt;/code&gt;, &lt;code&gt;0.0.0.0&lt;/code&gt;, or &lt;code&gt;::1&lt;/code&gt;) and PID, read the parent process (&lt;code&gt;PPID&lt;/code&gt;) and full command line (&lt;code&gt;CommandLine&lt;/code&gt;), and then stop the right owner gracefully (&lt;code&gt;SIGTERM&lt;/code&gt;) instead of killing a symptom.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;Error: listen EADDRINUSE: address already &lt;span class="k"&gt;in&lt;/span&gt; use :::3000
    at Server.setupListenHandle &lt;span class="o"&gt;[&lt;/span&gt;as _listen2&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;node:net:1904:16&lt;span class="o"&gt;)&lt;/span&gt;
    at listenInCluster &lt;span class="o"&gt;(&lt;/span&gt;node:net:1961:12&lt;span class="o"&gt;)&lt;/span&gt;

&lt;span class="c"&gt;# Python / Uvicorn equivalent:&lt;/span&gt;
OSError: &lt;span class="o"&gt;[&lt;/span&gt;Errno 98&lt;span class="o"&gt;]&lt;/span&gt; Address already &lt;span class="k"&gt;in&lt;/span&gt; use
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Finding the Port Owner and Parent Process on Windows, Linux &amp;amp; macOS
&lt;/h2&gt;

&lt;p&gt;Every major operating system includes built-in socket inspection tools. Rather than stopping at the raw PID, always inspect the process command line and parent PID so you know which terminal tab, repo, or background daemon owns the port.&lt;/p&gt;

&lt;p&gt;On Windows, &lt;code&gt;netstat -ano | findstr :3000&lt;/code&gt; only shows a numeric PID. Pairing PowerShell's &lt;code&gt;Get-NetTCPConnection&lt;/code&gt; with &lt;code&gt;Get-CimInstance Win32_Process&lt;/code&gt; exposes both &lt;code&gt;ParentProcessId&lt;/code&gt; and the exact &lt;code&gt;CommandLine&lt;/code&gt;. On modern Linux distributions, &lt;code&gt;ss -tulpn&lt;/code&gt; queries kernel netlink tables directly and is faster than legacy &lt;code&gt;netstat&lt;/code&gt;. On macOS, &lt;code&gt;lsof -nP -iTCP:3000 -sTCP:LISTEN&lt;/code&gt; disables DNS and port-name lookups (&lt;code&gt;-nP&lt;/code&gt;) for instant output.&lt;/p&gt;

&lt;p&gt;One Windows-specific trap: Hyper-V and WSL2 reserve dynamic excluded TCP port ranges at boot. Even when no process is listening on port 3000 or 5000, binding can fail if the port falls inside a reserved range—verify with &lt;code&gt;netsh interface ipv4 show excludedportrange protocol=tcp&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Linux (fastest check + parent process)&lt;/span&gt;
ss -tulpn &lt;span class="o"&gt;|&lt;/span&gt; grep :3000
ps -o pid,ppid,cmd -p &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;PID&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;

&lt;span class="c"&gt;# macOS (fast list without DNS lookup)&lt;/span&gt;
lsof -nP -iTCP:3000 -sTCP:LISTEN
ps -o pid,ppid,command -p &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;PID&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;

&lt;span class="c"&gt;# Windows PowerShell (port 3000 + command line + parent PID)&lt;/span&gt;
&lt;span class="nv"&gt;$conn&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; Get-NetTCPConnection -LocalPort 3000 -State Listen -ErrorAction SilentlyContinue
&lt;span class="nv"&gt;$conn&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; ForEach-Object &lt;span class="o"&gt;{&lt;/span&gt;
  Get-CimInstance Win32_Process -Filter &lt;span class="s2"&gt;"ProcessId = $($_.OwningProcess)"&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;
    Select-Object ProcessId, ParentProcessId, Name, CommandLine
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="c"&gt;# Windows Hyper-V / WSL2 excluded port range check&lt;/span&gt;
netsh interface ipv4 show excludedportrange &lt;span class="nv"&gt;protocol&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;tcp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Masked Ports in Docker, WSL2 &amp;amp; Automated CI Pipelines
&lt;/h2&gt;

&lt;p&gt;When a container publishes a port to the host (&lt;code&gt;-p 3000:3000&lt;/code&gt;), host-level &lt;code&gt;lsof&lt;/code&gt; or &lt;code&gt;ss&lt;/code&gt; only attributes the socket to &lt;code&gt;docker-proxy&lt;/code&gt; or &lt;code&gt;com.docker.backend&lt;/code&gt;. Force-killing the proxy daemon can corrupt container networking; instead, identify the exact publishing container and stop it cleanly with &lt;code&gt;docker stop&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;On WSL2, a dev server started inside Ubuntu is automatically forwarded to Windows &lt;code&gt;localhost:3000&lt;/code&gt;. Checking Windows &lt;code&gt;netstat&lt;/code&gt; only shows &lt;code&gt;wslrelay.exe&lt;/code&gt;; you must inspect &lt;code&gt;ss -tulpn&lt;/code&gt; inside the WSL distro to find and stop the actual Linux process.&lt;/p&gt;

&lt;p&gt;In CI/CD pipelines running parallel integration suites, binding to port &lt;code&gt;0&lt;/code&gt; (&lt;code&gt;server.listen(0)&lt;/code&gt;) lets the kernel assign a guaranteed free ephemeral port. When a fixed port is unavoidable (such as OAuth callback tests), add a pre-flight assertion step before launching the server.&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;# Check which Docker container publishes port 3000 or 5432&lt;/span&gt;
docker ps --format &lt;span class="s2"&gt;"table {{.ID}}\t{{.Names}}\t{{.Ports}}"&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; grep -E &lt;span class="s2"&gt;"3000|5432"&lt;/span&gt;

&lt;span class="c"&gt;# Stop only the conflicting container cleanly&lt;/span&gt;
docker stop &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;CONTAINER_ID&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;

&lt;span class="c"&gt;# Graceful SIGTERM on Linux/macOS before force-killing&lt;/span&gt;
&lt;span class="nb"&gt;kill&lt;/span&gt; -15 &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;PID&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="c"&gt;# Clean shutdown in Windows PowerShell&lt;/span&gt;
Stop-Process -Id &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;PID&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  IPv4 vs IPv6 (127.0.0.1 vs ::1) Traps and Graceful Shutdown in Code
&lt;/h2&gt;

&lt;p&gt;In Node.js 18+ and modern browsers, &lt;code&gt;localhost&lt;/code&gt; often resolves to IPv6 &lt;code&gt;::1&lt;/code&gt; first. If one server binds &lt;code&gt;127.0.0.1:3000&lt;/code&gt; and another tries to bind wildcard &lt;code&gt;:::3000&lt;/code&gt;, you can hit confusing &lt;code&gt;EADDRINUSE&lt;/code&gt; errors or split traffic between two servers. Pinning &lt;code&gt;--host 127.0.0.1&lt;/code&gt; explicitly in dev configs removes dual-stack ambiguity.&lt;/p&gt;

&lt;p&gt;Finally, ensure dev servers and API workers handle &lt;code&gt;SIGINT&lt;/code&gt; and &lt;code&gt;SIGTERM&lt;/code&gt; by calling &lt;code&gt;server.close()&lt;/code&gt; cleanly. Without graceful shutdown, open HTTP keep-alive sockets linger briefly in kernel state and trigger &lt;code&gt;EADDRINUSE&lt;/code&gt; during fast restarts.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Graceful shutdown in Node.js (prevents lingering sockets)&lt;/span&gt;
&lt;span class="kd"&gt;const&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;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;listen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"127.0.0.1"&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="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;signal&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"SIGINT"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"SIGTERM"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nb"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;on&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;signal&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;server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;close&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;exit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Inspect &amp;amp; Clean the Full Process Tree in One Command with PortTree
&lt;/h2&gt;

&lt;p&gt;Instead of memorizing OS-specific &lt;code&gt;ss&lt;/code&gt;, &lt;code&gt;lsof&lt;/code&gt;, &lt;code&gt;netstat&lt;/code&gt;, and PowerShell CIM flags, my zero-dependency Python CLI PortTree maps listening sockets to their full parent process tree across Linux, macOS, and Windows under one interface.&lt;/p&gt;

&lt;p&gt;If you want to dive deeper into how kernel socket tables, supervisor inheritance, and Docker network namespaces work under the hood, read the companion PortTree architecture guide linked below.&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;# Inspect the full process tree and working directory holding port 3000&lt;/span&gt;
python -m porttree --port 3000

&lt;span class="c"&gt;# CI preflight check: exit 0 if free, exit 1 + JSON if occupied&lt;/span&gt;
python -m porttree --assert-free 3000 --json

&lt;span class="c"&gt;# Safe two-stage cleanup (SIGTERM -&amp;gt; timeout -&amp;gt; SIGKILL)&lt;/span&gt;
python -m porttree --kill 3000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Frequently Asked Questions
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Why does EADDRINUSE come back two seconds after I kill the PID?
&lt;/h3&gt;

&lt;p&gt;Because you terminated a child worker whose parent supervisor (nodemon, PM2, Docker, or an IDE watcher) immediately respawned it. Inspect the parent PID (&lt;code&gt;PPID&lt;/code&gt;) and stop the supervisor or container instead.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why does Windows block port 3000 even when netstat shows no listening process?
&lt;/h3&gt;

&lt;p&gt;Hyper-V and WSL2 reserve dynamic TCP port ranges at boot. Run &lt;code&gt;netsh interface ipv4 show excludedportrange protocol=tcp&lt;/code&gt; to verify whether your port falls inside an excluded block, then either pick an unreserved port or restart the &lt;code&gt;winnat&lt;/code&gt; service.&lt;/p&gt;

&lt;h3&gt;
  
  
  Is it safe to kill -9 docker-proxy when a container holds the port?
&lt;/h3&gt;

&lt;p&gt;No. Killing &lt;code&gt;docker-proxy&lt;/code&gt; directly can leave container networking in an inconsistent state. Locate the publishing container with &lt;code&gt;docker ps&lt;/code&gt; and stop it cleanly via &lt;code&gt;docker stop &amp;lt;id&amp;gt;&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  How do I permanently prevent EADDRINUSE in CI test suites?
&lt;/h3&gt;

&lt;p&gt;Bind test servers to port &lt;code&gt;0&lt;/code&gt; (&lt;code&gt;listen(0)&lt;/code&gt;) so the kernel assigns an unused ephemeral port, and always close the server in teardown. If a fixed port is required, add a pre-flight check such as &lt;code&gt;porttree --assert-free &amp;lt;port&amp;gt;&lt;/code&gt; before starting the server.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Try PortTree &amp;amp; read the companion architecture guide:&lt;/strong&gt; &lt;a href="https://umutgungorr.com/projects/porttree?lang=en" rel="noopener noreferrer"&gt;PortTree Project Page&lt;/a&gt; | &lt;a href="https://umutgungorr.com/blog/porttree-socket-process-tree?lang=en" rel="noopener noreferrer"&gt;PortTree Socket &amp;amp; Process Tree Guide&lt;/a&gt; | &lt;a href="https://umutgungorr.com/blog/eaddrinuse-port-conflict-fix?lang=en" rel="noopener noreferrer"&gt;Original Guide on umutgungorr.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>linux</category>
      <category>node</category>
      <category>debugging</category>
      <category>cli</category>
    </item>
    <item>
      <title>Catch Broken Markdown Links and #Anchors Offline Before They Hit Production with DeadLinkFinder</title>
      <dc:creator>Umut Güngör</dc:creator>
      <pubDate>Fri, 16 Oct 2026 10:57:38 +0000</pubDate>
      <link>https://dev.to/umutgungor/catch-broken-markdown-links-and-anchors-offline-before-they-hit-production-with-deadlinkfinder-2g42</link>
      <guid>https://dev.to/umutgungor/catch-broken-markdown-links-and-anchors-offline-before-they-hit-production-with-deadlinkfinder-2g42</guid>
      <description>&lt;p&gt;Documentation rots quietly. You rename a file, refactor a section heading in your &lt;code&gt;README.md&lt;/code&gt;, or move a diagram into a new folder—and suddenly your documentation is full of dead relative links and broken &lt;code&gt;#heading-anchors&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Code review rarely catches these because nobody manually clicks every link and table-of-contents anchor in every pull request.&lt;/p&gt;

&lt;p&gt;That is why I built &lt;strong&gt;&lt;a href="https://umutgungorr.com/projects/deadlinkfinder" rel="noopener noreferrer"&gt;DeadLinkFinder&lt;/a&gt;&lt;/strong&gt;—a fast, &lt;strong&gt;zero-dependency&lt;/strong&gt; Python CLI that verifies local Markdown links, image assets, GitHub-flavored heading anchors, and optional external URLs before they reach production.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why Existing Link Checkers Frustrated Me
&lt;/h2&gt;

&lt;p&gt;When I looked for a link linter for my repositories, I kept running into three problems:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Heavy runtime dependencies:&lt;/strong&gt; Installing a full Node.js or headless browser stack just to check if &lt;code&gt;../docs/architecture.md&lt;/code&gt; exists in a Python repo felt unnecessary.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;False positives on GitHub &lt;code&gt;#anchors&lt;/code&gt;:&lt;/strong&gt; GitHub's heading slug algorithm has specific rules around punctuation, Unicode characters, emojis, and duplicate headings (&lt;code&gt;#install&lt;/code&gt;, &lt;code&gt;#install-1&lt;/code&gt;). Naive regex checkers constantly fail on valid anchors.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Detection without diagnosis:&lt;/strong&gt; Telling me &lt;code&gt;"Target not found"&lt;/code&gt; is only half the job. If I made a typo in a 40-heading document, the tool should tell me what I probably meant.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Quick Start
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;DeadLinkFinder&lt;/code&gt; uses only the Python standard library (&lt;code&gt;re&lt;/code&gt;, &lt;code&gt;pathlib&lt;/code&gt;, &lt;code&gt;difflib&lt;/code&gt;, &lt;code&gt;urllib&lt;/code&gt;), meaning zero external dependencies to audit or maintain.&lt;/p&gt;

&lt;p&gt;Install it directly from &lt;a href="https://pypi.org/project/deadlinkfinder/" rel="noopener noreferrer"&gt;PyPI&lt;/a&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip install deadlinkfinder
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run it against any directory or Markdown file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;deadlinkfinder docs/ README.md
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example terminal output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ deadlinkfinder docs/

🔍 DeadLinkFinder - Verifying documentation integrity...

[!] DLF-001  ERROR    docs/getting-started.md:28
    Target not found: '../guides/setup.md'
    Suggestion: Did you mean '../guides/install-setup.md'?

[!] DLF-002  ERROR    README.md:64
    Anchor not found: '#configuration-option'
    Suggestion: Did you mean '#configuration-options'?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Key Features Built for CI/CD
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Offline-First with Fuzzy Suggestions (&lt;code&gt;difflib&lt;/code&gt;)
&lt;/h3&gt;

&lt;p&gt;By default, &lt;code&gt;DeadLinkFinder&lt;/code&gt; runs &lt;strong&gt;100% offline&lt;/strong&gt; in milliseconds. It checks local file paths, image references (&lt;code&gt;![alt](./assets/demo.png)&lt;/code&gt;), and cross-file anchors (&lt;code&gt;./guide.md#installation&lt;/code&gt;). Whenever a target or anchor is missing, it uses &lt;code&gt;difflib&lt;/code&gt; to suggest the closest existing file or heading slug.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. GitHub-Compatible Heading Anchor Engine
&lt;/h3&gt;

&lt;p&gt;Whether your headings contain Turkish characters, emojis, inline code backticks, or repeated section titles across a document, the anchor resolver mirrors GitHub's exact slug generation rules.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Native SARIF v2.1.0 &amp;amp; JSON Output
&lt;/h3&gt;

&lt;p&gt;Want inline annotations directly on your GitHub Pull Requests or GitHub Code Scanning dashboard? Generate a SARIF report with deterministic line fingerprints:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;deadlinkfinder . --format sarif --output results.sarif
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or use &lt;code&gt;--format json&lt;/code&gt; for custom CI pipelines and pre-commit hooks.&lt;/p&gt;




&lt;h2&gt;
  
  
  Part of a Zero-Dependency CLI Suite
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;DeadLinkFinder&lt;/code&gt; is part of my open-source suite of zero-dependency developer tools, alongside &lt;a href="https://umutgungorr.com/blog/cli-tools-that-earn-trust" rel="noopener noreferrer"&gt;EnvDoctor&lt;/a&gt; (for &lt;code&gt;.env&lt;/code&gt; contract auditing) and &lt;a href="https://umutgungorr.com/projects/tokenguard" rel="noopener noreferrer"&gt;TokenGuard&lt;/a&gt; (for pre-commit secret scanning).&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Case Study &amp;amp; Architecture Notes:&lt;/strong&gt; &lt;a href="https://umutgungorr.com/projects/deadlinkfinder" rel="noopener noreferrer"&gt;umutgungorr.com/projects/deadlinkfinder&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Source Code (GitHub):&lt;/strong&gt; &lt;a href="https://github.com/umutgungorr/deadlinkfinder" rel="noopener noreferrer"&gt;github.com/umutgungorr/deadlinkfinder&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;PyPI Package:&lt;/strong&gt; &lt;a href="https://pypi.org/project/deadlinkfinder/" rel="noopener noreferrer"&gt;pypi.org/project/deadlinkfinder&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;More Engineering Articles &amp;amp; Projects:&lt;/strong&gt; &lt;a href="https://umutgungorr.com/" rel="noopener noreferrer"&gt;Umut Güngör — umutgungorr.com&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you maintain open-source documentation or internal engineering wikis, give &lt;code&gt;deadlinkfinder&lt;/code&gt; a spin in your CI pipeline—feedback and issues are always welcome!&lt;/p&gt;

</description>
      <category>python</category>
      <category>cli</category>
      <category>opensource</category>
      <category>documentation</category>
    </item>
    <item>
      <title>Stop Breaking Production: How to Audit and Sync .env Files with EnvDoctor</title>
      <dc:creator>Umut Güngör</dc:creator>
      <pubDate>Thu, 15 Oct 2026 18:56:15 +0000</pubDate>
      <link>https://dev.to/umutgungor/stop-breaking-production-how-to-audit-and-sync-env-files-with-envdoctor-fmp</link>
      <guid>https://dev.to/umutgungor/stop-breaking-production-how-to-audit-and-sync-env-files-with-envdoctor-fmp</guid>
      <description>&lt;p&gt;Every developer has been there: your code passes all local tests, you deploy to staging or production, and the application immediately crashes with KeyError: DATABASE_URL or an undefined environment variable.&lt;/p&gt;

&lt;p&gt;As projects grow, maintaining .env files across different environments becomes painful:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;.env.example drifts out of sync with actual code requirements.&lt;/li&gt;
&lt;li&gt;New variables get added by teammates without documentation.&lt;/li&gt;
&lt;li&gt;Secret leaks happen when templates aren't audited properly.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To solve this deterministically with zero bloat, I built &lt;strong&gt;&lt;a href="https://github.com/umutgungorr/envdoctor" rel="noopener noreferrer"&gt;EnvDoctor&lt;/a&gt;&lt;/strong&gt; — a zero-dependency Python CLI tool designed to audit, synchronize, and validate environment configurations.&lt;/p&gt;




&lt;h3&gt;
  
  
  What Does EnvDoctor Do?
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;check&lt;/strong&gt;: Compares your active .env against .env.example and flags missing or extraneous keys before you deploy.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;sync&lt;/strong&gt;: Safely merges new keys into .env.example without touching secrets or sensitive values.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;audit&lt;/strong&gt;: Scans your codebase with regex patterns to find environment variable calls that aren't declared in your documentation templates.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Example audit run:&lt;br&gt;
$ envdoctor audit --strict&lt;br&gt;
[PASS] .env matches .env.example&lt;br&gt;
[WARN] Found undeclared variable in src/config.py: CACHE_TTL&lt;/p&gt;




&lt;h3&gt;
  
  
  Why Zero Dependencies?
&lt;/h3&gt;

&lt;p&gt;CLI diagnostic tools should not add 50MB of third-party packages to your environment just to inspect text files. EnvDoctor relies entirely on the Python Standard Library, making it fast, secure, and instant to run in GitHub Actions or Docker entrypoints.&lt;/p&gt;




&lt;h3&gt;
  
  
  Links &amp;amp; Resources
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GitHub Repository&lt;/strong&gt;: &lt;a href="https://github.com/umutgungorr/envdoctor" rel="noopener noreferrer"&gt;github.com/umutgungorr/envdoctor&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Author Portfolio &amp;amp; Systems&lt;/strong&gt;: &lt;a href="https://umutgungorr.com" rel="noopener noreferrer"&gt;Umut Güngör (umutgungorr.com)&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Deep Dive &amp;amp; Benchmarks&lt;/strong&gt;: &lt;a href="https://umutgungorr.com/blog/cli-tools-that-earn-trust" rel="noopener noreferrer"&gt;Read full case study on umutgungorr.com&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Feel free to star the repo, test it on your projects, and share your feedback!&lt;/p&gt;

</description>
      <category>python</category>
      <category>devops</category>
      <category>opensource</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
