<?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: Duck</title>
    <description>The latest articles on DEV Community by Duck (@kidkender).</description>
    <link>https://dev.to/kidkender</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%2F1180759%2F768e8e5a-e9ea-4611-b79c-337dd817c9d7.jpeg</url>
      <title>DEV Community: Duck</title>
      <link>https://dev.to/kidkender</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kidkender"/>
    <language>en</language>
    <item>
      <title>Stale responses in Redux Toolkit: the requestId guard you probably need</title>
      <dc:creator>Duck</dc:creator>
      <pubDate>Mon, 23 Nov 2026 08:12:14 +0000</pubDate>
      <link>https://dev.to/kidkender/stale-responses-in-redux-toolkit-the-requestid-guard-you-probably-need-3mam</link>
      <guid>https://dev.to/kidkender/stale-responses-in-redux-toolkit-the-requestid-guard-you-probably-need-3mam</guid>
      <description>&lt;p&gt;A todo list shows the right results for a moment, then flips back to the old ones. There's no error in the console, and every test passes.&lt;/p&gt;

&lt;p&gt;I ran into this while fixing an issue in an open source React + Redux Toolkit app. Two &lt;code&gt;fetchTodos&lt;/code&gt; requests were in flight at the same time, the older one answered last, and the reducer wrote its result over the newer one. Here is the bug, two variants of it that are easy to miss, the fix, and how to test it without fake timers.&lt;/p&gt;

&lt;h2&gt;
  
  
  The bug
&lt;/h2&gt;

&lt;p&gt;This is the slice most of us write for a list:&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="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;fetchTodos&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;createAsyncThunk&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="s1"&gt;'todos/fetchAll'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;filters&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;TodoFilters&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;todosApi&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getAll&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;filters&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// in the slice&lt;/span&gt;
&lt;span class="n"&gt;builder&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addCase&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fetchTodos&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;pending&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'loading'&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;addCase&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fetchTodos&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;fulfilled&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;action&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;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'idle'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;items&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;action&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;total&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;action&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;meta&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;total&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;addCase&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fetchTodos&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;rejected&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'error'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Nothing here links a response to the request the UI is waiting for. Whichever response &lt;strong&gt;resolves&lt;/strong&gt; last wins, not whichever request &lt;strong&gt;started&lt;/strong&gt; last.&lt;/p&gt;

&lt;p&gt;That happens more often than you'd think:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The user types in a search box: &lt;code&gt;a&lt;/code&gt;, then &lt;code&gt;ab&lt;/code&gt;. The &lt;code&gt;a&lt;/code&gt; query is slower (more results) and returns after &lt;code&gt;ab&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;They click through pages quickly.&lt;/li&gt;
&lt;li&gt;You refetch on window focus while a filter change is still loading.&lt;/li&gt;
&lt;li&gt;The first request hits a cold cache or a slow network; the second one doesn't.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The result is a list that doesn't match the filter on screen. It's hard to reproduce because it depends on timing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two variants people miss
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;A stale error.&lt;/strong&gt; The old request fails after the new one has already succeeded. The data on screen is correct, but &lt;code&gt;status&lt;/code&gt; is now &lt;code&gt;'error'&lt;/code&gt;, so the UI shows an error banner over good data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A response that arrives after logout.&lt;/strong&gt; A fetch starts, the user logs out, and the slice resets to its initial state:&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="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addCase&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;logout&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="n"&gt;initialState&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then the response arrives, &lt;code&gt;fulfilled&lt;/code&gt; runs, and the reset state is filled with the previous user's list. If the next person signs in on the same tab, they can see it. Of the three, this is the one I'd fix first.&lt;/p&gt;

&lt;h2&gt;
  
  
  The fix: &lt;code&gt;action.meta.requestId&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;createAsyncThunk&lt;/code&gt; gives every dispatch a unique &lt;code&gt;requestId&lt;/code&gt;. It's on &lt;code&gt;action.meta&lt;/code&gt; for &lt;code&gt;pending&lt;/code&gt;, &lt;code&gt;fulfilled&lt;/code&gt; and &lt;code&gt;rejected&lt;/code&gt;, so all three actions of one dispatch share it.&lt;/p&gt;

&lt;p&gt;Store the id when a request starts, and ignore any result whose id doesn't match:&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="n"&gt;builder&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addCase&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;logout&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="n"&gt;initialState&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addCase&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fetchTodos&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;pending&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;action&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;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_fetchTodosRequestId&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;action&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;meta&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;requestId&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'loading'&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;addCase&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fetchTodos&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;fulfilled&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;action&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="c1"&gt;// an older request answering late (or one started before logout)&lt;/span&gt;
    &lt;span class="c1"&gt;// must not overwrite the list&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;action&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;meta&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;requestId&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_fetchTodosRequestId&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;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'idle'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;items&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;action&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;total&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;action&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;meta&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;total&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;addCase&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fetchTodos&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;rejected&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;action&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;action&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;meta&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;requestId&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_fetchTodosRequestId&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;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'error'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;All three cases are handled:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Reverse order:&lt;/strong&gt; the second &lt;code&gt;pending&lt;/code&gt; overwrites the stored id, so the first response no longer matches.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Stale error:&lt;/strong&gt; same check in &lt;code&gt;rejected&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Logout:&lt;/strong&gt; &lt;code&gt;initialState&lt;/code&gt; has no stored id, so a response from before the reset can't match.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I named the field with a leading underscore and typed it as optional. It's bookkeeping, not UI state, and no component should read it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Testing it without timers
&lt;/h2&gt;

