<?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: Daniel Pertu</title>
    <description>The latest articles on DEV Community by Daniel Pertu (@daniel_pertu).</description>
    <link>https://dev.to/daniel_pertu</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%2F3981169%2F83f3f6c9-9d75-47a7-9b7c-c28d13594696.jpg</url>
      <title>DEV Community: Daniel Pertu</title>
      <link>https://dev.to/daniel_pertu</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/daniel_pertu"/>
    <language>en</language>
    <item>
      <title>Our product name is a constant imported by 22 files, and the word still appears on 403 other lines of code</title>
      <dc:creator>Daniel Pertu</dc:creator>
      <pubDate>Wed, 02 Dec 2026 11:08:56 +0000</pubDate>
      <link>https://dev.to/daniel_pertu/our-product-name-is-a-constant-imported-by-22-files-and-the-word-still-appears-on-403-other-lines-59g6</link>
      <guid>https://dev.to/daniel_pertu/our-product-name-is-a-constant-imported-by-22-files-and-the-word-still-appears-on-403-other-lines-59g6</guid>
      <description>&lt;p&gt;&lt;a href="https://nakodo.app/about" rel="noopener noreferrer"&gt;Nakodo&lt;/a&gt; has a ten-line module, &lt;code&gt;src/lib/brand.ts&lt;/code&gt;, that exports the product's name, a descriptor and a description. The comment above it says "the product's name and descriptor, in one place". Client components import it, which is why the operator's address lives in a different file that browsers never see.&lt;/p&gt;

&lt;p&gt;If you have ever renamed a product, you know what "in one place" is worth, so I measured it.&lt;/p&gt;

&lt;h2&gt;
  
  
  In the source
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;What&lt;/th&gt;
&lt;th&gt;Count&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Files that import &lt;code&gt;@/lib/brand&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;22&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Uses of &lt;code&gt;BRAND.name&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;42&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Uses of &lt;code&gt;BRAND.description&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;7&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Uses of &lt;code&gt;BRAND.descriptor&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Lines outside &lt;code&gt;src/content&lt;/code&gt; that contain the word "Nakodo"&lt;/td&gt;
&lt;td&gt;605&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;of which comments&lt;/td&gt;
&lt;td&gt;202&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;of which code or copy&lt;/td&gt;
&lt;td&gt;403, across 107 files&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Lines inside &lt;code&gt;src/content&lt;/code&gt; (the public pages)&lt;/td&gt;
&lt;td&gt;700, across 98 files&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;So the constant covers about a tenth of the places the name is typed. The reason is not carelessness. Many of the 403 lines are sentences a customer reads, and a sentence reads better written out than assembled from &lt;code&gt;${BRAND.name} drafts a reply&lt;/code&gt;. The largest single file is a campaign editor screen with 31 of them.&lt;/p&gt;

&lt;p&gt;The honest answer to "how many places do I change for a rename" is therefore: the constant, and then a search and replace through 107 files and 98 content pages, and then a reading of every result. The constant is a good start, and it was never going to be the whole job.&lt;/p&gt;

&lt;h2&gt;
  
  
  In what the visitor gets
&lt;/h2&gt;

&lt;p&gt;I fetched all 106 URLs in &lt;a href="https://nakodo.app/sitemap.xml" rel="noopener noreferrer"&gt;/sitemap.xml&lt;/a&gt; and counted the word in the HTML:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Total mentions&lt;/td&gt;
&lt;td&gt;6,032&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Fewest on a page&lt;/td&gt;
&lt;td&gt;28, on &lt;a href="https://nakodo.app/guides" rel="noopener noreferrer"&gt;/guides&lt;/a&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Median&lt;/td&gt;
&lt;td&gt;42&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Most on a page&lt;/td&gt;
&lt;td&gt;139, on &lt;a href="https://nakodo.app/how-it-works" rel="noopener noreferrer"&gt;/how-it-works&lt;/a&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Counting the HTML is generous, because the same page has the name in a title, a meta description, structured data, an &lt;code&gt;og:&lt;/code&gt; tag and a link as well as the visible text, so the 139 is not 139 sentences.&lt;/p&gt;

&lt;p&gt;The name's kanji, 仲人, is on &lt;strong&gt;all 106 pages&lt;/strong&gt;. It is in the footer, in a &lt;code&gt;lang="ja"&lt;/code&gt; span that says it is the Japanese word for the go-between who makes an introduction. That one is not from the constant either, and it is the better for being written where it is read.&lt;/p&gt;

&lt;h2&gt;
  
  
  The part that would break quietly
&lt;/h2&gt;

&lt;p&gt;One reference in this area is not a string at all. The layout builds every page title as a template, &lt;code&gt;%s · ${BRAND.name}&lt;/code&gt;, so that part follows the constant. The check for how long a page title may be does not:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// The layout appends " · Nakodo" (9 characters) to page titles. Titles stay at&lt;/span&gt;
&lt;span class="c1"&gt;// or under this so the rendered title is under 60 characters&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="no"&gt;MAX_TITLE&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The 9 in that comment is &lt;code&gt;" · "&lt;/code&gt; plus six letters. It is written as a number, and the content test compares each page's own title to 50. Rename the product to a 12-character name and every title can be 6 characters longer than the test believes, with the suffix counted at 15. Pages at 50 would render at 65, over the 60 characters a results page shows, and the test would pass.&lt;/p&gt;

&lt;p&gt;The constant could be derived instead:&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="no"&gt;MAX_TITLE&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;59&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;" · "&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="no"&gt;BRAND&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That gives 50 today and moves with the name. I have not made the change, and I am writing it down here because it is the kind of coupling a constant existing in one place makes you assume is already handled.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where the descriptor goes
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;BRAND.descriptor&lt;/code&gt; is "A field guide to creators", and it has one use: the small label in the email layout. The phrase is not on any of the 106 pages I fetched, though the site's whole look is the field guide. That is another sign that the constant holds what code needs rather than what the brand says, and the second is a design choice I would rather keep than fix.&lt;/p&gt;

&lt;p&gt;If you want to try the count on your own project, the measure is &lt;code&gt;grep -rn "YourName" src | grep -v "^src/content" | wc -l&lt;/code&gt; against &lt;code&gt;grep -rl "@/lib/brand" src | wc -l&lt;/code&gt;. The ratio is the number that tells you how much your constant is doing.&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>nextjs</category>
      <category>webdev</category>
      <category>refactoring</category>
    </item>
    <item>
      <title>A downgrade pauses your campaigns in two different ways, and only one of them comes back when you upgrade</title>
      <dc:creator>Daniel Pertu</dc:creator>
      <pubDate>Wed, 02 Dec 2026 11:07:52 +0000</pubDate>
      <link>https://dev.to/daniel_pertu/a-downgrade-pauses-your-campaigns-in-two-different-ways-and-only-one-of-them-comes-back-when-you-59ga</link>
      <guid>https://dev.to/daniel_pertu/a-downgrade-pauses-your-campaigns-in-two-different-ways-and-only-one-of-them-comes-back-when-you-59ga</guid>
      <description>&lt;p&gt;Every subscription product needs a function for what happens when a customer moves to a smaller plan. In &lt;a href="https://nakodo.app/pricing" rel="noopener noreferrer"&gt;Nakodo&lt;/a&gt; it is &lt;code&gt;enforcePlanLimits&lt;/code&gt; in &lt;code&gt;src/lib/billing.ts&lt;/code&gt;, about 50 lines, and the Stripe webhook sync calls it whenever the plan's rank goes down. A paid plan that stops being paid counts as Free for this purpose, so a lapsed subscription ends up in the same function.&lt;/p&gt;

&lt;p&gt;I had not re-read it since I wrote it. Doing so turned up one design choice I would not have called a choice at the time.&lt;/p&gt;

&lt;h2&gt;
  
  
  What a smaller plan takes away
&lt;/h2&gt;

&lt;p&gt;The plans differ in how many campaigns run at once (Free 1, Pro 5, Business 25) and in what kinds of campaign they can run. The function takes things away in a fixed order:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Active campaigns of a kind the new plan does not include are paused.&lt;/li&gt;
&lt;li&gt;Campaigns that a user paused but left searching also have searching switched off.&lt;/li&gt;
&lt;li&gt;Of the campaigns still running, the most recently launched keep running up to the plan's count, and the rest are paused.&lt;/li&gt;
&lt;li&gt;Each campaign's keywords are trimmed to the new per-campaign limit.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The order matters in one place. Step 1 runs before step 3, and a paused campaign no longer counts as running, so campaigns removed for their kind do not use up a slot. Take an account with three business campaigns and four creator campaigns that falls to Free, which has one slot and no business campaigns. Step 1 pauses the three business ones, and step 3 then keeps the most recently launched of the four creator campaigns. Run the steps the other way round and the single slot could go to a business campaign that then gets paused for its kind, leaving the account with nothing running.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two pauses that look the same on screen
&lt;/h2&gt;

&lt;p&gt;Both step 1 and step 3 end with a paused campaign. The code writes them differently:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// step 1: the plan has no business campaigns&lt;/span&gt;
&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;pausedByNakodo&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"plan"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;// step 3: too many campaigns for the plan&lt;/span&gt;
&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;pausedByUser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"both"&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 two helpers live in &lt;code&gt;src/lib/pause.ts&lt;/code&gt;. &lt;code&gt;pausedByNakodo(reason)&lt;/code&gt; sets a status of paused, a &lt;code&gt;pauseReason&lt;/code&gt;, and no pause mode. &lt;code&gt;pausedByUser(mode)&lt;/code&gt; sets a mode and no reason. The module's comment says the point of the design: "a mode or reason never outlives its pause".&lt;/p&gt;

&lt;p&gt;The difference that follows is in &lt;code&gt;widenCampaigns&lt;/code&gt;, which runs on an upgrade and relaunches what the new plan allows. It skips any paused campaign unless the reason is &lt;code&gt;outreach_limit&lt;/code&gt; or &lt;code&gt;plan&lt;/code&gt;:&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;if&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="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="s2"&gt;"active"&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;pauseReason&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="s2"&gt;"outreach_limit"&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;pauseReason&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="s2"&gt;"plan"&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So after a downgrade and then an upgrade:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Why it was paused&lt;/th&gt;
&lt;th&gt;Stored as&lt;/th&gt;
&lt;th&gt;After the upgrade&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Its kind is no longer in the plan&lt;/td&gt;
&lt;td&gt;system pause, reason &lt;code&gt;plan&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;relaunched on its own&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Over the plan's campaign count&lt;/td&gt;
&lt;td&gt;a pause by the user, &lt;code&gt;both&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;stays paused until the user resumes it&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;My reading of it, which the code does not state: a campaign paused for its kind has an obvious answer: the plan that lacks it is the only cause, so the plan that has it again is the whole cure. A campaign paused for being the 6th of 5 has no such answer. Which five should come back? The user had a choice of which to keep, and the system had no better guess than the ones launched last, so it does not quietly resume the rest. Writing that as a user pause means a person looks at the list and picks.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I would check before calling this right
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Replies and conversations.&lt;/strong&gt; The function's own comment says conversations already started carry on. The system pause does that: it stops finding only. The user-style &lt;code&gt;both&lt;/code&gt; pause also stops first emails and follow-ups. If a customer has a conversation that is running on a campaign paused for count, whether the conversation carries on as the comment promises depends on how a paused campaign handles replies, and I have not run that case.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tests.&lt;/strong&gt; No test file imports &lt;code&gt;enforcePlanLimits&lt;/code&gt;. The pieces around it do have them, including the pause helpers and the share arithmetic, but the order of the four steps is only enforced by the order of the statements. A test with three business and four creator campaigns on a smaller plan is about thirty lines of setup, and it would pin the property above.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The audit rows.&lt;/strong&gt; Each pause writes &lt;code&gt;campaign.paused&lt;/code&gt; with a reason of &lt;code&gt;plan_kind&lt;/code&gt; or &lt;code&gt;plan_limit&lt;/code&gt;, so after the fact you can tell the two apart even though the campaign row cannot be told from a user's own pause once step 3 has run. That is the other half of the design: the history is in the audit log and the current state is in the row.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where to look
&lt;/h2&gt;

