<?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"><channel><title><![CDATA[Kiran Sai]]></title><description><![CDATA[Kiran Sai]]></description><link>https://kiransaidev.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Thu, 26 Nov 2026 11:47:06 GMT</lastBuildDate><atom:link href="https://kiransaidev.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Review in Dependency Order: A Method for Large (and AI-Written) Pull Requests]]></title><description><![CDATA[How I review the plan first, then the layers, and why it cuts review back-and-forth]]></description><link>https://kiransaidev.hashnode.dev/review-in-dependency-order-a-method-for-large-and-ai-written-pull-requests</link><guid isPermaLink="true">https://kiransaidev.hashnode.dev/review-in-dependency-order-a-method-for-large-and-ai-written-pull-requests</guid><category><![CDATA[code review]]></category><category><![CDATA[Software Engineering]]></category><category><![CDATA[AI]]></category><category><![CDATA[Flutter]]></category><category><![CDATA[best practices]]></category><dc:creator><![CDATA[Kiran Sai]]></dc:creator><pubDate>Mon, 23 Nov 2026 14:39:43 GMT</pubDate><content:encoded><![CDATA[<p>AI coding tools changed one thing about my week more than anything else: the size of the pull requests landing in my review queue.</p>
<p>A feature that used to arrive as three or four small PRs over a week now arrives in an afternoon as one 2,000-line diff. It has models, an API client, state management, UI, a couple of "small tweaks" to shared widgets, and the tests. It compiles, it mostly works, and reviewing it properly is exhausting.</p>
<p>And it's not just humans reviewing anymore. With AI review bots on every PR, our PRs easily reach 50 to 60 conversations. Forty comments on a single PR is normal now.</p>
<p>When a diff is that big and that noisy, reviewers do one of two things. They skim and approve, or they add their own comments across every layer at once, and the author spends days chasing changes up and down the stack. Neither one is a real review.</p>
<p>Over time I settled on a method that has nothing to do with any framework. I use it on Flutter code at work, but it applies to any codebase with layers:</p>
<blockquote>
<p><strong>Review the plan first. Then split the code by dependency and review it from the bottom up, one layer at a time.</strong></p>
</blockquote>
<p>The goal is simple: settle each decision once, at the right level, so you have fewer review discussions and fewer large late changes.</p>
<p>Stacked PRs and bottom-up review aren't new ideas. What I want to share is the specific rules that made it work for my team, especially now that a lot of the code is AI-written.</p>
<hr />
<h2>1. Review the plan before you review any code</h2>
<p>Most painful review threads aren't about code at all. They're about architecture: "why is this state global?", "shouldn't this be its own service?", "why are we caching this here?" When those questions come up on a code PR, the answer means rewriting code that's already written, and that's what causes the big late changes.</p>
<p>So the first PR in the stack has no code in it. It's the <strong>build plan</strong>, as its own PR.</p>
<p>With AI-assisted development this comes almost for free, because most agent workflows produce a plan before they write code. Review that plan properly:</p>
<ul>
<li>Don't stop at the top-level flowchart. AI review tools like Greptile generate one for a PR, and it's a useful overview, but it's not enough. Open the <strong>detailed Mermaid diagrams in the plan itself</strong> (data flow, sequence) and check that the flow actually makes sense.</li>
<li>Comment on the <strong>architecture and approach</strong> here: where state lives, which layers change, what's shared, what's new.</li>
<li>Agree on it before anyone reviews a line of implementation.</li>
</ul>
<p>Once the plan is approved, the code PRs don't need to reopen those arguments. Code review can focus on whether the code does what the agreed plan says, and does it well. That alone removes most of the back-and-forth.</p>
<h2>2. Split by dependency, not by file count</h2>
<p>The usual advice is "keep PRs small." That's true, but it doesn't help much. Small <em>how</em>? Splitting a 2,000-line PR into four random 500-line PRs doesn't make it easier to review.</p>
<p>The split that works follows the direction of dependencies:</p>
<ol>
<li><strong>Data layer:</strong> models, DTOs, serialization, schemas.</li>
<li><strong>Data access layer:</strong> API clients, repositories, local storage.</li>
<li><strong>State / business logic:</strong> view models, providers, blocs, controllers, use cases.</li>
<li><strong>UI:</strong> screens, widgets, components, navigation hooks.</li>
<li><strong>Feature integration PR:</strong> wiring it all together end to end.</li>
</ol>
<p>Each PR builds on the one below it and only depends on code that's already been reviewed. In a Flutter app with Riverpod, that's models, then the network layer, then providers, then UI. In a web app it might be schema, then API routes, then hooks or store, then components. In a backend it might be migrations, then repositories, then services, then handlers. The layer names change, but the order doesn't.</p>
<p>Here's what the whole stack looks like, starting with the plan:</p>
<img src="https://cdn.hashnode.com/uploads/covers/6b0327218d1c5dbf67c3346d/2a39b62c-34ed-4491-bb99-ea7507c73978.png" alt="PR stack split by dependency: build plan, data layer, data access layer, state and logic, UI, feature integration, with a separate shared/design-system PR" style="display:block;margin:0 auto" />