&lt;p&gt;You don't need fake timers or &lt;code&gt;setTimeout&lt;/code&gt; in the mock. Return a promise you resolve yourself, then resolve the requests in the order you want:&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="nf"&gt;it&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'keeps the latest request when two resolve in reverse order'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;async&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="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;resolveFirst&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;TodosResponse&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;void&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="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="kc"&gt;undefined&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;vi&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;mocked&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;todosApi&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;getAll&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;mockReturnValueOnce&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;resolve&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;resolveFirst&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;resolve&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="nf"&gt;mockResolvedValueOnce&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;todoB&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;meta&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;total&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="cm"&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;store&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;makeTodosStore&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;first&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dispatch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;fetchTodos&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;filters&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;'a'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dispatch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;fetchTodos&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;filters&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;'ab'&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;resolveFirst&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;todoA&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;todoB&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;meta&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;total&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="cm"&gt;/* ... */&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;first&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="nf"&gt;expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getState&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;todos&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;items&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toEqual&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;todoB&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;expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getState&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;todos&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toBe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'idle'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The other two tests follow the same pattern:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Stale error:&lt;/strong&gt; call &lt;code&gt;reject&lt;/code&gt; on the first promise after the second request succeeds, and check that &lt;code&gt;status&lt;/code&gt; is still &lt;code&gt;'idle'&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Logout:&lt;/strong&gt; dispatch &lt;code&gt;logout()&lt;/code&gt; between starting the fetch and resolving it, and check that &lt;code&gt;items&lt;/code&gt; is still empty.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To check the tests themselves, I put the reducer back to the version without the guard. All three new tests failed and the rest of the suite still passed. That's how I know they test the race and not something else.&lt;/p&gt;

&lt;h2&gt;
  
  
  Alternatives, and when to pick them
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Approach&lt;/th&gt;
&lt;th&gt;Stops the stale write&lt;/th&gt;
&lt;th&gt;Cancels the request&lt;/th&gt;
&lt;th&gt;Cost&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;requestId&lt;/code&gt; guard in the reducer&lt;/td&gt;
&lt;td&gt;yes&lt;/td&gt;
&lt;td&gt;no&lt;/td&gt;
&lt;td&gt;a few lines&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;promise.abort()&lt;/code&gt; on the previous dispatch&lt;/td&gt;
&lt;td&gt;yes: it ends right away as &lt;code&gt;rejected&lt;/code&gt; with &lt;code&gt;meta.aborted&lt;/code&gt;, and its &lt;code&gt;fulfilled&lt;/code&gt; never runs&lt;/td&gt;
&lt;td&gt;only if the thunk passes &lt;code&gt;thunkAPI.signal&lt;/code&gt; to &lt;code&gt;fetch&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;you have to keep the handle and remember to call it&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;condition&lt;/code&gt; option&lt;/td&gt;
&lt;td&gt;skips starting a new fetch&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;wrong here: the newer request has new filters&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;RTK Query&lt;/td&gt;
&lt;td&gt;yes&lt;/td&gt;
&lt;td&gt;yes&lt;/td&gt;
&lt;td&gt;moving the endpoint over&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;If you can move the endpoint to RTK Query, do that. It caches each argument separately, so a slow &lt;code&gt;a&lt;/code&gt; response can't replace the &lt;code&gt;ab&lt;/code&gt; results. Abort and the guard work well together. Abort saves the network call, and the guard still protects you anywhere someone forgot to abort.&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;The guard is in the reducer only. The stale &lt;code&gt;rejected&lt;/code&gt; action still reaches middleware, so a global "show an error toast on any rejected action" listener will still fire. If you have one, apply the same check there or skip rejected actions whose request is no longer current.&lt;/li&gt;
&lt;li&gt;I used one id per thunk type. If two parts of the screen use the same thunk for different lists at the same time, they will cancel each other's results. Then you need one id per list, keyed by something in &lt;code&gt;action.meta.arg&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The rule I keep now
&lt;/h2&gt;

&lt;p&gt;If a reducer writes the result of an async call, it should first check whether this is still the request the UI is waiting for. With &lt;code&gt;createAsyncThunk&lt;/code&gt; that check is a single line.&lt;/p&gt;

&lt;p&gt;How do you handle this in your apps: abort, a request id, or RTK Query everywhere?&lt;/p&gt;

</description>
      <category>redux</category>
      <category>react</category>
      <category>javascript</category>
      <category>testing</category>
    </item>
    <item>
      <title>4 concurrency bugs I found reviewing my own Go service</title>
      <dc:creator>Duck</dc:creator>
      <pubDate>Sat, 21 Nov 2026 10:26:00 +0000</pubDate>
      <link>https://dev.to/kidkender/4-concurrency-bugs-i-found-reviewing-my-own-go-service-44hc</link>
      <guid>https://dev.to/kidkender/4-concurrency-bugs-i-found-reviewing-my-own-go-service-44hc</guid>
      <description>&lt;p&gt;I've been practicing code review for Go, mostly on other people's code. At some point it felt a bit dishonest not to point the same checklist at my own. So I took &lt;a href="https://github.com/Kidkender/prohealth-api" rel="noopener noreferrer"&gt;prohealth-api&lt;/a&gt;, a hospital booking API I built in Go (Gin, PostgreSQL, Redis Streams), and read every goroutine in it with four questions in mind.&lt;/p&gt;

&lt;p&gt;It has two pieces of background work: an outbox worker that moves events from Postgres to a Redis Stream, and a notification consumer that reads that stream through a consumer group. Plus the HTTP server, of course. Small service, not much concurrency. I still found four things to fix. All of them are in &lt;a href="https://github.com/Kidkender/prohealth-api/commit/0b6b425" rel="noopener noreferrer"&gt;one commit&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The checklist
&lt;/h2&gt;

&lt;p&gt;For every &lt;code&gt;go&lt;/code&gt; statement:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Who stops it?&lt;/strong&gt; A context, a closed channel, the end of its input. If nothing stops it, it leaks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Who waits for it?&lt;/strong&gt; If &lt;code&gt;main&lt;/code&gt; returns, is anyone waiting, or is the work cut off halfway?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;What happens on error?&lt;/strong&gt; Returned, retried with a delay, or retried in a tight loop?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Are resources released?&lt;/strong&gt; Tickers, timers, response bodies, rows.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Each bug below was found by one of these questions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Bug 1: the HTTP server ignored shutdown
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Who stops it?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;main&lt;/code&gt; already used &lt;code&gt;signal.NotifyContext&lt;/code&gt;, so SIGTERM cancelled a context and the background worker stopped. The server didn't:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cancel&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;signal&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;NotifyContext&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Background&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;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Interrupt&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;syscall&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;SIGTERM&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;defer&lt;/span&gt; &lt;span class="nf"&gt;cancel&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;go&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;OutboxWorker&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;// ...&lt;/span&gt;
&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;":"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;port&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Gin's &lt;code&gt;r.Run&lt;/code&gt; blocks until the process dies and never looks at &lt;code&gt;ctx&lt;/code&gt;. So on a deploy, the worker shut down nicely while requests in flight were simply dropped when the process was killed.&lt;/p&gt;

