<?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: Jeonghun Mun</title>
    <description>The latest articles on DEV Community by Jeonghun Mun (@jeonghun917).</description>
    <link>https://dev.to/jeonghun917</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%2F4219942%2Fd5fd21e8-5e0a-4419-812a-2fac2d65c82c.jpg</url>
      <title>DEV Community: Jeonghun Mun</title>
      <link>https://dev.to/jeonghun917</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jeonghun917"/>
    <language>en</language>
    <item>
      <title>One line that does nothing: 4 bugs hiding behind it in Saleor, Wagtail, Tandoor and Mealie</title>
      <dc:creator>Jeonghun Mun</dc:creator>
      <pubDate>Tue, 03 Nov 2026 16:39:54 +0000</pubDate>
      <link>https://dev.to/jeonghun917/one-line-that-does-nothing-4-bugs-hiding-behind-it-in-saleor-wagtail-tandoor-and-mealie-4n89</link>
      <guid>https://dev.to/jeonghun917/one-line-that-does-nothing-4-bugs-hiding-behind-it-in-saleor-wagtail-tandoor-and-mealie-4n89</guid>
      <description>&lt;p&gt;QuerySet methods don't change the queryset. They return a new one. So this line does nothing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;qs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Product&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;objects&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;all&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;only_dirty&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;qs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;dirty&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;   &lt;span class="c1"&gt;# returns a new queryset; qs is unchanged
&lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;qs&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It reads fine and it runs fine. Tests often still pass too, because the unfiltered result usually contains the rows the test was looking for.&lt;/p&gt;

&lt;p&gt;I found these by running a check for calls whose result is thrown away over about 25 open source Python projects, then going through every hit by hand. Most were noise. Eleven were real bugs. These four are reported so far:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Saleor&lt;/strong&gt;: an option that was only supposed to recalculate prices for products that changed ended up recalculating every discounted product. The existing test passed anyway: the one listing that should have been left alone was skipped for an unrelated reason.&lt;br&gt;
&lt;a href="https://github.com/saleor/saleor/pull/19984" rel="noopener noreferrer"&gt;https://github.com/saleor/saleor/pull/19984&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Wagtail&lt;/strong&gt;: a superuser who submitted a page for moderation got the moderation email about their own submission. The one line meant to exclude the submitter was the discarded call, so nobody was excluded at all. The existing test missed it because the user submitting in the test wasn't a superuser. When the reviewer asked for a test in a working project, I ran it in a fresh Wagtail project before and after the fix; the results are in the thread.&lt;br&gt;
&lt;a href="https://github.com/wagtail/wagtail/pull/14790" rel="noopener noreferrer"&gt;https://github.com/wagtail/wagtail/pull/14790&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tandoor&lt;/strong&gt;: a &lt;code&gt;?category=&lt;/code&gt; filter on an API endpoint was never applied. There was a "TODO add tests for filter" right above it.&lt;br&gt;
&lt;a href="https://github.com/TandoorRecipes/recipes/pull/4917" rel="noopener noreferrer"&gt;https://github.com/TandoorRecipes/recipes/pull/4917&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Mealie&lt;/strong&gt;: this one isn't Django. It's SQLAlchemy, whose Select objects work the same generative way. A generic filter meant to keep each household's data separate was never applied. Recipe pages had their own explicit filters, so the bug never showed there. The maintainers fixed it after the report.&lt;br&gt;
&lt;a href="https://github.com/mealie-recipes/mealie/issues/8964" rel="noopener noreferrer"&gt;https://github.com/mealie-recipes/mealie/issues/8964&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The pattern survived code review in every case. It looks like correct code, because everything except the assignment is correct.&lt;/p&gt;