&lt;p&gt;The limits as customers see them are on &lt;a href="https://nakodo.app/pricing" rel="noopener noreferrer"&gt;/pricing&lt;/a&gt;, and the plain-English description of what business campaigns are is at &lt;a href="https://nakodo.app/features/business-outreach" rel="noopener noreferrer"&gt;/features/business-outreach&lt;/a&gt;. The follow-ups themselves are described at &lt;a href="https://nakodo.app/features/follow-ups" rel="noopener noreferrer"&gt;/features/follow-ups&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>saas</category>
      <category>stripe</category>
      <category>architecture</category>
    </item>
    <item>
      <title>Upgrading must not shrink anyone's share, so I checked 27,404 ways to split a day, and the rounding never fires</title>
      <dc:creator>Daniel Pertu</dc:creator>
      <pubDate>Wed, 02 Dec 2026 11:06:56 +0000</pubDate>
      <link>https://dev.to/daniel_pertu/upgrading-must-not-shrink-anyones-share-so-i-checked-27404-ways-to-split-a-day-and-the-rounding-1g56</link>
      <guid>https://dev.to/daniel_pertu/upgrading-must-not-shrink-anyones-share-so-i-checked-27404-ways-to-split-a-day-and-the-rounding-1g56</guid>
      <description>&lt;p&gt;&lt;a href="https://nakodo.app/pricing" rel="noopener noreferrer"&gt;Nakodo&lt;/a&gt; gives each plan a number of new outreach emails a day: Free 10, Pro 25, Business 75. On plans with more than one campaign, that day is split between the campaigns, and each campaign owns a share the user chose. When someone upgrades, every share has to grow with the day, or the user pays for 75 and gets 25 spread the same way.&lt;/p&gt;

&lt;p&gt;The function that does it is small enough to quote whole:&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;function&lt;/span&gt; &lt;span class="nf"&gt;widenShare&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;share&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;fromDay&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;toDay&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;toDay&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;fromDay&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;fromDay&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;floor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;share&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;toDay&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;fromDay&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;share&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;A share grows in proportion, so a campaign with 10 of Pro's 25 gets 30 of Business's 75. It rounds down, and the comment explains why: the shares must still add up to no more than the new day. A smaller day leaves a share alone, because after a downgrade it can only be lowered, never raised past the room that is free.&lt;/p&gt;

&lt;p&gt;I had never asked how much the &lt;code&gt;Math.floor&lt;/code&gt; costs. This week I ran the question.&lt;/p&gt;

&lt;h2&gt;
  
  
  The experiment
&lt;/h2&gt;

&lt;p&gt;For each pair of plans, I generated every possible way to split the old day across one, two, three or four campaigns, with shares from zero up to what is left, pushed each through &lt;code&gt;widenShare&lt;/code&gt;, and recorded three things: whether the new shares ever add up to more than the new day, whether any share shrank, and how much of the exact proportional amount the floor threw away.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Plans&lt;/th&gt;
&lt;th&gt;Splits tried&lt;/th&gt;
&lt;th&gt;Over the new day&lt;/th&gt;
&lt;th&gt;A share shrank&lt;/th&gt;
&lt;th&gt;Lost to the floor&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Pro to Business&lt;/td&gt;
&lt;td&gt;27,404&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Free to Pro&lt;/td&gt;
&lt;td&gt;1,364&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;up to 2 emails&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Free to Business&lt;/td&gt;
&lt;td&gt;1,364&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;up to 2 emails&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The Pro to Business row tells the story. 25 times 3 is 75, so every share scales by an exact integer, and the floor has nothing to throw away. Not in one of 27,404 splits. The Free rows lose something, because 25 over 10 is 2.5: a share of 3 becomes 7, not 7.5. In the worst four-campaign split the loss is two emails.&lt;/p&gt;

&lt;h2&gt;
  
  
  And then the call site
&lt;/h2&gt;

&lt;p&gt;That table made me open &lt;code&gt;widenCampaigns&lt;/code&gt; in &lt;code&gt;src/lib/pipeline/launch.ts&lt;/code&gt;, which is the only caller:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Only between plans that split their day: a one-campaign plan gives its&lt;/span&gt;
&lt;span class="c1"&gt;// campaign the whole day, whatever share it has.&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;before&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;campaigns&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;limits&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;campaigns&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Free allows one campaign, so Free never enters that branch. A one-campaign plan has no shares to widen. The only pair that does is Pro (5 campaigns) to Business (25), where the ratio is exactly 3.&lt;/p&gt;

&lt;p&gt;So &lt;strong&gt;the rounding in &lt;code&gt;widenShare&lt;/code&gt; is never exercised in production today.&lt;/strong&gt; The Free rows in my table are a calculation about a path the app does not take. The code is correct and has its own unit test. It carries a decision, "round down so we never promise more than the day", that costs nothing until somebody changes a plan's day to a number that is not a multiple of the plan below it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Is that dead code?
&lt;/h2&gt;

&lt;p&gt;I do not think so. A one-line function with the right rule is cheaper than a future surprise. What I took from the run is narrower:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;The invariant, not the function, is what to test.&lt;/strong&gt; My experiment is the right test: for any split and any pair of plans, the widened shares add to no more than the new day, and no share shrinks. It runs in a moment, and the existing unit test checks examples rather than all of them.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;"Lost to the floor" is a pricing input.&lt;/strong&gt; If a plan with an odd ratio is ever added, a table like this says how many emails a customer silently loses on upgrade, and "up to 2 on a day of 25" is a number you can decide about.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Read the call site before you trust the table.&lt;/strong&gt; Half of my interesting results were about a case the guard in the caller rules out.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Check it yourself
&lt;/h2&gt;

&lt;p&gt;The plan limits are on &lt;a href="https://nakodo.app/pricing" rel="noopener noreferrer"&gt;/pricing&lt;/a&gt;, and every number there comes from the same &lt;code&gt;PLANS&lt;/code&gt; object the function reads. The experiment is a 30-line loop with a generator that walks the splits. It needs nothing but &lt;code&gt;node&lt;/code&gt; and the file itself, because &lt;code&gt;daily-shares.ts&lt;/code&gt; imports nothing.&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>testing</category>
      <category>math</category>
      <category>javascript</category>
    </item>
    <item>
      <title>One nullable Redis client, three callers, and three different answers to "Redis is not configured"</title>
      <dc:creator>Daniel Pertu</dc:creator>
      <pubDate>Wed, 02 Dec 2026 11:06:08 +0000</pubDate>
      <link>https://dev.to/daniel_pertu/one-nullable-redis-client-three-callers-and-three-different-answers-to-redis-is-not-configured-28e5</link>
      <guid>https://dev.to/daniel_pertu/one-nullable-redis-client-three-callers-and-three-different-answers-to-redis-is-not-configured-28e5</guid>
      <description>&lt;p&gt;The Redis helper in &lt;a href="https://nakodo.app" rel="noopener noreferrer"&gt;Nakodo&lt;/a&gt; is twelve lines. It returns an Upstash client when the environment has either the &lt;code&gt;UPSTASH_REDIS_REST_*&lt;/code&gt; pair or the &lt;code&gt;KV_REST_API_*&lt;/code&gt; pair that Vercel's integration sets, and &lt;code&gt;null&lt;/code&gt; otherwise. Null is the default on a laptop and on a preview deployment.&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;function&lt;/span&gt; &lt;span class="nf"&gt;redisFromEnv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Redis&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;null&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;configured&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;env&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"UPSTASH_REDIS_REST_URL"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nf"&gt;env&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"KV_REST_API_URL"&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;amp;&amp;amp;&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;env&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"UPSTASH_REDIS_REST_TOKEN"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nf"&gt;env&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"KV_REST_API_TOKEN"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;configured&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="nc"&gt;Redis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fromEnv&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="kc"&gt;null&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;A function that can return null makes every caller write the "else" branch, and I counted: there are three callers in &lt;code&gt;src/&lt;/code&gt;, plus one script, and they chose three different meanings for it.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. The rate limiter: fail open
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;src/lib/ratelimit.ts&lt;/code&gt; has 18 named rules, from &lt;code&gt;signIn&lt;/code&gt; (10 attempts in 10 minutes per email) to &lt;code&gt;write&lt;/code&gt; (120 a minute per user). With no Redis, &lt;code&gt;limiter(rule)&lt;/code&gt; returns null and &lt;code&gt;rateLimit()&lt;/code&gt; returns straight away, so &lt;strong&gt;nothing is limited&lt;/strong&gt;. The comment at the top says that is the point: a missing or broken Redis must not take sign-in down with it. A failing call gets one second, and then the request goes through, with a logged error.&lt;/p&gt;

&lt;p&gt;There is one asymmetry I like. On a live deployment with no Redis, the module logs &lt;code&gt;Rate limiting is off: set UPSTASH_REDIS_REST_URL...&lt;/code&gt; once, because there it is a misconfiguration. Locally it is silent, because there it is a Tuesday.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. The place search: degrade to one process
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;src/lib/places/geocode.ts&lt;/code&gt; looks up place names against Nominatim, which allows one request a second. With Redis, a fixed-window limiter of one per second keyed on the constant &lt;code&gt;"global"&lt;/code&gt; makes every server instance take a turn, and results are cached for 30 days. Without Redis the same module swaps in a &lt;code&gt;Map&lt;/code&gt; and a &lt;code&gt;lastLocal&lt;/code&gt; timestamp:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;cached&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;redis&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;redis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;PlaceMatch&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="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;null&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;memory&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;key&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 map is cleared when it passes 500 entries. This is a third policy, and it is the opposite of the first one: &lt;strong&gt;it still limits, just per process&lt;/strong&gt;. The reason is that the limit is somebody else's rule, and breaking it gets the whole app blocked. Failing open would be correct for our own limit and wrong for Nominatim's.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. The sitemap announcer: do nothing
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;src/lib/seo/indexnow.ts&lt;/code&gt; runs hourly and tells search engines about pages whose &lt;code&gt;updated&lt;/code&gt; date has moved. Which pages were already announced lives in one Redis hash. Without Redis it returns &lt;code&gt;{ skipped: "Redis isn't configured" }&lt;/code&gt;, and the comment gives the reason: it cannot tell what changed, so it does nothing rather than announce every page every hour.&lt;/p&gt;

&lt;p&gt;That is the third policy: &lt;strong&gt;fail closed&lt;/strong&gt;. Re-announcing 106 pages every hour would be noise to the engines, and the hash is the only state.&lt;/p&gt;

&lt;h2&gt;
  
  
  The same null, and a decision table
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Caller&lt;/th&gt;
&lt;th&gt;Without Redis&lt;/th&gt;
&lt;th&gt;Why&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Rate limiter&lt;/td&gt;
&lt;td&gt;allow everything&lt;/td&gt;
&lt;td&gt;protecting our own endpoints must not take them down&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Place search&lt;/td&gt;
&lt;td&gt;limit per process&lt;/td&gt;
&lt;td&gt;the limit is a third party's&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Announcer&lt;/td&gt;
&lt;td&gt;skip the run&lt;/td&gt;
&lt;td&gt;it has no memory of what it sent&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The types gave me nothing here. &lt;code&gt;Redis | null&lt;/code&gt; is one type for three different answers, and I could not have written the table from the signatures. What I would change is to make the policy part of the call: a &lt;code&gt;redisOr("open" | "local" | "skip")&lt;/code&gt; helper would put the decision at the use site, where a reader sees it.&lt;/p&gt;

&lt;h2&gt;
  
  
  A prefix that does not match
&lt;/h2&gt;

