<?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: LubuSeb</title>
    <description>The latest articles on DEV Community by LubuSeb (@lubuseb).</description>
    <link>https://dev.to/lubuseb</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%2F4059178%2F1b19713e-e615-48ab-904d-6397a0e4a844.jpg</url>
      <title>DEV Community: LubuSeb</title>
      <link>https://dev.to/lubuseb</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/lubuseb"/>
    <language>en</language>
    <item>
      <title>I Built a Snowflake Search Desk for Missing Dogs. Its Most Important Result Is "No Match."</title>
      <dc:creator>LubuSeb</dc:creator>
      <pubDate>Fri, 14 Aug 2026 20:37:03 +0000</pubDate>
      <link>https://dev.to/lubuseb/i-built-a-snowflake-search-desk-for-missing-dogs-its-most-important-result-is-no-match-5ao9</link>
      <guid>https://dev.to/lubuseb/i-built-a-snowflake-search-desk-for-missing-dogs-its-most-important-result-is-no-match-5ao9</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for &lt;a href="https://dev.to/challenges/weekend-2026-08-13"&gt;Weekend Challenge: Dog Days Edition&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;AI disclosure: I used Codex extensively to implement, test and review this project, and to draft this post. I verified the public build, the live Snowflake execution and every numerical claim below.&lt;/em&gt;&lt;/p&gt;

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

&lt;p&gt;When a dog goes missing, the words used by owners and shelters rarely line up perfectly. "Gray" may arrive as "silver." "Border Collie mix" may be recorded as "Border Collie." A nearby intake can be easy to miss.&lt;/p&gt;

&lt;p&gt;A weak resemblance can also create false hope.&lt;/p&gt;

&lt;p&gt;I built &lt;strong&gt;Bark Back Home&lt;/strong&gt;, a missing-dog search desk that compares a structured report with Austin Animal Center's public intake data. It returns a short ranked list, explains every point in the score and refuses to select a candidate when evidence is weak, conflicting or too close to another result.&lt;/p&gt;

&lt;p&gt;The three sample missing-dog reports are fictional. The app does not collect owner names, contact details, photos or exact home addresses. Shelter candidates come from public records, but a ranked result is never presented as an identification.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Bark Back Home can say which public record deserves human review. It cannot say that the shelter dog is yours.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmgrvts9pyov16n5ctsij.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmgrvts9pyov16n5ctsij.png" alt="Bark Back Home public fixture demo" width="800" height="433"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://lubuseb.github.io/bark-back-home/" rel="noopener noreferrer"&gt;Open the fixture-backed interactive demo&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/LubuSeb/bark-back-home/blob/codex/bark-back-home/docs/hackathon-build/live-snowflake-proof.md" rel="noopener noreferrer"&gt;Read the live Snowflake proof and query receipts&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The hosted demo is deliberately fixture-only. It never receives a Snowflake key and cannot create warehouse spend. Its header and every result label say &lt;strong&gt;Offline fixture&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The live acceptance run exercised the same application API against Snowflake through a local, least-privilege service. The main report was Luna: a fictional male, black-and-white Border Collie mix last seen in ZIP &lt;code&gt;78613&lt;/code&gt;. Snowflake ranked public intake record &lt;code&gt;31498&lt;/code&gt; first with a score of &lt;strong&gt;100&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The interface exposes the breed, color, sex, location and timing contributions instead of reducing the result to an unexplained confidence number. The record still needs to be checked with the shelter using its public animal ID.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbhrqv7ll7qoj4lk1z5z0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbhrqv7ll7qoj4lk1z5z0.png" alt="The public fixture showing the same positive decision path" width="800" height="433"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The live Snowflake search produced query ID &lt;code&gt;01c66412-0005-6537-0000-0001966e91b9&lt;/code&gt;; its four-source lineage query was &lt;code&gt;01c66413-0005-642d-0000-0001966e71c9&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;I then ran Scout, the fictional negative control. The leading live candidate scored &lt;strong&gt;65.3&lt;/strong&gt;, below the automatic threshold of 78, and had conflicting breed evidence. Snowflake selected no candidate. The hosted fixture makes the same behavior easy to replay with a harsher contradiction:&lt;/p&gt;

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

&lt;p&gt;That is the result I care about most. A matching system should demonstrate not only what it can retrieve, but also when it will stop.&lt;/p&gt;

&lt;h2&gt;
  
  
  Code
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/LubuSeb/bark-back-home" rel="noopener noreferrer"&gt;Source code, tests and reproduction instructions&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The application uses React and TypeScript for the case-file interface, an Express API, the Snowflake Node SDK with key-pair authentication, and checked-in SQL for setup, loading, modeling, contracts and parameterized ranking.&lt;/p&gt;

&lt;p&gt;The repository's first commit was made on August 14 after the challenge opened. The final gate includes &lt;strong&gt;62 tests across nine files&lt;/strong&gt;, TypeScript checking, a production build and a dependency audit with zero known vulnerabilities. GitHub Actions independently reruns the complete gate before deploying the fixture demo.&lt;/p&gt;

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

&lt;p&gt;Snowflake is the matching system, not a database logo attached afterward.&lt;/p&gt;

&lt;p&gt;The live run loaded four City of Austin feeds:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feed&lt;/th&gt;
&lt;th&gt;Rows&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Current intakes&lt;/td&gt;
&lt;td&gt;5,586&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Current outcomes&lt;/td&gt;
&lt;td&gt;5,643&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Historical intakes&lt;/td&gt;
&lt;td&gt;94,608&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Historical outcomes&lt;/td&gt;
&lt;td&gt;94,505&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Total&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;200,342&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Snowflake normalizes breed, color, sex, ZIP and timestamps. It removes current intakes that have a later outcome, calculates historical return-to-owner context and produced &lt;strong&gt;551 unresolved current dog records&lt;/strong&gt; for this run.&lt;/p&gt;

&lt;p&gt;Each candidate receives inspectable contributions:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Factor&lt;/th&gt;
&lt;th&gt;Weight&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Breed&lt;/td&gt;
&lt;td&gt;32&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Color&lt;/td&gt;
&lt;td&gt;20&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Location&lt;/td&gt;
&lt;td&gt;18&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Sex&lt;/td&gt;
&lt;td&gt;16&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Time&lt;/td&gt;
&lt;td&gt;14&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A high aggregate score is not enough. Automatic selection also requires at least 60% evidence coverage, no hard chronology or known-sex conflict, and an eight-point lead over the runner-up. Snowflake performs retrieval and ranking. The shared application matcher checks the safety gates again before the interface can show a possible match.&lt;/p&gt;

&lt;p&gt;The first live model execution found a real integration bug. Snowflake inferred &lt;code&gt;NUMBER(16,6)&lt;/code&gt; inside a SQL function declared to return &lt;code&gt;FLOAT&lt;/code&gt;. Explicitly casting the complete result repaired the function. The automated gate stayed green, and the live model then passed all &lt;strong&gt;17 SQL contracts&lt;/strong&gt;: four timezone cases, four ZIP-extraction cases and nine breed/color parity cases.&lt;/p&gt;

&lt;p&gt;I used separate review passes to challenge the matcher, current public-feed schema, privacy boundary and live Snowflake path. A finding counted only when it could be reproduced as a test, SQL contract or browser-visible failure.&lt;/p&gt;

&lt;p&gt;The API authenticates with an encrypted key pair through the dedicated &lt;code&gt;BARK_BACK_HOME_APP&lt;/code&gt; role. Query history showed both searches and both lineage queries completing under that role:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F48bqdv7w135okqxbk1hg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F48bqdv7w135okqxbk1hg.png" alt="Four successful Snowflake app-role query receipts. The worksheet role inspected account history; ROLE_NAME shows the role that executed each application query." width="799" height="390"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A direct application-role query against a raw ingest table was denied. The public-facing path can read modeled views and functions, not the staged raw payloads.&lt;/p&gt;

&lt;p&gt;The current refresh is intentionally modest: validated truncate-and-copy loading for a private hackathon demonstration. A continuously operated service should replace it with shadow tables and an atomic swap.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prize Categories
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Best Use of Snowflake&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This is the only technology category I am entering.&lt;/p&gt;

&lt;p&gt;Snowflake performs the central work: loading four public datasets, normalizing inconsistent descriptions, filtering resolved records, calculating historical context, ranking candidates and retaining query and lineage receipts for the answer shown to the user.&lt;/p&gt;