<p>Each box is one PR and one review. Each arrow means "builds on, and is reviewed after."</p>
<h2>3. Review starts before the feature is finished</h2>
<p>This is the part people usually miss. Splitting by dependency isn't only about smaller diffs. It changes <strong>when</strong> review can start.</p>
<p>With one big PR, nobody can review anything until the entire feature is done. With an approved plan, the feature is built in phases, and each phase goes up as its own PR the moment it's ready. The data layer doesn't need the UI to exist before it can be reviewed. Each phase stands on its own against the agreed plan.</p>
<p>So while the data layer is being reviewed, the author is already building the data access layer. By the time the last phase is written, most of the feature has already been reviewed and merged. You don't wait for the final phase to start, and you don't get a 2,000-line review dump at the end. That's the biggest practical win of the whole approach.</p>
<h2>4. Review in order, not in parallel</h2>
<p>This is the rule people push back on most, and it's the one I care about most.</p>
<p>When a feature is split into a stack, it's tempting to put all the PRs up at once and let different reviewers take different layers in parallel. It feels faster, but it isn't.</p>
<p>Say a reviewer on the data-layer PR points out that a field should be nullable, or that an enum is missing a case. That one comment now changes the repository, the state logic and the UI above it. If those PRs were being reviewed at the same time, every comment on them was made against code that's about to change. You get to review the same lines twice and argue about them once more than you needed to.</p>
<p>Reviewing in order means:</p>
<ul>
<li>Each layer is reviewed against a <strong>settled foundation</strong>.</li>
<li>Feedback flows <strong>one way</strong>, upward, instead of bouncing around the stack.</li>
<li>The reviewer's mental model builds up the same way the code does: "here's the data, here's how it's fetched, here's how it's held, here's how it's shown."</li>
</ul>
<p>The upper PRs can (and should) be open as drafts so people can see where things are heading. But the <em>review</em> goes bottom-up.</p>
<h2>5. Shared and design-system changes get their own PR. Always.</h2>
<p>This rule matters more with AI-written code than anything else in this post.</p>
<p>When an AI tool builds a feature, it often "helpfully" changes shared code along the way: a button gets a new parameter, a theme colour moves, a common text style gets adjusted so the new screen looks right. Buried in a feature PR, those changes are almost invisible, and they affect every screen that uses that component.</p>
<p>So the rule is simple: <strong>any change to shared components, design tokens, theming, or common utilities goes in its own PR</strong>, reviewed by someone who owns that shared code, before the feature PRs that depend on it.</p>
<p>This does two things. Owners of shared code actually see the change. And the feature PRs stay honest, because they only contain the feature.</p>
<h2>6. End with a feature integration PR, and review it differently</h2>
<p>Once each layer is approved on its own, something still needs to check that they work <em>together</em>. That's the last PR in the stack, and the review questions are different:</p>
<ul>
<li><strong>Scope and lifecycle:</strong> is state created, cached and disposed where it should be? (In Riverpod terms, are providers scoped and auto-disposed correctly? In other stacks, the same question about stores, services or DI containers.)</li>
<li><strong>Navigation and entry points:</strong> can the user actually reach this, and get back out cleanly, from every place they're supposed to?</li>
<li><strong>Empty, loading and error states:</strong> each layer handled its own errors, but does the screen show something sensible when the API is slow, returns nothing, or fails?</li>
<li><strong>End-to-end tests:</strong> does at least one test run the real path through every layer?</li>
</ul>
<p>Layer reviews check that each piece is correct. The integration review checks that the pieces fit together, and that's where a lot of bugs in AI-written code hide.</p>
<h2>7. Use AI as a pair reviewer, line by line</h2>
<p>I use AI heavily in review, but not as a one-shot "summarise this PR" button. I use it <em>in place</em>, the moment I hit something, the way I'd lean over and ask a colleague:</p>
<ul>
<li><strong>"Why does this exist?"</strong> I see a variable or parameter and can't tell why it's there. I select it and ask, right then, where it's used and what it's for. Often the answer is "nowhere useful," and that's a comment.</li>
<li><strong>"Is this repeated anywhere?"</strong> I notice two model contracts or DTOs that look nearly the same. I ask the AI to check the rest of the codebase for duplicates and suggest a cleaner shape, such as one shared model or a common base.</li>
<li><strong>"What is this block actually doing?"</strong> I hit a loop or a piece of logic that's too dense to follow. I select just that block and ask for its purpose and its edge cases. Then the author and I can decide whether it should be simplified, split, or left alone with a comment.</li>
</ul>
<p>That makes the review much faster and much deeper. But the AI gives me <strong>context</strong>; it doesn't give me the decision. Whether the code is correct, whether it fits the agreed plan, and whether it'll hurt us in six months stay with a human reviewer. An AI-written PR reviewed only by an AI isn't reviewed.</p>
<h2>8. Bots and humans don't review the same thing</h2>
<p>Having both AI bots and humans on a PR doesn't mean two sets of eyes looking for the same things. They're good at different jobs, and the review works best when each one sticks to its own.</p>
<ul>
<li><strong>Bots review the code.</strong> They're good at edge cases: null handling, missed error paths, off-by-one logic, inconsistent naming, a missing test. They're tireless and fast, and they don't get bored on file forty.</li>
<li><strong>Humans review the thinking behind it.</strong> Is this the right architecture? Does the code fit how we build things here? Will it scale for the organization, and for the next team that has to extend it in a year? A bot can't answer those, because the answers live in context that isn't in the diff.</li>
</ul>
<p>The plan-first approach fits this naturally. Most of the human, architectural review happens on the build plan PR, before any code exists. By the time the code PRs arrive, bots handle the line-level edge cases, and humans check that the code follows the agreed plan and holds up long term. Nobody spends their review time on comments the other side is better at.</p>
<h2>9. Make it the default with a PR template</h2>
<p>None of this lasts if it depends on people remembering. We put it into the PR template. Every PR in a stack states:</p>
<ul>
<li><strong>Layer:</strong> plan / data / data access / state / UI / shared / feature integration</li>
<li><strong>Plan:</strong> link to the approved build plan PR</li>
<li><strong>Depends on:</strong> link to the PR below it in the stack</li>
<li><strong>Shared code touched:</strong> yes/no (if yes, it should be its own PR)</li>
<li><strong>What to focus on:</strong> the one or two things the author most wants checked</li>
<li><strong>How it was tested</strong></li>
</ul>
<p>It takes the author two minutes to fill in, and it tells the reviewer exactly where this PR sits and what to look at.</p>
<hr />
<h2>What changed for me</h2>
<p>The biggest change wasn't a metric. It was how I understand code.</p>
<p>I used to review by reading line by line, and on a large PR that's exhausting: you're trying to work out what the feature <em>is</em> while you check whether it's written well. With a reviewed plan and a dependency-ordered stack, I already have a mental model of the feature before I open the first code PR, and even a big change feels easy to review.</p>
<p>The order helps too. When I review the model contracts first, I know exactly which fields come in and go out. By the time I reach the API layer, it's obvious how each call is made and which fields it actually uses, so I can spot fields that aren't needed and push back on them early, before they spread into the state and UI layers.</p>
<p>The second change surprised me: I learn faster. Every so often a PR has a clever piece of logic or a pattern I've never tried. Before, I'd either skip past it or spend an hour working it out. Now I select it, ask the AI to walk me through the flow, and come away understanding an implementation I can use myself. Review stopped being only a gate and became one of the main ways I learn.</p>
<hr />
<h2>The short version</h2>
<ul>
<li><strong>Review the plan first</strong>, as its own PR, including the detailed diagrams. Settle architecture there, not in code review.</li>
<li>Split big changes by <strong>dependency</strong>, not by size, and ship each phase as its own PR so <strong>review starts before the feature is finished</strong>.</li>
<li>Review <strong>bottom-up, in order</strong>. Parallel review of a stack means reviewing code that's about to change.</li>
<li><strong>Shared and design-system changes always get their own PR</strong>, especially with AI-written code.</li>
<li>Finish with a <strong>feature integration PR</strong> that checks scope, navigation, and empty and error states.</li>
<li>Use AI <strong>in place</strong> to explain, find duplication and untangle logic; let humans <strong>own correctness</strong>.</li>
<li>Let <strong>bots catch edge cases</strong> and <strong>humans judge architecture, fit and scalability</strong>. They're different reviews, not duplicate ones.</li>
<li>Make it stick with a <strong>PR template</strong>.</li>
</ul>
<p>None of this is specific to Flutter, or even to mobile. Any reviewer will run into it once the diffs get big, and with AI writing more of our code, they're only getting bigger.</p>
<p><em>How does your team handle large PRs? I'd like to hear what's worked for you.</em></p>
]]></content:encoded></item></channel></rss>