---
title: "Madhav Bhasin (@madhavbhasin) | Hashnode"
description: "Production patterns for backend engineers who are tired of hello-world tutorials. Read the latest articles by Madhav Bhasin on Hashnode."
url: "https://hashnode.com/@madhavbhasin"
---

@madhavbhasin

# Madhav Bhasin

@madhavbhasin · Noida, India · Joined March 2022

Production patterns for backend engineers who are tired of hello-world tutorials.

[Website](https://madhav.dev/)

## Comments

[Good addition — secrets: inherit is the obvious convenience solution that creates a non-obvious governance problem. Once a shared workflow lives in a central repo, inheriting everything means the callee gets access to secrets it doesn't need, across every repo that calls it. Fine for a small team with a single org repo. Worth a deliberate decision rather than a default once you're managing secrets across multiple projects or teams.](https://hashnode.com/posts/github-actions-i-set-up-on-every-project/6ab0a2db5130721a4750d43a/comment/6ab0a8808eef7389083ae9fc#reply-6ac624df5197ceb9c25903ad)

Reply · Article · Oct 7 · [GitHub Actions I Set Up on Every Project](https://hashnode.com/posts/github-actions-i-set-up-on-every-project/6ab0a2db5130721a4750d43a)

["Treat the workflow interface like an API" is the right mental model and the post doesn't say it that clearly. Explicit inputs and outputs, documented permissions, no repository-specific assumptions baked in — those are the constraints that make a reusable workflow actually reusable rather than just shared. The hidden coupling problem is real and usually shows up the second time you try to use the workflow somewhere new.](https://hashnode.com/posts/github-actions-i-set-up-on-every-project/6ab0a2db5130721a4750d43a/comment/6ab312418a8d2afe41db0b2f#reply-6ac624b550c9f923d1942c91)

Reply · Article · Oct 7 · [GitHub Actions I Set Up on Every Project](https://hashnode.com/posts/github-actions-i-set-up-on-every-project/6ab0a2db5130721a4750d43a)

[Exactly — the queue buildup from rapid fixup commits is the most visible pain point that concurrency groups solve. The cancel-in-progress: false distinction for deploys is worth keeping in mind too, where you want queuing rather than cancellation.](https://hashnode.com/posts/github-actions-i-set-up-on-every-project/6ab0a2db5130721a4750d43a/comment/6ab31fb9014d78810ab76e85#reply-6ac624917569a2b10a3128ba)

Reply · Article · Oct 7 · [GitHub Actions I Set Up on Every Project](https://hashnode.com/posts/github-actions-i-set-up-on-every-project/6ab0a2db5130721a4750d43a)

[Thanks — "assertion strategy problem" is the reframe that made the rest of the testing approach click for us too. The demo-to-production gap on AI features is real and mostly comes down to exactly this: the habits that work for deterministic code silently fail on probabilistic output. Glad it was useful.](https://hashnode.com/posts/testing-ai-dependent-code-mocking-llms-evaluating-outputs-and-avoiding-flaky-tests/6ac33dab2f76360ece243dda/comment/6ac38410c1c1217cc41efe9f#reply-6ac6242543b2dd81ee2ac8b9)

Reply · Article · Oct 7 · [Testing AI-Dependent Code: Mocking LLMs, Evaluating Outputs, and Avoiding Flaky Tests](https://hashnode.com/posts/testing-ai-dependent-code-mocking-llms-evaluating-outputs-and-avoiding-flaky-tests/6ac33dab2f76360ece243dda)

[This is the cleaner framing than what the post uses. Contract tests verify the application handles the response correctly — schema, error paths, retry bounds. Evaluation cases verify the model extracted the right thing. Conflating the two is what produces tests that are either flaky or meaningless. "Make each test responsible for a property that can actually be judged reliably" is the principle the post should have opened with.](https://hashnode.com/posts/testing-ai-dependent-code-mocking-llms-evaluating-outputs-and-avoiding-flaky-tests/6ac33dab2f76360ece243dda/comment/6ac38d069811b96acdb1f7dd#reply-6ac624071e7294a005eda001)

Reply · Article · Oct 7 · [Testing AI-Dependent Code: Mocking LLMs, Evaluating Outputs, and Avoiding Flaky Tests](https://hashnode.com/posts/testing-ai-dependent-code-mocking-llms-evaluating-outputs-and-avoiding-flaky-tests/6ac33dab2f76360ece243dda)

[You're right that schema validity and extraction correctness are different things, and the post conflates them. Asserting total\_amount > 0 catches malformed output, not wrong output. The locale-aware comparison against a labelled expected value is the correct approach for testing extraction quality — it just belongs in the separate evaluation suite against known source documents, not the mocked unit tests. The mocked tests cover application behaviour; the evaluation suite covers whether the model extracted the right value. Both need to exist.](https://hashnode.com/posts/testing-ai-dependent-code-mocking-llms-evaluating-outputs-and-avoiding-flaky-tests/6ac33dab2f76360ece243dda/comment/6ac39aaa147f64827744312d#reply-6ac623c86fa83e597a3f61a5)

Reply · Article · Oct 7 · [Testing AI-Dependent Code: Mocking LLMs, Evaluating Outputs, and Avoiding Flaky Tests](https://hashnode.com/posts/testing-ai-dependent-code-mocking-llms-evaluating-outputs-and-avoiding-flaky-tests/6ac33dab2f76360ece243dda)

[Solid edge case — finish\_reason="length" is exactly the kind of failure that looks like success if you're only checking that the response came back. Checking it before any persistence call is the right place to gate it, and worth adding to the fixture suite alongside the malformed JSON case. The bounded retry matters too — a truncated response retried with the same prompt and same token limit will truncate again.](https://hashnode.com/posts/testing-ai-dependent-code-mocking-llms-evaluating-outputs-and-avoiding-flaky-tests/6ac33dab2f76360ece243dda/comment/6ac3a9a510e928a5044df243#reply-6ac6238d28eaabc1974c0380)

Reply · Article · Oct 7 · [Testing AI-Dependent Code: Mocking LLMs, Evaluating Outputs, and Avoiding Flaky Tests](https://hashnode.com/posts/testing-ai-dependent-code-mocking-llms-evaluating-outputs-and-avoiding-flaky-tests/6ac33dab2f76360ece243dda)

[Good addition — temperature=0 plus a fixed seed is a useful middle ground, especially for integration tests where you want some real-API coverage but less noise. The caveat you flagged is the right one: seed behaviour isn't guaranteed across model versions, so it's a noise reducer not a flakiness eliminator. Still worth doing. I'd pair it with snapshotting the model version in the test so a version bump is a visible signal rather than a silent source of drift.](https://hashnode.com/posts/testing-ai-dependent-code-mocking-llms-evaluating-outputs-and-avoiding-flaky-tests/6ac33dab2f76360ece243dda/comment/6ac42d3e350baa25b6591b81#reply-6ac6236edf1531d125998a5c)

Reply · Article · Oct 7 · [Testing AI-Dependent Code: Mocking LLMs, Evaluating Outputs, and Avoiding Flaky Tests](https://hashnode.com/posts/testing-ai-dependent-code-mocking-llms-evaluating-outputs-and-avoiding-flaky-tests/6ac33dab2f76360ece243dda)

[The normaliser for numbers and dates is exactly the right move — one fix, whole category gone. For free text: three things I actually assert on — required concept is present (loose, not keyword), length is within a sane range, and no model artefacts (leading "Sure!", markdown fences in plain-text fields). Beyond that I treat it as an evaluation problem, not a unit test problem. Weekly real API runs are where those quality regressions surface, not mocked tests.](https://hashnode.com/posts/testing-ai-dependent-code-mocking-llms-evaluating-outputs-and-avoiding-flaky-tests/6ac33dab2f76360ece243dda/comment/6ac5cd104ca22d4f001e92fc#reply-6ac6233528eaabc1974c0325)

Reply · Article · Oct 7 · [Testing AI-Dependent Code: Mocking LLMs, Evaluating Outputs, and Avoiding Flaky Tests](https://hashnode.com/posts/testing-ai-dependent-code-mocking-llms-evaluating-outputs-and-avoiding-flaky-tests/6ac33dab2f76360ece243dda)

[Three that actually hurt us: Migrate and refactor separately. When something breaks mid-migration you won't know which change caused it. Move first, clean up after. Don't assume equivalent services behave the same. SQS and Pub/Sub are both "message queues." The delivery guarantees and retry behaviour are different enough to surprise you. Write a rollback plan per service, not just for the database. When a Cloud Run service had issues post-deploy, we were improvising. A one-page runbook per service removes the stress. Good rule of thumb: if a decision feels rushed mid-migration, it probably is.](https://hashnode.com/posts/i-migrated-a-product-from-aws-to-gcp-here-s-what-i-d-do-differently/6a69533aba3a27735ad8fd2c/comment/6a698179b767141471eb3aae#reply-6a71900ba8231247706d2922)

Reply · Article · Aug 4 · [I Migrated a Product from AWS to GCP — Here's What I'd Do Differently](https://hashnode.com/posts/i-migrated-a-product-from-aws-to-gcp-here-s-what-i-d-do-differently/6a69533aba3a27735ad8fd2c)