&lt;p&gt;Without Snowflake, Bark Back Home is a case-file interface. With Snowflake, it becomes an explainable public-record search desk, including the ability to say that the responsible answer is to keep looking.&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>weekendchallenge</category>
      <category>snowflake</category>
      <category>webdev</category>
    </item>
    <item>
      <title>One Event-Loop Turn, One False Redis Capacity Error</title>
      <dc:creator>LubuSeb</dc:creator>
      <pubDate>Sun, 09 Aug 2026 13:37:02 +0000</pubDate>
      <link>https://dev.to/lubuseb/one-event-loop-turn-one-false-redis-capacity-error-3hp3</link>
      <guid>https://dev.to/lubuseb/one-event-loop-turn-one-false-redis-capacity-error-3hp3</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for &lt;a href="https://dev.to/bugsmash"&gt;DEV's Summer Bug Smash: Clear the Lineup&lt;/a&gt; powered by &lt;a href="https://sentry.io/" rel="noopener noreferrer"&gt;Sentry&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Project Overview
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/redis/redis-py" rel="noopener noreferrer"&gt;redis-py&lt;/a&gt; is the Python client for Redis. Its asynchronous cluster implementation maintains a per-node connection pool with an in-use set, a free queue, and optional &lt;code&gt;max_connections&lt;/code&gt; capacity.&lt;/p&gt;

&lt;p&gt;The bug was not a leaked connection or a deadlock. It was one event-loop turn in which a usable pool slot existed in neither place.&lt;/p&gt;

&lt;h2&gt;
  
  
  Bug Fix or Performance Improvement
&lt;/h2&gt;

&lt;p&gt;An active async cluster connection can be marked for reconnect while a previous disconnect is still waiting for the socket to close. The disconnect clears the reconnect flag before it suspends, but another error or maintenance notification can mark the connection again during that wait.&lt;/p&gt;

&lt;p&gt;By the time &lt;code&gt;ClusterNode.release()&lt;/code&gt; receives it, the connection is closed but marked again.&lt;/p&gt;

&lt;p&gt;The old release path treated every marked connection the same:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;connection&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;should_reconnect&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="n"&gt;task&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;asyncio&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create_task&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;_disconnect_and_release&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;connection&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_background_tasks&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;task&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;task&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add_done_callback&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_background_tasks&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;discard&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;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_free&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;connection&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For an already-closed connection, the second disconnect performs no I/O. Its only useful operation is appending the connection to &lt;code&gt;_free&lt;/code&gt;, and that operation is deferred until the background task runs.&lt;/p&gt;

&lt;p&gt;At &lt;code&gt;max_connections=1&lt;/code&gt;, a concurrent acquire in that gap sees:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;_free is empty
len(_connections) == max_connections
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and raises &lt;code&gt;MaxConnectionsError&lt;/code&gt;. Capacity is about to return, but the caller receives a real application error first.&lt;/p&gt;

&lt;h2&gt;
  
  
  Code
&lt;/h2&gt;

&lt;p&gt;The diagnosis and proposed directions came from &lt;a href="https://github.com/redis/redis-py/issues/4247" rel="noopener noreferrer"&gt;&lt;code&gt;petyaslavova&lt;/code&gt; in issue #4247&lt;/a&gt;. She traced the ownership gap, identified the reachable re-marking triggers, and suggested either returning an already-closed connection inline or making &lt;code&gt;release()&lt;/code&gt; async.&lt;/p&gt;

&lt;p&gt;My contribution in &lt;a href="https://github.com/redis/redis-py/pull/4256" rel="noopener noreferrer"&gt;redis-py PR #4256&lt;/a&gt; was to implement the smaller guarded fix and add a deterministic regression test through the real &lt;code&gt;execute_command()&lt;/code&gt; path.&lt;/p&gt;

&lt;p&gt;The repaired branch keeps the background disconnect for connections that are still open. If the connection is already closed, it clears the stale flag and returns the slot immediately:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;connection&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;should_reconnect&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;connection&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;is_connected&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;task&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;asyncio&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create_task&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;_disconnect_and_release&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;connection&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_background_tasks&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;task&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;task&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add_done_callback&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_background_tasks&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;discard&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;connection&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;reset_should_reconnect&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_free&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;connection&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This preserves the safety rule that a marked, connected socket must never go back into circulation. It also avoids scheduling a no-op disconnect for one that is already closed.&lt;/p&gt;

&lt;h2&gt;
  
  
  My Improvements
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Reproduce the race through the real command path
&lt;/h3&gt;

&lt;p&gt;A test that manually set two flags and called &lt;code&gt;release()&lt;/code&gt; would prove the branch, but not that production control flow can reach it. The regression test instead drives &lt;code&gt;ClusterNode.execute_command()&lt;/code&gt; with a scripted connection and uses &lt;code&gt;asyncio.Event&lt;/code&gt; objects to control the interleaving:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Start sending the command.&lt;/li&gt;
&lt;li&gt;Mark active connections for reconnect.&lt;/li&gt;
&lt;li&gt;Let the response complete so the normal error path starts disconnecting.&lt;/li&gt;
&lt;li&gt;Wait until the disconnect has suspended.&lt;/li&gt;
&lt;li&gt;Mark the same connection again.&lt;/li&gt;
&lt;li&gt;Allow the disconnect to finish.&lt;/li&gt;
&lt;li&gt;Acquire the next connection immediately.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The final assertions check the behavior that matters:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;assert&lt;/span&gt; &lt;span class="n"&gt;node&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;acquire_connection&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="ow"&gt;is&lt;/span&gt; &lt;span class="n"&gt;connection&lt;/span&gt;
&lt;span class="k"&gt;assert&lt;/span&gt; &lt;span class="n"&gt;node&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_background_tasks&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="k"&gt;assert&lt;/span&gt; &lt;span class="n"&gt;connection&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;should_reconnect&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="ow"&gt;is&lt;/span&gt; &lt;span class="bp"&gt;False&lt;/span&gt;
&lt;span class="k"&gt;assert&lt;/span&gt; &lt;span class="n"&gt;connection&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;disconnect_calls&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Before the fix, that acquire can hit the transient false-capacity window and the release path schedules a redundant second disconnect. After the fix, the same connection is available inline.&lt;/p&gt;

&lt;h3&gt;
  
  
  Prefer the narrow invariant repair
&lt;/h3&gt;

&lt;p&gt;One alternative was to add a waiting acquisition API and turn more of the pool surface asynchronous. That would change public behavior and add coordination around a symptom.&lt;/p&gt;

&lt;p&gt;The smaller fix restores the existing pool invariant: once a closed connection is released, it should be reusable immediately. No new public method, retry policy, timeout, or queue is required.&lt;/p&gt;

&lt;h3&gt;
  
  
  Keep the scope honest
&lt;/h3&gt;

&lt;p&gt;This affects the async cluster pool when a node is at an explicitly configured connection limit and a reconnect mark lands during disconnect. It does not affect the synchronous cluster pool or the standalone pools. It causes a transient spurious &lt;code&gt;MaxConnectionsError&lt;/code&gt;, not a permanent client hang.&lt;/p&gt;

&lt;p&gt;The focused cluster connection-handling suite passed 13 tests on Windows and Ubuntu WSL. The changed code passed the repository's lint task, Ruff checks, formatting, vulture, and &lt;code&gt;git diff --check&lt;/code&gt;. Cursor Bugbot passed on the public PR. At publication time, the upstream GitHub Actions for CI, Docs CI, CodeQL, and spellcheck still awaited maintainer approval, so I did not yet treat the full repository matrix as passed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Update, August 17, 2026:&lt;/strong&gt; &lt;a href="https://github.com/redis/redis-py/pull/4256" rel="noopener noreferrer"&gt;PR #4256&lt;/a&gt; was approved and merged upstream as commit &lt;a href="https://github.com/redis/redis-py/commit/3972275826c4c2a40c05c999e55d682ffbd33a48" rel="noopener noreferrer"&gt;&lt;code&gt;3972275&lt;/code&gt;&lt;/a&gt;. All 368 GitHub checks in the final PR rollup succeeded.&lt;/p&gt;

&lt;h2&gt;
  
  
  Result
&lt;/h2&gt;

&lt;p&gt;An already-closed, re-marked connection now returns to the free queue in the same release call. The pool no longer reports false exhaustion simply because a no-op background task has not received its event-loop turn yet.&lt;/p&gt;

&lt;p&gt;Concurrency bugs are often described as timing problems, but the useful question is usually about ownership: at every suspension point, which structure owns the resource, and can another task observe a state in which nobody can use it? Here, the implementation changed 6 additions and 4 deletions in production code, while the larger part of the patch made the &lt;code&gt;execute_command()&lt;/code&gt; regression deterministic.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;AI disclosure: I used AI tooling to assist with this project and post.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>bugsmash</category>
      <category>opensource</category>
      <category>python</category>
    </item>
    <item>
      <title>When YouTube Changed the Header: Fixing Invidious's Gaming Channel</title>
      <dc:creator>LubuSeb</dc:creator>
      <pubDate>Sun, 09 Aug 2026 13:35:30 +0000</pubDate>
      <link>https://dev.to/lubuseb/when-youtube-changed-the-header-fixing-invidiouss-auto-generated-channels-1e00</link>
      <guid>https://dev.to/lubuseb/when-youtube-changed-the-header-fixing-invidiouss-auto-generated-channels-1e00</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for &lt;a href="https://dev.to/bugsmash"&gt;DEV's Summer Bug Smash: Clear the Lineup&lt;/a&gt; powered by &lt;a href="https://sentry.io/" rel="noopener noreferrer"&gt;Sentry&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Project Overview
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/iv-org/invidious" rel="noopener noreferrer"&gt;Invidious&lt;/a&gt; is an open-source alternative front end for YouTube. Because it reads YouTube's internal response structures, it has to survive upstream payload changes that arrive without a stable public schema.&lt;/p&gt;

