<?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: Rajesh Bhanushali</title>
    <description>The latest articles on DEV Community by Rajesh Bhanushali (@rajeshbhan82496).</description>
    <link>https://dev.to/rajeshbhan82496</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%2F3958929%2Fb8930447-4d00-48e8-ba9a-c671731d6fb4.png</url>
      <title>DEV Community: Rajesh Bhanushali</title>
      <link>https://dev.to/rajeshbhan82496</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rajeshbhan82496"/>
    <language>en</language>
    <item>
      <title>How a missing DEFAULT column locked my production DB for 20 minutes (and why your CI won't catch it)</title>
      <dc:creator>Rajesh Bhanushali</dc:creator>
      <pubDate>Tue, 01 Sep 2026 08:54:13 +0000</pubDate>
      <link>https://dev.to/rajeshbhan82496/how-a-missing-default-column-locked-my-production-db-for-20-minutes-and-why-your-ci-wont-catch-it-407</link>
      <guid>https://dev.to/rajeshbhan82496/how-a-missing-default-column-locked-my-production-db-for-20-minutes-and-why-your-ci-wont-catch-it-407</guid>
      <description>&lt;p&gt;Let’s be brutally honest. As developers, we don’t fear database downtime. We fear the Post-Mortem incident meeting where we have to explain to the CTO why a simple &lt;code&gt;ALTER TABLE&lt;/code&gt; statement brought the entire API down.&lt;/p&gt;

&lt;p&gt;A while back, we had a classic 2 AM outage. A developer merged a migration that added a new &lt;code&gt;NOT NULL&lt;/code&gt; column to a massive production table, but forgot to provide a &lt;code&gt;DEFAULT&lt;/code&gt; value. &lt;/p&gt;

&lt;p&gt;If you know PostgreSQL, you know what happened next. Postgres slapped an &lt;strong&gt;Access Exclusive Lock&lt;/strong&gt; on the table while it verified the constraint across 10 million rows. The app went down, queues backed up, and support tickets flooded in.&lt;/p&gt;

&lt;p&gt;I decided we needed an automated check in our CI/CD pipeline to catch this. But when I looked at the existing SQL linters, I realized they are completely broken.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Problem with Most SQL Linters (Alert Fatigue)
&lt;/h3&gt;

&lt;p&gt;Most SQL linters are dumb. They just use Regex to hunt for keywords like &lt;code&gt;DROP TABLE&lt;/code&gt; or &lt;code&gt;ALTER TABLE ... NOT NULL&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;Because they suffer from &lt;strong&gt;"Context Blindness"&lt;/strong&gt;, they throw false positives everywhere. For example, if you write a migration that creates an ephemeral (temporary) table, and then drops it in the very next file, a dumb linter will flag the &lt;code&gt;DROP TABLE&lt;/code&gt; as a critical danger and block your CI. &lt;/p&gt;

&lt;p&gt;Developers get annoyed, they start ignoring the linter warnings, or worse, they bypass the CI checks entirely. &lt;/p&gt;

&lt;h3&gt;
  
  
  Building a "Context-Aware" Shield
&lt;/h3&gt;

&lt;p&gt;I got tired of the false positives, so I built &lt;strong&gt;&lt;a href="https://github.com/turfin-logic/migra-guard" rel="noopener noreferrer"&gt;migra-guard&lt;/a&gt;&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;Instead of dumb Regex, it uses an AST (Abstract Syntax Tree) engine and tracks the chronological state of your migrations across your Pull Request. It remembers what it has seen.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Drop an ephemeral table created in the same PR?&lt;/strong&gt; &lt;code&gt;migra-guard&lt;/code&gt; knows it's a new table. It stays quiet. (SAFE)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Add NOT NULL to a brand new table?&lt;/strong&gt; Safe.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Drop an existing production table?&lt;/strong&gt; CI blocked. 🚨&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Add NOT NULL to a prod table without a DEFAULT?&lt;/strong&gt; CI blocked. 🚨&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It acts as an automated Senior DBA that lives inside your GitHub Actions. It doesn't scream at you for local development patterns, it only screams when you are actually about to nuke production.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Ultimate Insurance Policy
&lt;/h3&gt;

&lt;p&gt;As a Tech Lead, you can't manually review every single SQL migration from junior developers. You need a system you can blame, an automated scapegoat that catches Postgres lock quirks &lt;em&gt;before&lt;/em&gt; they merge. &lt;/p&gt;

&lt;p&gt;It's completely zero-config and open-source.&lt;/p&gt;

&lt;p&gt;If you are using PostgreSQL, drop this in your CI pipeline. It’s cheaper than a DBA, and it's the best insurance policy your team can buy against human error.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Check out the repo here:&lt;/strong&gt; &lt;a href="https://github.com/turfin-logic/migra-guard" rel="noopener noreferrer"&gt;turfin-logic/migra-guard&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let me know if I missed any other ridiculous Postgres locking edge cases, I'm adding more AST rules this weekend!&lt;/p&gt;

</description>
      <category>postgres</category>
      <category>devops</category>
      <category>opensource</category>
      <category>webdev</category>
    </item>
    <item>
      <title>The goal was simple: reduce debugging time and make crash handling faster for developers.
I’m still improving it, but the core idea is working well and I’m excited to keep building in public.
GitHub: turfin-logic/autofixer-agent</title>
      <dc:creator>Rajesh Bhanushali</dc:creator>
      <pubDate>Wed, 01 Jul 2026 15:09:35 +0000</pubDate>
      <link>https://dev.to/rajeshbhan82496/the-goal-was-simple-reduce-debugging-time-and-make-crash-handling-faster-for-developers-im-40g7</link>
      <guid>https://dev.to/rajeshbhan82496/the-goal-was-simple-reduce-debugging-time-and-make-crash-handling-faster-for-developers-im-40g7</guid>
      <description></description>
      <category>agents</category>
      <category>buildinpublic</category>
      <category>debugging</category>
      <category>showdev</category>
    </item>
    <item>
      <title>How I Built an AI Agent That Watches My Logs and Opens Pull Requests While I Sleep 😴🤖</title>
      <dc:creator>Rajesh Bhanushali</dc:creator>
      <pubDate>Fri, 29 May 2026 18:52:08 +0000</pubDate>
      <link>https://dev.to/rajeshbhan82496/how-i-built-an-ai-agent-that-watches-my-logs-and-opens-pull-requests-while-i-sleep-lif</link>
      <guid>https://dev.to/rajeshbhan82496/how-i-built-an-ai-agent-that-watches-my-logs-and-opens-pull-requests-while-i-sleep-lif</guid>
      <description>&lt;p&gt;As a developer, there are few things more anxiety-inducing than the Slack notification sound at 3:00 AM: &lt;em&gt;"Production is down."&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;You groggily open your laptop, pull up the server logs, trace the exception through 5 different files, fix a missing &lt;code&gt;try/catch&lt;/code&gt; block, push the hotfix, and try to go back to sleep.&lt;/p&gt;

&lt;p&gt;I got tired of this. As an engineer obsessed with automation, I decided to build something that solves the problem for me. Enter &lt;strong&gt;AutoFixer-Agent&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is AutoFixer?
&lt;/h2&gt;

&lt;p&gt;AutoFixer is an autonomous AI agent (built with Python) that watches your production server logs in real-time. When it detects a crash or an exception, it doesn't just alert you — it investigates the stack trace, finds the exact bug in your codebase, generates a contextual fix using LLMs, and &lt;strong&gt;automatically opens a Pull Request on GitHub&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;You wake up to a PR waiting for review, not a broken production environment. ✅&lt;/p&gt;

&lt;h2&gt;
  
  
  How it Works Under the Hood 🛠️
&lt;/h2&gt;

&lt;p&gt;The architecture is surprisingly simple but immensely powerful:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;The Log Watcher:&lt;/strong&gt; A background Python daemon constantly tails your &lt;code&gt;error.log&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Brain (LLM Orchestration):&lt;/strong&gt; When an exception is thrown, the agent captures the stack trace and uses the Google Gemini API to analyze the root cause. It maps the error back to the specific line of code in the repository.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Fixer:&lt;/strong&gt; The agent generates a drop-in replacement block of code.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The GitHub Bot:&lt;/strong&gt; Using GitHub Actions and the GitHub CLI, the agent branches off &lt;code&gt;main&lt;/code&gt;, applies the fix locally, runs sanity checks, and pushes a new Pull Request with a detailed explanation of the bug.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  The "Aha!" Moment 💡
&lt;/h2&gt;

&lt;p&gt;The hardest part wasn't generating the code — LLMs are great at that now. The hardest part was building the &lt;strong&gt;context window&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;If a generic &lt;code&gt;KeyError&lt;/code&gt; happens, the LLM needs to know &lt;em&gt;what&lt;/em&gt; dictionary it came from. A naked stack trace is not enough.&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
python
# Bad prompt (hallucination-prone):
"Fix this error: KeyError: 'user_id'"

# Good prompt (context-aware):
"Fix this error: KeyError: 'user_id'
Surrounding code (lines 45-95 of auth/handler.py):
...
def process_request(payload):
    user = payload['user_id']  # &amp;lt;-- line 52
..."

To solve this, AutoFixer dynamically pulls in the surrounding **50 lines of code** from the file mentioned in the stack trace before sending the prompt to the AI. This gives the model enough context to write a *safe*, production-ready fix rather than a hallucinated one.

## Why This Matters

We are moving from **"AI as a pair programmer"** (GitHub Copilot) to **"AI as a DevOps team member."**

Tools like AutoFixer prove that we can delegate tedious, high-stress tasks — like 3 AM hotfixes — to autonomous systems that handle the boring parts while we sleep.

## Try it Out!

I've open-sourced the entire project! You can clone it, simulate a crash in your local logs, and watch it generate a GitHub PR in real time.

🔗 **GitHub:** [turfin-logic/autofixer-agent](https://github.com/turfin-logic/autofixer-agent)

If you're into automation, DevSecOps, or AI agents — drop a ⭐ on the repo or contribute. Let's automate the boring (and stressful) stuff together. 💪
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>ai</category>
      <category>python</category>
      <category>devops</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