&lt;p&gt;(The check came out of readfirst, an MIT CLI I'm building: &lt;a href="https://github.com/jeonghun917/readfirst" rel="noopener noreferrer"&gt;https://github.com/jeonghun917/readfirst&lt;/a&gt;. I used Claude Code to help trace call paths and write the test scripts; the reports are mine.)&lt;/p&gt;

&lt;h3&gt;
  
  
  What I learned
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;In review, a bare &lt;code&gt;qs.something(...)&lt;/code&gt; on its own line is worth a second look. The model, the field and the value can all look right, and the line still does nothing.&lt;/li&gt;
&lt;li&gt;It's easy to write when you're in a hurry. Coding agents write it too.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  If you want to catch it in your code
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Search your code for lines that start with a queryset variable and a method call, with nothing assigned: &lt;code&gt;^\s*\w+\.(filter|exclude|order_by|select_related|prefetch_related|annotate|distinct)\(&lt;/code&gt; You'll get some noise, but it's a fast pass. Linters don't help here: pylint's &lt;code&gt;expression-not-assigned&lt;/code&gt; skips calls, because a call may have side effects.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A few more are pending in other projects. I'll add them once the maintainers have seen the reports.&lt;/p&gt;

</description>
      <category>django</category>
      <category>python</category>
      <category>debugging</category>
      <category>codereview</category>
    </item>
    <item>
      <title>140 PRs to stop my AI coding agent from forgetting my codebase. The fix was one file.</title>
      <dc:creator>Jeonghun Mun</dc:creator>
      <pubDate>Sun, 01 Nov 2026 04:01:59 +0000</pubDate>
      <link>https://dev.to/jeonghun917/140-prs-to-stop-my-ai-coding-agent-from-forgetting-my-codebase-the-fix-was-one-file-41gi</link>
      <guid>https://dev.to/jeonghun917/140-prs-to-stop-my-ai-coding-agent-from-forgetting-my-codebase-the-fix-was-one-file-41gi</guid>
      <description>&lt;p&gt;I'm building a Bannerlord-like strategy game on my own, with AI coding agents doing a lot of the typing.&lt;/p&gt;

&lt;p&gt;Every new session went the same way. The agent lost track of how the game was put together, "fixed" code that&lt;br&gt;
was working, and when I pointed it out I got the classic &lt;em&gt;"You're right, my mistake."&lt;/em&gt; Then it happened again.&lt;/p&gt;

&lt;p&gt;Over about 140 PRs I tried most of the obvious fixes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Feed it my best session.&lt;/strong&gt; I pasted in the whole chat from the session where everything went right, like a
Space Marine gene-seed. Same agent, same mistakes. I had only swapped the code for chat history.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Inject best practices and past failures.&lt;/strong&gt; It turned into a pile of exceptions, and work slowed to a crawl.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A report and a handover doc for every task.&lt;/strong&gt; Keeping the docs up to date became more work than the code, and
soon the docs contradicted each other.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What worked in the end was much simpler.&lt;/p&gt;
&lt;h2&gt;
  
  
  What agents miss
&lt;/h2&gt;

&lt;p&gt;Coding agents follow imports well. Ask one to change a function and it finds the callers, reads the tests and makes&lt;br&gt;
a reasonable edit.&lt;/p&gt;

&lt;p&gt;What it can't find is what the team knows but never wrote down next to the code:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;"amounts in this module are in cents"&lt;/li&gt;
&lt;li&gt;"the mobile app reads this table; don't drop columns"&lt;/li&gt;
&lt;li&gt;"run the payment e2e after touching this"&lt;/li&gt;
&lt;li&gt;"this file is generated; edit the template instead"&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That knowledge lives in someone's head, an old Slack thread, or a README nobody opens before editing.&lt;/p&gt;
&lt;h2&gt;
  
  
  One file, handed out per file
&lt;/h2&gt;

&lt;p&gt;The structure had to be so simple that neither I nor the model has to think about using it. So I turned it into a&lt;br&gt;
small open-source CLI, &lt;a href="https://github.com/jeonghun917/readfirst" rel="noopener noreferrer"&gt;readfirst&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;It keeps that knowledge in &lt;code&gt;.readfirst/map.json&lt;/code&gt;. Files are grouped, and each group lists:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;checks&lt;/strong&gt;: the commands to run after changing it, and what each one covers&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;risks&lt;/strong&gt;: the traps a newcomer would fall into&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;rules&lt;/strong&gt;: promises the code must keep, and what breaks if it doesn't
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"src-billing"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"title"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"charging cards"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"files"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"src/billing/**"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"checks"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"run"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"npm test -- billing"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"why"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"charges and refunds"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"risks"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"text"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"amounts are in cents"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Before changing a file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx readfirst &lt;span class="nb"&gt;read &lt;/span&gt;src/billing/charge.ts
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It prints only what applies to that file: the rules, risks and checks, plus the tests and callers that reach it&lt;br&gt;
through imports (JS/TS and Python).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fpqog8mvxsmnu134obsy2.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fpqog8mvxsmnu134obsy2.gif" alt="npx readfirst read prints the rules, risks, checks, tests and callers for one file" width="800" height="745"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To make an agent use it, add one line to &lt;code&gt;CLAUDE.md&lt;/code&gt;, &lt;code&gt;AGENTS.md&lt;/code&gt; or &lt;code&gt;.cursorrules&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;Before changing a file, run &lt;span class="sb"&gt;`npx readfirst read &amp;lt;file&amp;gt;`&lt;/span&gt; and follow what it says.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Keeping it from going stale
&lt;/h2&gt;

&lt;p&gt;A map that rots is worse than no map. So there's a GitHub Action:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;jeonghun917/readfirst@v0&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On every pull request it posts one comment, updated on each push, with the rules, risks and checks for the files that&lt;br&gt;
changed. It also &lt;strong&gt;fails the check when the map stops covering the code&lt;/strong&gt;, for example when a new file isn't in any&lt;br&gt;
group. The map gets fixed in the same PR that made it stale.&lt;/p&gt;

&lt;p&gt;The CLI and the Action are MIT licensed, have no runtime dependencies, make no network or model calls, and need no&lt;br&gt;
account.&lt;/p&gt;

&lt;h2&gt;
  
  
  The first map
&lt;/h2&gt;

&lt;p&gt;The hard part is writing the first map, because the useful parts are exactly the ones nobody wrote down.&lt;br&gt;
&lt;code&gt;npx readfirst init&lt;/code&gt; drafts groups from your folders, and &lt;code&gt;npx readfirst prompt&lt;/code&gt; gives your own agent a brief to fill in&lt;br&gt;
the rest.&lt;/p&gt;

&lt;p&gt;There's also a hosted option. Install a GitHub App, comment &lt;code&gt;/readfirst fill&lt;/code&gt; on an issue, and it reads the repository&lt;br&gt;
plus your existing notes (README, CLAUDE.md, docs) and opens the map as a pull request. Each risk lists the file and&lt;br&gt;
line it came from, so you can check it before merging. Here's the map it wrote for a copy of Express:&lt;br&gt;
&lt;a href="https://github.com/jeonghun917/express/pull/2" rel="noopener noreferrer"&gt;jeonghun917/express#2&lt;/a&gt;. A couple of the risks it found:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;res.sendFile throws unless the path is absolute or opts.root is given, and dotfiles are denied by default;&lt;br&gt;
relaxing this exposes files from user-supplied paths&lt;/p&gt;

&lt;p&gt;test/acceptance/ runs the examples through the real app, so editing an example can break npm test&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The first hosted map per account is free: &lt;a href="https://readfirst-cloud.vercel.app" rel="noopener noreferrer"&gt;readfirst-cloud.vercel.app&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I'd like to hear
&lt;/h2&gt;

&lt;p&gt;Is "groups + checks + risks + rules" the right shape for this kind of knowledge? What would you want an agent, or a&lt;br&gt;
new teammate, to see before touching a file in your codebase?&lt;/p&gt;

&lt;p&gt;The longer version of the 140-PR story is&lt;br&gt;
&lt;a href="https://github.com/jeonghun917/ai-development-control-plane" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>devtools</category>
      <category>opensource</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