&lt;p&gt;One long-running failure affected YouTube's auto-generated channels. Opening a channel such as Gaming could raise:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Missing hash key: "interactiveTabbedHeaderRenderer" (KeyError)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The report had been open for years, but the failure was still reproducible against YouTube's current Gaming payload.&lt;/p&gt;

&lt;h2&gt;
  
  
  Bug Fix or Performance Improvement
&lt;/h2&gt;

&lt;p&gt;The parser assumed every auto-generated channel used this legacy header:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;header.interactiveTabbedHeaderRenderer
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;YouTube's current response for the affected channel instead uses:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;header.pageHeaderRenderer.content.pageHeaderViewModel
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The title and avatar moved into new nested view models. Some metadata that existed in the legacy shape is optional or absent in the current one. A direct key lookup therefore crashed before Invidious could render the channel page.&lt;/p&gt;

&lt;p&gt;There was a second edge case behind it: a selected YouTube tab can exist without a &lt;code&gt;content&lt;/code&gt; key. The extractor treated selection as proof of content and raised another &lt;code&gt;KeyError&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Code
&lt;/h2&gt;

&lt;p&gt;The implementation and focused regression tests are in &lt;a href="https://github.com/iv-org/invidious/pull/5858" rel="noopener noreferrer"&gt;Invidious PR #5858&lt;/a&gt;, linked to the project's &lt;a href="https://github.com/iv-org/invidious/issues/2137" rel="noopener noreferrer"&gt;$30 bug bounty issue&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Instead of scattering optional lookups through &lt;code&gt;get_about_info&lt;/code&gt;, I extracted one compatibility boundary:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight crystal"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;extract_auto_generated_channel_header&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;initdata&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ucid&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;header&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;initdata&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dig?&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"header"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"interactiveTabbedHeaderRenderer"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="c1"&gt;# Parse the legacy shape.&lt;/span&gt;
  &lt;span class="k"&gt;elsif&lt;/span&gt; &lt;span class="n"&gt;header&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;initdata&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dig?&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"header"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"pageHeaderRenderer"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;header_view&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;header&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dig?&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"content"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"pageHeaderViewModel"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="c1"&gt;# Parse the current shape with bounded fallbacks.&lt;/span&gt;
  &lt;span class="k"&gt;else&lt;/span&gt;
    &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="no"&gt;InfoException&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="s2"&gt;"Could not extract channel header for &lt;/span&gt;&lt;span class="si"&gt;#{&lt;/span&gt;&lt;span class="n"&gt;ucid&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;: "&lt;/span&gt; &lt;span class="p"&gt;\&lt;/span&gt;
      &lt;span class="s2"&gt;"expected interactiveTabbedHeaderRenderer or pageHeaderRenderer."&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The caller now consumes one normalized result regardless of which upstream renderer arrived.&lt;/p&gt;

&lt;p&gt;For the empty selected-tab case, the fix is intentionally smaller:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight crystal"&gt;&lt;code&gt;&lt;span class="n"&gt;content&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;extract_selected_tab&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;target&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"tabs"&lt;/span&gt;&lt;span class="p"&gt;])[&lt;/span&gt;&lt;span class="s2"&gt;"content"&lt;/span&gt;&lt;span class="p"&gt;]?&lt;/span&gt;
&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;raw_items&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;nil?&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;An empty selected tab is an empty result, not an exceptional parser state.&lt;/p&gt;

&lt;h2&gt;
  
  
  My Improvements
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Preserve compatibility instead of chasing one payload
&lt;/h3&gt;

&lt;p&gt;Replacing the legacy branch with the new one would have fixed today's Gaming channel while breaking instances that still receive the older renderer. The extractor explicitly supports both shapes, and both have regression fixtures.&lt;/p&gt;

&lt;h3&gt;
  
  
  Default only when data is missing
&lt;/h3&gt;

&lt;p&gt;The current shape does not always provide the banner, description, badges, or microformat fields the old parser expected. Those values receive narrow fallbacks.&lt;/p&gt;

&lt;p&gt;One detail mattered: &lt;code&gt;familySafe: false&lt;/code&gt; must remain false. A truthy fallback would silently convert a real value into a default. The implementation distinguishes &lt;code&gt;nil&lt;/code&gt; from &lt;code&gt;false&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight crystal"&gt;&lt;code&gt;&lt;span class="n"&gt;family_safe&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;initdata&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dig?&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"microformat"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"microformatDataRenderer"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"familySafe"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;try&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;as_bool&lt;/span&gt;

&lt;span class="n"&gt;is_family_friendly&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;family_safe&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;nil?&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="kp"&gt;true&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;family_safe&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Validate the route, not only the helper
&lt;/h3&gt;

&lt;p&gt;The focused fixtures cover:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the current &lt;code&gt;pageHeaderRenderer&lt;/code&gt; title and avatar path&lt;/li&gt;
&lt;li&gt;the legacy &lt;code&gt;interactiveTabbedHeaderRenderer&lt;/code&gt; path&lt;/li&gt;
&lt;li&gt;an explicit &lt;code&gt;familySafe: false&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;a selected tab with no content&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I then ran the full local suite: 167 examples, 0 failures. The production Docker image built, the target channel route returned HTTP 200 with the expected &lt;code&gt;Gaming - Invidious&lt;/code&gt; title and visible channel data, and the API route returned HTTP 200.&lt;/p&gt;

&lt;p&gt;At the time of this update, upstream CI is 10 of 12 checks green: lint, both AMD64 and ARM64 Docker builds, and Crystal 1.14 through 1.20. The Crystal 1.21 and nightly jobs stop on unrelated repository-wide deprecation warnings in the logger and static asset handler; neither warning touches this change.&lt;/p&gt;

&lt;h3&gt;
  
  
  Scope of the fix
&lt;/h3&gt;

&lt;p&gt;This is not a complete fix for every auto-generated YouTube channel. The route I reproduced was Gaming, and PR #5858 handles the &lt;code&gt;pageHeaderRenderer&lt;/code&gt; shape while keeping the legacy renderer working.&lt;/p&gt;

&lt;p&gt;A follow-up investigation in &lt;a href="https://github.com/iv-org/invidious/issues/5868" rel="noopener noreferrer"&gt;issue #5868&lt;/a&gt; found a third shape, &lt;code&gt;carouselHeaderRenderer&lt;/code&gt;, on the Sports channel. &lt;a href="https://github.com/iv-org/invidious/pull/5869" rel="noopener noreferrer"&gt;PR #5869&lt;/a&gt; extends the same extracted-function approach to that case and explicitly credits #5858 for the compatibility boundary and selected-tab guard. The accurate result here is that Gaming and other &lt;code&gt;pageHeaderRenderer&lt;/code&gt; channels work again. Sports needs the follow-up.&lt;/p&gt;

&lt;h2&gt;
  
  
  Result
&lt;/h2&gt;

&lt;p&gt;The current auto-generated Gaming channel loads instead of reaching the error template, while the legacy renderer remains supported.&lt;/p&gt;

&lt;p&gt;The broader lesson is that resilient parsers need an explicit compatibility boundary. Optional chaining everywhere can suppress useful errors; hard-coded indexing everywhere turns routine upstream drift into an outage. Normalizing known shapes in one place gave this fix both a clear failure mode and a testable contract.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;AI disclosure: I used AI tooling to assist with this project and post.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>bugsmash</category>
      <category>opensource</category>
      <category>crystal</category>
    </item>
    <item>
      <title>Fixing npmx's 502 for packages blocked by jsDelivr's 150 MB limit</title>
      <dc:creator>LubuSeb</dc:creator>
      <pubDate>Sun, 09 Aug 2026 12:57:54 +0000</pubDate>
      <link>https://dev.to/lubuseb/fixing-npmxs-502-for-packages-blocked-by-jsdelivrs-150-mb-limit-33fg</link>
      <guid>https://dev.to/lubuseb/fixing-npmxs-502-for-packages-blocked-by-jsdelivrs-150-mb-limit-33fg</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for &lt;a href="https://dev.to/bugsmash"&gt;DEV's Summer Bug Smash: Clear the Lineup&lt;/a&gt; powered by &lt;a href="https://sentry.io/" rel="noopener noreferrer"&gt;Sentry&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Project Overview
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://npmx.dev/" rel="noopener noreferrer"&gt;npmx.dev&lt;/a&gt; is a fast, modern browser for the npm registry. It lets developers browse package source files, compare versions, and inspect package information without leaving the browser.&lt;/p&gt;

&lt;p&gt;I worked on &lt;a href="https://github.com/npmx-dev/npmx.dev/issues/2899" rel="noopener noreferrer"&gt;npmx issue #2899&lt;/a&gt;. Opening the code or skills view for &lt;code&gt;next@16.2.9&lt;/code&gt; returned a 502 because npmx could not retrieve the package file list from jsDelivr.&lt;/p&gt;