&lt;p&gt;While reading, I noticed that the rate limiter prefixes its keys with &lt;code&gt;nakodo:rl:&lt;/code&gt;, the announcer uses &lt;code&gt;nakodo:indexnow:submitted&lt;/code&gt;, and the place search uses &lt;code&gt;rl:nominatim&lt;/code&gt;. One of three has dropped the app name. Nothing breaks, since only this app uses the database, but the day it shares one with another app, a key named &lt;code&gt;rl:nominatim&lt;/code&gt; is the one that belongs to nobody. Renaming it is a one-line change, and the old key expires with its one-second window.&lt;/p&gt;

&lt;h2&gt;
  
  
  Things you can check
&lt;/h2&gt;

&lt;p&gt;The announcer is the reason &lt;a href="https://nakodo.app/sitemap.xml" rel="noopener noreferrer"&gt;/sitemap.xml&lt;/a&gt; carries honest dates. 62 of its 106 entries say &lt;code&gt;2026-11-26&lt;/code&gt; and 44 say &lt;code&gt;2026-10-03&lt;/code&gt;, because the date is a page's last substantive change and not the build date. A build date would make the announcer re-submit everything on every deploy.&lt;/p&gt;

&lt;p&gt;One thing I have not tested is what the place search does when Redis is configured but failing. The cache read swallows errors. The turn-taking call, &lt;code&gt;limiter.limit("global")&lt;/code&gt;, does not wrap itself in a try, so I expect a failing Redis to surface as an error rather than a slow fallback. If I am right, the fix is three lines.&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>redis</category>
      <category>architecture</category>
      <category>nextjs</category>
    </item>
    <item>
      <title>I spelled all 106 of our URLs eight ways, and only one spelling that should work gets a 404</title>
      <dc:creator>Daniel Pertu</dc:creator>
      <pubDate>Wed, 02 Dec 2026 11:05:20 +0000</pubDate>
      <link>https://dev.to/daniel_pertu/i-spelled-all-106-of-our-urls-eight-ways-and-only-one-spelling-that-should-work-gets-a-404-2387</link>
      <guid>https://dev.to/daniel_pertu/i-spelled-all-106-of-our-urls-eight-ways-and-only-one-spelling-that-should-work-gets-a-404-2387</guid>
      <description>&lt;p&gt;Every site gets linked to in ways its owner did not write. A newsletter lowercases a slug, a forum adds a slash, a QR code appends &lt;code&gt;utm_source&lt;/code&gt;, someone types &lt;code&gt;www.&lt;/code&gt; out of habit. The sitemap lists one spelling per page. What the server does with the other spellings is a decision that nobody made on purpose, and I had never counted it for &lt;a href="https://nakodo.app/pricing" rel="noopener noreferrer"&gt;nakodo.app&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;So I took the 106 URLs in &lt;a href="https://nakodo.app/sitemap.xml" rel="noopener noreferrer"&gt;/sitemap.xml&lt;/a&gt;, spelled each one eight ways, and sent 848 requests with &lt;code&gt;curl&lt;/code&gt;, eight at a time. No redirects followed: I wanted the first answer.&lt;/p&gt;

&lt;h2&gt;
  
  
  The table
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Spelling of &lt;code&gt;/pricing&lt;/code&gt;
&lt;/th&gt;
&lt;th&gt;What came back, across all 106 pages&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;as listed&lt;/td&gt;
&lt;td&gt;106 × 200&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/PRICING&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;105 × 404&lt;/strong&gt;, 1 × 200&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/pricing/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;105 × 308 to the clean URL, 1 × 200&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;//pricing&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;106 × 308 to the clean URL&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/pricing?utm_source=x&amp;amp;fbclid=y&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;106 × 200&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/pricing%20&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;106 × 404&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;https://www.nakodo.app/pricing&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;106 × &lt;strong&gt;307&lt;/strong&gt; to the apex&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;http://nakodo.app/pricing&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;106 × &lt;strong&gt;308&lt;/strong&gt; to https&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The two "1 × 200" rows are the home page. &lt;code&gt;/&lt;/code&gt; uppercased is still &lt;code&gt;/&lt;/code&gt;, and a slash on &lt;code&gt;/&lt;/code&gt; is no change at all, so they pass trivially.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I did not expect
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Uppercase is a 404, not a redirect.&lt;/strong&gt; &lt;code&gt;/PRICING&lt;/code&gt; and &lt;code&gt;/Guides/How-To-Find-Influencers&lt;/code&gt; both answer 404. That is the correct reading of the URL standard, because paths are case sensitive, and Next.js follows it. But it is the one spelling on the list that a human or a mail client does produce, since some of them capitalise the start of a link. The 404 page is our field guide entry for a bird that was never recorded, and it is marked &lt;code&gt;noindex&lt;/code&gt;, so nothing damaging happens. A link that works in one email client and 404s in another is just a lost visitor.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The 404 is cached.&lt;/strong&gt; &lt;code&gt;curl -I https://nakodo.app/PRICING&lt;/code&gt; showed &lt;code&gt;age: 141365&lt;/code&gt; and &lt;code&gt;cache-control: public, max-age=0, must-revalidate&lt;/code&gt;. That is the same prerendered 404 page, served from Vercel's cache with an &lt;code&gt;etag&lt;/code&gt; and a &lt;code&gt;last-modified&lt;/code&gt; of 30 November, 39 hours old, and revalidated on every request. A typo costs the server nothing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;www&lt;/code&gt; is a 307 and &lt;code&gt;http&lt;/code&gt; is a 308.&lt;/strong&gt; The rule for http is permanent. The rule for www is temporary. Both end up at &lt;code&gt;https://nakodo.app/&amp;lt;path&amp;gt;&lt;/code&gt; with the path intact in all 106 cases. A client that remembers a 308 will skip the hop next time. A 307 means it will ask again every time. The chain from &lt;code&gt;http://www.nakodo.app/pricing&lt;/code&gt; takes two hops: 308 to &lt;code&gt;https://www.&lt;/code&gt;, then 307 to the apex. Nothing in the repo sets that redirect, so it comes from how the &lt;code&gt;www&lt;/code&gt; host is configured with the host, not from code. Whether it can be made permanent is something I still have to check there.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A tracking query changes nothing.&lt;/strong&gt; All 106 URLs answer 200 with &lt;code&gt;?utm_source=x&amp;amp;fbclid=y&lt;/code&gt;, and the canonical link on the response stays the clean URL. For a static page like &lt;a href="https://nakodo.app/guides/how-to-find-influencers" rel="noopener noreferrer"&gt;/guides/how-to-find-influencers&lt;/a&gt; the response is a cache hit, with the same &lt;code&gt;age&lt;/code&gt; as the clean URL, so the query string shares the cache entry. &lt;a href="https://nakodo.app/pricing" rel="noopener noreferrer"&gt;/pricing&lt;/a&gt; is different, because it renders per request for the visitor's currency, so both spellings are a &lt;code&gt;MISS&lt;/code&gt; with &lt;code&gt;cache-control: private, no-store&lt;/code&gt;. That is the cost of showing a price in pounds, euros or dollars in the HTML.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A trailing space is a 404.&lt;/strong&gt; &lt;code&gt;/pricing%20&lt;/code&gt; is not normalised. I tried &lt;code&gt;.html&lt;/code&gt; and &lt;code&gt;/index&lt;/code&gt; too, and those 404 as well, which is right: we never served them.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is cheap to fix and what is not
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Finding&lt;/th&gt;
&lt;th&gt;Fix&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;uppercase 404s&lt;/td&gt;
&lt;td&gt;lowercase redirect in &lt;code&gt;proxy.ts&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;one more branch in the file that already owns the public-path allowlist&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;www is 307&lt;/td&gt;
&lt;td&gt;check the host's domain setting&lt;/td&gt;
&lt;td&gt;outside the repo&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;404s are cached&lt;/td&gt;
&lt;td&gt;none needed&lt;/td&gt;
&lt;td&gt;nothing to do&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;I will leave the uppercase decision alone for now. The honest argument for a redirect is that it turns a lost visitor into a found one. The argument against is that it creates a second URL for every page that a crawler can discover and has to be told not to treat as a duplicate. The sitemap lists lowercase only, the canonical is lowercase, and I have no evidence yet that anyone is arriving by an uppercase link. If that changes, it is a small branch.&lt;/p&gt;

&lt;p&gt;You can run the census yourself. The script is one &lt;code&gt;curl -s -o /dev/null -w "%{http_code} %{redirect_url}"&lt;/code&gt; per spelling.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>seo</category>
      <category>http</category>
      <category>nextjs</category>
    </item>
    <item>
      <title>Our price in 22 currencies adds between 4.01% and 15.14% to the pound price, and the "ends in 9" rule decides which</title>
      <dc:creator>Daniel Pertu</dc:creator>
      <pubDate>Wed, 02 Dec 2026 11:04:01 +0000</pubDate>
      <link>https://dev.to/daniel_pertu/our-price-in-22-currencies-adds-between-401-and-1514-to-the-pound-price-and-the-ends-in-9-1ej8</link>
      <guid>https://dev.to/daniel_pertu/our-price-in-22-currencies-adds-between-401-and-1514-to-the-pound-price-and-the-ends-in-9-1ej8</guid>
      <description>&lt;p&gt;&lt;a href="https://nakodo.app/pricing" rel="noopener noreferrer"&gt;Nakodo&lt;/a&gt; prices in pounds, and visitors from 66 countries see their own currency instead. The conversion is one function in &lt;code&gt;src/lib/pricing/currency.ts&lt;/code&gt;, and the comment above it states the rule:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A converted price is the pound price times the rate, plus 4%, rounded up to the next whole amount ending in 9.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I wrote that comment in October and never checked what it does in aggregate. Today I copied the file out, ran it for both paid plans (£39 and £119) in all 22 non-pound currencies, and compared each result with the plain &lt;code&gt;pounds * rate&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The floor is 4.01%, the ceiling is 15.14%
&lt;/h2&gt;

&lt;p&gt;The margin is 4% on paper. Measured against the unrounded conversion, the 44 prices land between &lt;strong&gt;4.01% and 15.14%&lt;/strong&gt;, with a median of &lt;strong&gt;4.73%&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Where the extra comes from is rounding up to the next number ending in 9, which is a bigger step for a price that is small in its own currency:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Currency&lt;/th&gt;
&lt;th&gt;£39 shown&lt;/th&gt;
&lt;th&gt;Unrounded&lt;/th&gt;
&lt;th&gt;Over&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Swiss franc&lt;/td&gt;
&lt;td&gt;CHF 49&lt;/td&gt;
&lt;td&gt;42.56&lt;/td&gt;
&lt;td&gt;15.14%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;US dollar&lt;/td&gt;
&lt;td&gt;$59&lt;/td&gt;
&lt;td&gt;51.48&lt;/td&gt;
&lt;td&gt;14.60%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;New Zealand dollar&lt;/td&gt;
&lt;td&gt;$99&lt;/td&gt;
&lt;td&gt;91.74&lt;/td&gt;
&lt;td&gt;7.91%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Canadian dollar&lt;/td&gt;
&lt;td&gt;$79&lt;/td&gt;
&lt;td&gt;73.31&lt;/td&gt;
&lt;td&gt;7.76%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Euro&lt;/td&gt;
&lt;td&gt;€49&lt;/td&gt;
&lt;td&gt;45.86&lt;/td&gt;
&lt;td&gt;6.84%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Japanese yen&lt;/td&gt;
&lt;td&gt;￥8,449&lt;/td&gt;
&lt;td&gt;8,117.46&lt;/td&gt;
&lt;td&gt;4.08%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Indian rupee&lt;/td&gt;
&lt;td&gt;₹5,159&lt;/td&gt;
&lt;td&gt;4,959.24&lt;/td&gt;
&lt;td&gt;4.03%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Hungarian forint&lt;/td&gt;
&lt;td&gt;17 619 Ft&lt;/td&gt;
&lt;td&gt;16,932.24&lt;/td&gt;
&lt;td&gt;4.06%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A franc price of 44.26 (the 4% margin included) has to become 49, because the next number ending in 9 is nearly five francs away. A yen price of 8,449 only has to clear 8,442. The rule is the same and the cost is not. At £119 the dollar drops from 14.6% to 7.58% over, and the franc from 15.14% to 7.04%, because the same ten-unit step is a smaller share of a bigger number.&lt;/p&gt;