&lt;p&gt;The fix is to own the &lt;code&gt;http.Server&lt;/code&gt; and call &lt;code&gt;Shutdown&lt;/code&gt; yourself:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="n"&gt;srv&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Server&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nc"&gt;Addr&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;":"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;port&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Handler&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;go&lt;/span&gt; &lt;span class="k"&gt;func&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;srv&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;ListenAndServe&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;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="kc"&gt;nil&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;errors&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Is&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;err&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;ErrServerClosed&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Fatal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="o"&gt;&amp;lt;-&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Done&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;cancel&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// a second Ctrl+C now kills the process&lt;/span&gt;
&lt;span class="n"&gt;shutdownCtx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cancelShutdown&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;WithTimeout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Background&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="mi"&gt;15&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Second&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;defer&lt;/span&gt; &lt;span class="nf"&gt;cancelShutdown&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;srv&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Shutdown&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;shutdownCtx&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="kc"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"server shutdown: %v"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;Shutdown&lt;/code&gt; stops accepting new connections and waits for active requests to finish, up to the timeout. Three details that are easy to get wrong:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;ListenAndServe&lt;/code&gt; returns &lt;code&gt;http.ErrServerClosed&lt;/code&gt; after &lt;code&gt;Shutdown&lt;/code&gt;. That's the normal path, not an error, so it must not hit &lt;code&gt;log.Fatal&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The timeout context is built from &lt;code&gt;context.Background()&lt;/code&gt;, not from &lt;code&gt;ctx&lt;/code&gt;. &lt;code&gt;ctx&lt;/code&gt; is already cancelled at this point; deriving from it would give &lt;code&gt;Shutdown&lt;/code&gt; zero time.&lt;/li&gt;
&lt;li&gt;Call &lt;code&gt;cancel()&lt;/code&gt; right after &lt;code&gt;&amp;lt;-ctx.Done()&lt;/code&gt;. Until then &lt;code&gt;NotifyContext&lt;/code&gt; keeps catching the signal, so a second Ctrl+C does nothing and a stuck &lt;code&gt;Shutdown&lt;/code&gt; means waiting out the full timeout. Calling it restores the default handling, so a second Ctrl+C kills the process.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Bug 2: nobody waited for the workers
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Who waits for it?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Even after bug 1, &lt;code&gt;main&lt;/code&gt; started the worker with a bare &lt;code&gt;go&lt;/code&gt; and returned as soon as the server was done. The consumer had the same shape inside its own &lt;code&gt;Run&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="nc"&gt;NotificationConsumer&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nc"&gt;Run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Context&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;go&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;recoverPendingMessages&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;consumeNewMessages&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When &lt;code&gt;Run&lt;/code&gt; returns, the reclaim loop may still be in the middle of handling a message. When &lt;code&gt;main&lt;/code&gt; returns, everything dies wherever it is. For an outbox worker that means a job can be pushed to Redis but never marked as published.&lt;/p&gt;

&lt;p&gt;A &lt;code&gt;sync.WaitGroup&lt;/code&gt; is enough here:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="nc"&gt;NotificationConsumer&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nc"&gt;Run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Context&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="n"&gt;wg&lt;/span&gt; &lt;span class="n"&gt;sync&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;WaitGroup&lt;/span&gt;
    &lt;span class="n"&gt;wg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;go&lt;/span&gt; &lt;span class="k"&gt;func&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;defer&lt;/span&gt; &lt;span class="n"&gt;wg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Done&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;recoverPendingMessages&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&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;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;consumeNewMessages&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;wg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Wait&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And in &lt;code&gt;main&lt;/code&gt;, the worker gets the same treatment, with &lt;code&gt;workers.Wait()&lt;/code&gt; after &lt;code&gt;srv.Shutdown&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;wg.Add(1)&lt;/code&gt; goes before &lt;code&gt;go&lt;/code&gt;, never inside the goroutine. If it's inside, &lt;code&gt;Wait&lt;/code&gt; can run before &lt;code&gt;Add&lt;/code&gt; and return immediately. I used a WaitGroup rather than &lt;code&gt;errgroup&lt;/code&gt; because neither loop returns an error; they log and keep going. If they did return errors, &lt;code&gt;errgroup.WithContext&lt;/code&gt; would be the better fit, since the first error would cancel the others.&lt;/p&gt;

&lt;h2&gt;
  
  
  Bug 3: a hot loop when Redis was down
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;What happens on error?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The consumer reads with &lt;code&gt;XReadGroup&lt;/code&gt; and a 5 second block. &lt;code&gt;redis.Nil&lt;/code&gt; just means nothing arrived, so that case loops. Every other error was logged at Info level and the loop tried again at once.&lt;/p&gt;

&lt;p&gt;If Redis is down, the call fails instantly, so this becomes a busy loop: full CPU, and a log line per iteration. Exactly when you most want readable logs.&lt;/p&gt;

&lt;p&gt;After the fix it backs off, and the wait still respects shutdown:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;minReadBackoff&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;500&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Millisecond&lt;/span&gt;
    &lt;span class="n"&gt;maxReadBackoff&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Second&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;// inside the loop&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="kc"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;errors&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Is&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;err&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;redis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Nil&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;continue&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Err&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="kc"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;continue&lt;/span&gt; &lt;span class="c1"&gt;// shutting down: the select at the top of the loop returns&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;slog&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"xreadgroup error"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"err"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"retry_in"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;backoff&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;select&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;-&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Done&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;case&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;-&lt;/span&gt;&lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;After&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;backoff&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;backoff&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;backoff&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;maxReadBackoff&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;continue&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="n"&gt;backoff&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;minReadBackoff&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A few things that matter here:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;select&lt;/code&gt; on &lt;code&gt;ctx.Done()&lt;/code&gt;. With a plain &lt;code&gt;time.Sleep&lt;/code&gt;, a shutdown during a 30 second backoff would hang for up to 30 seconds.&lt;/li&gt;