&lt;p&gt;The issue reporter, &lt;a href="https://github.com/314systems" rel="noopener noreferrer"&gt;314systems&lt;/a&gt;, had already done the important initial diagnosis. They identified that the package exceeded jsDelivr's configured 150 MB limit. I started from that finding, confirmed the 403 response, reproduced how it became a 502 inside npmx, and implemented a bounded fallback.&lt;/p&gt;

&lt;p&gt;I am not claiming that Sentry discovered the cause. I used Sentry later to independently verify the runtime boundary and the behavior before and after the fix.&lt;/p&gt;

&lt;p&gt;The issue was opened before the challenge, but the implementation and evidence work were completed during the contest period. The core fix and both final Sentry evidence-state commits are timestamped August 9, 2026.&lt;/p&gt;

&lt;h2&gt;
  
  
  Bug Fix or Performance Improvement
&lt;/h2&gt;

&lt;p&gt;Before the fix, npmx had one provider for package file metadata and content: jsDelivr.&lt;/p&gt;

&lt;p&gt;For an oversized package such as &lt;code&gt;next@16.2.9&lt;/code&gt;, the sequence was:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;npmx requested package metadata from jsDelivr.&lt;/li&gt;
&lt;li&gt;jsDelivr returned 403.&lt;/li&gt;
&lt;li&gt;npmx converted that upstream failure into a 502.&lt;/li&gt;
&lt;li&gt;The code browser and related views stopped there.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I reproduced this against a production build from the baseline commit, &lt;code&gt;5be120b&lt;/code&gt;.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Production-build probe&lt;/th&gt;
&lt;th&gt;Baseline result&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;File tree for &lt;code&gt;next@16.2.9&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;502&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;package.json&lt;/code&gt; for &lt;code&gt;next@16.2.9&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;502&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;File tree for a normal &lt;code&gt;vue&lt;/code&gt; version&lt;/td&gt;
&lt;td&gt;200&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1oz9l7mcp29qapp9dvvw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1oz9l7mcp29qapp9dvvw.png" alt="Before the fix, the next@16.2.9 code page shows " width="799" height="333"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The fix keeps jsDelivr as the primary provider. If, and only if, jsDelivr returns 403, npmx retries the same metadata or file request through UNPKG.&lt;/p&gt;

&lt;p&gt;After the fix:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Production-build probe&lt;/th&gt;
&lt;th&gt;Fixed result&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;File tree for &lt;code&gt;next@16.2.9&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;200, with 8,076 files&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;package.json&lt;/code&gt; for &lt;code&gt;next@16.2.9&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;200&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;File tree for the same &lt;code&gt;vue&lt;/code&gt; control&lt;/td&gt;
&lt;td&gt;200 through jsDelivr, with no fallback&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F3u1zk1e02v2b75u6n14q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F3u1zk1e02v2b75u6n14q.png" alt="After the fix, the next@16.2.9 code page loads its full package file tree" width="799" height="333"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is a functional fix, not a performance claim. The result is that a package refused by jsDelivr can still be browsed instead of producing a 502.&lt;/p&gt;

&lt;h2&gt;
  
  
  Code
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Issue:&lt;/strong&gt; &lt;a href="https://github.com/npmx-dev/npmx.dev/issues/2899" rel="noopener noreferrer"&gt;npmx-dev/npmx.dev#2899&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Core fix:&lt;/strong&gt; &lt;a href="https://github.com/LubuSeb/npmx.dev/commit/941bf209ca204495e001ddd80728d8fec98a2280" rel="noopener noreferrer"&gt;941bf209&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Review follow-up:&lt;/strong&gt; &lt;a href="https://github.com/LubuSeb/npmx.dev/commit/098a59b635f984ee47ea028a69133917703e1def" rel="noopener noreferrer"&gt;098a59b6&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Upstream pull request:&lt;/strong&gt; &lt;a href="https://github.com/npmx-dev/npmx.dev/pull/3161" rel="noopener noreferrer"&gt;npmx-dev/npmx.dev#3161&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Baseline Sentry evidence state:&lt;/strong&gt; &lt;a href="https://github.com/LubuSeb/npmx.dev/commit/bf0e046566cc237d8d0ff1ba394fb2a43cda3cd8" rel="noopener noreferrer"&gt;bf0e0465&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fixed Sentry evidence state:&lt;/strong&gt; &lt;a href="https://github.com/LubuSeb/npmx.dev/commit/c95e027e537224741997989997a81e55460dc59e" rel="noopener noreferrer"&gt;c95e027e&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The central provider decision is deliberately narrow:&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;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;fetchWithFallback&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="nx"&gt;primaryUrl&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;fallbackUrl&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;signal&lt;/span&gt;&lt;span class="p"&gt;?:&lt;/span&gt; &lt;span class="nx"&gt;AbortSignal&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;PackageFetchResult&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;primary&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;primaryUrl&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;signal&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt;

  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;primary&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;status&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="mi"&gt;403&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;primary&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ok&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;cancelResponseBody&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;primary&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;provider&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;jsdelivr&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;response&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;primary&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;cancelResponseBody&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;primary&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;fallback&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;fallbackUrl&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;signal&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;fallback&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ok&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;cancelResponseBody&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;fallback&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;provider&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;unpkg&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;response&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;fallback&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 404, 500, or successful response from jsDelivr keeps its existing behavior. This is not a general retry for every failure.&lt;/p&gt;

&lt;p&gt;UNPKG and jsDelivr return different metadata shapes, so changing the URL was only part of the work. jsDelivr provides a nested tree. UNPKG provides a flat file list. The fix validates the UNPKG response and converts it into the tree structure that the rest of npmx expects.&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="nx"&gt;provider&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;unpkg&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;parsed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;v&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;safeParse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;UnpkgMetadataResponseSchema&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;parsed&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;success&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;parsed&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;output&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kr"&gt;package&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="nx"&gt;packageName&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="nf"&gt;invalidFileListError&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;package&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;packageName&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;version&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;tree&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;convertUnpkgToFileTree&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;parsed&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;output&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;files&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The core fix touches 18 files: 12 application or shared-code files and 6 test or fixture files. That breadth is necessary because the jsDelivr assumption was spread across several consumers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;File-tree metadata&lt;/li&gt;
&lt;li&gt;Individual file content&lt;/li&gt;
&lt;li&gt;Package comparisons&lt;/li&gt;
&lt;li&gt;File comparisons&lt;/li&gt;
&lt;li&gt;Skills processing&lt;/li&gt;
&lt;li&gt;Raw-file links in the code viewer&lt;/li&gt;
&lt;li&gt;Shared provider types and URL construction&lt;/li&gt;
&lt;li&gt;Tests and route fixtures for those paths&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A narrower patch to the visible package page would have left other routes failing on the same package.&lt;/p&gt;

&lt;p&gt;The Sentry instrumentation is separate from the upstream fix. It exists only in evidence commits on my fork so I could compare controlled production builds without asking the npmx maintainers to accept challenge-specific monitoring code.&lt;/p&gt;

&lt;h2&gt;
  
  
  My Improvements
&lt;/h2&gt;

&lt;h3&gt;
  
  
  One fallback policy for every package-file consumer
&lt;/h3&gt;

&lt;p&gt;I added shared helpers for package metadata and file requests. The code viewer, file tree, comparison routes, and skills path now follow the same provider policy.&lt;/p&gt;

&lt;p&gt;Normal traffic still uses jsDelivr. Only a primary 403 activates UNPKG.&lt;/p&gt;

&lt;h3&gt;
  
  
  Strict metadata validation
&lt;/h3&gt;

&lt;p&gt;The UNPKG response is treated as external input. The converter validates paths, sizes, integrity values, and the requested package name before creating the internal tree.&lt;/p&gt;

&lt;p&gt;It also rejects duplicate paths and file-directory conflicts instead of silently accepting an ambiguous result.&lt;/p&gt;

&lt;h3&gt;
  
  
  Fixed processing limits
&lt;/h3&gt;

&lt;p&gt;Supporting larger packages does not mean accepting unlimited metadata or file content.&lt;/p&gt;

&lt;p&gt;The UNPKG metadata path has these fixed limits:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;10 MiB maximum metadata response&lt;/li&gt;
&lt;li&gt;50,000 files&lt;/li&gt;
&lt;li&gt;100 path segments per file&lt;/li&gt;
&lt;li&gt;250,000 total path segments&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;File bodies use a bounded streaming reader. The code viewer still limits highlighted source files to 500 KiB, while its &lt;code&gt;package.json&lt;/code&gt; helper allows up to 2 MiB.&lt;/p&gt;

&lt;p&gt;Those are intentional limits. A package with metadata beyond the new bounds will still fail safely, and a source file larger than the existing viewer limit will still not be rendered inline. The fix resolves the provider-level package failure. It does not remove every content-size restriction in npmx.&lt;/p&gt;

&lt;h3&gt;
  
  
  Fixed and encoded provider URLs