&lt;p&gt;So "we add 4%" is true to within a percentage point for 26 of the 44 prices, and not true for the dollar, the euro and the franc on the cheaper plan. The other 18 are over by 5.6% to 15.1%. I would rather say that here than leave the comment as the whole story. Whether a $59 plan looks fairer than $55 is a pricing question I have not tested. The code does what the comment says.&lt;/p&gt;

&lt;h2&gt;
  
  
  Rounding to a 9 is five lines
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;endInNine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;amount&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&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;whole&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ceil&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;amount&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mf"&gt;1e-9&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;whole&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="mi"&gt;19&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;whole&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;1e-9&lt;/code&gt; stops floating point error pushing an exactly whole amount up a unit: without it, a computed 139.00000000000003 would become 149. The &lt;code&gt;(19 - whole % 10) % 10&lt;/code&gt; is the distance to the next 9, and it is 0 when you are already on one.&lt;/p&gt;

&lt;h2&gt;
  
  
  Whole numbers, because the page says so
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;formatMinorUnits&lt;/code&gt; drops the decimals when the amount is whole, so the page says "€49" and not "€49.00". Because every converted price ends in 9, none of them ever has cents. The format is &lt;code&gt;Intl.NumberFormat&lt;/code&gt; with the currency's own locale, and the locale table has one note I like: Israel uses &lt;code&gt;en-IL&lt;/code&gt;, because &lt;code&gt;he-IL&lt;/code&gt; adds right-to-left marks into a price that sits in the middle of an English sentence.&lt;/p&gt;

&lt;h2&gt;
  
  
  Minor units are not what Stripe thinks they are
&lt;/h2&gt;

&lt;p&gt;There are two different "digits" in play, and they disagree for exactly two of the 22 currencies:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Currency&lt;/th&gt;
&lt;th&gt;Written with&lt;/th&gt;
&lt;th&gt;Stripe counts in&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Yen&lt;/td&gt;
&lt;td&gt;0 decimals&lt;/td&gt;
&lt;td&gt;whole yen&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Forint&lt;/td&gt;
&lt;td&gt;0 decimals&lt;/td&gt;
&lt;td&gt;hundredths&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Icelandic króna&lt;/td&gt;
&lt;td&gt;0 decimals&lt;/td&gt;
&lt;td&gt;hundredths&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;code&gt;Intl&lt;/code&gt; says the forint is written without decimals, and Stripe nevertheless wants 1761900 for a 17,619 Ft price. Yen is the only one of our currencies Stripe treats as zero-decimal, so the code keeps a one-element &lt;code&gt;STRIPE_ZERO_DECIMAL&lt;/code&gt; set and derives everything else. A unit test pins both: the forint and krona amounts must be exactly 100 times the shown price, and yen must equal it. If a currency were added with the wrong assumption, the checkout would charge a hundredth or a hundred times the price, and the page would still look right.&lt;/p&gt;

&lt;h2&gt;
  
  
  What you can check
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://nakodo.app/pricing" rel="noopener noreferrer"&gt;/pricing&lt;/a&gt; renders the visitor's price in the HTML, per request. Crawlers are matched on user agent and always get pounds, so the search listing is not in the currency of a datacentre. The same function feeds the Stripe session, so the figure on the page is the figure charged, and I have found no way to make them differ.&lt;/p&gt;

&lt;p&gt;The rates are fixed from one day's ECB reference rates, deliberately not live, because they set the charge. That makes the real markup drift with the market. The 4% is a margin at the moment the rates were taken, and a fixed rate cannot promise it for ever.&lt;/p&gt;

&lt;p&gt;The existing test only requires a converted price to be less than ten units above the rate plus margin. The open work is a test that fails when any converted price is more than, say, 12% over its unrounded value.&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>stripe</category>
      <category>webdev</category>
      <category>pricing</category>
    </item>
    <item>
      <title>Everything our build emits is cached for a year, everything in public/ is re-checked on every visit, and the 304 is no faster than the 200</title>
      <dc:creator>Daniel Pertu</dc:creator>
      <pubDate>Wed, 02 Dec 2026 10:43:46 +0000</pubDate>
      <link>https://dev.to/daniel_pertu/everything-our-build-emits-is-cached-for-a-year-everything-in-public-is-re-checked-on-every-e54</link>
      <guid>https://dev.to/daniel_pertu/everything-our-build-emits-is-cached-for-a-year-everything-in-public-is-re-checked-on-every-e54</guid>
      <description>&lt;p&gt;There are two kinds of static file on &lt;a href="https://pub-trivia.app" rel="noopener noreferrer"&gt;pub-trivia.app&lt;/a&gt;, and they get opposite cache headers without anyone having decided that.&lt;/p&gt;

&lt;p&gt;Files the build emits into &lt;code&gt;/_next/static/immutable/&lt;/code&gt; are cached for a year. Files I put into &lt;code&gt;public/&lt;/code&gt; are told to check back with the server on every use. I only noticed because I was reading response headers for a different reason, and the two groups sat next to each other in the output looking like they belonged to different sites.&lt;/p&gt;

&lt;h2&gt;
  
  
  The two policies, side by side
&lt;/h2&gt;

&lt;p&gt;Request one file from each group:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -sI https://pub-trivia.app/logo.svg
curl -sI &lt;span class="s2"&gt;"https://pub-trivia.app/_next/static/immutable/media/07a39a8a4660cc7c-s.p.1v5bejj26fx9h.woff2"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first answers &lt;code&gt;cache-control: public, max-age=0, must-revalidate&lt;/code&gt;. The second answers &lt;code&gt;cache-control: public,max-age=31536000,immutable&lt;/code&gt;. That is the entire difference between a file the browser may use without asking and one it must ask about every time.&lt;/p&gt;