&lt;li&gt;Reset the backoff after a successful read, or one bad minute makes every later error wait 30 seconds.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;errors.Is&lt;/code&gt; instead of &lt;code&gt;==&lt;/code&gt;, so a wrapped &lt;code&gt;redis.Nil&lt;/code&gt; still matches.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;time.After&lt;/code&gt; allocates a new timer on every call. In a hot path I'd reuse a &lt;code&gt;time.Timer&lt;/code&gt;. Here it only runs on errors, so it's fine.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Bug 4: a ticker that was never stopped
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Are resources released?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The outbox worker polls every five seconds:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="n"&gt;ticker&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;NewTicker&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Second&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="k"&gt;select&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;-&lt;/span&gt;&lt;span class="n"&gt;ticker&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;C&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;process&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;-&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Done&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There was no &lt;code&gt;ticker.Stop()&lt;/code&gt;. The fix is one line: &lt;code&gt;defer ticker.Stop()&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;I should be honest about how much this one matters. Before Go 1.23, a ticker that was never stopped stayed alive forever, which was a real leak. Since Go 1.23 the runtime can garbage-collect a ticker that nothing references anymore, even if &lt;code&gt;Stop&lt;/code&gt; was never called. This project is on Go 1.25, so in practice it wasn't leaking.&lt;/p&gt;

&lt;p&gt;I still added the &lt;code&gt;defer&lt;/code&gt;. It states the intent, it's correct on older Go versions, and code like this tends to get copied into places where it's called many times. But I wouldn't call it a bug in a code review today without that caveat.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I'd look at next
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Running the tests with &lt;code&gt;-race&lt;/code&gt; in CI. None of these bugs were data races, but the four questions don't find races; the race detector does.&lt;/li&gt;
&lt;li&gt;The Redis lock used for booking has a TTL. If the work under the lock takes longer than the TTL, another instance can take it. Lease renewal or fencing tokens are the usual answers, and that's a post of its own.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Takeaway
&lt;/h2&gt;

&lt;p&gt;None of this needed a profiler or a load test. Asking "who stops it, who waits for it, what happens on error, what gets released" for each goroutine found all four. The service is small, which is the point: these bugs show up in small services too, and they're cheap to fix before the first bad deploy or Redis outage.&lt;/p&gt;

&lt;p&gt;The fixes are in &lt;a href="https://github.com/Kidkender/prohealth-api/commit/0b6b425" rel="noopener noreferrer"&gt;this commit&lt;/a&gt;, and the code is on &lt;a href="https://github.com/Kidkender/prohealth-api" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>go</category>
      <category>concurrency</category>
      <category>backend</category>
      <category>redis</category>
    </item>
    <item>
      <title>After Setting Up JWT, Redis, Docker, Swagger, and CI for the 20th Time, I Built ArchGen</title>
      <dc:creator>Duck</dc:creator>
      <pubDate>Wed, 03 Jun 2026 10:58:22 +0000</pubDate>
      <link>https://dev.to/kidkender/after-setting-up-jwt-redis-docker-swagger-and-ci-for-the-20th-time-i-built-archgen-3jkp</link>
      <guid>https://dev.to/kidkender/after-setting-up-jwt-redis-docker-swagger-and-ci-for-the-20th-time-i-built-archgen-3jkp</guid>
      <description>&lt;h2&gt;
  
  
  I Built ArchGen: A Backend Project Generator Powered by GitHub Copilot
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;This is a submission for the GitHub Copilot Challenge.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;As a backend developer, I kept running into the same problem.&lt;/p&gt;

&lt;p&gt;Every new project started with hours of repetitive setup:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Configure TypeScript&lt;/li&gt;
&lt;li&gt;Set up Fastify or FastAPI&lt;/li&gt;
&lt;li&gt;Configure database connections&lt;/li&gt;
&lt;li&gt;Add authentication&lt;/li&gt;
&lt;li&gt;Configure logging&lt;/li&gt;
&lt;li&gt;Add Docker support&lt;/li&gt;
&lt;li&gt;Create CI pipelines&lt;/li&gt;
&lt;li&gt;Set up validation and error handling&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;None of these tasks were difficult.&lt;/p&gt;

&lt;p&gt;They were just repetitive.&lt;/p&gt;

&lt;p&gt;After creating multiple backend services, I realized I was spending more time configuring projects than actually building features.&lt;/p&gt;

&lt;p&gt;So I built &lt;strong&gt;ArchGen&lt;/strong&gt;, a CLI tool that generates production-ready backend projects in seconds.&lt;/p&gt;

&lt;p&gt;Instead of spending hours wiring infrastructure together, developers can run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;archgen create my-app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Answer a few prompts and get a complete backend project ready to run.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why I Built It
&lt;/h2&gt;

&lt;p&gt;I wanted a developer experience similar to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;create-next-app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;but for backend applications.&lt;/p&gt;

&lt;p&gt;Most backend generators either:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;create very minimal projects&lt;/li&gt;
&lt;li&gt;generate outdated code&lt;/li&gt;
&lt;li&gt;focus on only one framework&lt;/li&gt;
&lt;li&gt;don't support upgrading generated projects&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I wanted something opinionated, modern, and practical.&lt;/p&gt;

&lt;p&gt;The generated projects include real-world essentials such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Authentication&lt;/li&gt;
&lt;li&gt;Validation&lt;/li&gt;
&lt;li&gt;Logging&lt;/li&gt;
&lt;li&gt;Error handling&lt;/li&gt;
&lt;li&gt;Redis integration&lt;/li&gt;
&lt;li&gt;Docker support&lt;/li&gt;
&lt;li&gt;CI workflows&lt;/li&gt;
&lt;li&gt;API documentation&lt;/li&gt;
&lt;li&gt;Email services&lt;/li&gt;
&lt;li&gt;S3-compatible storage&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These are things I add to almost every backend project.&lt;/p&gt;




&lt;h2&gt;
  
  
  How GitHub Copilot Helped
&lt;/h2&gt;

&lt;p&gt;GitHub Copilot was heavily involved throughout development.&lt;/p&gt;

&lt;h3&gt;
  
  
  Generating Boilerplate Faster
&lt;/h3&gt;

&lt;p&gt;ArchGen itself generates boilerplate, but building the generator required writing a lot of repetitive code.&lt;/p&gt;

&lt;p&gt;Copilot helped accelerate:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;CLI command implementations&lt;/li&gt;
&lt;li&gt;Interactive prompt flows&lt;/li&gt;
&lt;li&gt;Template generation logic&lt;/li&gt;
&lt;li&gt;File system operations&lt;/li&gt;
&lt;li&gt;Validation helpers&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Refactoring Large Template Systems
&lt;/h3&gt;

