<?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: Mohamed Sajib</title>
    <description>The latest articles on DEV Community by Mohamed Sajib (@sajeeb_ahmed).</description>
    <link>https://dev.to/sajeeb_ahmed</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%2F4195424%2Fd9fc7865-cffd-44f7-9bff-abc3c25db191.png</url>
      <title>DEV Community: Mohamed Sajib</title>
      <link>https://dev.to/sajeeb_ahmed</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sajeeb_ahmed"/>
    <language>en</language>
    <item>
      <title>3 Bugs I Fixed Before Shipping My WhatsApp AI Receptionist</title>
      <dc:creator>Mohamed Sajib</dc:creator>
      <pubDate>Tue, 20 Oct 2026 06:12:37 +0000</pubDate>
      <link>https://dev.to/sajeeb_ahmed/3-bugs-i-fixed-before-shipping-my-whatsapp-ai-receptionist-175m</link>
      <guid>https://dev.to/sajeeb_ahmed/3-bugs-i-fixed-before-shipping-my-whatsapp-ai-receptionist-175m</guid>
      <description>&lt;p&gt;My WhatsApp AI receptionist answered pricing questions, booked appointments, and handed off to a human.&lt;/p&gt;

&lt;p&gt;The demo worked. Then a production review exposed three bugs in its knowledge pipeline: &lt;strong&gt;CSV/PDF/URL → chunks → Postgres.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Re-uploading erased unchanged facts
&lt;/h2&gt;

&lt;p&gt;Deduplication compared incoming chunks against the previous version. Unchanged chunks were discarded as duplicates—then deleted when the old version was replaced.&lt;/p&gt;

&lt;p&gt;A 10% update left just 10% of the knowledge. No error. Just missing answers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fix:&lt;/strong&gt; Identify the previous version before deduping, exclude its chunks from the comparison, and replace it in one transaction. Add a regression test.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Two workers could claim the same job
&lt;/h2&gt;

&lt;p&gt;A &lt;code&gt;SELECT&lt;/code&gt; followed by an &lt;code&gt;UPDATE&lt;/code&gt; let two workers pick the same pending source.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fix:&lt;/strong&gt; Claim it atomically:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;UPDATE&lt;/span&gt; &lt;span class="n"&gt;knowledge_sources&lt;/span&gt;
&lt;span class="k"&gt;SET&lt;/span&gt; &lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'processing'&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="err"&gt;$&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;
  &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'pending'&lt;/span&gt;
&lt;span class="n"&gt;RETURNING&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No returned row means no claim. That worker skips ingestion.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Website imports opened an SSRF path
&lt;/h2&gt;

&lt;p&gt;A submitted URL could send the server to localhost, internal services, or cloud metadata—including through redirects.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fix:&lt;/strong&gt; Add URL-fetch safeguards: allow HTTP(S) only, check resolved IPs for internal destinations, revalidate every redirect, and cap responses at 5 MB.&lt;/p&gt;

&lt;h2&gt;
  
  
  The lesson
&lt;/h2&gt;

&lt;p&gt;These fixes shipped in &lt;strong&gt;v0.5.0&lt;/strong&gt;, with &lt;strong&gt;30 tests&lt;/strong&gt; using Node’s built-in runner.&lt;/p&gt;

&lt;p&gt;A working conversation is only part of the test. Re-uploads, competing workers, and untrusted URLs deserve their own.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Which of these has caught you before? My bet: the check-then-act race.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;— Sajib, full-stack developer from Dhaka · &lt;a href="https://sajib.dev.cv" rel="noopener noreferrer"&gt;sajib.dev.cv&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>security</category>
      <category>node</category>
      <category>postgres</category>
    </item>
  </channel>
</rss>