&lt;p&gt;Here is every static file I could find, with the header each one carries:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;file                         bytes       cache-control
/logo.svg                        606     public, max-age=0, must-revalidate
/favicon.svg                     606     public, max-age=0, must-revalidate
/icon.svg                      1,034     public, max-age=0, must-revalidate
/favicon.ico                   4,418     public, max-age=0, must-revalidate
/manifest.webmanifest            281     public, max-age=0, must-revalidate
/demo-1.webp               1,769,688     public, max-age=0, must-revalidate
/demo-2.webp                 953,385     public, max-age=0, must-revalidate
/demo-3.webp                 915,548     public, max-age=0, must-revalidate
/_next/image?url=...         24,498     public, max-age=0, must-revalidate
/_next/static/immutable/*   (37 paths)  public,max-age=31536000,immutable
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The five small files add up to 6,945 bytes. The three large images are in the megabytes, and I will leave their weight alone here and look only at the policy. The optimised hero image that the browser actually downloads is also &lt;code&gt;max-age=0&lt;/code&gt;, so the browser is told to ask again for that too.&lt;/p&gt;

&lt;p&gt;Where does that leave the rule I wrote to cache things for a year? &lt;code&gt;next.config.mjs&lt;/code&gt; has exactly one: it covers &lt;code&gt;/static/:path*&lt;/code&gt;, a folder we do not have. It matches nothing, and the build output gets its year-long header from the framework, not from us. Everything that is ours is on the platform default.&lt;/p&gt;

&lt;h2&gt;
  
  
  What revalidation costs
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;max-age=0, must-revalidate&lt;/code&gt; does not mean "download it again". It means "ask first", and the usual answer is a 304 with no body. So the cost on a repeat visit should be small. I measured how small by requesting four files in full and then again with &lt;code&gt;If-None-Match&lt;/code&gt; set to the file's own &lt;code&gt;etag&lt;/code&gt;, fifteen times each, from one laptop:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;file                   full response (median)    conditional (median)
/logo.svg              200, 606 B, 70 ms         304, 0 B, 73 ms
/icon.svg              200, 1,034 B, 73 ms       304, 0 B, 67 ms
/manifest.webmanifest  200, 281 B, 76 ms         304, 0 B, 71 ms
/demo-1.webp           200, 1,769,688 B, 300 ms  304, 0 B, 71 ms
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For the three small files, the 304 is not faster than the 200. They are within a few milliseconds of each other and the order is not even consistent: the logo is slower as a 304, the other two are faster. The time is the round trip, about 70 ms to this edge from here, and 600 bytes more or less does not register against it. A 304 on a small file saves nothing a person could feel, and spends a request to do it.&lt;/p&gt;

&lt;p&gt;The image is a different story: 300 ms against 71 ms is the saving a 304 is meant to give. But a file that large only earns it once the browser has a copy to compare against, and the page does not use that file directly. It asks for a resized version, which is &lt;code&gt;max-age=0&lt;/code&gt; as well.&lt;/p&gt;

&lt;h2&gt;
  
  
  Which of these actually happens on a page view
&lt;/h2&gt;

&lt;p&gt;Every page carries four head links to files in the table: the SVG favicon, the &lt;code&gt;.ico&lt;/code&gt;, the touch icon and the manifest. Browsers fetch those rarely and on their own schedule, so I would not count them against a page view. The one that matters is the logo, because it is in the header: 114 of our 117 pages have an &lt;code&gt;&amp;lt;img src="/logo.svg?dpl=..."&amp;gt;&lt;/code&gt;, the three that do not being the compact-footer legal pages.&lt;/p&gt;

&lt;p&gt;So on a warm repeat visit to almost any page, one of the requests is a conditional fetch for a 606 byte file, answered 304. It does not block rendering, and it is one request among a few dozen. I am not going to claim it makes the site slow, because I have not measured a page view with and without it, and I would expect the difference to be too small to see.&lt;/p&gt;

&lt;p&gt;What it does do is show up in every waterfall, and it is the sort of thing that is cheap to remove and expensive to explain.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I would change
&lt;/h2&gt;

&lt;p&gt;Two options, neither urgent:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Give the file a year and a name that changes.&lt;/strong&gt; The build already does this for everything it emits. Import the logo from a module instead of linking to &lt;code&gt;public/logo.svg&lt;/code&gt;, and the framework hashes the name and applies the immutable header for free.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Add a header rule for the small public files.&lt;/strong&gt; A day is plenty for a logo, and it turns a conditional request into no request at all. The rule needs to name the files, since the existing one points at a folder that is not there.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I prefer the first because it removes a class of problem rather than adding a rule to maintain. Option two works today, and has the disadvantage that a changed logo takes up to a day to reach people who already have the old one.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the numbers do not show
&lt;/h2&gt;

&lt;p&gt;They are one location, one network and one edge node, fifteen runs each, so they rank the files and nothing more. I did not test a real browser's behaviour: whether Chrome sends a conditional request for the logo on a back-navigation, a reload or a fresh visit is a different set of rules, and &lt;code&gt;max-age=0&lt;/code&gt; is treated differently on each. And I have not shown that anyone has been hurt by any of this.&lt;/p&gt;

&lt;h2&gt;
  
  
  Check it on your site
&lt;/h2&gt;

&lt;p&gt;Two commands do it. First list the static files a page references, then read their headers:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -s https://pub-trivia.app/ &lt;span class="o"&gt;|&lt;/span&gt; grep -oE &lt;span class="s1"&gt;'(src|href)="/[^"]+"'&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; sort -u
curl -sI https://pub-trivia.app/logo.svg &lt;span class="o"&gt;|&lt;/span&gt; grep -i cache-control
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the build output says a year and your own files say zero, you have the same two-tier arrangement. You can also see the live site it describes: &lt;a href="https://pub-trivia.app" rel="noopener noreferrer"&gt;the homepage&lt;/a&gt; has the logo in the header, &lt;a href="https://pub-trivia.app/pricing" rel="noopener noreferrer"&gt;the pricing page&lt;/a&gt; shows the same one, and &lt;a href="https://pub-trivia.app/tools" rel="noopener noreferrer"&gt;the free tools&lt;/a&gt; are a good place to see the rest of the static output in action.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>performance</category>
      <category>caching</category>
      <category>nextjs</category>
    </item>
    <item>
      <title>I added a tracking query string to all 117 pages of our site, and 115 of them answered from the same cache entry</title>
      <dc:creator>Daniel Pertu</dc:creator>
      <pubDate>Wed, 02 Dec 2026 10:42:17 +0000</pubDate>
      <link>https://dev.to/daniel_pertu/i-added-a-tracking-query-string-to-all-117-pages-of-our-site-and-115-of-them-answered-from-the-1joi</link>
      <guid>https://dev.to/daniel_pertu/i-added-a-tracking-query-string-to-all-117-pages-of-our-site-and-115-of-them-answered-from-the-1joi</guid>
      <description>&lt;p&gt;Every link you share gets decorated. Newsletters add &lt;code&gt;utm_source&lt;/code&gt;, social platforms add &lt;code&gt;fbclid&lt;/code&gt;, a QR code printed on a beer mat gets whatever the printer's tool appends. The page at the other end has to cope with a URL it has never seen, and what "cope" means depends on three things: what the cache keys on, what the canonical says, and what robots says.&lt;/p&gt;

&lt;p&gt;I had never checked any of the three for &lt;a href="https://pub-trivia.app" rel="noopener noreferrer"&gt;pub-trivia.app&lt;/a&gt;, so I did it for every page. The method was dull on purpose: for each of the 117 URLs in &lt;code&gt;sitemap.xml&lt;/code&gt;, request it plain, then request it again with &lt;code&gt;?utm_source=newsletter&amp;amp;fbclid=abc123&lt;/code&gt; on the end, save the headers and the body each time, and compare.&lt;/p&gt;

&lt;h2&gt;
  
  
  The result
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pages    status   cache (plain / with query)   canonical   robots   body
115      200      HIT / HIT                    same        same     identical
2        200      MISS / MISS                  same        same     differs
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Of the 117 pages, 115 are prerendered and behave the same way. The page with the query string gets a cache hit exactly like the page without it, and &lt;code&gt;cache-control: public, max-age=0, must-revalidate&lt;/code&gt; on both. The canonical &lt;code&gt;&amp;lt;link&amp;gt;&lt;/code&gt; on the decorated URL is the clean URL, with no query on it. The robots meta tag is the same on both. And once I strip the deployment id from both bodies, to rule it out as noise, the two match byte for byte on all 115.&lt;/p&gt;

&lt;p&gt;To check this is a property of the cache and not a lucky pair of requests, I fetched one guide page with five different junk query strings and read the response headers:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -sI &lt;span class="s2"&gt;"https://pub-trivia.app/guides/how-to-host-a-pub-quiz?a=1"&lt;/span&gt;
curl -sI &lt;span class="s2"&gt;"https://pub-trivia.app/guides/how-to-host-a-pub-quiz"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Both return &lt;code&gt;x-vercel-cache: HIT&lt;/code&gt;, the same &lt;code&gt;age&lt;/code&gt; (31,336 seconds when I ran them, which is the entry's age, not the request's), the same &lt;code&gt;etag&lt;/code&gt;, the same &lt;code&gt;content-length&lt;/code&gt; of 75,963, and the same &lt;code&gt;x-matched-path&lt;/code&gt;. Run the pair yourself on &lt;a href="https://pub-trivia.app/guides/how-to-host-a-pub-quiz" rel="noopener noreferrer"&gt;any guide&lt;/a&gt; and the &lt;code&gt;age&lt;/code&gt; values will match each other, which is the proof: they are one object. Change the query to a random number and it stays one object.&lt;/p&gt;

&lt;p&gt;That is the useful property. A query string cannot force our server to render a prerendered page. There is no way to say "give me a fresh copy" by decorating the URL, and a crawler that follows ten thousand tracking variants of one link causes zero renders.&lt;/p&gt;

&lt;h2&gt;
  
  
  The two pages that differ
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;/&lt;/code&gt; and &lt;code&gt;/pricing&lt;/code&gt; are the exceptions: both answer &lt;code&gt;x-vercel-cache: MISS&lt;/code&gt;, both send &lt;code&gt;cache-control: private, no-cache, no-store&lt;/code&gt;, and the body differs between the plain and the decorated request.&lt;/p&gt;

&lt;p&gt;I assumed the query string was changing something. It is not. Two plain requests for &lt;a href="https://pub-trivia.app/pricing" rel="noopener noreferrer"&gt;the pricing page&lt;/a&gt; a second apart also differ from each other, and the whole difference is two &lt;code&gt;&amp;lt;meta&amp;gt;&lt;/code&gt; tags that carry per-request tracing identifiers, 428 bytes in total. Remove those two tags from both responses and they are equal. So the difference between "with the query" and "without" is the same as the difference between any two requests, and the query string contributes nothing.&lt;/p&gt;

&lt;p&gt;I will not try to explain why those two pages are rendered per request beyond the obvious: the &lt;a href="https://pub-trivia.app/pricing" rel="noopener noreferrer"&gt;pricing page&lt;/a&gt; shows a price in the visitor's own currency, so it cannot be one shared copy. The query string is not part of that decision.&lt;/p&gt;

&lt;h2&gt;
  
  
  Does the canonical protect us?
&lt;/h2&gt;

&lt;p&gt;It is the only thing that does, and it is enough. The robots meta tag on a decorated URL says the same thing as on the clean one, &lt;code&gt;index, follow&lt;/code&gt;, and &lt;code&gt;robots.txt&lt;/code&gt; has no rule about query strings. So a search engine is allowed to index &lt;code&gt;?utm_source=newsletter&lt;/code&gt; as a separate URL, and what stops it from treating that as a duplicate is the canonical pointing back at the clean address.&lt;/p&gt;

&lt;p&gt;That is how it is supposed to work, and I confirmed it works on all 117 pages rather than on the few I had looked at. The canonical is a strong hint and not an instruction, but a hint that is correct on every page is about as good as the mechanism gets.&lt;/p&gt;

&lt;p&gt;One detail worth noting: the canonical for the homepage has no trailing slash (&lt;code&gt;https://pub-trivia.app&lt;/code&gt;), where the URL in the sitemap has one. That is a different spelling of the same address, and it is consistent everywhere I looked.&lt;/p&gt;

&lt;h2&gt;
  
  
  The length limit
&lt;/h2&gt;

&lt;p&gt;I also asked how long a query string can get before something answers differently, using one static page and the pricing page:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;query length     guide page    pricing page
8,000            200           200
16,000           200           200
32,000           200           200
64,000           414           414
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At 32,000 characters both pages still answer 200, and at 64,000 the edge answers 414 (URI Too Long) before the request reaches either one. Both pages hit the same ceiling, so it belongs to the platform in front of the app and not to anything we wrote. Real tracking parameters are a few hundred characters at most, so this is a curiosity. It is also a single measurement on one day, and I would not build anything on the exact number.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I did not test
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Other parameters.&lt;/strong&gt; I used &lt;code&gt;utm_source&lt;/code&gt; and &lt;code&gt;fbclid&lt;/code&gt; because those are what real links carry. A parameter the application reads would behave differently. None of our prerendered pages read their query string, which is why they all behave identically, but the sign-in pages do read &lt;code&gt;next&lt;/code&gt;, and they are not in the sitemap, so they are not in this census.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Other times and places.&lt;/strong&gt; One fetch from one machine, so the cache status I saw is for the edge node that answered me.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;What Google does with it.&lt;/strong&gt; I know what the pages say. I do not know what the crawler indexes, and Search Console is the place to look at that.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The two-minute version for your site
&lt;/h2&gt;

&lt;p&gt;Pick a few URLs. Request each plain and with &lt;code&gt;?utm_source=test&amp;amp;fbclid=abc&lt;/code&gt;, and compare four things: the cache header, the canonical, the robots tag, and the body size. If the cache status changes, your cache key includes the query and every tracking variant is a fresh render. If the canonical changes, your duplicate handling is broken. Ours does neither, and the cheap way to see it is to open &lt;a href="https://pub-trivia.app/?utm_source=devto" rel="noopener noreferrer"&gt;the homepage&lt;/a&gt;, view source, and read the canonical, which is the clean address with no query on it.&lt;/p&gt;

&lt;p&gt;If you run quiz nights and want a site that behaves this way for your own links, the tools on &lt;a href="https://pub-trivia.app/tools" rel="noopener noreferrer"&gt;the free tools page&lt;/a&gt; work without an account, and &lt;a href="https://pub-trivia.app/faq" rel="noopener noreferrer"&gt;the FAQ&lt;/a&gt; covers the rest.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>seo</category>
      <category>nextjs</category>
      <category>caching</category>
    </item>
    <item>
      <title>The whole .app TLD is on the HSTS preload list, so our http:// redirect only ever serves curl, and our www host sends a different HSTS header from the apex</title>
      <dc:creator>Daniel Pertu</dc:creator>
      <pubDate>Wed, 02 Dec 2026 10:39:12 +0000</pubDate>
      <link>https://dev.to/daniel_pertu/the-whole-app-tld-is-on-the-hsts-preload-list-so-our-http-redirect-only-ever-serves-curl-and-41nn</link>
      <guid>https://dev.to/daniel_pertu/the-whole-app-tld-is-on-the-hsts-preload-list-so-our-http-redirect-only-ever-serves-curl-and-41nn</guid>
      <description>&lt;p&gt;Our site sends &lt;code&gt;strict-transport-security: max-age=63072000; includeSubDomains; preload&lt;/code&gt; on every response. The header lives in &lt;code&gt;next.config.mjs&lt;/code&gt;, with &lt;code&gt;preload&lt;/code&gt; on the end because that is what the snippets say, and I had never checked whether it was doing anything. This week I did.&lt;/p&gt;

&lt;p&gt;The site is &lt;a href="https://pub-trivia.app" rel="noopener noreferrer"&gt;pub-trivia.app&lt;/a&gt;, and the TLD is the interesting part. Google owns &lt;code&gt;.app&lt;/code&gt;, and the whole TLD is on the HSTS preload list. Every &lt;code&gt;.app&lt;/code&gt; domain is treated as HTTPS-only by the major browsers before it has sent a single request. The preload API agrees:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="n"&gt;curl&lt;/span&gt; &lt;span class="err"&gt;-&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="s2"&gt;"https://hstspreload.org/api/v2/status?domain=pub-trivia.app"&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"pub-trivia.app"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"preloaded"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"bulk"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"preloadedDomain"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"app"&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;preloadedDomain: "app"&lt;/code&gt; is the line to read. We are not on the list because we asked to be. We are on it because the parent is. So the &lt;code&gt;preload&lt;/code&gt; token in our header is a request to join a list we are already covered by, and the thing we have been guarding is the one case that cannot happen: a browser asking for &lt;code&gt;http://pub-trivia.app&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What a browser does, and what everything else does
&lt;/h2&gt;

&lt;p&gt;Type &lt;code&gt;http://pub-trivia.app/pricing&lt;/code&gt; into Chrome with the Network tab open. You will see a &lt;code&gt;307 Internal Redirect&lt;/code&gt; with a &lt;code&gt;Non-Authoritative-Reason: HSTS&lt;/code&gt; header on it. That response was made up by the browser, and nothing was sent. The address is rewritten to &lt;code&gt;https://&lt;/code&gt; before any packet leaves the machine. Try it on &lt;a href="https://pub-trivia.app/pricing" rel="noopener noreferrer"&gt;the pricing page&lt;/a&gt;, and then try the same address in &lt;code&gt;curl&lt;/code&gt;, which has no preload list:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="n"&gt;curl&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;si&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="c1"&gt;//pub-trivia.app/pricing&lt;/span&gt;
&lt;span class="no"&gt;HTTP&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mf"&gt;1.0&lt;/span&gt; &lt;span class="mi"&gt;308&lt;/span&gt; &lt;span class="nc"&gt;Permanent&lt;/span&gt; &lt;span class="nc"&gt;Redirect&lt;/span&gt;
&lt;span class="nc"&gt;Location&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;https&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="c1"&gt;//pub-trivia.app/pricing&lt;/span&gt;
&lt;span class="na"&gt;Refresh: 0;url&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;https&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="c1"&gt;//pub-trivia.app/pricing&lt;/span&gt;
&lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Vercel&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That is the response a browser never sees. The &lt;code&gt;http://&lt;/code&gt; listener on our domain exists for command line tools, link checkers, crawlers following an old &lt;code&gt;http&lt;/code&gt; link, and any client without a preload list. It answers with a 308, not our application, and notice what it does not send: there is no &lt;code&gt;strict-transport-security&lt;/code&gt; header on it. That is correct, since browsers ignore the header over plain HTTP, and it means the first hop for these clients carries no HSTS at all.&lt;/p&gt;

&lt;h2&gt;
  
  
  Four shapes, three answers
&lt;/h2&gt;

&lt;p&gt;I requested the same page in four shapes and recorded the status line and the HSTS header of the first response. The last column is the median of twelve full requests with &lt;code&gt;-L&lt;/code&gt;, including the redirects, from one laptop, so treat the milliseconds as a ranking and not a promise.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;request                              first response   HSTS on it                                       median
https://pub-trivia.app/pricing       200              max-age=63072000; includeSubDomains; preload      308 ms
http://pub-trivia.app/pricing        308 to https     none                                              349 ms
https://www.pub-trivia.app/pricing   307 to apex      max-age=63072000                                  407 ms
http://www.pub-trivia.app/pricing    308 to https www none (then 307 to the apex)                       422 ms
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Three things stand out.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The www host sends a different HSTS header.&lt;/strong&gt; The 307 from &lt;code&gt;www&lt;/code&gt; carries &lt;code&gt;max-age=63072000&lt;/code&gt; and nothing else: no &lt;code&gt;includeSubDomains&lt;/code&gt;, no &lt;code&gt;preload&lt;/code&gt;. That header did not come from our config, because our rule is attached to our own responses and this one is a redirect generated by the platform's domain layer. The value is the same two years, so the practical effect is the same. But the header on &lt;code&gt;www&lt;/code&gt; and the header on the apex are authored by two different systems, and if I ever changed ours, the other would not follow.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The www redirect is a 307.&lt;/strong&gt; The &lt;code&gt;http&lt;/code&gt; redirect is a 308, which is permanent, and the &lt;code&gt;www&lt;/code&gt; redirect is a 307, which is temporary. Both end at the apex. Search engines treat the two similarly in practice, but a 307 tells a client not to remember the move, and so every non-browser client repeats the extra hop forever. The response also carries &lt;code&gt;cache-control: public, max-age=0, must-revalidate&lt;/code&gt;, which is an instruction not to reuse it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The extra hops cost 40 to 115 ms here.&lt;/strong&gt; Adding the &lt;code&gt;http&lt;/code&gt; hop costs 41 ms over the direct request, the &lt;code&gt;www&lt;/code&gt; hop 99 ms, and both together 114 ms. Those are small numbers for a client that is not a person, and every one of those clients is a crawler or a script. The people who matter reach the site through the browser, which skips every redirect in the table except the www one.&lt;/p&gt;

&lt;h2&gt;
  
  
  What would be worth changing
&lt;/h2&gt;

&lt;p&gt;Not much, and that is the useful finding:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;The &lt;code&gt;preload&lt;/code&gt; token.&lt;/strong&gt; It is harmless, but it implies a list we are not on. If I rewrote the header today, I would leave it off and add a comment that the TLD does the work. Leaving it also means I cannot be accused of an unfulfilled preload submission, because there is no per-domain entry to maintain.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;includeSubDomains&lt;/code&gt;.&lt;/strong&gt; This is the part with a real consequence. It tells browsers that every subdomain of &lt;code&gt;pub-trivia.app&lt;/code&gt; must be HTTPS as well. Since the TLD is preloaded, that is already true for browsers whether or not we say it, but our header is how a non-preloaded copy of the rule would reach a client that does not ship the list.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The 307 on www.&lt;/strong&gt; If the platform lets me pick the status code for the redirect, 308 is the right one for a move that has been in place since launch.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  What I cannot show you
&lt;/h2&gt;

&lt;p&gt;The Chrome behaviour above is documented and I have seen it, but it is not something &lt;code&gt;curl&lt;/code&gt; can demonstrate, so treat that paragraph as a thing to check in your own browser rather than something I have measured here. I also have not tested Safari or Firefox, which ship their own copies of the list (derived from Chromium's), and which I would expect to behave the same way.&lt;/p&gt;

&lt;p&gt;The timings are one laptop, one network, twelve runs per shape. They rank the four shapes and show that none is slow. They are not a claim about anyone else's connection.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it on your own domain
&lt;/h2&gt;

&lt;p&gt;Three commands cover the whole check:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -s &lt;span class="s2"&gt;"https://hstspreload.org/api/v2/status?domain=YOURDOMAIN"&lt;/span&gt;
curl -si http://YOURDOMAIN/ &lt;span class="o"&gt;|&lt;/span&gt; head -8
curl -si https://www.YOURDOMAIN/ &lt;span class="o"&gt;|&lt;/span&gt; head -8
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the first says &lt;code&gt;preloadedDomain&lt;/code&gt; is your TLD, your own &lt;code&gt;preload&lt;/code&gt; token is decoration. If the second shows a 301 where a 308 would do, or the third shows an HSTS header that differs from your apex, you have found the same small inconsistencies I did. The site they came from is live: start at the &lt;a href="https://pub-trivia.app" rel="noopener noreferrer"&gt;homepage&lt;/a&gt;, look at &lt;a href="https://pub-trivia.app/faq" rel="noopener noreferrer"&gt;the FAQ&lt;/a&gt;, or try &lt;a href="https://pub-trivia.app/tools" rel="noopener noreferrer"&gt;the free tools&lt;/a&gt;, which need no account.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>security</category>
      <category>http</category>
      <category>devops</category>
    </item>
    <item>
      <title>Our type checker reads 2,980 files to check 495 of ours, and the Stripe SDK's types are 1.7 times the size of our whole app</title>
      <dc:creator>Daniel Pertu</dc:creator>
      <pubDate>Wed, 02 Dec 2026 10:37:28 +0000</pubDate>
      <link>https://dev.to/daniel_pertu/our-type-checker-reads-2980-files-to-check-495-of-ours-and-the-stripe-sdks-types-are-17-times-11ep</link>
      <guid>https://dev.to/daniel_pertu/our-type-checker-reads-2980-files-to-check-495-of-ours-and-the-stripe-sdks-types-are-17-times-11ep</guid>
      <description>&lt;p&gt;The repository behind &lt;a href="https://pub-trivia.app" rel="noopener noreferrer"&gt;pub-trivia.app&lt;/a&gt; type checks cleanly. &lt;code&gt;tsc --noEmit&lt;/code&gt; exits 0, and I have been saying "the types are fine" for months without ever asking what the compiler is reading when it says so. This week the dependency bump landed TypeScript 6.0.3 alongside Next 16.4, which gave me a reason to open it up.&lt;/p&gt;

&lt;p&gt;Two flags do all the work: &lt;code&gt;--extendedDiagnostics&lt;/code&gt;, which prints the cost, and &lt;code&gt;--listFilesOnly&lt;/code&gt;, which prints the inputs. Everything below comes from running them on the app's root &lt;code&gt;tsconfig.json&lt;/code&gt;, on a laptop, with Node 24.&lt;/p&gt;

&lt;h2&gt;
  
  
  The headline numbers
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Files:                  2,980
Lines of TypeScript:   68,262
Lines of Library:      59,129
Lines of Definitions: 458,018
Lines of JavaScript:        0
Identifiers:          624,683
Types:                140,418
Instantiations:       536,203
Memory used:          895 MB
Parse time:             0.71 s
Check time:             3.98 s
Total time:             5.86 s
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Our own code is 68,262 lines. The definitions the compiler reads on the way to understanding that code are 458,018. That is a ratio of 6.7 to 1, and it is the number that shapes everything else here: the type checker spends its life reading other people's declarations.&lt;/p&gt;

&lt;h2&gt;
  
  
  2,980 files, 495 of them ours
&lt;/h2&gt;

&lt;p&gt;I filtered the file list into two buckets: paths inside the repository and outside &lt;code&gt;node_modules&lt;/code&gt;, and everything else. Ours is 495 files, or 16.6 per cent of what the compiler opens. Broken down by top level directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;app                218
components         126
utils               47
ws-server           32
lib                 27
__tests__           26
.next                7   (generated route types)
everything else     12
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two things stand out. First, &lt;code&gt;ws-server&lt;/code&gt; is in the list. The root &lt;code&gt;tsconfig.json&lt;/code&gt; includes &lt;code&gt;**/*.ts&lt;/code&gt;, so the web app's type check also reads the standalone server package's 32 files. That package has its own &lt;code&gt;tsconfig.json&lt;/code&gt; and its own &lt;code&gt;tsc&lt;/code&gt; build, which finishes in 1.2 seconds and reads a much smaller program. Nothing is wrong here, but it does mean a type error in that package can fail the root check, and the same file gets checked twice under two different sets of options.&lt;/p&gt;