&lt;p&gt;As the project grew, I had to reorganize templates into reusable modules.&lt;/p&gt;

&lt;p&gt;Copilot was useful for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Refactoring duplicated logic&lt;/li&gt;
&lt;li&gt;Extracting reusable utilities&lt;/li&gt;
&lt;li&gt;Updating imports across files&lt;/li&gt;
&lt;li&gt;Generating repetitive template mappings&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Building Addon Support
&lt;/h3&gt;

&lt;p&gt;One of ArchGen's core features is addon injection:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;archgen add docker
archgen add websocket
archgen add oauth
archgen add email
archgen add s3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Copilot helped scaffold many of the repetitive integration points required to support multiple addons consistently.&lt;/p&gt;




&lt;h2&gt;
  
  
  Features
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Generate a Full Backend Project
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;archgen create my-app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Generates a production-ready backend structure.&lt;/p&gt;

&lt;h3&gt;
  
  
  Multiple Language Support
&lt;/h3&gt;

&lt;p&gt;Node.js stack:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;TypeScript&lt;/li&gt;
&lt;li&gt;Fastify&lt;/li&gt;
&lt;li&gt;Prisma&lt;/li&gt;
&lt;li&gt;Redis&lt;/li&gt;
&lt;li&gt;JWT&lt;/li&gt;
&lt;li&gt;Zod&lt;/li&gt;
&lt;li&gt;Pino&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Python stack:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;FastAPI&lt;/li&gt;
&lt;li&gt;SQLAlchemy 2.0&lt;/li&gt;
&lt;li&gt;PostgreSQL&lt;/li&gt;
&lt;li&gt;Redis&lt;/li&gt;
&lt;li&gt;APScheduler&lt;/li&gt;
&lt;li&gt;Pydantic v2&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Add Features Later
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;archgen add websocket
archgen add oauth
archgen add api-docs
archgen add email
archgen add s3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No need to regenerate the entire project.&lt;/p&gt;

&lt;h3&gt;
  
  
  Upgrade Existing Projects
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;archgen upgrade
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;ArchGen tracks project metadata and can re-apply updated templates later.&lt;/p&gt;




&lt;h2&gt;
  
  
  Example
&lt;/h2&gt;

&lt;p&gt;Creating a complete backend project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;archgen create ecommerce-api &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--language&lt;/span&gt; node &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--docker&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--testing&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--ci&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--oauth&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--api-docs&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This generates:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fastify application&lt;/li&gt;
&lt;li&gt;Prisma setup&lt;/li&gt;
&lt;li&gt;Docker configuration&lt;/li&gt;
&lt;li&gt;GitHub Actions workflow&lt;/li&gt;
&lt;li&gt;OAuth integration&lt;/li&gt;
&lt;li&gt;API documentation&lt;/li&gt;
&lt;li&gt;Testing configuration&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;in under a second.&lt;/p&gt;




&lt;h2&gt;
  
  
  Demo &amp;amp; Screenshots
&lt;/h2&gt;

&lt;p&gt;Here's a quick look at the ArchGen workflow, from project creation to the final generated codebase.&lt;/p&gt;

&lt;h3&gt;
  
  
  Interactive CLI Experience
&lt;/h3&gt;

&lt;p&gt;ArchGen guides developers through project creation using interactive prompts. Instead of memorizing dozens of flags, you can simply answer a few questions and generate a fully configured backend project.&lt;/p&gt;

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




&lt;h3&gt;
  
  
  Supported Languages and Addons
&lt;/h3&gt;

&lt;p&gt;The CLI allows developers to choose between Node.js and Python stacks, along with optional addons such as Docker, Testing, CI/CD, WebSocket support, OAuth, Email, S3 storage, and AI agent integrations.&lt;/p&gt;

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




&lt;h3&gt;
  
  
  Detailed Stack Information
&lt;/h3&gt;

&lt;p&gt;Before generating a project, developers can inspect the complete technology stack. This helps teams understand exactly what will be included in the generated application.&lt;/p&gt;

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




&lt;h3&gt;
  
  
  Project Generation in Action
&lt;/h3&gt;

&lt;p&gt;Creating a production-ready backend takes only a few seconds. ArchGen automatically configures the selected stack, dependencies, and project structure.&lt;/p&gt;

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




&lt;h3&gt;
  
  
  Generated Production-Ready Structure
&lt;/h3&gt;

&lt;p&gt;The generated project includes a clean and opinionated architecture with modules, middleware, configuration, shared utilities, database integration, and other production essentials already wired together.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzwq5un0pp3ltx31ej3s4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzwq5un0pp3ltx31ej3s4.png" alt="Code space after genenerate by archgen" width="800" height="412"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Learned
&lt;/h2&gt;

&lt;p&gt;Building ArchGen taught me that developer productivity isn't only about writing application code.&lt;/p&gt;

&lt;p&gt;A huge amount of engineering time is spent creating the same infrastructure repeatedly.&lt;/p&gt;

&lt;p&gt;By automating that setup process, developers can spend more time solving actual business problems.&lt;/p&gt;

&lt;p&gt;GitHub Copilot helped me move much faster, especially when implementing repetitive scaffolding logic and maintaining consistency across templates.&lt;/p&gt;




&lt;h2&gt;
  
  
  Links
&lt;/h2&gt;

&lt;p&gt;GitHub Repository:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/Kidkender/archgen" rel="noopener noreferrer"&gt;https://github.com/Kidkender/archgen&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;NPM Package:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.npmjs.com/package/@kidkender/archgen" rel="noopener noreferrer"&gt;https://www.npmjs.com/package/@kidkender/archgen&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thanks for reading!&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>githubchallenge</category>
      <category>tooling</category>
      <category>webdev</category>
    </item>
    <item>
      <title>I Finally Finished the Architecture Tool I Abandoned 2 Months Ago</title>
      <dc:creator>Duck</dc:creator>
      <pubDate>Tue, 02 Jun 2026 04:49:42 +0000</pubDate>
      <link>https://dev.to/kidkender/i-finally-finished-the-architecture-tool-i-abandoned-2-months-ago-2hck</link>
      <guid>https://dev.to/kidkender/i-finally-finished-the-architecture-tool-i-abandoned-2-months-ago-2hck</guid>
      <description>&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;Two months ago, I started building an experimental tool called &lt;strong&gt;ArchMind&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The idea was simple:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;What if software architecture could be tested the same way we test behavior?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In large Laravel applications, a single request often spans multiple layers:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Route
 → Middleware
 → Authentication
 → Controller
 → Service
 → Transaction
 → Event
 → Listener
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Tests verify behavior.&lt;/p&gt;

