<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Code-Review on rjrowland</title><link>https://rjrowland.com/tags/code-review/</link><description>Recent content in Code-Review on rjrowland</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Fri, 31 Jul 2026 09:00:00 -0500</lastBuildDate><atom:link href="https://rjrowland.com/tags/code-review/index.xml" rel="self" type="application/rss+xml"/><item><title>Code Review Is Wasted on Style Comments</title><link>https://rjrowland.com/posts/engineering-practices-code-review/</link><pubDate>Fri, 31 Jul 2026 09:00:00 -0500</pubDate><guid>https://rjrowland.com/posts/engineering-practices-code-review/</guid><description>&lt;p&gt;Code review has its highest leverage at the design level, not the style level. The questions that matter most are structural.&lt;/p&gt;
&lt;h2 id="are-invariants-maintained"&gt;Are invariants maintained?&lt;/h2&gt;
&lt;p&gt;What does the system depend on being true, and does this change preserve that? This question catches whole classes of bugs a line-by-line read misses entirely.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-go" data-lang="go"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;// The invariant: a settled transfer always has a SettledAt timestamp.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;// This PR adds a new status without touching that guarantee.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;func&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;markSettled&lt;/span&gt;(&lt;span style="color:#a6e22e"&gt;ctx&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;context&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;Context&lt;/span&gt;, &lt;span style="color:#a6e22e"&gt;transferID&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;TransferID&lt;/span&gt;, &lt;span style="color:#a6e22e"&gt;network&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;string&lt;/span&gt;) &lt;span style="color:#66d9ef"&gt;error&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;return&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;db&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;Transfers&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;Update&lt;/span&gt;(&lt;span style="color:#a6e22e"&gt;ctx&lt;/span&gt;, &lt;span style="color:#a6e22e"&gt;transferID&lt;/span&gt;, &lt;span style="color:#a6e22e"&gt;TransferUpdate&lt;/span&gt;{&lt;span style="color:#a6e22e"&gt;Status&lt;/span&gt;: &lt;span style="color:#e6db74"&gt;&amp;#34;settled&amp;#34;&lt;/span&gt;, &lt;span style="color:#a6e22e"&gt;Network&lt;/span&gt;: &lt;span style="color:#a6e22e"&gt;network&lt;/span&gt;})
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#75715e"&gt;// SettledAt never gets set — nothing enforces it, nothing warns you&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Line by line, this reads fine: it updates a status, it takes a network, it compiles. The bug only shows up when you ask the invariant question directly — &amp;ldquo;settled transfers always have a &lt;code&gt;SettledAt&lt;/code&gt;&amp;rdquo; was true before this PR and isn&amp;rsquo;t after it. A line-by-line read has no way to know that invariant exists unless someone states it and checks the diff against it.&lt;/p&gt;</description></item></channel></rss>