&lt;p&gt;Second, &lt;code&gt;.next/types&lt;/code&gt; contributes seven generated files. The &lt;code&gt;include&lt;/code&gt; list names &lt;code&gt;.next/types/**/*.ts&lt;/code&gt; and &lt;code&gt;.next/dev/types/**/*.ts&lt;/code&gt;, and on a fresh clone with no build both directories are empty. The config is written for a state that only exists after &lt;code&gt;next dev&lt;/code&gt; or &lt;code&gt;next build&lt;/code&gt; has run.&lt;/p&gt;

&lt;h2&gt;
  
  
  Who owns the other 2,485 files
&lt;/h2&gt;

&lt;p&gt;I measured the line count of every file the compiler lists and grouped by package. These are the biggest:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;package               files    lines
stripe                  228    115,389
typescript (libs)        89     59,040
@types/node              82     52,449
next                    358     41,421
drizzle-orm             600     37,562
lucide-react              1     32,373
csstype                   1     24,113
@sentry/core            259     13,506
lightningcss              3     10,506
ioredis                  21      9,928
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The Stripe SDK's declarations are 115,389 lines, which is 1.7 times everything we wrote. The SDK ships one declaration per API resource and per parameter object, and we touch a handful of them: a checkout session, a subscription, a webhook event. The compiler reads all of them, because TypeScript follows imports to a package's entry point and the entry point re-exports the world.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;lucide-react&lt;/code&gt; is the opposite shape: one file of 32,373 lines, a type declaration for every icon in the set. &lt;code&gt;next.config.mjs&lt;/code&gt; has &lt;code&gt;optimizePackageImports&lt;/code&gt; for it, which helps the bundler, and does nothing for the type checker, which reads the whole declaration regardless of how many icons we import.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;drizzle-orm&lt;/code&gt; is 600 files in 37,562 lines, a different pattern again: lots of small files, which is where parse time goes.&lt;/p&gt;

&lt;p&gt;I counted 113 distinct packages contributing files. The top ten above add up to about 396,000 lines, out of 517,000 for the compiler's library and definition lines together.&lt;/p&gt;

&lt;h2&gt;
  
  
  Warm is 2.4 seconds, cold is 6.5
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;tsconfig.json&lt;/code&gt; sets &lt;code&gt;incremental: true&lt;/code&gt;, and a tsbuildinfo file is written next to it. It is 847,593 bytes, and &lt;code&gt;.gitignore&lt;/code&gt; covers &lt;code&gt;*.tsbuildinfo&lt;/code&gt;, so it is never committed. I timed three runs each way:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;without incremental:   6.42 s   6.58 s   6.52 s
with incremental:      6.61 s   2.44 s   2.46 s
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first incremental run pays the full price and writes the file. The next two take 2.4 seconds, which is 63 per cent less, with nothing changed. The caveat in that figure is the last three words. A warm run with no edits is the best case, and the real number for an edit-and-check loop sits between 2.4 and 6.5 depending on how far the change ripples.&lt;/p&gt;