&lt;p&gt;Static analysis verifies code quality.&lt;/p&gt;

&lt;p&gt;But architectural changes often slip through unnoticed.&lt;/p&gt;

&lt;p&gt;A missing &lt;code&gt;DB::transaction()&lt;/code&gt;, a removed middleware, or a missing authorization layer can pass tests and code review while still creating production issues.&lt;/p&gt;

&lt;p&gt;ArchMind parses Laravel applications into execution graphs and helps developers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Visualize execution flows&lt;/li&gt;
&lt;li&gt;Detect architecture findings&lt;/li&gt;
&lt;li&gt;Track architectural drift&lt;/li&gt;
&lt;li&gt;Prevent topology regressions in CI&lt;/li&gt;
&lt;li&gt;Provide execution-aware context for AI assistants&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The project is open source and available on npm:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-g&lt;/span&gt; @kidkender/archmind
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;GitHub:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/Kidkender/archMind" rel="noopener noreferrer"&gt;https://github.com/Kidkender/archMind&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;npm:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.npmjs.com/package/@kidkender/archmind" rel="noopener noreferrer"&gt;https://www.npmjs.com/package/@kidkender/archmind&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Trace a Route
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;archmind trace &lt;span class="nt"&gt;--project&lt;/span&gt; &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="s2"&gt;"POST /orders"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;POST /orders
└─ auth:sanctum
   └─ ResolveTenant
      └─ OrderController::store
         └─ OrderService::createOrder
            └─ DB::transaction
               ├─ Order::create
               └─ OrderCreated
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

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

&lt;h3&gt;
  
  
  Detect Architecture Regressions
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;archmind verify &lt;span class="nt"&gt;--project&lt;/span&gt; &lt;span class="nb"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;✘ TOPOLOGY REGRESSION

Route:
  POST /orders

Lost:
  transaction_boundary
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This catches situations where important architectural guarantees disappear during refactoring.&lt;/p&gt;

&lt;h3&gt;
  
  
  CI Integration
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;npm install -g @kidkender/archmind&lt;/span&gt;
&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;archmind verify --project .&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If a transaction boundary, authentication layer, or tenant isolation mechanism disappears, CI fails immediately.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;📸 Insert screenshot: &lt;code&gt;archmind trace&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;📸 Insert screenshot: &lt;code&gt;archmind verify&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  The Comeback Story
&lt;/h2&gt;

&lt;p&gt;When I originally started ArchMind, it was little more than an experiment.&lt;/p&gt;

&lt;p&gt;It could parse Laravel routes and generate a basic execution graph.&lt;/p&gt;

&lt;p&gt;That was interesting, but not useful enough for real projects.&lt;/p&gt;

&lt;p&gt;At that point the project was missing almost everything required to be practical.&lt;/p&gt;

&lt;h3&gt;
  
  
  Before
&lt;/h3&gt;

&lt;p&gt;❌ No topology regression detection&lt;/p&gt;

&lt;p&gt;❌ No architecture findings&lt;/p&gt;

&lt;p&gt;❌ No CI integration&lt;/p&gt;

&lt;p&gt;❌ No retrieval benchmarks&lt;/p&gt;

&lt;p&gt;❌ No npm package&lt;/p&gt;

&lt;p&gt;❌ No real-world validation&lt;/p&gt;

&lt;p&gt;The project sat unfinished while I worked on other things.&lt;/p&gt;

&lt;p&gt;A few months later I revisited the idea after encountering a production issue caused by an architectural change that passed both tests and code review.&lt;/p&gt;

&lt;p&gt;That experience convinced me there was still something worth pursuing.&lt;/p&gt;

&lt;h3&gt;
  
  
  What I Added
&lt;/h3&gt;

&lt;p&gt;Over the following months I completed:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Execution graph engine&lt;/li&gt;
&lt;li&gt;Architecture findings system&lt;/li&gt;
&lt;li&gt;Topology regression detection&lt;/li&gt;
&lt;li&gt;CI workflows&lt;/li&gt;
&lt;li&gt;Retrieval engine improvements&lt;/li&gt;
&lt;li&gt;Benchmark suite&lt;/li&gt;
&lt;li&gt;npm publishing&lt;/li&gt;
&lt;li&gt;Documentation&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Results
&lt;/h3&gt;

&lt;p&gt;Retrieval recall improved from:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;0.71 → 1.00
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Architecture QA benchmark:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Method&lt;/th&gt;
&lt;th&gt;Score&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;ArchMind&lt;/td&gt;
&lt;td&gt;76.7%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;File-based retrieval&lt;/td&gt;
&lt;td&gt;61.7%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Token usage reduction:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Up to 15.6× smaller context
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Most importantly, the project evolved from a prototype into something developers can actually install and use.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;📸 Insert screenshot: benchmark table&lt;/p&gt;

&lt;p&gt;📸 Insert screenshot: npm package page&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  My Experience with GitHub Copilot
&lt;/h2&gt;

&lt;p&gt;GitHub Copilot played a significant role in helping me finish the project.&lt;/p&gt;

&lt;p&gt;One of the hardest parts of reviving an older codebase is rebuilding momentum.&lt;/p&gt;

&lt;p&gt;After several months away from ArchMind, there were many areas where I needed to quickly re-familiarize myself with the implementation.&lt;/p&gt;

&lt;p&gt;Copilot helped by:&lt;/p&gt;

&lt;h3&gt;
  
  
  Accelerating Refactors
&lt;/h3&gt;

&lt;p&gt;Large portions of the execution graph engine required repeated traversal and visitor patterns.&lt;/p&gt;

&lt;p&gt;Copilot generated boilerplate structures that I could adapt rather than writing everything from scratch.&lt;/p&gt;

&lt;h3&gt;
  
  
  Expanding Test Coverage