&lt;/h3&gt;

&lt;p&gt;Package versions and individual path segments are encoded before being added to provider URLs. Provider origins are fixed in code rather than accepted from request input.&lt;/p&gt;

&lt;h3&gt;
  
  
  Raw-file viewer tradeoff
&lt;/h3&gt;

&lt;p&gt;The raw-file buttons now link to UNPKG's file viewer. This makes raw access work for a package that jsDelivr refuses to serve.&lt;/p&gt;

&lt;p&gt;The tradeoff is that the raw button uses UNPKG even when the in-app request succeeded through jsDelivr. The current API response does not expose the selected provider to the UI, so the link cannot switch dynamically without widening the public response shape.&lt;/p&gt;

&lt;p&gt;I chose working raw access for oversized packages over keeping the raw link visually tied to the primary provider. This does add an UNPKG dependency to the raw-view action, but it does not change the primary server-fetch path for normal packages.&lt;/p&gt;

&lt;h3&gt;
  
  
  Regression coverage
&lt;/h3&gt;

&lt;p&gt;The tests cover:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;jsDelivr success without fallback&lt;/li&gt;
&lt;li&gt;Fallback after a jsDelivr 403&lt;/li&gt;
&lt;li&gt;File and metadata requests&lt;/li&gt;
&lt;li&gt;Invalid UNPKG payloads&lt;/li&gt;
&lt;li&gt;Duplicate paths and file-directory conflicts&lt;/li&gt;
&lt;li&gt;Metadata, file-count, depth, and complexity limits&lt;/li&gt;
&lt;li&gt;Bounded response reading&lt;/li&gt;
&lt;li&gt;Scoped packages and encoded file paths&lt;/li&gt;
&lt;li&gt;Existing normal-package behavior&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The final core-fix validation included:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Check&lt;/th&gt;
&lt;th&gt;Result&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Unit suite&lt;/td&gt;
&lt;td&gt;1,743 passing&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Type checking&lt;/td&gt;
&lt;td&gt;Passing&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Linting&lt;/td&gt;
&lt;td&gt;Passing&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Production build&lt;/td&gt;
&lt;td&gt;Passing&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Focused package-code page tests&lt;/td&gt;
&lt;td&gt;Passing&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Live &lt;code&gt;next@16.2.9&lt;/code&gt; production probe&lt;/td&gt;
&lt;td&gt;200, 8,076 files&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Normal &lt;code&gt;vue&lt;/code&gt; control&lt;/td&gt;
&lt;td&gt;200, no fallback&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Browser check of the package-code page&lt;/td&gt;
&lt;td&gt;Passing&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Upstream pull request checks&lt;/td&gt;
&lt;td&gt;All passing&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Best Use of Sentry
&lt;/h2&gt;

&lt;p&gt;I used Sentry Error Monitoring and custom server tracing to verify the runtime behavior of the existing failure and the fallback.&lt;/p&gt;

&lt;p&gt;Again, Sentry did not discover jsDelivr's 150 MB limit. The reporter, 314systems, identified that cause. Sentry let me independently show what npmx did with the upstream response and whether the fix changed only the intended path.&lt;/p&gt;

&lt;h3&gt;
  
  
  Controlled before-and-after evidence
&lt;/h3&gt;

&lt;p&gt;I instrumented two fork-only production states:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Baseline source: &lt;code&gt;5be120b&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Baseline evidence state: &lt;a href="https://github.com/LubuSeb/npmx.dev/commit/bf0e046566cc237d8d0ff1ba394fb2a43cda3cd8" rel="noopener noreferrer"&gt;bf0e0465&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Fixed source: &lt;code&gt;941bf209&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Final upstream PR head: &lt;code&gt;098a59b6&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Fixed evidence state: &lt;a href="https://github.com/LubuSeb/npmx.dev/commit/c95e027e537224741997989997a81e55460dc59e" rel="noopener noreferrer"&gt;c95e027e&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Baseline release: &lt;code&gt;npmx-2899-before-5be120b-clean&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Fixed release: &lt;code&gt;npmx-2899-after-941bf209-clean&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Environment: &lt;code&gt;bugsmash-local&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Both states use &lt;code&gt;@sentry/nuxt&lt;/code&gt; in production-build mode. Instrumentation is enabled only when &lt;code&gt;BUGSMASH_SENTRY_ENABLED=true&lt;/code&gt;, and the DSN remains in an environment variable.&lt;/p&gt;

&lt;p&gt;The hosted fixed-state evidence uses the core implementation at &lt;code&gt;941bf209&lt;/code&gt;. The later &lt;code&gt;098a59b6&lt;/code&gt; review follow-up does not change the provider fallback. It preserves comparison aborts, clarifies size-limit errors, expands one comment, and adds a bounded-reader test.&lt;/p&gt;

&lt;p&gt;I added custom server spans around the provider boundary. They record a small set of explicit attributes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;asset.kind&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;assetKind&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;cdn.provider&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;provider&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;cdn.role&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;role&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;fallback.used&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;role&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;fallback&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;npm.package&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;packageName&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;npm.version&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;version&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;source.commit&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;sourceCommit&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;bugsmash.synthetic&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The provider span also records the HTTP status and whether a primary 403 triggered the fallback.&lt;/p&gt;

&lt;p&gt;This is custom server tracing within one synthetic local service. I did not propagate traces to jsDelivr or UNPKG, so I am not describing it as distributed tracing.&lt;/p&gt;

&lt;h3&gt;
  
  
  What Error Monitoring showed before the fix
&lt;/h3&gt;

&lt;p&gt;The baseline production request returned 502.&lt;/p&gt;

&lt;p&gt;The local Sentry envelope capture contained:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The npmx error event&lt;/li&gt;
&lt;li&gt;A custom jsDelivr provider transaction&lt;/li&gt;
&lt;li&gt;HTTP status 403&lt;/li&gt;
&lt;li&gt;Sentry status &lt;code&gt;permission_denied&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;fallback.available: false&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Matching trace IDs between the error event and provider transaction&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F3hc4jtrr9rlwi2atnwy0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F3hc4jtrr9rlwi2atnwy0.png" alt="Sentry baseline error event for the failed next@16.2.9 file-tree request" width="800" height="417"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Baseline hosted tree trace ID:&lt;/strong&gt; &lt;code&gt;4de5891fa25248b58cd01be1f9a35975&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Baseline hosted tree error event:&lt;/strong&gt; &lt;code&gt;596c2d3547914b619f661223aa7e8eda&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Baseline hosted file trace ID:&lt;/strong&gt; &lt;code&gt;6a06a704a73148fba774f0ba87ee0797&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  What custom server tracing showed after the fix
&lt;/h3&gt;

&lt;p&gt;The same production request returned 200 after the fix.&lt;/p&gt;

&lt;p&gt;The local evidence run showed this sequence:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The jsDelivr primary metadata request returned 403.&lt;/li&gt;
&lt;li&gt;The custom span recorded &lt;code&gt;fallback.triggered: true&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The UNPKG fallback returned 200.&lt;/li&gt;
&lt;li&gt;npmx converted the metadata into a tree containing 8,076 files.&lt;/li&gt;
&lt;li&gt;The API request completed successfully.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The package-file route showed the same recovery for &lt;code&gt;package.json&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;vue&lt;/code&gt; control stayed on jsDelivr and recorded no fallback. That control matters because it shows the fix did not redirect normal package traffic.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F13fobvmx9ghftkidrtum.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F13fobvmx9ghftkidrtum.png" alt="Sentry fixed-state trace showing the primary jsDelivr request returning 403" width="800" height="417"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fa8i8pj6f6st8f6x0i7f1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fa8i8pj6f6st8f6x0i7f1.png" alt="Sentry fixed-state trace showing the UNPKG fallback returning 200" width="800" height="417"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fub951yts3jincee0no8p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fub951yts3jincee0no8p.png" alt="Sentry conversion span showing a successful tree containing 8,076 files" width="800" height="417"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Fixed hosted tree trace ID:&lt;/strong&gt; &lt;code&gt;564054b21cbb43c7b195cf3e08a17ba6&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fixed hosted file trace ID:&lt;/strong&gt; &lt;code&gt;113024125b8641ed9dfecee823b33550&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F7np6dn9bj97u67hq09w8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F7np6dn9bj97u67hq09w8.png" alt="Sentry Vue control trace showing jsDelivr returning 200 without a fallback" width="800" height="417"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Control hosted trace ID:&lt;/strong&gt; &lt;code&gt;aaf98132b1014b6188ce8c30f22a04ea&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Keeping the synthetic evidence small and private
&lt;/h3&gt;

&lt;p&gt;These were synthetic local requests, but I still configured the SDK to collect as little request data as possible.&lt;/p&gt;

&lt;p&gt;The evidence setup disables user information, cookies, request and response headers, bodies, query parameters, breadcrumbs, source maps, database query data, frame variables, and outgoing trace propagation. Request objects are removed before events are sent, and the custom evidence spans are marked as synthetic.&lt;/p&gt;