&lt;p&gt;The two methods agree where they should: both exit 0, and both read the same 2,980 files. Incremental mode saves the checking, not the reading. The reading is what the next section is about.&lt;/p&gt;

&lt;h2&gt;
  
  
  The flag that does nothing
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;allowJs: true&lt;/code&gt; is in our config. The diagnostics say &lt;code&gt;Lines of JavaScript: 0&lt;/code&gt;. There is no JavaScript in the program, so the flag has no effect on it.&lt;/p&gt;

&lt;p&gt;I would have guessed this was a leftover from the template that created the project, and I think it is, but I cannot prove it from the tree. The practical consequence of removing it would be that a stray &lt;code&gt;.js&lt;/code&gt; file added later stops being type checked, which is mostly an argument for deleting it and discovering that the build breaks.&lt;/p&gt;

&lt;p&gt;Equally, &lt;code&gt;target: "ES2017"&lt;/code&gt; is quite conservative for a project whose &lt;code&gt;lib&lt;/code&gt; is &lt;code&gt;esnext&lt;/code&gt; and whose server runs on Node 24. The compiler does not emit anything here (&lt;code&gt;noEmit: true&lt;/code&gt;), so the target only changes which syntax the checker will accept without an error, and I would expect nothing to change if it moved. I did not change it, because I did not measure it, and that is the honest summary of this paragraph.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I would do about the 2,980
&lt;/h2&gt;

&lt;p&gt;Nothing, mostly. 6.5 seconds cold and 2.4 warm for a 68,000 line application is not a problem, and &lt;code&gt;skipLibCheck: true&lt;/code&gt; is already on, which is the flag that stops the compiler from checking those 458,000 definition lines for internal errors. It still has to parse them, and the 0.71 second parse time is that cost.&lt;/p&gt;

&lt;p&gt;The one change I would consider is splitting the &lt;code&gt;include&lt;/code&gt; so that the web app's check does not walk into &lt;code&gt;ws-server&lt;/code&gt;, which already has its own build. That would cut 32 files from a program of 2,980 and save very little time. The reason to do it is the duplicate check, not the speed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Run it on your own repo
&lt;/h2&gt;

&lt;p&gt;You need two commands, and a few lines of scripting to group the output by package:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx tsc --noEmit --extendedDiagnostics --incremental &lt;span class="kc"&gt;false&lt;/span&gt;
npx tsc --noEmit --listFilesOnly
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first number to look at is the ratio of &lt;code&gt;Lines of TypeScript&lt;/code&gt; to &lt;code&gt;Lines of Definitions&lt;/code&gt;. Ours is 1 to 6.7. If yours is much lower, you probably have a dependency with a small footprint and a lot of your own code, and if it is much higher, one package is probably dominating, and &lt;code&gt;--listFilesOnly&lt;/code&gt; will say which.&lt;/p&gt;

&lt;p&gt;If you want to see what all those lines are type checking, the app is live: &lt;a href="https://pub-trivia.app" rel="noopener noreferrer"&gt;the homepage&lt;/a&gt; has a demo you can play, &lt;a href="https://pub-trivia.app/tools" rel="noopener noreferrer"&gt;the tools page&lt;/a&gt; holds the free utilities that run in your browser, and &lt;a href="https://pub-trivia.app/pricing" rel="noopener noreferrer"&gt;pricing&lt;/a&gt; shows the checkout the Stripe types are there for. The free tier needs no card.&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>nextjs</category>
      <category>performance</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Twelve pnpm exemptions for a Next.js version we have not installed in 181 days, and four override lines that turned out to be floors</title>
      <dc:creator>Daniel Pertu</dc:creator>
      <pubDate>Wed, 02 Dec 2026 10:35:41 +0000</pubDate>
      <link>https://dev.to/daniel_pertu/twelve-pnpm-exemptions-for-a-nextjs-version-we-have-not-installed-in-181-days-and-four-override-3l8h</link>
      <guid>https://dev.to/daniel_pertu/twelve-pnpm-exemptions-for-a-nextjs-version-we-have-not-installed-in-181-days-and-four-override-3l8h</guid>
      <description>&lt;p&gt;pnpm 11 holds back any package version that was published less than a day ago. The setting is &lt;code&gt;minimumReleaseAge&lt;/code&gt;, it defaults to 1,440 minutes, and it exists so that a freshly published malicious release has a day to be noticed before your install picks it up. The companion setting, &lt;code&gt;minimumReleaseAgeExclude&lt;/code&gt;, is the escape hatch: a list of exact versions that may skip the wait.&lt;/p&gt;

&lt;p&gt;I wrote about that gate once already, from an Expo monorepo where the exclude list was nine pinned versions. This time the subject is the web app behind &lt;a href="https://pub-trivia.app" rel="noopener noreferrer"&gt;pub-trivia.app&lt;/a&gt;, which has a smaller &lt;code&gt;pnpm-workspace.yaml&lt;/code&gt; and a more embarrassing result.&lt;/p&gt;

&lt;p&gt;The file has three jobs: it lists the one workspace package (&lt;code&gt;ws-server&lt;/code&gt;), it carries the build-script allowlist and the overrides, and it carries the exclude list. On 30 November I bumped the dependencies and the file grew four lines. So I read the whole thing against the lockfile.&lt;/p&gt;

&lt;h2&gt;
  
  
  The exclude list names versions that are not in the lockfile
&lt;/h2&gt;

&lt;p&gt;Twelve entries:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@next/env@15.5.19
@next/eslint-plugin-next@15.5.19
@next/swc-darwin-arm64@15.5.19
@next/swc-darwin-x64@15.5.19
@next/swc-linux-arm64-gnu@15.5.19
@next/swc-linux-arm64-musl@15.5.19
@next/swc-linux-x64-gnu@15.5.19
@next/swc-linux-x64-musl@15.5.19
@next/swc-win32-arm64-msvc@15.5.19
@next/swc-win32-x64-msvc@15.5.19
eslint-config-next@15.5.19
next@15.5.19
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Eight of them are the platform binaries for Next's compiler, one per operating system and CPU pair, and the other four are the framework and its two companion packages. This is what an exclude list for a framework release looks like: you list the package and every one of its optional binaries, because a half-excluded release is a failed install.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;grep -c 15.5.19 pnpm-lock.yaml&lt;/code&gt; returns 0. The lockfile resolves Next to 16.4.6, with &lt;code&gt;@next/env@16.4.6&lt;/code&gt; and the same eight binaries at that version. Nothing in the tree is at 15.5.19.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git log -S&lt;/code&gt; explains how that happened. The list was in the initial commit on 2 June, when &lt;code&gt;package.json&lt;/code&gt; said Next 15.5. Two days later, on 4 June, the framework moved to 16 and the exclude list stayed behind. It has been dead for 181 days and has survived every one of the commits since, including the one that touched the file on 30 November.&lt;/p&gt;

&lt;h2&gt;
  
  
  What a dead exemption costs
&lt;/h2&gt;

&lt;p&gt;Nothing, today. An exclude entry that matches no installed version does not do anything. That is the honest answer, and I would rather give it than inflate the finding.&lt;/p&gt;

&lt;p&gt;The cost is what the list says to the next person who opens the file. It reads as "we deliberately bypass the release-age gate for Next". We do not, and cannot, for the version we run. Next 16.4.6 installed through the normal one day gate, which is how the setting is meant to work.&lt;/p&gt;

&lt;p&gt;There is a second cost, which is the format. If a Next security patch lands and we want it inside the day, this list is where the entry goes, and the twelve lines above are the template for the right shape: the package, the two companions, and eight binaries. A stale copy of that template at least saves me typing it out, which is the only thing I can say in its favour.&lt;/p&gt;

&lt;p&gt;I have not deleted it. The post is about what the file claims, and I would rather leave the file as it is for the moment and make the correction a separate commit.&lt;/p&gt;

&lt;h2&gt;
  
  
  The four new override lines
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;overrides&lt;/code&gt; block had two entries until last week, pinning &lt;code&gt;@types/react&lt;/code&gt; and &lt;code&gt;@types/react-dom&lt;/code&gt; to exact versions so the types match the runtime. The dependency commit added four:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight toml"&gt;&lt;code&gt;&lt;span class="n"&gt;fast&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;uri&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="mf"&gt;3.1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;9&lt;/span&gt;
&lt;span class="n"&gt;browserslist&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="mf"&gt;4.28&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;
&lt;span class="n"&gt;baseline&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;browser&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;mapping&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="mf"&gt;2.11&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;
&lt;span class="n"&gt;vite&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="mf"&gt;8.1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;None of these is a package we import. &lt;code&gt;pnpm why&lt;/code&gt; shows where each comes from:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;fast-uri&lt;/code&gt; arrives through &lt;code&gt;ajv&lt;/code&gt;, which arrives through &lt;code&gt;schema-utils&lt;/code&gt; and webpack, which arrives through the Sentry build plugin.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;browserslist&lt;/code&gt; and &lt;code&gt;baseline-browser-mapping&lt;/code&gt; arrive through Babel's compilation targets, the Sentry plugin, the lint config's React hooks plugin, and &lt;code&gt;styled-jsx&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;vite&lt;/code&gt; has exactly one route in: through &lt;code&gt;@vitest/mocker&lt;/code&gt; and &lt;code&gt;vitest&lt;/code&gt;. We use vitest for the unit tests, so vite is a test runner's dependency, not part of anything that ships.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;An override of this shape is a floor. It does not say "use this version", it says "never resolve below it". Here is what each floor resolves to in today's lockfile:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;package                    override     installed
fast-uri                   ^3.1.9       3.1.9
browserslist               ^4.28.7      4.29.6
baseline-browser-mapping   ^2.11.0      2.11.40
vite                       ^8.1.6       8.4.0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Only &lt;code&gt;fast-uri&lt;/code&gt; sits exactly on its floor. &lt;code&gt;browserslist&lt;/code&gt; is a minor version above it, &lt;code&gt;vite&lt;/code&gt; is three minors above, and &lt;code&gt;baseline-browser-mapping&lt;/code&gt; is forty patch releases above. That is how a floor behaves: the lockfile moves up on its own, and the override only stops it moving down.&lt;/p&gt;

&lt;p&gt;That makes these lines hard to read. A reader sees four packages named and reasonably assumes four problems were fixed. What the commit message says is that it aligned the lockfile with the overrides, which is true, and which does not say why the overrides are there. I do not know, and nothing in the file tells me.&lt;/p&gt;

&lt;p&gt;If they were added to pull in a security fix, the version in the override should be the patched version and a comment should name the advisory. If they were added to stop duplicate copies, the right tool is &lt;code&gt;pnpm dedupe&lt;/code&gt;, and &lt;code&gt;pnpm why vite&lt;/code&gt; printing "Found 1 version of vite" suggests the floor did something. Either way, a four line block with no reasons is a trap for a future cleanup.&lt;/p&gt;

&lt;h2&gt;
  
  
  What an override cannot do
&lt;/h2&gt;

&lt;p&gt;While checking, I ran &lt;code&gt;pnpm audit&lt;/code&gt;. It reports five moderate advisories, in packages that arrive transitively through build and dev tooling. An override can raise a floor for a package that is below the fixed version, but the advisories I looked at are not helped by the four lines above, and none of the four packages is one of them. So the block should not be read as a response to the audit.&lt;/p&gt;

&lt;p&gt;I am deliberately not listing the advisories, since a post is a poor place to publish an open findings list. The point is only that "we added overrides" and "we cleared the audit" are different claims, and the diff only supports the first.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I would put in the file
&lt;/h2&gt;