&lt;/h3&gt;

&lt;p&gt;Copilot helped generate test scaffolding and edge-case scenarios that I later refined and validated manually.&lt;/p&gt;

&lt;p&gt;This made it easier to improve confidence while evolving the architecture.&lt;/p&gt;

&lt;h3&gt;
  
  
  Documentation and Examples
&lt;/h3&gt;

&lt;p&gt;Many CLI examples, usage snippets, and documentation sections were drafted with Copilot assistance and then edited for accuracy.&lt;/p&gt;

&lt;h3&gt;
  
  
  Reducing Context Switching
&lt;/h3&gt;

&lt;p&gt;Most importantly, Copilot reduced the friction of returning to an unfinished project.&lt;/p&gt;

&lt;p&gt;Instead of spending hours reconstructing implementation details, I could iterate faster and focus on the architectural ideas behind the tool.&lt;/p&gt;




&lt;h2&gt;
  
  
  What I Learned
&lt;/h2&gt;

&lt;p&gt;The biggest lesson from finishing ArchMind is that architecture itself can be treated as data.&lt;/p&gt;

&lt;p&gt;Once architecture becomes a graph, it becomes possible to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Version it&lt;/li&gt;
&lt;li&gt;Query it&lt;/li&gt;
&lt;li&gt;Compare it&lt;/li&gt;
&lt;li&gt;Verify it&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That realization transformed ArchMind from an abandoned side project into a tool that developers can use to protect architectural intent in production systems.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Tests verify behavior.&lt;/p&gt;

&lt;p&gt;ArchMind verifies architecture.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Links
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;GitHub&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/Kidkender/archMind" rel="noopener noreferrer"&gt;https://github.com/Kidkender/archMind&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;npm&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.npmjs.com/package/@kidkender/archmind" rel="noopener noreferrer"&gt;https://www.npmjs.com/package/@kidkender/archmind&lt;/a&gt;&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>githubchallenge</category>
    </item>
    <item>
      <title>Tests Verify Behavior. ArchMind Verifies Architecture.</title>
      <dc:creator>Duck</dc:creator>
      <pubDate>Tue, 02 Jun 2026 03:06:09 +0000</pubDate>
      <link>https://dev.to/kidkender/tests-verify-behavior-archmind-verifies-architecture-lpi</link>
      <guid>https://dev.to/kidkender/tests-verify-behavior-archmind-verifies-architecture-lpi</guid>
      <description>&lt;p&gt;The PR was 14 lines.&lt;/p&gt;

&lt;p&gt;The incident cost two days.&lt;/p&gt;

&lt;p&gt;Tests passed. Code review approved. Production corrupted customer orders anyway.&lt;/p&gt;

&lt;p&gt;Someone refactored &lt;code&gt;OrderService&lt;/code&gt;. One method call moved outside &lt;code&gt;DB::transaction()&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The email notification failed mid-request.&lt;/p&gt;

&lt;p&gt;Half the order was written. Half wasn't.&lt;/p&gt;

&lt;p&gt;The diff looked harmless.&lt;/p&gt;

&lt;p&gt;The types were correct.&lt;/p&gt;

&lt;p&gt;The logic seemed unchanged.&lt;/p&gt;

&lt;p&gt;The architecture was not.&lt;/p&gt;




&lt;h2&gt;
  
  
  The problem I kept running into
&lt;/h2&gt;

&lt;p&gt;Modern Laravel applications rarely execute inside a single file.&lt;/p&gt;

&lt;p&gt;A request often flows through:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Route
 → Middleware
 → FormRequest
 → Policy
 → Controller
 → Service
 → Transaction
 → Event
 → Listener
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The bigger the application becomes, the harder it is to understand this flow.&lt;/p&gt;

&lt;p&gt;Most tooling doesn't help much.&lt;/p&gt;

&lt;p&gt;PHPStan verifies types.&lt;/p&gt;

&lt;p&gt;Tests verify behavior.&lt;/p&gt;

&lt;p&gt;Code review focuses on diffs.&lt;/p&gt;

&lt;p&gt;But none of them answer a simple question:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Did the execution architecture of this route change?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

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

Before:
  auth
  tenant middleware
  DB::transaction
  Order::create
  OrderCreated event

After:
  auth
  tenant middleware
  Order::create
  OrderCreated event
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The transaction disappeared.&lt;/p&gt;

&lt;p&gt;The code still compiles.&lt;/p&gt;

&lt;p&gt;The tests may still pass.&lt;/p&gt;

&lt;p&gt;But the architecture has changed.&lt;/p&gt;




&lt;h2&gt;
  
  
  I wanted architecture to become testable
&lt;/h2&gt;

&lt;p&gt;Frontend teams have snapshot testing.&lt;/p&gt;

&lt;p&gt;If a UI unexpectedly changes, CI catches it.&lt;/p&gt;

&lt;p&gt;I started wondering:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;What if we could do the same thing for execution architecture?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That idea became ArchMind.&lt;/p&gt;

&lt;p&gt;Instead of treating a Laravel project as a collection of files, ArchMind builds an execution graph.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Route
 → Middleware
 → Controller
 → Service
 → Transaction
 → Event
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The graph becomes a baseline.&lt;/p&gt;

&lt;p&gt;Future commits are compared against it.&lt;/p&gt;

&lt;p&gt;If an important architectural component disappears, ArchMind reports a topology regression.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;✘ TOPOLOGY REGRESSION: POST /orders

lost:
  transaction_boundary
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;CI fails before the change reaches production.&lt;/p&gt;




&lt;h2&gt;
  
  
  What ArchMind actually does
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Trace execution flow
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;archmind trace &lt;span class="nt"&gt;--project&lt;/span&gt; &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="s2"&gt;"POST /orders"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;POST /orders
└─ auth:sanctum
   └─ ResolveTenant
      └─ OrderController::store
         └─ OrderService::createOrder
            └─ DB::transaction
               ├─ Order::create
               └─ OrderCreated
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This provides a route-level view of the execution path.&lt;/p&gt;

&lt;p&gt;No digging through controllers, services, events, and listeners manually.&lt;/p&gt;




&lt;h3&gt;
  
  
  2. Detect topology regressions
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;archmind verify &lt;span class="nt"&gt;--project&lt;/span&gt; &lt;span class="nb"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;✘ TOPOLOGY REGRESSION