&lt;p&gt;Sentry still derived coarse location labels on some child spans from the network ingress. The private dashboard retained those labels even though IP storage was disabled, so I kept the dashboard private and excluded those fields from every publishable screenshot.&lt;/p&gt;

&lt;p&gt;I also scanned the captured raw envelopes. They did not contain local user paths, authorization values, cookies, user-agent values, IP addresses, or request and response headers.&lt;/p&gt;

&lt;p&gt;Sentry's value here was verification. Error Monitoring preserved the baseline failure. Custom server tracing made the provider decision visible. Together they showed one failed provider becoming a controlled fallback and a successful response, while the normal control remained on the original path.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;AI disclosure: I used AI tooling to assist with this project and post.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>bugsmash</category>
      <category>typescript</category>
      <category>sentry</category>
    </item>
    <item>
      <title>Building a 10.2x Faster Search-Only Retrieval Path on Arm64</title>
      <dc:creator>LubuSeb</dc:creator>
      <pubDate>Sat, 08 Aug 2026 21:46:37 +0000</pubDate>
      <link>https://dev.to/lubuseb/building-a-102x-faster-search-only-retrieval-path-on-arm64-4f01</link>
      <guid>https://dev.to/lubuseb/building-a-102x-faster-search-only-retrieval-path-on-arm64-4f01</guid>
      <description>&lt;p&gt;NeonRecall's best accepted native Arm64 workload showed a &lt;strong&gt;10.214x three-run median throughput speedup&lt;/strong&gt; over its FP32 retrieval baseline.&lt;/p&gt;

&lt;p&gt;That number needs a clear boundary. This is a single-threaded, search-only benchmark over already-produced embeddings. It does not include model inference, embedding generation, index construction, or corpus and query quantization.&lt;/p&gt;

&lt;p&gt;Within that boundary, the result was consistent across three vector widths:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Workload&lt;/th&gt;
&lt;th&gt;Per-run speedups&lt;/th&gt;
&lt;th&gt;Three-run median&lt;/th&gt;
&lt;th&gt;INT8 / FP32 payload&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;384 dimensions&lt;/td&gt;
&lt;td&gt;9.349x, 10.465x, 10.214x&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;10.214x&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;25.26%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;768 dimensions&lt;/td&gt;
&lt;td&gt;9.311x, 9.921x, 9.354x&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;9.354x&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;25.13%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1536 dimensions&lt;/td&gt;
&lt;td&gt;4.988x, 9.243x, 7.517x&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;7.517x&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;25.07%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Every optimized run was faster and had lower p95 search latency. The benchmark ran on native Arm64 Linux and selected the &lt;code&gt;aarch64-neon-dotprod&lt;/code&gt; kernel.&lt;/p&gt;

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

&lt;h2&gt;
  
  
  The problem I wanted to isolate
&lt;/h2&gt;

&lt;p&gt;A semantic-retrieval service usually has at least two distinct stages:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;A model turns text into embeddings.&lt;/li&gt;
&lt;li&gt;A search layer compares a query embedding with stored document embeddings.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;It is easy to mix the two and report a speedup that is hard to interpret. NeonRecall deliberately isolates the second stage.&lt;/p&gt;

&lt;p&gt;Both benchmark paths receive the same deterministic vectors and use the same top-k ranking implementation. The difference is the representation and dot-product arithmetic:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The baseline stores and searches FP32 vectors.&lt;/li&gt;
&lt;li&gt;The optimized path stores symmetric per-vector INT8 vectors and uses an Arm-specific integer dot product.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This makes the comparison narrow, but it also makes the result easier to audit.&lt;/p&gt;

&lt;h2&gt;
  
  
  Per-vector INT8 instead of FP32
&lt;/h2&gt;

&lt;p&gt;Each FP32 vector is quantized independently. NeonRecall finds the vector's largest absolute value and derives one scale:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;scale = max(abs(vector)) / 127
q[i]  = clamp(round(vector[i] / scale), -127, 127)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The index stores one signed byte per dimension plus one FP32 scale per vector. During search, the integer dot product is rescaled before ranking:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="kt"&gt;int64_t&lt;/span&gt; &lt;span class="n"&gt;integer_score&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
    &lt;span class="n"&gt;dot_int8_selected_impl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;selected&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;kind&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;values&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;vectors&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="n"&gt;values&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="n"&gt;scores&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;static_cast&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;float&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;integer_score&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
          &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;scale&lt;/span&gt;
          &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;vectors&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="n"&gt;scale&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For these workloads, that representation used &lt;strong&gt;25.1% to 25.3% of the FP32 encoded-vector payload&lt;/strong&gt;. This is a payload comparison, not a claim about total process memory or container overhead.&lt;/p&gt;

&lt;h2&gt;
  
  
  Selecting the right Arm kernel at runtime
&lt;/h2&gt;

&lt;p&gt;NeonRecall provides three INT8 paths:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A portable scalar implementation.&lt;/li&gt;
&lt;li&gt;An AArch64 NEON widening implementation.&lt;/li&gt;
&lt;li&gt;An AArch64 NEON dot-product implementation.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The binary checks the CPU at runtime and selects the strongest supported path:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;capabilities&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;is_aarch64&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;capabilities&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;neon&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;KernelKind&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;ScalarInt8&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"scalar-int8"&lt;/span&gt;&lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;capabilities&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dotprod&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;KernelKind&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;NeonDotProduct&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"aarch64-neon-dotprod"&lt;/span&gt;&lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;KernelKind&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;NeonWidening&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"aarch64-neon-widening"&lt;/span&gt;&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On a CPU with the dot-product extension, the hot loop processes 16 signed bytes at a time:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="n"&gt;int8x16_t&lt;/span&gt; &lt;span class="n"&gt;left&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;vld1q_s8&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;lhs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;offset&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="n"&gt;int8x16_t&lt;/span&gt; &lt;span class="n"&gt;right&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;vld1q_s8&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;rhs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;offset&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="n"&gt;accumulator&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;vdotq_s32&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;accumulator&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;left&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;right&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The scalar path still matters. It gives the optimized representation a portable correctness reference, while runtime dispatch keeps the binary usable across different machines.&lt;/p&gt;

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

&lt;h2&gt;
  
  
  Measuring quality without overstating it
&lt;/h2&gt;

&lt;p&gt;Quantization is only useful if retrieval remains acceptable, so the evidence pipeline includes a separate quality sanity check.&lt;/p&gt;

&lt;p&gt;A revision-pinned qint8 MiniLM ONNX encoder produces one set of real embeddings. NeonRecall then compares FP32 retrieval arithmetic with INT8 retrieval arithmetic over those same embeddings.&lt;/p&gt;

&lt;p&gt;Across three repetitions, both paths reached macro recall@10 of &lt;code&gt;1.0&lt;/code&gt; on the included 18-document, six-query demo, with identical top-ten lists.&lt;/p&gt;

&lt;p&gt;That is encouraging, but it is not a general retrieval-quality claim. It is a bounded regression check on a small authored dataset. It is also not a full-FP32 model versus INT8 model comparison; both retrieval paths use embeddings from the same pinned encoder.&lt;/p&gt;

&lt;h2&gt;
  
  
  The evidence pipeline is designed to reject bad runs
&lt;/h2&gt;

&lt;p&gt;Performance work becomes much less convincing when the benchmark screenshot cannot be traced back to a binary, source commit, CPU, and exact input.&lt;/p&gt;

&lt;p&gt;The accepted NeonRecall aggregate comes from three repetitions on a native &lt;code&gt;ubuntu-24.04-arm&lt;/code&gt; GitHub Actions runner. Before accepting the result, the workflow:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;verifies the source commit and uploaded binary hashes;&lt;/li&gt;
&lt;li&gt;re-executes every uploaded binary on the aggregate runner;&lt;/li&gt;
&lt;li&gt;confirms ELF64 little-endian AArch64 identity;&lt;/li&gt;
&lt;li&gt;regenerates disassembly and requires the selected kernel's Arm instruction;&lt;/li&gt;
&lt;li&gt;locks deterministic input fingerprints and cross-run checksums;&lt;/li&gt;
&lt;li&gt;recomputes recall from raw ranked document IDs and repository qrels; and&lt;/li&gt;
&lt;li&gt;rejects scalar dispatch, performance regressions, excessive payload, or recall below the documented threshold.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The public aggregate records commit &lt;code&gt;904c8bd7120ef419a68019ed5ab92f43bf49d55c&lt;/code&gt;, workflow run &lt;code&gt;29539633599&lt;/code&gt;, the selected kernel, the compiler, the model revision, every individual speedup, and the quality results.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reproducing the short path
&lt;/h2&gt;