&lt;p&gt;Three changes, in order of cost:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Delete the twelve exclusions, because nothing installed matches them.&lt;/li&gt;
&lt;li&gt;Put a one line comment above each override naming the reason, or delete the override.&lt;/li&gt;
&lt;li&gt;Set &lt;code&gt;minimumReleaseAge&lt;/code&gt; explicitly, even to the default of 1,440. Today the gate is on by omission, which is the weakest way for a security control to exist, and a future pnpm that changes the default would change our posture without a diff.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You cannot check any of this from the outside, since the file is in a private repository. What you can check is the product the file builds. &lt;a href="https://pub-trivia.app" rel="noopener noreferrer"&gt;The homepage&lt;/a&gt; loads a playable demo, &lt;a href="https://pub-trivia.app/tools" rel="noopener noreferrer"&gt;the free tools&lt;/a&gt; run entirely in your browser, and the free tier needs no card. If you have a workspace file of your own, &lt;code&gt;grep&lt;/code&gt; it for exact versions and then grep your lockfile for the same strings. Zero hits means you have an exemption for something you do not run.&lt;/p&gt;

</description>
      <category>pnpm</category>
      <category>nextjs</category>
      <category>javascript</category>
      <category>security</category>
    </item>
    <item>
      <title>Our deployment id went from 6,052 mentions to 248 after a dependency bump, and no line of our code changed</title>
      <dc:creator>Daniel Pertu</dc:creator>
      <pubDate>Wed, 02 Dec 2026 10:34:33 +0000</pubDate>
      <link>https://dev.to/daniel_pertu/our-deployment-id-went-from-6052-mentions-to-131-after-a-dependency-bump-and-no-line-of-our-code-2213</link>
      <guid>https://dev.to/daniel_pertu/our-deployment-id-went-from-6052-mentions-to-131-after-a-dependency-bump-and-no-line-of-our-code-2213</guid>
      <description>&lt;p&gt;On 2 November I wrote about a query string. Every asset URL on pub-trivia.app carried &lt;code&gt;?dpl=&lt;/code&gt; followed by a deployment id, and I counted it 6,052 times across 72 pages. The point of that post was that the id changes on every deploy, so every deploy hands every returning visitor a cold cache for files that did not change.&lt;/p&gt;

&lt;p&gt;On 30 November I committed a dependency bump: Next went from 16.2.7 to 16.4.6, along with the Radix, Sentry, Supabase and Stripe packages. It touched &lt;code&gt;package.json&lt;/code&gt;, the lockfile, and a four-line addition to &lt;code&gt;pnpm-workspace.yaml&lt;/code&gt;. It touched nothing under &lt;code&gt;app/&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Today I fetched all 117 pages in the sitemap again and ran the same count. This post is the diff, and the part where I correct myself.&lt;/p&gt;

&lt;p&gt;You can follow along on any page. Open &lt;a href="https://pub-trivia.app/pricing" rel="noopener noreferrer"&gt;pub-trivia.app/pricing&lt;/a&gt;, view source, and search for &lt;code&gt;dpl=&lt;/code&gt;. I will tell you what you should find.&lt;/p&gt;

&lt;h2&gt;
  
  
  The numbers
&lt;/h2&gt;

&lt;p&gt;Same method as before: &lt;code&gt;curl --compressed&lt;/code&gt; on every URL in &lt;code&gt;sitemap.xml&lt;/code&gt;, then a regex over the saved HTML. The earlier figures come from my two earlier posts, so the pages in scope differ (72 then, 117 now). I have used per-page figures where the page count matters.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                                   before                  2 Dec (117 pages)
?dpl= occurrences                  6,052 (72 pages, 2 Nov)  131
  per page                         about 84                 1.1
deployment id, any form            not counted              248 (131 + 117 data-dpl-id)
script tags with a src             2,258 (30 Nov)           2,372
inline script tags                 2,525 (30 Nov)           783
/pricing script tags               44 (30 Nov)              29
/pricing document bytes            102,010 (30 Nov)         95,321
distinct /_next/ paths in HTML     44 (30 Nov, all root-    38
                                   relative paths)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The 30 November figures come from the census I published that day, over the same 117 pages. So the script rows are a direct before and after, and the inline count dropped from 2,525 to 783, a fall of 69 per cent, while the external script count rose by 114.&lt;/p&gt;

&lt;p&gt;Where do the 131 remaining &lt;code&gt;dpl=&lt;/code&gt; occurrences live? 114 of them are the logo: &lt;code&gt;/logo.svg?dpl=...&lt;/code&gt; in the header image, one per page. The other 17 are on the homepage, which carries 18 in total, because its image preloads are written with the id. The three legal pages, which get the compact footer and no header image, have none.&lt;/p&gt;

&lt;p&gt;I first wrote that the id had gone from everywhere else, and that was wrong. Counting the bare &lt;code&gt;dpl_&lt;/code&gt; string instead of &lt;code&gt;dpl=&lt;/code&gt; gives 248 occurrences, because every one of the 117 pages also carries it once as a &lt;code&gt;data-dpl-id&lt;/code&gt; attribute on the &lt;code&gt;&amp;lt;html&amp;gt;&lt;/code&gt; tag. So the three legal pages do name the deployment, once each, and the real total is 248, about 2.1 per page, against 6,052 across 72 pages.&lt;/p&gt;

&lt;p&gt;So the id has not gone away. It is gone from every script and stylesheet reference, and what remains is the image URLs and one attribute per page.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the script URLs look like now
&lt;/h2&gt;

&lt;p&gt;Here is how to see the new shape yourself:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -s https://pub-trivia.app/pricing &lt;span class="o"&gt;|&lt;/span&gt; grep -o &lt;span class="s1"&gt;'/_next/static/immutable/chunks/[^"]*\.js'&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; head -3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Every one of the 37 static paths in the HTML now sits under &lt;code&gt;/_next/static/immutable/&lt;/code&gt;, a folder name that did not exist in our output before. The chunk file names are short content hashes with no query string. Fetch one and read the headers:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -sI https://pub-trivia.app/_next/static/immutable/chunks/&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;one of the names above&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You get &lt;code&gt;cache-control: public,max-age=31536000,immutable&lt;/code&gt; and an &lt;code&gt;etag&lt;/code&gt; that is just the file's own path. The folder is named for the policy it carries.&lt;/p&gt;

&lt;p&gt;I also repeated the experiment from the earlier post, asking for the same chunk three ways: bare, with &lt;code&gt;?dpl=nonsense&lt;/code&gt;, and with the real id. All three answered 200 with the same 28,850 bytes. The server ignores the query on these files, as it did before, but now the HTML does not bother sending it.&lt;/p&gt;

&lt;p&gt;The logo is a different case. &lt;code&gt;/logo.svg&lt;/code&gt; answers with &lt;code&gt;cache-control: public, max-age=0, must-revalidate&lt;/code&gt;, with or without the query, so the one asset that still carries a deployment id is the one that revalidates on every visit regardless. That is a &lt;code&gt;public/&lt;/code&gt; file, not a build output, and the headers for it are a separate decision from anything in the bump.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I claimed, and what I can now say
&lt;/h2&gt;

&lt;p&gt;In the earlier post I wrote that the cost of the query string was one cold cache per deploy: 456 KB of JavaScript, correctly cached and then discarded because its URL changed. I can no longer say that about the current output, because the URL is now a function of the file's content rather than of the deployment.&lt;/p&gt;

&lt;p&gt;But I have to be careful about what I have actually shown. I have shown the shape of the HTML and the headers on one deploy. I have not shown what happens on the next deploy, because there has not been one yet. The claim "unchanged chunks keep their URLs across deploys" follows from the names being content hashes, and it is the claim I would bet on, but it is a prediction until the second deploy exists. To make it checkable, here are three chunk names from today's &lt;code&gt;/pricing&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;14qlqcx-itjdn.js
0l6a80_l7i7xs.js
18b76hi3rltfx.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After our next deploy, run the &lt;code&gt;grep&lt;/code&gt; above again. If a name from this list is still there, the cold-cache cost is gone. If all three have changed, I was wrong and the hash includes something deploy-specific.&lt;/p&gt;

&lt;p&gt;I also cannot tell you from outside that the bump is what changed the output. I can see that the HTML changed shape between 30 November and today and that the only commit in between is a dependency bump that moved Next across two minor versions. That is a strong correlation with one data point, and I have not diffed the two build outputs.&lt;/p&gt;

&lt;h2&gt;
  
  
  The inline scripts are the surprise
&lt;/h2&gt;

&lt;p&gt;I expected the query string to move. I did not expect the inline &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; count to fall by 69 per cent.&lt;/p&gt;

&lt;p&gt;On the 30 November census, the 117 pages carried 2,525 inline scripts between them, about 22 per page. Now they carry 783: 5 to 8 per page, with a median of 7. The external ones went up a little, from 2,258 to 2,372, so the page is not merely moving the same work around. The &lt;code&gt;/pricing&lt;/code&gt; document lost 6,689 bytes (102,010 down to 95,321), about 6.6 per cent, and the whole set of 117 documents now totals 9,158,662 bytes, a median of 77,005 and a maximum of 157,868 (the homepage).&lt;/p&gt;

&lt;p&gt;I do not know why. Inline scripts in this kind of page are how the framework streams its server-rendered payload into the document, and I would guess the new version batches them, but I have not read the changelog closely enough to say so, and a guess in a post is how the last correction came about. What I can say is that the number of places in our HTML where a script has to be parsed before it can be skipped is a third of what it was, and that I did nothing to cause it.&lt;/p&gt;

&lt;h2&gt;
  
  
  What did not change
&lt;/h2&gt;

&lt;p&gt;Plenty stayed put, which is worth listing because "everything is faster" would be the wrong takeaway:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;link: rel=preload&lt;/code&gt; header for the two font files is still on the homepage response, with the same font paths now under the new folder.&lt;/li&gt;
&lt;li&gt;The response headers we set in &lt;code&gt;next.config.mjs&lt;/code&gt; (HSTS, &lt;code&gt;nosniff&lt;/code&gt;, &lt;code&gt;X-Frame-Options&lt;/code&gt;, the referrer and permissions policies) are all present and unchanged.&lt;/li&gt;
&lt;li&gt;The HTML itself is still &lt;code&gt;cache-control: private, no-cache, no-store, max-age=0, must-revalidate&lt;/code&gt; on the homepage, as it was.&lt;/li&gt;
&lt;li&gt;There are still no iframes and no forms in the 117 documents.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why this is the cheapest kind of win
&lt;/h2&gt;

&lt;p&gt;The lesson I take from this is not about Next. A configuration that existed for the framework's own reasons (skew protection, in this case) cost us a measurable amount for a long time, and the fix arrived as a passenger on a maintenance commit. A dependency bump is a thing to measure on both sides: before and after, on every page, with the same script. If I had not rerun the census, I would still be telling people about a cold cache that no longer exists.&lt;/p&gt;

&lt;p&gt;You can run the whole thing yourself in a few lines. Fetch &lt;code&gt;https://pub-trivia.app/sitemap.xml&lt;/code&gt;, request each URL, and count &lt;code&gt;dpl=&lt;/code&gt;, &lt;code&gt;&amp;lt;script&lt;/code&gt;, and &lt;code&gt;/_next/static/immutable/&lt;/code&gt; in the saved HTML. The same pages are the ones you can browse: &lt;a href="https://pub-trivia.app/pricing" rel="noopener noreferrer"&gt;pricing&lt;/a&gt;, &lt;a href="https://pub-trivia.app/tools" rel="noopener noreferrer"&gt;the free tools&lt;/a&gt;, and &lt;a href="https://pub-trivia.app/faq" rel="noopener noreferrer"&gt;the FAQ&lt;/a&gt; are good places to start, and the whole site is on the &lt;a href="https://pub-trivia.app" rel="noopener noreferrer"&gt;PubTrivia homepage&lt;/a&gt;, which has a free tier that needs no card if you would like to try the product the pages describe.&lt;/p&gt;

&lt;p&gt;If you find a chunk name that survives our next deploy, you have just confirmed the part of this post that I could only predict.&lt;/p&gt;

</description>
      <category>nextjs</category>
      <category>webdev</category>
      <category>performance</category>
      <category>caching</category>
    </item>
  </channel>
</rss>
