<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Dipesh Kumar Gulati on Medium]]></title>
        <description><![CDATA[Stories by Dipesh Kumar Gulati on Medium]]></description>
        <link>https://medium.com/@dgulati2001?source=rss-7e76fced094b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*6UennSJ5D3c2pB7b</url>
            <title>Stories by Dipesh Kumar Gulati on Medium</title>
            <link>https://medium.com/@dgulati2001?source=rss-7e76fced094b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 08:48:21 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dgulati2001/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[I Was About to Copy an Existing Flow. Then I Stopped.]]></title>
            <link>https://medium.com/@dgulati2001/i-was-about-to-copy-an-existing-flow-then-i-stopped-eb6254c43458?source=rss-7e76fced094b------2</link>
            <guid isPermaLink="false">https://medium.com/p/eb6254c43458</guid>
            <dc:creator><![CDATA[Dipesh Kumar Gulati]]></dc:creator>
            <pubDate>Mon, 14 Sep 2026 11:26:27 GMT</pubDate>
            <atom:updated>2026-09-14T11:26:27.339Z</atom:updated>
            <content:encoded><![CDATA[<p>Recently, I had to work on an organization member invite flow.</p><p>There was already a team member invite flow in the system.</p><p>So the obvious approach was pretty simple:</p><p>Take the existing team invite flow, copy it for organizations, make the required changes, and move on.</p><p>At first, that actually seemed reasonable.</p><p>The two flows were very similar.</p><p>But while going through the existing implementation, I started noticing that most of the logic was basically the same.</p><p>The main difference was <strong>what the invite belonged to</strong>.</p><p>A team invite belonged to a team.</p><p>An organization invite belonged to an organization.</p><p>That made me pause.</p><p>If I copied the whole flow, I’d have two implementations doing almost the same thing.</p><p>And eventually, they would probably start drifting apart.</p><p>One would get a bug fix.</p><p>The other wouldn’t.</p><p>One would get a new validation.</p><p>The other might be forgotten.</p><p>So instead of creating another invite flow, I decided to make the invite logic more centralized.</p><p>The idea was fairly simple.</p><p>Rather than having separate implementations for every type of invite, the common flow would handle the invite and we’d tell it what kind of invite we’re dealing with.</p><p>Something along the lines of:</p><pre>Invite<br>  |<br>  +-- type: TEAM<br>  |      -&gt; team-related collection<br>  |<br>  +-- type: ORGANIZATION<br>         -&gt; organization-related collection</pre><p>The core invite logic stays in one place.</p><p>The type determines what it is associated with.</p><p>That also means adding another invite type later doesn’t necessarily mean copying the entire flow again.</p><p>What I liked about this change wasn’t really the abstraction itself.</p><p>It was the fact that I almost didn’t make it.</p><p>The first instinct when you’re given a new feature that looks similar to something that already exists is often:</p><p><strong>“I’ll just reuse the existing code.”</strong></p><p>And sometimes that’s exactly the right answer.</p><p>But there’s a difference between reusing code and duplicating a flow.</p><p>If two things share the same business behavior but differ in one or two contextual details, copying the entire implementation can make the system harder to maintain.</p><p>In my case, the existing team invite flow gave me a good starting point.</p><p>But after looking at it more closely, I realized the better approach was to separate the common invite behavior from the thing that changes between invite types.</p><p>I also didn’t want to make the abstraction too clever.</p><p>That’s something I’ve become more conscious of.</p><p>It’s easy to look at duplicated code and immediately build some huge generic system around it.</p><p>I didn’t want that either.</p><p>The goal was much simpler:</p><p>Keep the invite process common.</p><p>Pass the invite type.</p><p>Resolve the collection or relationship that belongs to that type.</p><p>Let the rest of the flow stay the same.</p><p>So instead of:</p><pre>Team Invite Flow<br>Organization Invite Flow<br>Another Invite Flow<br>...</pre><p>the idea becomes:</p><pre>Invite Flow<br>                     |<br>          +----------+----------+<br>          |                     |<br>        TEAM              ORGANIZATION<br>          |                     |<br>      Team data          Organization data</pre><p>The business flow stays centralized while the type-specific part stays separate.</p><p>This also made me think differently about the phrase <strong>“don’t repeat yourself.”</strong></p><p>I don’t think DRY means every similar-looking piece of code needs to become a shared abstraction.</p><p>Sometimes duplication is actually easier to understand.</p><p>The question I find more useful is:</p><p><strong>Are these two things going to change together?</strong></p><p>If they have the same business rules and are likely to evolve together, sharing the flow makes sense.</p><p>If they’re only similar today but have different reasons to change, forcing them together can create a different problem.</p><p>In this case, the invite behavior was fundamentally the same.</p><p>The relationship it was creating was what changed.</p><p>That felt like a good boundary for the abstraction.</p><p>The feature itself wasn’t particularly huge.</p><p>But it reminded me of something I keep learning while working on existing systems:</p><p><strong>Sometimes the best implementation isn’t the one that gets the new feature working fastest.</strong></p><p>It’s the one that makes the next similar feature a little less painful.</p><p>I could have copied the team invite flow and probably finished the first version faster.</p><p>Instead, I spent some extra time understanding what was actually common between the two flows.</p><p>That small amount of thinking changed the implementation quite a bit.</p><p>And now, if another type of invite comes along, I don’t have to start by copying the whole thing again.</p><p>That’s probably the part I value most.</p><p>Not that I created a “reusable architecture.”</p><p>Just that the next person working on a similar requirement has a better starting point than I did.</p><p><strong>Have you ever started implementing a feature by copying an existing flow, only to realize the better solution was to centralize the common part?</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eb6254c43458" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Time Caching Made Everything Worse]]></title>
            <link>https://medium.com/@dgulati2001/the-time-caching-made-everything-worse-01afc4ab299c?source=rss-7e76fced094b------2</link>
            <guid isPermaLink="false">https://medium.com/p/01afc4ab299c</guid>
            <dc:creator><![CDATA[Dipesh Kumar Gulati]]></dc:creator>
            <pubDate>Mon, 01 Jun 2026 18:40:28 GMT</pubDate>
            <atom:updated>2026-06-01T18:40:28.086Z</atom:updated>
            <content:encoded><![CDATA[<p>Caching is one of those things that sounds like an easy win.</p><blockquote>Add a cache.</blockquote><blockquote>Reduce load.</blockquote><blockquote>Improve performance.</blockquote><p>At least, that’s what I thought.</p><h3>It started with a simple problem</h3><p>We had an analytics flow where certain queries were getting expensive.</p><p>Not always slow, but frequent enough to matter.</p><p>The obvious fix?</p><blockquote><em>Cache the response.</em></blockquote><p>So I added a cache layer with a short TTL.</p><p>Nothing fancy.</p><p>Just enough to avoid hitting the database repeatedly for the same data.</p><h3>And it worked… initially</h3><ul><li>Latency dropped..</li><li>System load reduced.</li><li>Everything looked good.</li></ul><h3>Until it didn’t</h3><p>After a while, something felt off.</p><p>The numbers didn’t always match.</p><p>Refreshing the same data sometimes gave different results.</p><p>Not drastically wrong — but inconsistent.</p><p>That’s worse.</p><h3>The real issue</h3><p>The problem wasn’t the cache itself.</p><p>It was <strong>when the data was changing.</strong></p><p>The underlying data was being updated asynchronously.</p><ul><li>Pipelines were still processing.</li><li>New data was arriving.</li></ul><p>But the cache didn’t know that. So it kept serving slightly outdated data.</p><h3>Why this was tricky</h3><p>There were no errors.</p><ul><li>No failures.</li><li>No alerts.</li></ul><p>From the system’s point of view, everything was working perfectly.</p><p>But from a user’s perspective, the data wasn’t reliable.</p><h3>The wrong assumption</h3><p>I had assumed:</p><blockquote><em>If data changes, it’s okay for cache to be slightly stale.</em></blockquote><p>But in analytics systems, that assumption doesn’t always hold.</p><p>Sometimes users expect:</p><ul><li>consistency within a session</li><li>predictable numbers</li><li>not “it depends on when you refreshed”</li></ul><h3>What I changed</h3><p>Instead of blindly caching responses, I started thinking about:</p><ul><li><strong>when data is considered “stable”</strong></li><li><strong>what level of staleness is acceptable</strong></li><li><strong>where caching actually makes sense</strong></li></ul><p>In some cases, I removed caching completely.</p><p>In others, I aligned cache TTL with data sync cycles.</p><h3>The takeaway</h3><p>Caching is not just a performance optimization.</p><p>It’s a <strong>data consistency decision.</strong></p><p>And if you don’t think about it that way, you might end up trading speed for correctness without realizing it.</p><p>Sometimes, not caching is the better choice.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=01afc4ab299c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Time I Almost Built a Custom Pipeline — and Didn’t]]></title>
            <link>https://medium.com/@dgulati2001/the-time-i-almost-built-a-custom-pipeline-and-didnt-b28586c4cb50?source=rss-7e76fced094b------2</link>
            <guid isPermaLink="false">https://medium.com/p/b28586c4cb50</guid>
            <category><![CDATA[materializedviews]]></category>
            <category><![CDATA[etl-pipeline]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[clickhouse]]></category>
            <category><![CDATA[views]]></category>
            <dc:creator><![CDATA[Dipesh Kumar Gulati]]></dc:creator>
            <pubDate>Mon, 20 Apr 2026 17:36:58 GMT</pubDate>
            <atom:updated>2026-04-20T17:36:58.988Z</atom:updated>
            <content:encoded><![CDATA[<p>At one point, I was working on an analytics flow where we needed to transform raw data before querying it.</p><p>The raw events were coming in fine, but querying them directly wasn’t practical.</p><p>We needed:</p><ul><li>pre-aggregated data</li><li>faster queries</li><li>a cleaner structure for analytics</li></ul><p>So naturally, the question came up:</p><blockquote><em>Where should this transformation happen?</em></blockquote><h3>The first instinct: build a custom layer</h3><p>My initial thought was to introduce a transformation layer.</p><p>Something like:</p><ul><li>fetch raw data</li><li>process it in a scheduled job</li><li>write transformed data into another table</li></ul><p>This felt flexible.</p><blockquote>If the logic changes, we just update the job.</blockquote><blockquote>If we need more control, we handle it in code.</blockquote><blockquote>It gave a sense of ownership over the pipeline.</blockquote><h3>But something felt off</h3><p>The more I thought about it, the more I realized:</p><p>I was about to rebuild something that the database already knows how to do.</p><p>ClickHouse already provides a way to transform and store derived data.</p><p>Materialized views.</p><h3>Rethinking the problem</h3><p>Instead of adding another service or job, I asked:</p><blockquote><em>Can this be pushed down to the database layer?</em></blockquote><p>With a materialized view:</p><ul><li>raw data flows into a source table</li><li>transformation happens automatically</li><li>results are stored in a target table</li></ul><blockquote>No cron jobs.</blockquote><blockquote>No extra service.</blockquote><blockquote>No retry logic to maintain.</blockquote><h3>The trade-off</h3><p>Of course, materialized views are not perfect.</p><p>They come with constraints:</p><ul><li>less flexibility compared to custom code</li><li>harder to modify once deployed</li><li>tied closely to database structure</li></ul><p>But in this case, the transformation logic was:</p><ul><li>well-defined</li><li>stable</li><li>not expected to change frequently</li></ul><p>Which made it a good fit.</p><h3>What I chose</h3><p>I went with a materialized view instead of building a custom transformation layer.</p><p>And it simplified more than I expected.</p><blockquote>No background job to monitor.</blockquote><blockquote>No syncing issues.</blockquote><blockquote>No additional failure points.</blockquote><blockquote>The data just flowed.</blockquote><h3>What I learned</h3><p>That decision changed how I think about backend systems.</p><p>Sometimes we try to solve problems in application code</p><p>that are better handled at the data layer.</p><p>Not everything needs:</p><ul><li>a service</li><li>a job</li><li>a pipeline</li></ul><p>Sometimes the simplest solution already exists — just at a different layer.</p><h3>The takeaway</h3><p>Before building something custom, it’s worth asking:</p><blockquote><em>Is this problem already solved somewhere else in the stack?</em></blockquote><p>Because every extra layer you introduce:</p><ul><li>adds complexity</li><li>creates new failure points</li><li>increases maintenance</li></ul><p>And avoiding that is often the better engineering decision.</p><p>If you’re building analytics systems, this trade-off shows up sooner than expected.</p><p>And the right answer usually depends less on tools and more on how your data actually behaves.</p><h3>🔚 CTA (important)</h3><p>If you enjoy reading about real backend decisions and trade-offs like this,</p><p>consider subscribing — I share short, experience-driven pieces regularly.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b28586c4cb50" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Feature That Didn’t Need an Event System]]></title>
            <link>https://medium.com/@dgulati2001/the-feature-that-didnt-need-an-event-system-38f8ae55f108?source=rss-7e76fced094b------2</link>
            <guid isPermaLink="false">https://medium.com/p/38f8ae55f108</guid>
            <dc:creator><![CDATA[Dipesh Kumar Gulati]]></dc:creator>
            <pubDate>Fri, 03 Apr 2026 00:01:02 GMT</pubDate>
            <atom:updated>2026-04-03T00:01:02.423Z</atom:updated>
            <content:encoded><![CDATA[<p>A while back, I was building a feature where multiple things needed to happen after a single action.</p><p>Something like:</p><ul><li>update a record</li><li>trigger a notification</li><li>log some activity</li><li>maybe call another service</li></ul><p>At that point, it felt like a good place to “do things properly.”</p><p>Instead of calling everything directly, I thought:</p><blockquote><em>Let’s make this event-driven.</em></blockquote><p>So I introduced an event.</p><p>That event had multiple listeners.</p><p>Each listener handled one responsibility.</p><p>On paper, it looked clean.</p><blockquote>Loosely coupled.<br>Extensible.<br>Easy to scale in the future.</blockquote><h3>It felt like the right design</h3><p>The idea was simple:</p><p>If tomorrow we need to add more actions, we just add another listener.</p><p>No need to touch existing code.</p><p>At that time, it felt like I was designing it the “correct” way.</p><h3>But reality was much simpler</h3><p>In practice, the system had:</p><ul><li>one main flow</li><li>a fixed set of actions</li><li>no real need for dynamic extensions</li></ul><p>Nothing was actually changing.</p><p>We weren’t adding new listeners.<br> We weren’t modifying behavior dynamically.</p><p>Everything was static.</p><h3>The hidden cost showed up later</h3><p>After some time, I had to debug an issue in that flow.</p><p>What used to be straightforward became harder to trace.</p><p>Instead of:</p><blockquote><em>Action → Step A → Step B → Step C</em></blockquote><p>It became:</p><blockquote><em>Action → Event → Listener A<br> → Listener B<br> → Listener C</em></blockquote><p>Now I had to jump across multiple files just to understand what was happening.</p><p>The system worked.</p><p>But it wasn’t easy to reason about.</p><h3>The realization</h3><p>That’s when it clicked.</p><p>I hadn’t built the system for what it needed.</p><p>I built it for what I imagined it might need someday.</p><h3>When patterns are useful — and when they’re not</h3><p>Patterns like event-driven design or observer-style systems are powerful.</p><p>They make sense when:</p><ul><li>behavior needs to be extended frequently</li><li>different parts of the system evolve independently</li><li>you truly need decoupling</li></ul><p>But when the flow is simple and stable,<br> they can introduce unnecessary complexity.</p><h3>What I do differently now</h3><p>Now, before introducing abstractions like events or listeners, I ask:</p><ul><li>Is this flow actually going to change?</li><li>Do I really need this level of decoupling?</li><li>Or am I just preparing for a future that may never come?</li></ul><p>Sometimes the answer is yes.</p><p>But many times, it isn’t.</p><h3>The takeaway</h3><p>Good design isn’t about using the “best” pattern.</p><p>It’s about choosing the simplest approach that fits the current problem.</p><p>Because every abstraction you add today<br> is something you’ll have to understand tomorrow.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=38f8ae55f108" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[“It Worked Perfectly on My Machine”]]></title>
            <link>https://medium.com/@dgulati2001/it-worked-perfectly-on-my-machine-e9b14263f906?source=rss-7e76fced094b------2</link>
            <guid isPermaLink="false">https://medium.com/p/e9b14263f906</guid>
            <dc:creator><![CDATA[Dipesh Kumar Gulati]]></dc:creator>
            <pubDate>Thu, 02 Apr 2026 05:44:50 GMT</pubDate>
            <atom:updated>2026-04-02T05:44:50.420Z</atom:updated>
            <content:encoded><![CDATA[<p>Every developer has said this at some point.</p><blockquote><em>“It works on my machine.”</em></blockquote><p>During development, everything behaves exactly the way we expect.</p><blockquote>The API responds correctly.<br>The database query returns the right data.<br>The background job finishes without errors.</blockquote><p>So we push the change to production with confidence.</p><p>And sometimes… things immediately start behaving differently.</p><h3>Development environments are controlled</h3><p>Local environments are predictable.</p><blockquote>You control the data.<br>You control the traffic.<br>You control when things run.</blockquote><blockquote>Most requests happen one at a time.<br>Data is usually clean and small.<br>Dependencies respond quickly.</blockquote><p>Because of this, many edge cases never appear during development.</p><h3>Production environments are unpredictable</h3><p>Production systems operate under very different conditions.</p><blockquote>Multiple users interact with the system at the same time.<br>Requests arrive in bursts.<br>External APIs respond slower than expected.</blockquote><p>The data is also very different.</p><blockquote>Fields may be missing.<br>Values may not match assumptions.<br>Records might be far larger than anything seen locally.</blockquote><p>None of these situations are unusual in production.</p><p>But they rarely appear in development.</p><h3>Timing changes behavior</h3><p>One subtle difference between local and production environments is timing.</p><p>In development, processes often run sequentially. In production, many things happen simultaneously.</p><blockquote>Two requests might update the same record.<br>Two jobs might process the same data.<br>A retry might trigger while another process is still running.</blockquote><p>These situations can lead to bugs that never appeared during development.</p><h3>The real test is production behavior</h3><p>Local testing is essential, but it only answers one question:</p><blockquote><em>Does the code work in a controlled environment?</em></blockquote><p>Production answers a different question:</p><blockquote><em>Does the system behave correctly under real conditions?</em></blockquote><p>That difference is where many important lessons in backend engineering come from.</p><h3>The mindset shift</h3><p>Over time, working with production systems changes how you think. You start asking questions like:</p><ul><li>What happens if two requests run at the same time?</li><li>What if the API response is incomplete?</li><li>What if this process runs twice?</li></ul><p>Thinking this way helps systems survive situations that development environments never reveal.</p><p>In the end, “It worked on my machine” isn’t wrong. It just means the real test hasn’t happened yet.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e9b14263f906" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The First Time I Had to Debug Someone Else’s Code]]></title>
            <link>https://medium.com/@dgulati2001/the-first-time-i-had-to-debug-someone-elses-code-fe5741d5d456?source=rss-7e76fced094b------2</link>
            <guid isPermaLink="false">https://medium.com/p/fe5741d5d456</guid>
            <dc:creator><![CDATA[Dipesh Kumar Gulati]]></dc:creator>
            <pubDate>Mon, 09 Mar 2026 08:37:07 GMT</pubDate>
            <atom:updated>2026-03-09T08:37:07.671Z</atom:updated>
            <content:encoded><![CDATA[<p>One thing no one tells you when you start working as a backend engineer:</p><p>You won’t spend most of your time writing new code.</p><p>You’ll spend a lot of time understanding code that already exists.</p><p>I remember the first time I had to debug an issue in a part of the system I hadn’t written.</p><p>At first it felt simple.</p><p>There was a bug report, and the expectation was to fix it.</p><p>I opened the code assuming I would quickly find the problem.</p><p>But within a few minutes I realized something.</p><p>The real challenge wasn’t fixing the bug.</p><p>The real challenge was understanding what the code was actually doing.</p><h3>Following the trail</h3><p>The function I started reading called another function.</p><p>That function triggered a background job.</p><p>The job updated some database records.</p><p>And another process later picked up those records and performed additional work.</p><p>What looked like a small piece of code was actually part of a much larger flow.</p><p>And the bug could have been happening anywhere along that chain.</p><h3>Learning to read systems</h3><p>At that moment I realized something important about backend work.</p><p>Debugging isn’t just about reading code.</p><p>It’s about understanding how different pieces of a system interact with each other.</p><p>APIs call services.<br>Services trigger jobs.<br>Jobs update data.<br>Data changes affect other parts of the system.</p><p>A small issue in one place can appear as a problem somewhere completely different.</p><h3>The skill that grows over time</h3><p>The first few times you debug a complex system, it feels slow and confusing.</p><p>You jump between files.<br>You check logs.<br>You follow the data step by step.</p><p>But over time, something interesting happens.</p><p>You start recognizing patterns.</p><p>You learn where problems usually hide.</p><p>And gradually you get faster at tracing the behavior of the system.</p><h3>A quiet but important skill</h3><p>Writing new code is visible work.</p><p>Debugging and understanding systems is quieter.</p><p>But in many backend roles, it becomes one of the most important skills you develop.</p><p>Because the ability to understand an unfamiliar system quickly is what allows you to change it safely.</p><p>And most real-world systems are far bigger than the parts any single engineer originally wrote.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fe5741d5d456" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Idempotency & Data Consistency in Backend Systems]]></title>
            <link>https://medium.com/@dgulati2001/idempotency-data-consistency-in-backend-systems-061c9619f37d?source=rss-7e76fced094b------2</link>
            <guid isPermaLink="false">https://medium.com/p/061c9619f37d</guid>
            <category><![CDATA[api]]></category>
            <category><![CDATA[backend-development]]></category>
            <category><![CDATA[idempotent]]></category>
            <category><![CDATA[idempotency]]></category>
            <category><![CDATA[backend-engineering]]></category>
            <dc:creator><![CDATA[Dipesh Kumar Gulati]]></dc:creator>
            <pubDate>Mon, 26 Jan 2026 08:23:47 GMT</pubDate>
            <atom:updated>2026-01-26T08:23:47.393Z</atom:updated>
            <content:encoded><![CDATA[<p><em>(Lessons from building systems that publish and sync data)</em></p><p>When I started building backend systems that interacted with external platforms, I assumed retries were harmless.</p><p>If something failed, just retry the request.<br> If a job ran again, it should “just work”.</p><p>That assumption didn’t last long.</p><p>Over time, I learned that <strong>retries are easy</strong> — <strong>data correctness is not</strong>.</p><p>This is where idempotency and data consistency quietly become some of the most important concepts in backend engineering.</p><h3>The problem isn’t failure — it’s partial success</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1010/1*amTUg2H1OLQ76SZhXexcUg.png" /><figcaption><strong><em>Partial success: the external action succeeds, but local state never updates.</em></strong></figcaption></figure><p>Most real systems don’t fail cleanly.</p><p>A request might:</p><ul><li>succeed on the external system</li><li>fail while saving data locally</li><li>time out even though the action already happened</li></ul><p>From the outside, everything looks fine:</p><ul><li>no crashes</li><li>no alerts</li><li>no obvious errors</li></ul><p>But internally, the data starts drifting.</p><p>Duplicate records appear.<br> Some records are missing.<br> Others look “valid” but represent the wrong state.</p><p>This is much harder to detect than a hard failure.</p><h3>What idempotency actually means in practice</h3><p>Idempotency is often explained as:</p><blockquote><em>“Calling the same operation multiple times should produce the same result.”</em></blockquote><p>That sounds simple, but in real systems it means something more specific:</p><ul><li>A retry should <strong>not create duplicates</strong></li><li>A rerun should <strong>not corrupt state</strong></li><li>A delayed response should <strong>not overwrite newer data</strong></li></ul><p>In short:</p><blockquote><em>Your system should be safe even when the same input shows up more than once.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/758/1*5Enjipv539s_lHFnj5Egzw.png" /><figcaption><strong><em>Retries without idempotency slowly corrupt data.</em></strong></figcaption></figure><p>And it <em>will</em> show up more than once.</p><h3>Where backend systems usually break</h3><p>From my experience, data inconsistency usually creeps in through these paths:</p><h3>1. Background jobs</h3><p>Jobs are retried.<br> Schedulers rerun.<br> Manual reprocessing happens.</p><p>If a job assumes “this runs only once”, it’s already fragile.</p><h3>2. External APIs</h3><p>External systems:</p><ul><li>change schemas</li><li>deprecate fields</li><li>resend data</li><li>return partial responses</li></ul><p>Your system must assume:</p><blockquote><em>“I don’t fully control the input.”</em></blockquote><h3>3. Time-based data</h3><p>Anything fetched or published over time is risky:</p><ul><li>daily metrics</li><li>periodic syncs</li><li>batch publishing</li></ul><p>If you don’t track <strong>what was already processed</strong>, you’re guessing.</p><h3>Simple techniques that make systems safer</h3><p>You don’t need complex infrastructure to improve consistency.<br> Some small patterns go a long way.</p><h3>✅ Idempotency keys</h3><p>Use a stable identifier for an operation.<br> If the same key appears again, treat it as the same request.</p><h3>✅ Database constraints</h3><p>Unique indexes are underrated.<br> They are often the last line of defense against duplication.</p><h3>✅ Upserts instead of inserts</h3><p>If data represents a “state”, overwrite it safely instead of assuming it’s new.</p><h3>✅ Explicit states</h3><p>Instead of boolean flags, use clear states:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/886/1*mrLnS2S7KHtjBom9azWe6Q.png" /><figcaption><strong><em>Explicit states make retries predictable and safe.</em></strong></figcaption></figure><p>This makes retries predictable.</p><h3>✅ Track progress, not assumptions</h3><p>Store:</p><ul><li>last processed timestamp</li><li>last processed identifier</li></ul><p>Never assume “this won’t run again”.</p><h3>Consistency is a design decision, not a bug fix</h3><p>One important realization for me was this:</p><blockquote><em>Data consistency cannot be patched later.</em></blockquote><p>If a system isn’t designed to be retry-safe, no amount of logging or alerts will fully protect it.</p><p>You have to decide early:</p><ul><li>What happens if this runs twice?</li><li>What happens if it partially succeeds?</li><li>What happens if the response changes tomorrow?</li></ul><p>Once you start asking these questions, your backend designs change permanently.</p><h3>Final thought</h3><p>Most backend systems don’t fail loudly.<br> They fail <strong>silently</strong>, one duplicate or missing record at a time.</p><p>Idempotency isn’t about perfection.<br> It’s about building systems that remain correct even when the real world behaves unpredictably.</p><p>And the real world always does.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=061c9619f37d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building an AI-Powered RFP Workflow: What I Learned Turning Messy Inputs into Something Usable]]></title>
            <link>https://medium.com/@dgulati2001/building-an-ai-powered-rfp-workflow-what-i-learned-turning-messy-inputs-into-something-usable-cd4d3b930025?source=rss-7e76fced094b------2</link>
            <guid isPermaLink="false">https://medium.com/p/cd4d3b930025</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[rfp-software]]></category>
            <category><![CDATA[rfp]]></category>
            <dc:creator><![CDATA[Dipesh Kumar Gulati]]></dc:creator>
            <pubDate>Sun, 11 Jan 2026 00:02:47 GMT</pubDate>
            <atom:updated>2026-01-11T00:02:47.751Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OM288RqH67cRk5zt_-AGdA.png" /></figure><p>Procurement sounds straightforward: write an RFP, send it to vendors, compare quotes, pick one.</p><p>In practice, it’s messy.</p><p>Requirements come in as long paragraphs, vendors reply with emails, PDFs, spreadsheets, half-data, and nothing is consistent. Someone eventually ends up manually reading everything, extract numbers, and trying to compare apples to oranges.</p><p>I spent some time building a system to improve this flow using AI. This post isn’t about “adding AI everywhere”, but about what actually worked, what didn’t, and what I learned while designing it.</p><h3>The Problem Wasn’t Writing Text</h3><p>The hardest part wasn’t generating RFP emails or summaries.</p><p>The real challenges were:</p><ul><li>turning vague, natural language input into something structured</li><li>handling vendor responses that had no fixed format</li><li>designing data models that wouldn’t break the moment requirements changed</li><li>using AI without blindly trusting its output</li></ul><p>Once I framed the problem this way, the design became much clearer.</p><h3>Start With the Data Model (Always)</h3><p>Before touching AI, I spent time on how the data should look.</p><figure><img alt="Workkflow for RFP" src="https://cdn-images-1.medium.com/max/1024/1*p3Q4GOXfxpExZ2KC9sao_w.png" /></figure><p>An RFP isn’t just text. Internally, it needs structure:</p><ul><li>what’s being procured</li><li>quantities and specifications</li><li>budget and deadlines</li><li>payment terms and constraints</li></ul><p>At the same time, I made sure to <strong>always store the original input</strong>. That turned out to be very important later — both for debugging and for reprocessing when logic changed.</p><p>Vendors were kept intentionally simple. Just clean master data.</p><p>Each proposal linked a vendor to an RFP and stored:</p><ul><li>the raw response (email + attachments)</li><li>the parsed structured data</li><li>a short AI-generated summary</li></ul><p>Having both raw and parsed versions saved me more than once.</p><h3>Turning Requirements Into Structure</h3><p>AI helped convert free-form requirements into a structured RFP. But I never treated that output as final.</p><p>Everything went through schema validation, and unclear fields were left empty instead of guessed. If something was ambiguous, I preferred missing data over wrong data.</p><h3>Parsing Vendor Responses</h3><p>Vendor replies were unpredictable. Some wrote paragraphs, some sent tables, some attached PDFs.</p><p>AI helped extract things like:</p><ul><li>prices</li><li>terms</li><li>delivery timelines</li></ul><p>But again, the key was <strong>not trusting it blindly</strong>. I kept indicators and always retained the original response for reference.</p><h3>Comparing Proposals</h3><p>Instead of just comparing prices, I used AI to help explain trade-offs:</p><ul><li>who met all requirements</li><li>who was cheaper but incomplete</li><li>who had better terms</li></ul><p>The goal wasn’t to auto-pick a vendor, but to help answer <em>why</em> one option made more sense than another.</p><h3>Email Was Harder Than Expected</h3><p>Email integration turned out to be one of the tricky part.</p><p>Replies come in threads, subjects change, attachments vary, and nothing is reliable.</p><p>What worked was keeping things simple:</p><ul><li>embed identifiers in email subjects</li><li>store every incoming email raw before processing</li><li>parse body and attachments together</li><li>never assume format consistency</li></ul><p>No fancy — just defensive.</p><h3>Designing for Change Early</h3><p>One thing I was very conscious about was change.</p><p>Requirements evolve. Fields get deprecated. Vendors change how they respond.</p><p>To avoid painful migrations:</p><ul><li>I relied on enums and mappings instead of rigid schemas</li><li>avoided deleting or overwriting historical data</li><li>made re-parsing possible if logic improved later</li></ul><p>This made the system much more forgiving.</p><h3>What This Taught Me About AI in Backend Systems</h3><p>A few things became very clear while building this:</p><ul><li>AI is great at interpretation, not authority</li><li>raw data should always be preserved</li><li>validation matters more than prompt cleverness</li><li>systems should assume AI will sometimes be wrong</li></ul><p>Once you accept that, AI becomes a really useful tool instead of a risky dependency.</p><h3>Final Thought</h3><p>For me, this project reinforced something important:</p><p>Modern backend work isn’t just about APIs and databases anymore. It’s about building systems that can handle unreliable inputs and still produce trustworthy outcomes.</p><p>AI helps — but only if you design around its limitations.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cd4d3b930025" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Silent Failures Are the Most Dangerous Kind of Bugs]]></title>
            <link>https://medium.com/@dgulati2001/silent-failures-are-the-most-dangerous-kind-of-bugs-da489a3452f8?source=rss-7e76fced094b------2</link>
            <guid isPermaLink="false">https://medium.com/p/da489a3452f8</guid>
            <category><![CDATA[error-handling]]></category>
            <category><![CDATA[software-bugs]]></category>
            <dc:creator><![CDATA[Dipesh Kumar Gulati]]></dc:creator>
            <pubDate>Wed, 31 Dec 2025 12:02:24 GMT</pubDate>
            <atom:updated>2025-12-31T12:02:24.310Z</atom:updated>
            <content:encoded><![CDATA[<p>Most engineers worry about systems crashing. In reality, the more dangerous problems are the ones that don’t fail loudly. This is a lesson I learned the hard way while working on a backend system that periodically fetched analytics data from a third-party API.</p><h3>Everything Looked Fine — Until It Didn’t</h3><p>We had background jobs running on a schedule to fetch account-level metrics from a social media platform.<br> The jobs were stable. They completed on time. There were no retries, no exceptions, no alerts.</p><p>From the outside, the system looked healthy.</p><p>A month later, during a routine data review, we noticed something strange:<br> some metrics hadn’t updated in weeks.</p><p>At first, it didn’t make sense. The jobs were running successfully every day. Logs showed no failures. Monitoring dashboards were green.</p><p>That’s when we decided to dry-run the flow locally and inspect the raw API responses.</p><h3>The Real Problem: Partial Errors and Assumptions</h3><p>The API hadn’t gone down. It hadn’t returned 500s. Instead, a few metrics had been <strong>deprecated</strong>, and the API was returning partial error responses indicating that those fields were no longer supported. We had made a dangerous assumption:</p><blockquote><em>“If the API call succeeds, the data must be valid.”</em></blockquote><p>Our job logic treated the request as successful as long as it received a response. We didn’t explicitly validate whether all expected metrics were present or whether the response contained warnings or field-level errors.</p><p>As a result:</p><ul><li>Jobs completed successfully</li><li>No exceptions were thrown</li><li>No alerts were triggered</li><li>But the data was silently missing</li></ul><p>The system wasn’t failing — it was <strong>lying</strong>.</p><h3>Why Silent Failures Hurt More Than Crashes</h3><p>Crashes get noticed quickly. Silent failures don’t.</p><p>They:</p><ul><li>Corrupt data over time</li><li>Break downstream analytics</li><li>Erode trust in dashboards and reports</li><li>Are discovered weeks or months later, when debugging is far harder</li></ul><p>By the time we noticed the issue, we had already lost a month of historical data.</p><h3>Fixing the System (and the Mindset)</h3><p>We immediately fixed the deprecated metrics and aligned the implementation with the latest API documentation.</p><p>But more importantly, we changed how we handled errors:</p><ul><li>We added explicit validation for expected fields</li><li>We treated partial API errors as first-class failures</li><li>We logged and surfaced warnings, not just exceptions</li><li>We added alerts for missing or incomplete data</li><li>We stopped equating “job success” with “data correctness”</li></ul><p>After these changes, similar issues became obvious within minutes instead of weeks.</p><h3>What This Taught Me About Backend Engineering</h3><p>That incident fundamentally changed how I think about backend systems:</p><ul><li><strong>Success ≠ correctness</strong></li><li><strong>External APIs change, often silently</strong></li><li><strong>Lack of errors does not mean healthy data</strong></li><li><strong>Observability is part of business logic</strong></li></ul><p>If your system depends on external data sources, error handling isn’t optional — it’s core infrastructure.</p><h3>Final Thought</h3><p>A backend system that crashes loudly is easier to fix than one that fails quietly.</p><p>The goal isn’t just to keep jobs running.<br> The goal is to know, with confidence, that the data you’re producing is correct.</p><p>And that confidence comes from defensive design, explicit validation, and treating “unexpected success” as a smell — not a win.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=da489a3452f8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What Laravel Jobs Taught Me About Designing Failure-Safe Background Work]]></title>
            <link>https://medium.com/@dgulati2001/what-laravel-jobs-taught-me-about-designing-failure-safe-background-work-a4d0fec26266?source=rss-7e76fced094b------2</link>
            <guid isPermaLink="false">https://medium.com/p/a4d0fec26266</guid>
            <category><![CDATA[cronjob-scheduler]]></category>
            <category><![CDATA[laravel-job]]></category>
            <category><![CDATA[laravel]]></category>
            <dc:creator><![CDATA[Dipesh Kumar Gulati]]></dc:creator>
            <pubDate>Sat, 27 Dec 2025 09:02:59 GMT</pubDate>
            <atom:updated>2025-12-27T09:02:59.064Z</atom:updated>
            <content:encoded><![CDATA[<p>Laravel makes background jobs feel deceptively simple. You create a job, push it to a queue, add retries, and assume the framework will handle the rest.</p><p>That assumption holds — until a job fails halfway through real work. I assumed:</p><ul><li>If a job fails, it will retry cleanly</li><li>Retries mean safety</li><li>Wrapping logic in a transaction guarantees consistency</li></ul><p>None of this is guaranteed by the queue system. Laravel retries the <strong>job</strong>, not the <strong>side effects</strong>.</p><h3>Failure</h3><p>One job processed multiple records. The job failed after updating some of them. When Laravel retried:</p><ul><li>Already-processed records were processed again</li><li>No exception was thrown</li><li>No warning appeared in logs</li></ul><p>The queue was healthy. The data wasn’t. What actually went wrong laravel jobs are <strong>at-least-once execution</strong>.</p><p>This means:</p><ul><li>A job may run more than once</li><li>A job may partially succeed</li><li>A job may be killed at any line of code</li></ul><p>Retries don’t undo previous writes.</p><h3>Design Correction</h3><p>I stopped designing jobs as “tasks” and started designing them as <strong>state transitions</strong>.</p><p>The fix wasn’t complex:</p><ul><li>Each record stored its processing state</li><li>The job checked state before doing work</li><li>Already-processed records were skipped</li><li>Failures affected only the current record</li></ul><p>Retries became harmless.</p><h3>What I Avoid Now</h3><ul><li>One job handling many unrelated records</li><li>Global database transactions inside jobs</li><li>Assuming tries means safety</li><li>Writing jobs that cannot be safely re-run</li></ul><h3>How I Design Laravel Jobs Now</h3><ul><li>One unit of work per job</li><li>Idempotent logic</li><li>Minimal transaction scope</li><li>Explicit state tracking</li></ul><p>A job should be kill-safe, retry-safe, and deploy-safe.</p><h3>Principle</h3><p>Laravel Jobs make execution easy. They don’t make correctness automatic. That responsibility still belongs to the developer.</p><h3>Ps: Why I Don’t Rely on failed() Alone</h3><p>The failed() method tells you a job broke. By the time failed() runs, the damage may already be done.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a4d0fec26266" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>