&lt;p&gt;On native Arm64 Linux, the basic correctness and dispatch path is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/LubuSeb/neonrecall-arm.git
&lt;span class="nb"&gt;cd &lt;/span&gt;neonrecall-arm
cmake &lt;span class="nt"&gt;-S&lt;/span&gt; &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-B&lt;/span&gt; build &lt;span class="nt"&gt;-DCMAKE_BUILD_TYPE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;Release &lt;span class="nt"&gt;-DBUILD_TESTING&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;ON
cmake &lt;span class="nt"&gt;--build&lt;/span&gt; build &lt;span class="nt"&gt;--parallel&lt;/span&gt;
ctest &lt;span class="nt"&gt;--test-dir&lt;/span&gt; build &lt;span class="nt"&gt;--output-on-failure&lt;/span&gt;
python3 &lt;span class="nt"&gt;-B&lt;/span&gt; &lt;span class="nt"&gt;-m&lt;/span&gt; unittest discover &lt;span class="nt"&gt;-s&lt;/span&gt; scripts/tests &lt;span class="nt"&gt;-v&lt;/span&gt;
./build/neonrecall selftest &lt;span class="nt"&gt;--json&lt;/span&gt;
./build/neonrecall search-demo
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The repository documents the longer native evidence route, including the pinned model assets, three benchmark repetitions, raw retrieval results, ELF checks, disassembly, and aggregation gates.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where this technique fits
&lt;/h2&gt;

&lt;p&gt;This design is relevant when retrieval arithmetic is a meaningful part of a CPU-bound RAG, recommendation, or vector-search workload and the embeddings already exist.&lt;/p&gt;

&lt;p&gt;It does not answer whether end-to-end application latency will improve by the same factor. That depends on model inference, data movement, index structure, concurrency, filtering, and the surrounding service. A useful next step would be testing larger corpora and a production index while measuring end-to-end latency and resident memory separately.&lt;/p&gt;

&lt;p&gt;For this experiment, the narrower result is the useful one: replacing FP32 search arithmetic with a purpose-built INT8 representation and an Arm NEON dot-product path produced a substantial, reproducible speedup on native Arm64.&lt;/p&gt;

&lt;h2&gt;
  
  
  Project links
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/LubuSeb/neonrecall-arm" rel="noopener noreferrer"&gt;Source code and reproduction guide&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/LubuSeb/neonrecall-arm/actions/runs/29539633599" rel="noopener noreferrer"&gt;Accepted native Arm64 workflow&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/LubuSeb/neonrecall-arm/blob/main/evidence/results/summary.json" rel="noopener noreferrer"&gt;Machine-readable aggregate&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://vimeo.com/1216698142" rel="noopener noreferrer"&gt;1:24 silent, captioned demo&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://devpost.com/software/neonrecall" rel="noopener noreferrer"&gt;Arm Create: AI Optimization Challenge submission&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;NeonRecall is Apache-2.0 licensed and was built for Track 2: Cloud AI in the Arm Create: AI Optimization Challenge.&lt;/p&gt;

</description>
      <category>arm</category>
      <category>cpp</category>
      <category>performance</category>
      <category>machinelearning</category>
    </item>
    <item>
      <title>I ported Picomatch to Rust. It passed 1,977 tests and lost the benchmark by 18x</title>
      <dc:creator>LubuSeb</dc:creator>
      <pubDate>Sun, 02 Aug 2026 14:09:38 +0000</pubDate>
      <link>https://dev.to/lubuseb/i-ported-picomatch-to-rust-it-passed-1977-tests-and-lost-the-benchmark-by-18x-19fa</link>
      <guid>https://dev.to/lubuseb/i-ported-picomatch-to-rust-it-passed-1977-tests-and-lost-the-benchmark-by-18x-19fa</guid>
      <description>&lt;p&gt;&lt;em&gt;A Port Mortem 2026 write-up about a JavaScript to Rust port, one strange Unicode character, and what green tests do not tell you.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The first benchmark result was not flattering.&lt;/p&gt;

&lt;p&gt;Picomatch, running under Node, handled about 7.18 million matches per second in my test. The direct Rust implementation managed about 395,000. That made the Rust version roughly 18.2 times slower.&lt;/p&gt;

&lt;p&gt;I kept the result because it makes the point of the project clearer. The hard part was verification: how much evidence would it take to trust an AI-assisted rewrite beyond the obvious cases?&lt;/p&gt;

&lt;h2&gt;
  
  
  The small library that was not a small target
&lt;/h2&gt;

&lt;p&gt;Picomatch is a dependency-free glob matcher used across the JavaScript ecosystem. Its committed runtime is only 2,444 lines of JavaScript, which made it look like a sensible target for a 72-hour port.&lt;/p&gt;

&lt;p&gt;The scope was reasonable for 72 hours, but I underestimated the compatibility surface.&lt;/p&gt;

&lt;p&gt;Matching &lt;code&gt;*.js&lt;/code&gt; is easy. Matching Picomatch means dealing with globstars at path boundaries, nested extglobs, braces, negation, captures, callbacks, Bash and minimatch options, Windows separators, JavaScript regex flags, UTF-16 indexes, and inputs designed to make a parser or regex engine suffer.&lt;/p&gt;

&lt;p&gt;I chose the official Picomatch snapshot at commit &lt;code&gt;4f41a8e&lt;/code&gt; and wrote a standalone Rust scanner, compiler, and matcher. The command-line program runs without Node. A small JavaScript adapter exists for the unchanged upstream test suite because those tests expect JavaScript callbacks, &lt;code&gt;RegExp&lt;/code&gt; objects, and synchronous API behavior. It does not contain a fallback glob matcher. Every search that is not an API shortcut runs in Rust.&lt;/p&gt;

&lt;p&gt;Getting that boundary right mattered. Otherwise I could have produced a convincing test report while quietly letting JavaScript do the difficult work.&lt;/p&gt;

&lt;h2&gt;
  
  
  All 1,977 tests were green. The port was still wrong
&lt;/h2&gt;

&lt;p&gt;The inherited Picomatch suite eventually passed in full. All 1,977 tests were green, and the repository also had 28 native Rust tests.&lt;/p&gt;

&lt;p&gt;Then differential testing found more problems.&lt;/p&gt;

&lt;p&gt;One of the clearest mismatches involved &lt;code&gt;ſ&lt;/code&gt;, the Latin long s. It looks a little like an &lt;code&gt;f&lt;/code&gt; without the full crossbar. JavaScript treats it differently depending on whether a regular expression uses legacy case-insensitive matching or Unicode-aware case-insensitive matching:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;s&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;ſ&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;   &lt;span class="c1"&gt;// false&lt;/span&gt;
&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;s&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;iu&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;ſ&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;// true&lt;/span&gt;

&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;k&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;K&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;   &lt;span class="c1"&gt;// false&lt;/span&gt;
&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;k&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;iu&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;K&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;// true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;My early implementation treated case-insensitive matching as one Unicode problem. JavaScript actually has two relevant behaviors here. Legacy &lt;code&gt;/i&lt;/code&gt; uses its own Canonicalize rules. Adding &lt;code&gt;u&lt;/code&gt; changes the result for characters such as long s and the Kelvin sign.&lt;/p&gt;

&lt;p&gt;An engine can call itself ECMAScript-compatible and still miss exactly this sort of historical corner.&lt;/p&gt;

&lt;p&gt;Instead of adding only those two characters as regressions, I pinned Node 24.18.0, derived the complete legacy Canonicalize table for the Basic Multilingual Plane, and added it to the native engine. The proof walks all 65,536 BMP code units, finds every nonidentity mapping, and checks both literal and character-class matching against Node and the pinned Picomatch version.&lt;/p&gt;

&lt;p&gt;That produced 1,169 nonidentity mappings, 2,392 ordered equivalences, and 4,784 literal and class checks. The odd character that exposed the bug became a test for the whole defined scope.&lt;/p&gt;

&lt;p&gt;The upstream suite was useful, but I did not want the final claim to depend on one set of examples or on hashes created inside my own repository.&lt;/p&gt;

&lt;p&gt;The proof grew in layers:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Evidence&lt;/th&gt;
&lt;th&gt;Result&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Upstream provenance&lt;/td&gt;
&lt;td&gt;38 test and fixture files pinned to Picomatch commit &lt;code&gt;4f41a8e&lt;/code&gt;, fetched and byte-compared&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Original suite&lt;/td&gt;
&lt;td&gt;1,977 unchanged tests passed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Native regressions&lt;/td&gt;
&lt;td&gt;28 Rust tests passed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Generated differential cases&lt;/td&gt;
&lt;td&gt;100,000 comparisons across five fixed seeds&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Directed differential cases&lt;/td&gt;
&lt;td&gt;535 executions, replaying 107 known edge cases under every seed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Legacy case folding&lt;/td&gt;
&lt;td&gt;4,784 literal and class checks over the derived BMP mappings&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The provenance check deserves a little explanation. A local checksum only proves that files did not change after I hashed them. It does not prove that I started with the upstream files. The stronger check fetches the exact upstream commit, confirms that the manifest covers the complete test tree, normalizes line endings, and byte-compares every file.&lt;/p&gt;

&lt;p&gt;The differential harness runs the pinned JavaScript implementation and the Rust port on the same generated patterns, paths, platform modes, and options. It includes extglobs, braces, classes, negation, Unicode, separators, and captures. Five fixed seeds keep it reproducible. Known failures are kept as directed cases instead of being left to chance.&lt;/p&gt;