Route:
  POST /orders

Lost:
  transaction_boundary
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The goal is not to verify business logic.&lt;/p&gt;

&lt;p&gt;The goal is to verify architecture.&lt;/p&gt;




&lt;h3&gt;
  
  
  3. Surface architecture findings
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;archmind findings &lt;span class="nt"&gt;--project&lt;/span&gt; &lt;span class="nb"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Examples:&lt;br&gt;
&lt;/p&gt;

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

Route is authenticated
but no authorization layer was detected.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or:&lt;br&gt;
&lt;/p&gt;

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

Event dispatched from inside
a transaction boundary.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These findings are intentionally conservative.&lt;/p&gt;

&lt;p&gt;The idea is to surface architectural risks for review rather than claim guaranteed vulnerabilities.&lt;/p&gt;




&lt;h2&gt;
  
  
  An unexpected side effect: better AI context
&lt;/h2&gt;

&lt;p&gt;Originally, ArchMind was not built as an AI tool.&lt;/p&gt;

&lt;p&gt;It started as a static analysis and architecture verification tool.&lt;/p&gt;

&lt;p&gt;But once an execution graph existed, it became useful for retrieval as well.&lt;/p&gt;

&lt;p&gt;Most AI coding tools work roughly like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Question
 ↓
Find similar files
 ↓
Send files to LLM
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;ArchMind instead retrieves execution context:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Question:
Why does this payment endpoint sometimes double-charge customers?

Relevant context:
- transaction boundary
- payment event dispatch
- after-commit listener
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In benchmark tests on real Laravel applications:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Metric&lt;/th&gt;
&lt;th&gt;ArchMind&lt;/th&gt;
&lt;th&gt;File Dump&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Correct answers&lt;/td&gt;
&lt;td&gt;3/3&lt;/td&gt;
&lt;td&gt;1/3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Average score&lt;/td&gt;
&lt;td&gt;76.7%&lt;/td&gt;
&lt;td&gt;61.7%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Tokens per query&lt;/td&gt;
&lt;td&gt;~700&lt;/td&gt;
&lt;td&gt;~9000&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The interesting result wasn't just higher accuracy.&lt;/p&gt;

&lt;p&gt;It was that the execution graph compressed architecture knowledge into a much smaller context window.&lt;/p&gt;




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

&lt;p&gt;At a high level:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PHP Source
    ↓
Tree-sitter parsing
    ↓
Laravel-aware analysis
    ↓
Execution Graph
    ↓
Topology Verification
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No PHP runtime required.&lt;/p&gt;

&lt;p&gt;Current support includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Laravel 10&lt;/li&gt;
&lt;li&gt;Laravel 11&lt;/li&gt;
&lt;li&gt;Laravel 12&lt;/li&gt;
&lt;li&gt;Middleware chains&lt;/li&gt;
&lt;li&gt;FormRequests&lt;/li&gt;
&lt;li&gt;Policies&lt;/li&gt;
&lt;li&gt;Transactions&lt;/li&gt;
&lt;li&gt;Events&lt;/li&gt;
&lt;li&gt;Route groups&lt;/li&gt;
&lt;li&gt;apiResource routes&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  What ArchMind does not do
&lt;/h2&gt;

&lt;p&gt;It's important to be clear about limitations.&lt;/p&gt;

&lt;p&gt;ArchMind will not catch:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Incorrect business logic&lt;/li&gt;
&lt;li&gt;Off-by-one errors&lt;/li&gt;
&lt;li&gt;Wrong comparison operators&lt;/li&gt;
&lt;li&gt;Runtime bugs caused by external services&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It focuses on structural and architectural changes.&lt;/p&gt;

&lt;p&gt;Think of it as:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Snapshot testing for execution architecture.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Not a replacement for tests.&lt;/p&gt;

&lt;p&gt;Not a replacement for static analysis.&lt;/p&gt;

&lt;p&gt;An additional layer that verifies architectural intent.&lt;/p&gt;




&lt;h2&gt;
  
  
  Example CI setup
&lt;/h2&gt;

&lt;p&gt;Save a baseline:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;archmind verify &lt;span class="nt"&gt;--project&lt;/span&gt; &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;--update&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Commit it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git add .archmind/baselines
git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"chore: add topology baseline"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then run in CI:&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="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;npm install -g @kidkender/archmind&lt;/span&gt;
&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;archmind verify --project .&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If a transaction boundary disappears, an auth middleware is removed, or a protected route loses part of its architecture, the build fails.&lt;/p&gt;




&lt;h2&gt;
  
  
  Final thoughts
&lt;/h2&gt;

&lt;p&gt;The most interesting realization from this project wasn't about Laravel.&lt;/p&gt;

&lt;p&gt;It was this:&lt;/p&gt;

&lt;p&gt;Tests verify behavior.&lt;/p&gt;

&lt;p&gt;Architecture usually lives in people's heads.&lt;/p&gt;

&lt;p&gt;When architecture becomes a graph, it becomes something we can version, compare, and verify.&lt;/p&gt;

&lt;p&gt;That's the idea behind ArchMind.&lt;/p&gt;

&lt;p&gt;I'd love feedback from Laravel developers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Have architectural regressions caused incidents in your projects?&lt;/li&gt;
&lt;li&gt;How do you currently review execution flow changes?&lt;/li&gt;
&lt;li&gt;Would architecture-level verification be useful in your CI pipeline?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;GitHub: &lt;a href="https://github.com/Kidkender/archMind" rel="noopener noreferrer"&gt;https://github.com/Kidkender/archMind&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>webdev</category>
      <category>programming</category>
      <category>laravel</category>
    </item>
    <item>
      <title>Write a telegram mini app</title>
      <dc:creator>Duck</dc:creator>
      <pubDate>Sat, 27 Jul 2024 10:39:36 +0000</pubDate>
      <link>https://dev.to/kidkender/duck-tma-2kh9</link>
      <guid>https://dev.to/kidkender/duck-tma-2kh9</guid>
      <description>&lt;p&gt;I wrote a telegram mini app that uses the user's telegram join date and gives them token rewards, features include leaderboard, or referral friends.&lt;/p&gt;

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

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

</description>
      <category>tma</category>
      <category>ton</category>
    </item>
  </channel>
</rss>