&lt;p&gt;The final run reported zero mismatches across 100,535 differential executions.&lt;/p&gt;

&lt;p&gt;That is not a formal proof over every possible string. It is bounded, reproducible evidence. I think saying where the evidence stops is part of making it useful.&lt;/p&gt;

&lt;h2&gt;
  
  
  Extglobs needed a compiler, not substitutions
&lt;/h2&gt;

&lt;p&gt;Another early mistake was thinking too locally about extglobs. Operators such as &lt;code&gt;?()&lt;/code&gt;, &lt;code&gt;*()&lt;/code&gt;, &lt;code&gt;+()&lt;/code&gt;, &lt;code&gt;@()&lt;/code&gt;, and &lt;code&gt;!()&lt;/code&gt; look like five pieces of syntax that can be translated one at a time.&lt;/p&gt;

&lt;p&gt;They cannot. Nesting changes the meaning. So do suffixes, alternation, path separators, captures, and repetition. A shallow implementation handled ordinary examples, then stalled or under-matched cases with nested negative extglobs.&lt;/p&gt;

&lt;p&gt;The correction was structural. The compiler now reduces pure chains of nested negation by parity while preserving the surrounding suffix and alternative context. It rewrites only repeated languages that it can show are safe, and it keeps the ambiguous cases literal when that is what Picomatch requires.&lt;/p&gt;

&lt;p&gt;Earlier adversarial and differential runs were more useful than the final zero-mismatch total because they supplied the cases that became permanent regressions. Those cases include nested negation, legacy case folding, capture numbering, regex flags, typed transport fields, Windows separators, globstar boundaries, and eager ignore behavior.&lt;/p&gt;

&lt;p&gt;A second compiler problem came from Picomatch's public regex source. APIs such as &lt;code&gt;parse&lt;/code&gt; and &lt;code&gt;makeRe&lt;/code&gt; expose the generated regular expression, and some upstream tests inspect it. At the same time, the Rust matcher needs an execution form that makes path-separator rules explicit.&lt;/p&gt;

&lt;p&gt;I initially tried to make one generated regex serve both purposes. That forced a bad choice. I could satisfy observable source assertions, or I could enforce native path behavior, but not always both with the same representation.&lt;/p&gt;

&lt;p&gt;The final compiler emits two related forms. One is the public source used by the compatibility API. The other is a private, slash-safe execution source used by Rust. Both come from the same compiler, but they have different jobs.&lt;/p&gt;

&lt;p&gt;Captures made the same lesson harder to ignore. With &lt;code&gt;capture: true&lt;/code&gt;, compiler-generated groups affect backreference numbering. Wildcards, braces, brackets, extglobs, named groups, and unmatched groups all need to be planned while the regex is emitted. Rust now returns the full match and every capture as UTF-16 spans. The adapter uses those spans to reconstruct the JavaScript result, including named groups and &lt;code&gt;d&lt;/code&gt;-flag indices. JavaScript owns state such as &lt;code&gt;g&lt;/code&gt; and &lt;code&gt;y&lt;/code&gt; &lt;code&gt;lastIndex&lt;/code&gt;, but Rust performs each search from the requested position.&lt;/p&gt;

&lt;h2&gt;
  
  
  A safety limit must not look like a non-match
&lt;/h2&gt;

&lt;p&gt;Glob patterns eventually become regular expressions, and regular expressions can backtrack badly. Limiting the parser was not enough. A valid-looking pattern could still consume unreasonable execution work.&lt;/p&gt;

&lt;p&gt;The compiler now bounds pattern length, nesting depth, branch count, unmatched bracket markers, and total compile work. The vendored regex engine also has deterministic execution fuel. Dispatch, scans, backtracking, and backreference comparisons all spend from the same budget.&lt;/p&gt;

&lt;p&gt;When that budget runs out, the matcher returns a recoverable &lt;code&gt;safe work limit&lt;/code&gt; error. It does not return &lt;code&gt;false&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;That distinction matters. A non-match says the engine finished and found no match. Exhaustion says the engine could not safely finish. Treating those as the same result could select or skip the wrong files in a build pipeline.&lt;/p&gt;

&lt;p&gt;The safety tests include both sides. A linear match against a one-million-character input succeeds. The hostile pattern &lt;code&gt;+(a*)b&lt;/code&gt; against a short near-miss reaches the work limit and returns an explicit error. The next ordinary request still succeeds through the same persistent process.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the benchmark measured
&lt;/h2&gt;

&lt;p&gt;I benchmarked three paths using the same four precompiled pattern and input pairs. Each path returned the same 75 percent match rate. The figures below are medians from three timed runs after warm-up.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Path&lt;/th&gt;
&lt;th&gt;Median throughput&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Picomatch on Node&lt;/td&gt;
&lt;td&gt;7,184,496 ops/s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Direct native Rust API&lt;/td&gt;
&lt;td&gt;395,048 ops/s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Rust through the synchronous proof adapter&lt;/td&gt;
&lt;td&gt;11,602 ops/s&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;V8's optimized regular-expression engine is extremely fast. The Rust implementation uses a safe ECMAScript interpreter with explicit fuel accounting. The proof adapter adds worker wakeups, framing, IPC, cache lookup, and JavaScript object reconstruction on top of that.&lt;/p&gt;

&lt;p&gt;If throughput were the only goal, this port would lose. The direct native matcher is still practical at roughly 0.40 million matches per second for this workload, but I am not presenting it as a speed improvement.&lt;/p&gt;

&lt;p&gt;So the port's value is not higher throughput. The Rust API and CLI run independently of Node, expensive work fails explicitly, and the repository provides a reproducible compatibility check. Publishing only the flattering measurements would weaken that claim.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I would do differently
&lt;/h2&gt;

&lt;p&gt;If I started again, I would build a small JavaScript regex conformance probe before committing to the first execution-engine design.&lt;/p&gt;

&lt;p&gt;It would cover legacy &lt;code&gt;/i&lt;/code&gt; versus &lt;code&gt;/iu&lt;/code&gt;, UTF-16 offsets, named and unmatched captures, &lt;code&gt;d&lt;/code&gt; indices, &lt;code&gt;g&lt;/code&gt; and &lt;code&gt;y&lt;/code&gt; state, lookarounds, and backreferences. I would also separate the public regex source from the private execution form on day one.&lt;/p&gt;

&lt;p&gt;Instead, those facts arrived as failures during integration. The failures led to a better design, but they cost time late in the build when every change touched the compiler, matcher, adapter, and proof harness.&lt;/p&gt;

&lt;p&gt;I would also add direct upstream byte comparison earlier. Repository-owned hashes felt reassuring until an independent review pointed out that the repository was effectively certifying itself.&lt;/p&gt;

&lt;p&gt;That review process was deliberate. I used separate coding agents to challenge the Rust design, provenance, fuzz grammar, captures, flags, safety, benchmarks, and presentation. I only accepted a concern when I could reproduce it as a failing case and run the fix through the full suite.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I would reuse on the next port
&lt;/h2&gt;

&lt;p&gt;The process that held up was fairly simple:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Pin the exact source revision and fetch it during verification.&lt;/li&gt;
&lt;li&gt;Keep the inherited tests unchanged.&lt;/li&gt;
&lt;li&gt;Run the source and target implementations on the same generated inputs.&lt;/li&gt;
&lt;li&gt;Turn every mismatch into a permanent directed regression.&lt;/li&gt;
&lt;li&gt;Exhaustively test small domains that are defined by a specification.&lt;/li&gt;
&lt;li&gt;Benchmark the unflattering paths too.&lt;/li&gt;
&lt;li&gt;State the implementation boundary and the limits of the proof.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Picomatch Mortis now passes all 1,977 frozen upstream tests and 28 native tests. Its current bounded differential corpus reports zero mismatches across 100,535 executions. Rust owns scanning, compilation, and every non-short-circuited match, capture, and ignore search. JavaScript remains at the API boundary where JavaScript objects and callbacks require it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Receipts
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/LubuSeb/picomatch-mortis" rel="noopener noreferrer"&gt;Source and reproduction instructions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/LubuSeb/picomatch-mortis/blob/main/DECISIONS.md" rel="noopener noreferrer"&gt;Decision log&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/LubuSeb/picomatch-mortis/blob/main/BENCHMARK.md" rel="noopener noreferrer"&gt;Benchmark report&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/LubuSeb/picomatch-mortis/releases/tag/port-mortem-demo-v1" rel="noopener noreferrer"&gt;Judge demo&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Built for &lt;a href="https://www.raptors.dev/" rel="noopener noreferrer"&gt;Hackathon Raptors&lt;/a&gt;, &lt;a href="https://x.com/raptors_hack" rel="noopener noreferrer"&gt;@raptors_hack&lt;/a&gt;, and the Port Mortem 2026 JavaScript to Rust track.&lt;/p&gt;

</description>
      <category>rust</category>
      <category>javascript</category>
      <category>testing</category>
      <category>hackathon</category>
    </item>
  </channel>
</rss>
