<?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: alice kelly</title>
    <description>The latest articles on DEV Community by alice kelly (@alice_kelly_68226d164218e).</description>
    <link>https://dev.to/alice_kelly_68226d164218e</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%2F3964597%2F05b1491a-2e5d-4a16-b698-92c7ba1a3c83.png</url>
      <title>DEV Community: alice kelly</title>
      <link>https://dev.to/alice_kelly_68226d164218e</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/alice_kelly_68226d164218e"/>
    <language>en</language>
    <item>
      <title>Reddit Reader Extension: What It Does (and Doesn't)</title>
      <dc:creator>alice kelly</dc:creator>
      <pubDate>Tue, 24 Nov 2026 05:16:00 +0000</pubDate>
      <link>https://dev.to/alice_kelly_68226d164218e/reddit-reader-extension-what-it-does-and-doesnt-44ke</link>
      <guid>https://dev.to/alice_kelly_68226d164218e/reddit-reader-extension-what-it-does-and-doesnt-44ke</guid>
      <description>&lt;p&gt;&lt;em&gt;I built this extension, so read the recommendation with that in mind. Everything below can be checked in the extension itself.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;A Reddit reader extension is a browser add-on that reformats a single reddit.com thread into a clean reading page. That is the whole category. It does not "unlock" Reddit, it does not get around account requirements, and it will not show you anything your browser cannot already load.&lt;/p&gt;

&lt;p&gt;What it does do is narrow: it removes the feed, the sidebars, the app banners and the comment clutter from a thread you are already reading, then gives you a few tools for working with that thread — highlight words you care about, and save the post plus comments as Markdown.&lt;/p&gt;

&lt;p&gt;If that is the job you need done, the category is useful. If you are looking for something else, most of the alternatives people recommend are not actually reader extensions, and this article will say so plainly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The one this article is about&lt;/strong&gt;&lt;br&gt;
Reddit Reader opens a thread in a clean panel inside Chrome or Edge, highlights your keywords, and exports the post plus comments to Markdown. Free to install; the free tier covers one keyword and three exports.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.wappkit.com/tools/reddit-viewer-extension" rel="noopener noreferrer"&gt;Reddit Reader on Wappkit&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What a reader extension actually does
&lt;/h2&gt;

&lt;p&gt;Four things, in order of how much they matter.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;It removes everything that is not the thread.&lt;/strong&gt; On a normal Reddit page, the post and its comments compete with a feed, a sidebar, a promotion banner, and at least one prompt to open the app. A reader extension hides all of it and reflows the text into a single column. The practical effect is not cosmetic: long threads become readable on a laptop screen without zooming out.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;It highlights the words you are looking for.&lt;/strong&gt; If you are reading a 400-comment thread for mentions of a specific tool, price point, or error message, highlighting turns a scan into a read. This is the feature people underestimate before they try it and rely on afterwards.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;It exports the thread as Markdown.&lt;/strong&gt; Markdown is the format that survives a paste into Obsidian, Notion, Bear, a GitHub issue, or an LLM prompt without turning into a wall of broken formatting. Post title, score, URL, body and comments come out as structured text rather than a screenshot.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;It keeps the work on your machine.&lt;/strong&gt; A reader extension only needs the tab you activate. It does not need to read every site you visit, and the better ones ask for exactly that — the active tab, nothing else.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it does not do
&lt;/h2&gt;

&lt;p&gt;This is the part most listicles skip.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;It does not bypass a Reddit challenge page.&lt;/strong&gt; Reddit increasingly serves logged-out visitors a JavaScript challenge instead of the thread. When that happens there is no post in the page for any extension to read. The workaround is not a different extension; it is opening the same thread on &lt;code&gt;old.reddit.com&lt;/code&gt;, which still renders public threads as plain HTML. Any tool claiming to "unlock" Reddit is either doing something against Reddit's terms or overstating what it can see.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;It does not show private, quarantined, or removed content.&lt;/strong&gt; If the content is not in the page, it is not in the export.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;It does not run on mobile.&lt;/strong&gt; Chrome extensions do not exist on iOS, and on Android only a handful of browsers support them. A phone reader has to be an app or an RSS workflow, not an extension.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;It does not sync between devices.&lt;/strong&gt; Your keywords and settings live in the browser profile where you set them up. No account, no cloud — which is a privacy feature and a convenience tradeoff at the same time.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The free tier is limited on purpose.&lt;/strong&gt; In the case of Reddit Reader, free means one keyword and three Markdown exports. The paid tier is $4.99 once, not a subscription, and it removes both limits. If you only need to export one thread a month, you will never pay — and that is fine.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;If the limits above are acceptable&lt;/strong&gt;&lt;br&gt;
The free tier is enough to test the workflow on a real thread: install it, open a long thread, add one keyword, export once. If that saves you time, the $4.99 unlock is the whole upgrade — there is no subscription and no account to create.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.wappkit.com/tools/reddit-viewer-extension" rel="noopener noreferrer"&gt;Reddit Reader on Wappkit&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Who this is actually for
&lt;/h2&gt;

&lt;p&gt;It is for people who read Reddit as a research source rather than as a feed: founders checking what customers say about a competitor, writers collecting quotes, moderators reviewing long threads, students pulling a discussion into notes.&lt;/p&gt;

&lt;p&gt;It is not for casual scrolling. If you open Reddit to see what is new, a reader extension adds a step and solves nothing. It is also not for anyone whose main device is a phone.&lt;/p&gt;

&lt;h2&gt;
  
  
  How it compares to the alternatives
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Approach&lt;/th&gt;
&lt;th&gt;Clean reading&lt;/th&gt;
&lt;th&gt;Keyword highlight&lt;/th&gt;
&lt;th&gt;Markdown export&lt;/th&gt;
&lt;th&gt;Works when Reddit blocks logged-out&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Native Reddit + browser reader mode&lt;/td&gt;
&lt;td&gt;Partial&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;old.reddit.com&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Browser find only&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;Yes, usually&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;RSS reader&lt;/td&gt;
&lt;td&gt;Headlines only&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Reader extension&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;No — same page limit&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The honest summary: &lt;code&gt;old.reddit.com&lt;/code&gt; is the most reliable way to read a public thread, and a reader extension is the most comfortable way to read one you can already open. They solve different halves of the problem, which is why the practical setup uses both.&lt;/p&gt;

&lt;p&gt;If you are starting from zero, the &lt;a href="https://dev.to/blog/browse-reddit-without-account-2025"&gt;logged-out browsing walkthrough&lt;/a&gt; covers the fundamentals, and the &lt;a href="https://dev.to/blog/reddit-viewer-vs-reddit-app-which-one-should-you-actually-use"&gt;reader versus app comparison&lt;/a&gt; covers when each one wins.&lt;/p&gt;

&lt;h2&gt;
  
  
  Common questions
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Is a Reddit reader extension free?
&lt;/h3&gt;

&lt;p&gt;Most are freemium. Reddit Reader is free to install with one keyword and three exports, then $4.99 one-time for unlimited. There is no subscription tier.&lt;/p&gt;

&lt;h3&gt;
  
  
  Does it collect my browsing data?
&lt;/h3&gt;

&lt;p&gt;It should not need to. A reader extension only requires access to the tab you activate. Reddit Reader requests &lt;code&gt;activeTab&lt;/code&gt;, &lt;code&gt;scripting&lt;/code&gt;, and &lt;code&gt;storage&lt;/code&gt; — it does not declare access to all sites, and it does not ship analytics.&lt;/p&gt;

&lt;h3&gt;
  
  
  Does it work on Edge?
&lt;/h3&gt;

&lt;p&gt;Yes. The same package runs on Chrome and Edge, since both are Chromium. Firefox needs a separate build.&lt;/p&gt;

&lt;h3&gt;
  
  
  What happens when Reddit changes its layout?
&lt;/h3&gt;

&lt;p&gt;Extractors break. Any extension that reads the page is coupled to Reddit's markup, so layout changes are a maintenance cost, not a one-time build. Expect occasional updates after major Reddit redesigns.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://www.wappkit.com/tools/reddit-viewer-extension" rel="noopener noreferrer"&gt;Reddit Reader product page&lt;/a&gt; - the feature list, free tier limits and Pro price used above.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.wappkit.com/privacy/reddit-reader" rel="noopener noreferrer"&gt;Reddit Reader privacy policy&lt;/a&gt; - what the extension stores and what leaves the browser.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://chromewebstore.google.com/detail/akgmihlphnhaejbhpmcjckpdogbplcng" rel="noopener noreferrer"&gt;Reddit Reader on the Chrome Web Store&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://microsoftedge.microsoft.com/addons/detail/jfanggdobljmlaohcldjoafnigmhfogh" rel="noopener noreferrer"&gt;Reddit Reader on Microsoft Edge Add-ons&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;A reader extension is a narrow tool. It cleans up a page you already opened, keeps a keyword visible while you scroll, and turns one thread into a Markdown file. It is not a scraper, an archiver or a full Reddit client, and it does not touch private communities or accounts. If that narrow job is what you need, the free tier is enough to judge it on a real thread; if you need data at scale, a desktop tool is the better fit.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Try it on one thread&lt;/strong&gt;&lt;br&gt;
Install, open a thread you already wanted to read, and see whether the clean view plus one keyword is worth keeping. If it is not, uninstall — it costs nothing to find out.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.wappkit.com/tools/reddit-viewer-extension" rel="noopener noreferrer"&gt;Reddit Reader on Wappkit&lt;/a&gt;&lt;/p&gt;

</description>
      <category>reddit</category>
      <category>browser</category>
      <category>productivity</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Your tool's save button is where you quietly lose users' data</title>
      <dc:creator>alice kelly</dc:creator>
      <pubDate>Tue, 17 Nov 2026 01:09:18 +0000</pubDate>
      <link>https://dev.to/alice_kelly_68226d164218e/your-tools-save-button-is-where-you-quietly-lose-users-data-4bck</link>
      <guid>https://dev.to/alice_kelly_68226d164218e/your-tools-save-button-is-where-you-quietly-lose-users-data-4bck</guid>
      <description>&lt;p&gt;A user reports that your tool corrupted their file. You look at the code, and it is correct. The parse is right, the serialization is right, the tests pass. And the user's file is still broken.&lt;/p&gt;

&lt;p&gt;This is the most common bug class in tools that write files, and it is almost never in the logic. It is in the four lines that decide &lt;em&gt;how&lt;/em&gt; the file gets written, and those four lines are usually the least reviewed part of the codebase — because they look trivial.&lt;/p&gt;

&lt;p&gt;I have written this wrong, shipped it, and had it cost real users real data. Here is what I learned about the failure modes that do not show up in tests.&lt;/p&gt;

&lt;h2&gt;
  
  
  The bug that passes every test
&lt;/h2&gt;

&lt;p&gt;Writing a file looks like this in almost every language:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nf"&gt;writeTo&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;targetFile&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;newContent&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The tests call it, the assertions pass, the file contains exactly the expected bytes. Green across the board.&lt;/p&gt;

&lt;p&gt;What the test does not cover is &lt;strong&gt;what happens when this line is interrupted halfway&lt;/strong&gt; — the process is killed, the laptop sleeps, the disk fills, the IDE is closed mid-save. In that case the file contains &lt;em&gt;some&lt;/em&gt; of the new content and none of the old. There is no valid version of the data left. Not the new one, not the previous one.&lt;/p&gt;

&lt;p&gt;For a config file or a document, that is a total loss. And it is not a logic bug — the logic was perfect. The problem is that the operation was never atomic.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why in-place writes fail on Windows specifically
&lt;/h2&gt;

&lt;p&gt;On POSIX systems, &lt;code&gt;rename()&lt;/code&gt; over an existing file is atomic. You can write a temp file and move it into place, and any reader sees either the old file or the new one, never a hybrid.&lt;/p&gt;

&lt;p&gt;Windows is different in a way that catches people out. A file opened by another process — including your own tool if you kept a handle open for the editor — cannot be replaced. &lt;code&gt;Files.move(..., ATOMIC_MOVE)&lt;/code&gt; throws. So a developer writes a fallback:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nc"&gt;Files&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;move&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tmp&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;target&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;ATOMIC_MOVE&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;IOException&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// fallback: just write it&lt;/span&gt;
    &lt;span class="nf"&gt;writeTo&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;target&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The fallback is exactly the corruption path. The error handling made the code &lt;em&gt;less&lt;/em&gt; safe, and it only triggers on the platform most users are on. Worse: it triggers &lt;em&gt;precisely when another handle exists&lt;/em&gt;, which is exactly when a failure is most likely.&lt;/p&gt;

&lt;p&gt;I hit this building an &lt;a href="https://plugins.jetbrains.com/plugin/35810-excel-lite--excel-xlsx-spreadsheet-viewer--editor" rel="noopener noreferrer"&gt;xlsx editor plugin for JetBrains IDEs&lt;/a&gt;. The plugin holds a workbook open for as long as the editor tab is open, which is the exact condition that makes the atomic move fail on Windows. The "obvious" fallback would have reintroduced the bug I was trying to avoid.&lt;/p&gt;

&lt;p&gt;The fix was to guarantee the handle is fully closed before the move, and to let the save fail loudly rather than silently degrade.&lt;/p&gt;

&lt;h2&gt;
  
  
  The three silent failures
&lt;/h2&gt;

&lt;p&gt;Not all file corruption crashes. Two of them are worse because nobody reports them.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Failure one: the truncated write.&lt;/strong&gt; Described above. The file does not open at all, or opens as garbage. Loud, at least.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Failure two: the format wipe.&lt;/strong&gt; The tool reads the file into a generic representation, changes one value, and serializes the whole thing back. Every byte of the file is rewritten from a model that only understands &lt;em&gt;values&lt;/em&gt;. Column widths, number formats, embedded objects, comments — whatever the model does not represent — come back as defaults.&lt;/p&gt;

&lt;p&gt;The data is intact. The tool reports success. The user opens the file and finds their carefully formatted report is now 64-pixel columns and no colors. Most will not file a bug; they will just stop using the tool. This is a silent 1-star review that never reaches your issue tracker.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Failure three: the structural inconsistency.&lt;/strong&gt; The file is a container with internal references (in OPC/zip-based formats, an XML part points at another by relationship ID). If you rewrite one part and not the index, you get a file that opens, displays the right values, and still fails validation — either immediately in strict readers, or weeks later when something recalculates.&lt;/p&gt;

&lt;p&gt;"It opened fine" is not a test. Three of these four failure modes produce a file that opens fine.&lt;/p&gt;

&lt;h2&gt;
  
  
  The pattern that actually works
&lt;/h2&gt;

&lt;p&gt;It is four steps and it has not changed in thirty years:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1. write the new content to &amp;lt;file&amp;gt;.tmp
2. flush and close the handle
3. copy &amp;lt;file&amp;gt; to &amp;lt;file&amp;gt;.bak
4. atomically replace &amp;lt;file&amp;gt; with &amp;lt;file&amp;gt;.tmp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The order matters and step 2 is the one people skip. If the temp handle is still open, step 4 falls back to a non-atomic path on Windows. Flushing is not enough — the handle must be closed.&lt;/p&gt;

&lt;p&gt;Step 3 is cheap insurance and it is what turns a catastrophic failure into an annoyance. A &lt;code&gt;.bak&lt;/code&gt; next to the file costs one copy operation and means the user has a recovery path that does not depend on you.&lt;/p&gt;

&lt;p&gt;Two details that matter in practice:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The temp file must live on the same filesystem.&lt;/strong&gt; An atomic move only works within one volume. If you write the temp file to the system temp directory and the target lives on another drive, the move silently becomes a copy-then-delete — which is not atomic and reintroduces exactly the failure you were avoiding. This is easy to get wrong because &lt;code&gt;Files.createTempFile()&lt;/code&gt; with no arguments puts the file in the OS temp directory, and on a machine with a second drive or a network share the target is often elsewhere. Create the temp file next to the target instead: &lt;code&gt;&amp;lt;file&amp;gt;.tmp&lt;/code&gt;, not &lt;code&gt;/tmp/something&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Flushing the temp file is not the same as closing it.&lt;/strong&gt; A flush pushes bytes from your buffer to the OS; it does not release the file handle. On Windows, an open handle on the &lt;em&gt;target&lt;/em&gt; blocks the replace, and an open handle on the temp file can block the rename on some filesystems. Close both, explicitly, before moving. In managed languages this means not relying on a garbage collector or a &lt;code&gt;use&lt;/code&gt; block whose scope you have not traced.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;If step 4 fails, do not fall back.&lt;/strong&gt; Leave the temp file and report an actionable error. A failed save that tells the user "close the file in Excel and retry" is infinitely better than a silent in-place write that destroys the original.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Never write to the file you are reading.&lt;/strong&gt; This sounds obvious and it is violated constantly, because reading and writing the same path is convenient and the failure only shows up under interruption.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to verify a save path without waiting for a crash
&lt;/h2&gt;

&lt;p&gt;You cannot easily test "the process dies mid-write" in a unit test. But you can check the properties that make it safe, and they are all observable:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Is a &lt;code&gt;.tmp&lt;/code&gt; or &lt;code&gt;.bak&lt;/code&gt; file created next to the target? If not, the write is in-place and unsafe.&lt;/li&gt;
&lt;li&gt;Does the file's modification time change atomically, or does it get progressively updated? Watch it during a large save.&lt;/li&gt;
&lt;li&gt;If you make the target read-only (or open it in another program), does the save fail cleanly, or does it overwrite anyway?&lt;/li&gt;
&lt;li&gt;Does the saved file still look right in the app that owns the format — not just in your tool?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That last one is the test most people miss. A file written by your tool and reopened by your tool proves nothing, because both share the same parser. Open it in the application the format belongs to, and you learn whether you wiped formatting, broke relationships, or silently re-encoded something.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why this matters more for developer tools
&lt;/h2&gt;

&lt;p&gt;For an app whose only job is editing one file, corruption costs the user one document. For a developer tool operating on files in a repository, the blast radius is different: those files are fixtures, test data, seed data, and config that other people depend on. A corrupted fixture gets committed and breaks someone else's build next week.&lt;/p&gt;

&lt;p&gt;That asymmetry is why I think file-writing code deserves the same review attention as authentication or concurrency, and why it rarely gets it. It is four lines. It looks like plumbing. And the failures it produces are invisible until they are expensive.&lt;/p&gt;

&lt;p&gt;The habit worth building is small: when you review a save path, ask what the file looks like at every possible interruption point. If the answer is "some of the new, none of the old", the code is wrong no matter how green the tests are.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where to read more
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/nio/file/Files.html#move(java.nio.file.Path,java.nio.file.Path,java.nio.file.CopyOption...)" rel="noopener noreferrer"&gt;Java NIO &lt;code&gt;Files.move&lt;/code&gt; — the &lt;code&gt;ATOMIC_MOVE&lt;/code&gt; guarantee and when it is not honoured&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://ecma-international.org/publications-and-standards/standards/ecma-376/" rel="noopener noreferrer"&gt;ECMA-376 — the OPC package model behind &lt;code&gt;.xlsx&lt;/code&gt;, &lt;code&gt;.docx&lt;/code&gt; and friends&lt;/a&gt; — useful if you need to know which parts a "format wipe" destroys&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://support.microsoft.com/en-us/excel/repair-a-corrupted-workbook" rel="noopener noreferrer"&gt;Microsoft — Repair a corrupted workbook&lt;/a&gt; — what users are told to do when this goes wrong, which is usually "lose your formatting"&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;If you write tools that touch files, the two questions that catch most of this: does the save go through a temp file, and is there a backup if it fails? Curious whether anyone has hit the "temp file on a different drive" variant — that one took me a while to spot.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>programming</category>
      <category>devtools</category>
      <category>jetbrains</category>
      <category>tooling</category>
    </item>
    <item>
      <title>IntelliJ keeps opening your .xlsx files? Here is how to stop it</title>
      <dc:creator>alice kelly</dc:creator>
      <pubDate>Sun, 15 Nov 2026 06:17:44 +0000</pubDate>
      <link>https://dev.to/alice_kelly_68226d164218e/intellij-keeps-opening-your-xlsx-files-here-is-how-to-stop-it-1pfn</link>
      <guid>https://dev.to/alice_kelly_68226d164218e/intellij-keeps-opening-your-xlsx-files-here-is-how-to-stop-it-1pfn</guid>
      <description>&lt;p&gt;You double-click a &lt;code&gt;.xlsx&lt;/code&gt; in the Project view, expecting Excel to open, and instead a tab appears inside the IDE. Maybe it renders correctly, maybe it shows a wall of XML. Either way, the file is now open somewhere you did not intend, and the editor you wanted never launched.&lt;/p&gt;

&lt;p&gt;This is not a bug and it is rarely caused by the IDE core. It is a &lt;strong&gt;file type association&lt;/strong&gt;, and it is one setting away from being undone. The harder part is knowing which component claimed the extension, because it might be a built-in module you never installed on purpose, or a plugin you added months ago and forgot about.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why an IDE claims a file type at all
&lt;/h2&gt;

&lt;p&gt;Every IntelliJ-based IDE has a &lt;code&gt;FileTypeManager&lt;/code&gt; that maps extensions to a parser. When you open a file, the IDE asks that manager which parser to use. If something registered &lt;code&gt;.xlsx&lt;/code&gt;, the IDE opens it internally; if nothing did, the OS opens it with the default application.&lt;/p&gt;

&lt;p&gt;The mapping is layered. Built-in modules register their formats at startup. Plugins register theirs through &lt;code&gt;fileType&lt;/code&gt; extension points in their &lt;code&gt;plugin.xml&lt;/code&gt;. And some plugins register for extensions they do not really own — a data tool that reads spreadsheets might claim &lt;code&gt;.xlsx&lt;/code&gt; just so it can preview it, which is enough to steal the double-click.&lt;/p&gt;

&lt;p&gt;That last case is the one people hit without realising. You install a database plugin for its SQL editor, and it quietly takes &lt;code&gt;.xlsx&lt;/code&gt;, &lt;code&gt;.csv&lt;/code&gt;, and &lt;code&gt;.xls&lt;/code&gt; along the way.&lt;/p&gt;

&lt;h2&gt;
  
  
  Finding out who claimed the extension
&lt;/h2&gt;

&lt;p&gt;Before changing anything, it helps to know the culprit. The IDE will tell you.&lt;/p&gt;

&lt;p&gt;Open &lt;strong&gt;Settings → Editor → File Types&lt;/strong&gt;. The list on the right shows every registered file type with its extensions. Find the one that lists &lt;code&gt;xlsx&lt;/code&gt; — the name is usually the owning plugin or the built-in module. Select it and the "File name patterns" box underneath shows exactly what it claims, sometimes more than you expected.&lt;/p&gt;

&lt;p&gt;Two things are worth checking while you are there:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Whether &lt;code&gt;.csv&lt;/code&gt; is also claimed.&lt;/strong&gt; Many spreadsheet plugins take both. If you only wanted xlsx handling, the CSV takeover is unintended and will surprise you later.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Whether the type is a plugin's or the platform's.&lt;/strong&gt; If it belongs to a plugin you can also just disable that plugin, which is cleaner than editing patterns if you do not need the tool at all.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Taking the association back
&lt;/h2&gt;

&lt;p&gt;There are three levels of fix, from surgical to blunt.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Remove only the extension.&lt;/strong&gt; In the same File Types screen, select the type, delete &lt;code&gt;*.xlsx&lt;/code&gt; from the patterns list, and apply. The type stays for other files; only the xlsx claim disappears. This is the cleanest option when you want to keep the plugin for its actual purpose.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Disable the plugin.&lt;/strong&gt; Settings → Plugins → find the owner → disable → restart. Blunt but reliable, and it also stops the plugin from claiming other formats you have not noticed yet.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Reset to defaults.&lt;/strong&gt; If the list has become a mess after installing and uninstalling several tools, restoring default file types clears the accumulated claims. Do this knowing it will also reset customisations you made on purpose.&lt;/p&gt;

&lt;p&gt;After any of these, the change is immediate — no restart needed for the pattern edit, though plugins that cache the mapping may need one.&lt;/p&gt;

&lt;h2&gt;
  
  
  The catch: what you lose when you take it back
&lt;/h2&gt;

&lt;p&gt;Blocking the IDE from opening spreadsheets means you are back to alt-tabbing into Excel for every small edit. For a one-off look at a fixture, that is fine. For the case where you keep fixing test data inside a repository, it is the exact friction the plugin existed to remove.&lt;/p&gt;

&lt;p&gt;There is also a subtler cost. Once &lt;code&gt;.xlsx&lt;/code&gt; opens externally, the IDE stops indexing the file contents, which some refactoring and search features rely on. Usually that is what you want — a binary blob is not something you search — but if a workflow depended on it, you will notice.&lt;/p&gt;

&lt;p&gt;The practical answer is usually not "block everything" but "block the sloppy plugin, keep a careful one."&lt;/p&gt;

&lt;h2&gt;
  
  
  How to tell a careful plugin from a sloppy one
&lt;/h2&gt;

&lt;p&gt;The behaviour that created this problem is exactly what separates good spreadsheet plugins from bad ones: &lt;strong&gt;what file types does it claim, and does it say so?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A plugin that claims &lt;code&gt;.xlsx&lt;/code&gt;, &lt;code&gt;.xlsm&lt;/code&gt;, &lt;code&gt;.xls&lt;/code&gt;, and &lt;code&gt;.csv&lt;/code&gt; on install is making decisions for you about four formats, and it is unlikely to handle all four well. The legacy &lt;code&gt;.xls&lt;/code&gt; format in particular is a completely different binary container, and tools that "support" it often just fail quietly.&lt;/p&gt;

&lt;p&gt;A plugin that claims only what it actually parses, and says so in the description, is a different proposition. So is one that lets you disable the association without uninstalling.&lt;/p&gt;

&lt;p&gt;There is a quick test you can run before installing anything. Open the plugin's Marketplace page and read the description for the words "opens", "claims", or a list of extensions. A careful author states the claim explicitly, because they know it is a promise. A vague author lets the plugin take whatever it can parse.&lt;/p&gt;

&lt;p&gt;A second test is what happens after you uninstall. File type claims registered at runtime sometimes outlive the plugin that made them, leaving a dead association that makes files open in a broken tab. If the plugin's reviews mention anything like "my files still open in it after uninstalling", that association is sticky and you should assume it will happen to you.&lt;/p&gt;

&lt;p&gt;This is the choice I made when building &lt;a href="https://plugins.jetbrains.com/plugin/35810-excel-lite--excel-xlsx-spreadsheet-viewer--editor" rel="noopener noreferrer"&gt;Excel Lite on JetBrains Marketplace&lt;/a&gt;: it claims &lt;code&gt;.xlsx&lt;/code&gt; and &lt;code&gt;.xlsm&lt;/code&gt; only, and deliberately does &lt;strong&gt;not&lt;/strong&gt; claim &lt;code&gt;.csv&lt;/code&gt; or &lt;code&gt;.xls&lt;/code&gt;, because it does not handle either properly. If you prefer Excel for spreadsheets, deleting the xlsx pattern in File Types turns it off without uninstalling.&lt;/p&gt;

&lt;h2&gt;
  
  
  When keeping the IDE association is right
&lt;/h2&gt;

&lt;p&gt;For all the annoyance, there is a real case for it: a spreadsheet that lives in your repository and changes often. Test fixtures, seed data, configuration workbooks that a non-developer maintains. Opening those in Excel means a context switch, and switching back means losing your place.&lt;/p&gt;

&lt;p&gt;The distinction that matters is &lt;strong&gt;where the file lives&lt;/strong&gt;, not what format it is. A one-off file on your desktop belongs in Excel. A file in &lt;code&gt;src/test/resources&lt;/code&gt; that you edit three times a week belongs wherever you can edit it without leaving the IDE — as long as the tool writing it does not damage it.&lt;/p&gt;

&lt;p&gt;That last clause is doing a lot of work. A spreadsheet editor that saves by rewriting the whole package can drop formatting, and one that writes in place can leave a truncated file if the process dies. If you are going to keep the association, keep it for a tool that writes to a temporary file and replaces the original atomically, not one that overwrites.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;I removed the pattern but the IDE still opens xlsx. Why?&lt;/strong&gt;&lt;br&gt;
Another registered type may also claim it. Check every entry in File Types rather than just the obvious one, and check whether a plugin registered the extension at runtime rather than in its descriptor.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Will disabling the plugin lose my settings?&lt;/strong&gt;&lt;br&gt;
Plugin settings generally survive a disable/enable cycle, but some tools store configuration in a project file that stays behind. If the settings matter, note them before disabling.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can I make Excel the default for only one project?&lt;/strong&gt;&lt;br&gt;
File type associations are IDE-wide, not per project. If you need project-specific behaviour, the practical workaround is a scope rule in your OS file manager or a separate IDE configuration.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Does this affect &lt;code&gt;.xlsm&lt;/code&gt; macro workbooks?&lt;/strong&gt;&lt;br&gt;
The association is per extension, so removing &lt;code&gt;.xlsx&lt;/code&gt; alone leaves &lt;code&gt;.xlsm&lt;/code&gt; claimed. Most spreadsheet plugins register both — check the pattern list for &lt;code&gt;*.xlsm&lt;/code&gt; separately.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why does the IDE open CSV as a table instead of text?&lt;/strong&gt;&lt;br&gt;
Because a plugin claimed &lt;code&gt;.csv&lt;/code&gt; too. CSV is text, and most developers want it as text. Removing the CSV pattern is usually the right fix, and it is a good reason to prefer plugins that do not claim it in the first place.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://plugins.jetbrains.com/docs/intellij/registering-file-type.html" rel="noopener noreferrer"&gt;IntelliJ Platform — File type registration&lt;/a&gt; — how &lt;code&gt;fileType&lt;/code&gt; extension points claim extensions&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.jetbrains.com/help/idea/creating-and-managing-file-types.html" rel="noopener noreferrer"&gt;IntelliJ IDEA — File type associations&lt;/a&gt; — the settings screen used above&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://stackoverflow.com/questions/78516163/prevent-intellij-idea-2024-1-1-open-xls-files-internally" rel="noopener noreferrer"&gt;Stack Overflow — Prevent IntelliJ IDEA from opening .xls files internally&lt;/a&gt; — the same problem reported by another user&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://support.microsoft.com/en-us/office/import-or-export-text-txt-or-csv-files-5250ac4c-663c-47ce-937b-339e391393ba" rel="noopener noreferrer"&gt;Microsoft — Differences between CSV and xlsx&lt;/a&gt; — why CSV and xlsx cannot share a parser&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://poi.apache.org/components/spreadsheet/" rel="noopener noreferrer"&gt;Apache POI — Spreadsheet formats&lt;/a&gt; — what &lt;code&gt;.xlsx&lt;/code&gt;, &lt;code&gt;.xlsm&lt;/code&gt; and legacy &lt;code&gt;.xls&lt;/code&gt; actually are&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;An IDE opening your spreadsheets is a file type association, and associations are editable. Find the owner in File Types, delete the extension pattern, and the double-click goes back to Excel immediately.&lt;/p&gt;

&lt;p&gt;The more useful habit is checking what a plugin claims before installing it. A tool that takes only the formats it parses, and says so, will not surprise you later — and if it does, you can turn it off without uninstalling anything.&lt;/p&gt;

</description>
      <category>intellij</category>
      <category>ide</category>
      <category>excel</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Google Maps stops at ~120 results per query. How I got 506 anyway.</title>
      <dc:creator>alice kelly</dc:creator>
      <pubDate>Sat, 14 Nov 2026 04:40:43 +0000</pubDate>
      <link>https://dev.to/alice_kelly_68226d164218e/google-maps-stops-at-120-results-per-query-how-i-got-506-anyway-2pjk</link>
      <guid>https://dev.to/alice_kelly_68226d164218e/google-maps-stops-at-120-results-per-query-how-i-got-506-anyway-2pjk</guid>
      <description>&lt;p&gt;I needed a defensible list of roofing contractors across three Texas cities. Not a demo — an actual dataset I could reason about.&lt;/p&gt;

&lt;p&gt;The scrape took about seven minutes. The next two hours went into figuring out why the numbers looked wrong.&lt;/p&gt;

&lt;p&gt;Two things broke, and neither was a bug in my code. Both are structural properties of Google Maps: a hard result ceiling per query, and a deduplication trap that makes a clean-looking dataset quietly unusable.&lt;/p&gt;

&lt;h2&gt;
  
  
  First: Google Maps stops at roughly 120 results per query
&lt;/h2&gt;

&lt;p&gt;Scrolling the Maps panel ends somewhere around 120 places. You can keep scrolling, the list just stops growing. There is nothing more to page through, so a bigger &lt;code&gt;depth&lt;/code&gt; parameter buys you nothing.&lt;/p&gt;

&lt;p&gt;Coverage therefore comes from query &lt;em&gt;variation&lt;/em&gt;, not query depth:&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="no"&gt;CITIES&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Dallas"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Houston"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Austin"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="no"&gt;TEMPLATES&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="s2"&gt;"roofing contractor in {city}, TX"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"roofing company {city} TX"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"roofer {city} TX"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"commercial roofing {city} TX"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;queries&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;format&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;city&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="no"&gt;CITIES&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="no"&gt;TEMPLATES&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;  &lt;span class="c1"&gt;# 12 searches&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Twelve searches, and the yield per query was nowhere near even:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Listings returned&lt;/th&gt;
&lt;th&gt;Queries&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;112&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;60–62&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;46&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;20–27&lt;/td&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5–15&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;506 unique listings after deduping on &lt;code&gt;place_id&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Look at the two queries that returned 112. That is the ceiling, visible. Now look at the four that returned 5–15 — those look like wasted calls until you check the set difference against everything else. They contribute businesses no other query surfaces.&lt;/p&gt;

&lt;p&gt;That is the actual argument for a query matrix: not volume, coverage. A single query per city got me roughly a quarter of the market.&lt;/p&gt;

&lt;p&gt;It also means "how many plumbers are there in Chicago" is a question Google Maps cannot answer for you. You get a sample, and the sample leans toward whatever Google considers prominent.&lt;/p&gt;

&lt;h2&gt;
  
  
  Second: deduplication looks solved and isn't
&lt;/h2&gt;

&lt;p&gt;After the run: 506 rows, 506 unique &lt;code&gt;place_id&lt;/code&gt; values, zero duplicates. Clean. Ship it.&lt;/p&gt;

&lt;p&gt;Then I grouped by normalized street address:&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="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;re&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;collections&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;defaultdict&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;norm_addr&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;lower&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;re&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sub&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="s2"&gt;"\b(suite|ste|unit|#)\s*[\w-]+"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;re&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sub&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="s2"&gt;"[^a-z0-9 ]"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;" "&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;" "&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;by_addr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;defaultdict&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;list&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;row&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;rows&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;by_addr&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nf"&gt;norm_addr&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"address"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;collisions&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;v&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;v&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;by_addr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;items&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Seven addresses held 17 companies between them. All seven are virtual office suites in the three downtowns. A few are lead-generation shells renting a prestige address; the rest are one-person operations sharing a registered agent.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;place_id&lt;/code&gt; cannot catch those, because they genuinely are different listings.&lt;/p&gt;

&lt;p&gt;The mirror-image problem:&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="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;collections&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;Counter&lt;/span&gt;

&lt;span class="n"&gt;brands&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Counter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"title"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;strip&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;lower&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;rows&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;chains&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;brands&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;items&lt;/span&gt;&lt;span class="p"&gt;(&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;n&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Seventeen brand names appeared at multiple locations, 36 listings in total. Those are real branches.&lt;/p&gt;

&lt;p&gt;So you need both passes, and they answer different questions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;dedupe by name → you delete legitimate branches&lt;/li&gt;
&lt;li&gt;dedupe by &lt;code&gt;place_id&lt;/code&gt; → you email the same head office four times&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I now run both and keep the collision lists rather than dropping rows. The point is to &lt;em&gt;see&lt;/em&gt; them.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the cleaned data looked like
&lt;/h2&gt;

&lt;p&gt;Two numbers worth keeping:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Metric&lt;/th&gt;
&lt;th&gt;Value&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Rated 4.5–5.0&lt;/td&gt;
&lt;td&gt;88.3%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Rated below 3.5&lt;/td&gt;
&lt;td&gt;6.1%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Median review count&lt;/td&gt;
&lt;td&gt;39&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Under 50 reviews&lt;/td&gt;
&lt;td&gt;53.8%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Under 400 reviews&lt;/td&gt;
&lt;td&gt;92.9%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Ratings cluster hard, and that is structural rather than a scraping artefact. The review request goes out at the single happiest moment in the customer relationship, so the distribution inflates and converges on 4.7–5.0.&lt;/p&gt;

&lt;p&gt;Practical consequence: rating is a poor discriminator in local services generally. Review &lt;em&gt;count&lt;/em&gt; separates businesses much more usefully, because it correlates with whether the owner still answers their own phone.&lt;/p&gt;

&lt;h2&gt;
  
  
  The field you cannot scrape reliably
&lt;/h2&gt;

&lt;p&gt;I re-ran a 52-listing sample with email extraction enabled. 48 had a website. Fourteen returned a usable address — 29.2% of the ones with a site.&lt;/p&gt;

&lt;p&gt;The other 34 were contact forms, JavaScript-rendered footers, or an address baked into an image. Two of them rendered the address as text inside a PNG.&lt;/p&gt;

&lt;p&gt;If your pipeline assumes &lt;code&gt;has_website → has_email&lt;/code&gt;, it will silently drop about 70% of the list. Design around phone as the primary channel and treat email as a bonus, or you will spend a week building a mailer for a list that is mostly empty.&lt;/p&gt;

&lt;h2&gt;
  
  
  Five things I would do differently next time
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Log per-query yield from the first run.&lt;/strong&gt; Pruning the query matrix should be a decision backed by numbers, not a guess. Four of my twelve queries looked useless and were not.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dedupe in two passes and keep both outputs.&lt;/strong&gt; &lt;code&gt;place_id&lt;/code&gt; for the strictly-identical, normalized address for the colliding. Deleting silently is how you end up not knowing your own dataset.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Persist the raw response.&lt;/strong&gt; Review counts drift week to week. Without the raw payload you cannot distinguish a business that changed from a scrape that changed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cap concurrency per proxy, not globally.&lt;/strong&gt; A global semaphore means one slow proxy throttles the whole pool.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Treat a row as &lt;code&gt;(place_id, scraped_at)&lt;/code&gt;.&lt;/strong&gt; The moment you drop the timestamp, you lose the ability to diff two runs, which is the only way to detect regressions in your own scraper.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Caveats
&lt;/h2&gt;

&lt;p&gt;One vertical, one state, one afternoon. Texas roofing in November is not dental practices in Berlin, and the distribution will move between categories.&lt;/p&gt;

&lt;p&gt;The results were served to a non-US IP pointed at US coordinates. A residential US IP will return a somewhat different set.&lt;/p&gt;

&lt;p&gt;The ceiling and the dedup traps are not artefacts of this run. They are properties of Maps, and they will show up in any category.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Method notes: 12 searches (4 keyword variants × 3 cities), results deduplicated on &lt;code&gt;place_id&lt;/code&gt;, 506 rows retained, single run on 14 November 2026. Email sample: 52 listings, one query, extraction enabled. I build a small Windows scraper for runs like this — &lt;a href="https://www.wappkit.com/blog/506-roofing-companies-texas-data-study" rel="noopener noreferrer"&gt;full write-up with the distributions is here&lt;/a&gt;. I am the author, so treat that mention as a disclosure rather than a recommendation.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>webscraping</category>
      <category>python</category>
      <category>data</category>
      <category>api</category>
    </item>
    <item>
      <title>Why plugins corrupt your .xlsx files (and how to check before it happens)</title>
      <dc:creator>alice kelly</dc:creator>
      <pubDate>Sat, 14 Nov 2026 00:07:44 +0000</pubDate>
      <link>https://dev.to/alice_kelly_68226d164218e/why-plugins-corrupt-your-xlsx-files-and-how-to-check-before-it-happens-57kl</link>
      <guid>https://dev.to/alice_kelly_68226d164218e/why-plugins-corrupt-your-xlsx-files-and-how-to-check-before-it-happens-57kl</guid>
      <description>&lt;p&gt;A corrupted &lt;code&gt;.xlsx&lt;/code&gt; file is almost never the result of a bad library. It is the result of a save operation that was interrupted, or a write that replaced more of the file than it needed to. The distinction matters, because the first is a design flaw you can detect in advance and the second is a silent one you usually discover days later.&lt;/p&gt;

&lt;p&gt;If you have ever installed a spreadsheet plugin, opened a workbook, changed one cell, and found the file unopenable afterwards, you have hit one of the three failure modes below. All three are avoidable, and none of them require the plugin to be malicious — just careless about a file format that punishes carelessness.&lt;/p&gt;

&lt;h2&gt;
  
  
  The format that makes corruption easy
&lt;/h2&gt;

&lt;p&gt;An &lt;code&gt;.xlsx&lt;/code&gt; file is a zip archive. Inside it there is a shared strings table, one XML part per worksheet, a styles part, and — critically — a &lt;code&gt;_rels&lt;/code&gt; directory that records how all those parts reference each other.&lt;/p&gt;

&lt;p&gt;That last piece is what separates a spreadsheet from a text file. Excel does not store "cell A1 contains 12". It stores a cell whose value lives in one place, whose style index points into a styles table, and whose worksheet is declared in a relationship file. Every one of those pointers has to stay consistent.&lt;/p&gt;

&lt;p&gt;A tool that reads the whole workbook, changes one value, and writes a fresh package from scratch has to rebuild all of those relationships correctly. Most library code does this well. The problem is not correctness in the happy path — it is what happens when the process dies halfway through writing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Failure mode one: the truncated write
&lt;/h2&gt;

&lt;p&gt;This is the most common and the most destructive. The tool opens the original file for writing, then streams the new workbook into it.&lt;/p&gt;

&lt;p&gt;If anything interrupts that stream — the IDE is closed, the process is killed, the disk fills, the machine sleeps — the file is left partially written. On disk it may still look like a valid &lt;code&gt;.xlsx&lt;/code&gt; by extension, but the zip central directory is missing or the XML is cut mid-element. Excel reports it as corrupt and offers to repair it, which usually means recovering the values and losing the formatting.&lt;/p&gt;

&lt;p&gt;The fix is well known and cheap: never write to the file you are reading. Write to a temporary file next to it, then move the temporary file over the original in one operation. A file move is atomic on the same filesystem, so a reader either sees the old complete file or the new complete file, never a half-written one.&lt;/p&gt;

&lt;h2&gt;
  
  
  Failure mode two: the formatting wipe
&lt;/h2&gt;

&lt;p&gt;Less dramatic, more common, and harder to notice. The values survive; everything else does not.&lt;/p&gt;

&lt;p&gt;When a tool reconstructs the package from a generic representation, it has to decide what to do with column widths, fills, borders, number formats, frozen panes, merged ranges, and conditional formatting. If the tool only cares about cell values, all of that comes back as defaults.&lt;/p&gt;

&lt;p&gt;The tell is visual: your carefully sized columns are now uniform, header rows lost their fill, and dates render as raw serial numbers. The data is intact, so nobody files a bug — they just quietly stop using the tool.&lt;/p&gt;

&lt;p&gt;This is not a crash. It is a fidelity decision made implicitly by whoever wrote the writer. A tool that rewrites only the cells you changed leaves the rest of the package untouched, and this failure mode does not happen at all.&lt;/p&gt;

&lt;h2&gt;
  
  
  Failure mode three: the broken relationship
&lt;/h2&gt;

&lt;p&gt;The subtle one. The workbook opens, but Excel complains about a repaired record, or a sheet is missing, or formulas that referenced an external link now show &lt;code&gt;#REF!&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;This happens when a tool edits one XML part without updating the corresponding relationship entry, or when it strips a part it did not understand — a chart definition, a pivot cache, a VBA project in an &lt;code&gt;.xlsm&lt;/code&gt; file. The package is still a valid zip. It is just inconsistent with itself.&lt;/p&gt;

&lt;p&gt;This is why "it opened fine" is not a sufficient test. A file can open, display your values, and still be structurally wrong in ways that only surface when Excel tries to recalculate or when another program reads it.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to tell whether a tool is safe before you trust it
&lt;/h2&gt;

&lt;p&gt;There is one question that separates careful tools from careless ones, and you can usually answer it from the documentation:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;When this tool saves, does it write to a temporary file and replace, or does it write in place?&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If the documentation does not say, assume the worse option. The safe pattern costs one extra file write and is trivial to describe, so a tool that does it will usually mention it — and a tool that overwrites silently has no reason to advertise the fact.&lt;/p&gt;

&lt;p&gt;Three supporting questions worth asking:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Does it keep a backup?&lt;/strong&gt; A &lt;code&gt;.bak&lt;/code&gt; next to the original costs nothing and turns a catastrophic failure into an inconvenience.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Does it claim file types you did not ask for?&lt;/strong&gt; Several plugins register for &lt;code&gt;.csv&lt;/code&gt; on install. That is a separate risk — the association often survives uninstalling the plugin — and it is a signal that the tool is willing to take over more of your filesystem than you agreed to.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Does it tell you what it cannot do?&lt;/strong&gt; A tool that states its limits — row caps, no formula editing, formatting preserved but not editable — has thought about the boundary between what it touches and what it leaves alone. That is the same discipline that produces safe saves.&lt;/p&gt;

&lt;h2&gt;
  
  
  The verification habit that catches everything
&lt;/h2&gt;

&lt;p&gt;If you already have a tool you are unsure about, there is a two-minute test.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Copy a workbook you care about to a scratch directory.&lt;/li&gt;
&lt;li&gt;Open the copy, change one cell, save.&lt;/li&gt;
&lt;li&gt;Open it again from a fresh process — not the tab you already have open.&lt;/li&gt;
&lt;li&gt;Check the &lt;code&gt;.bak&lt;/code&gt; exists and the columns still look the way they did.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Step three matters because the editor was holding a parsed representation, not the file. Reopening forces a real read from disk. Step four catches the formatting wipe, which a value-based check will miss.&lt;/p&gt;

&lt;p&gt;If both pass, the tool is probably careful. If the file fails to open but the &lt;code&gt;.bak&lt;/code&gt; opens fine, you have found a truncating writer and you should stop using it on anything you cannot regenerate.&lt;/p&gt;

&lt;h2&gt;
  
  
  What a safe writer looks like from the inside
&lt;/h2&gt;

&lt;p&gt;For the record, the sequence that avoids all three failure modes is short:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1. copy &amp;lt;file&amp;gt; to &amp;lt;file&amp;gt;.bak
2. write the new workbook to &amp;lt;file&amp;gt;.tmp
3. flush and close the tmp handle
4. atomically move &amp;lt;file&amp;gt;.tmp over &amp;lt;file&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On Windows there is one extra requirement that is easy to miss: the original file handle must be fully closed before step four, otherwise the atomic move fails and the code falls back to writing in place — reintroducing failure mode one. Libraries that keep the workbook open for the lifetime of the editor have to be careful here.&lt;/p&gt;

&lt;p&gt;This is the pattern I used when building &lt;a href="https://plugins.jetbrains.com/plugin/35810-excel-lite--excel-xlsx-spreadsheet-viewer--editor" rel="noopener noreferrer"&gt;an xlsx editor for JetBrains IDEs&lt;/a&gt;. It is not a feature you can show in a screenshot, which is exactly why it is worth checking for.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Can a corrupted xlsx be repaired?&lt;/strong&gt;&lt;br&gt;
Often, yes — values usually survive. Excel's Open and Repair recovers cell contents but frequently drops formatting, and structural problems like broken chart references may not come back. If you kept a &lt;code&gt;.bak&lt;/code&gt;, use that instead; recovery tools are a last resort, not a strategy.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Does this apply to &lt;code&gt;.xls&lt;/code&gt; files too?&lt;/strong&gt;&lt;br&gt;
Yes, and worse. The legacy &lt;code&gt;.xls&lt;/code&gt; format is a binary container rather than a zip, so the failure modes are less inspectable — a truncated &lt;code&gt;.xls&lt;/code&gt; is much harder to recover than a truncated &lt;code&gt;.xlsx&lt;/code&gt;. The same "write to temp, then move" rule applies.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why did my file open fine but Excel says it needs repair?&lt;/strong&gt;&lt;br&gt;
That is failure mode three. Excel tolerates some inconsistencies on open and then reports them when it validates the package on save or recalculate. A structurally wrong file can look correct for weeks.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Is a plugin more likely to corrupt a file than a script?&lt;/strong&gt;&lt;br&gt;
Not inherently. Both use the same libraries. The difference is that a plugin holds the file open for as long as the tab is open, which is precisely the condition that makes an in-place write dangerous on Windows.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What if the tool only offers "Save" with no backup option?&lt;/strong&gt;&lt;br&gt;
Then test it on a copy first, and keep the original outside the project. A tool with no backup path is a tool whose failure mode you discover at the worst possible time.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://ecma-international.org/publications-and-standards/standards/ecma-376/" rel="noopener noreferrer"&gt;ECMA-376 — Office Open XML file formats&lt;/a&gt; — the OPC package and relationship model this article describes&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://poi.apache.org/components/spreadsheet/" rel="noopener noreferrer"&gt;Apache POI — XSSF and streaming writers&lt;/a&gt; — what a writer has to preserve, and why streaming modes exist for large files&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://support.microsoft.com/en-us/excel/repair-a-corrupted-workbook" rel="noopener noreferrer"&gt;Microsoft — Repair a corrupted workbook&lt;/a&gt; — what Excel's repair actually recovers&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://stackoverflow.com/questions/78516163/prevent-intellij-idea-2024-1-1-open-xls-files-internally" rel="noopener noreferrer"&gt;Stack Overflow — Prevent IntelliJ IDEA from opening .xls files internally&lt;/a&gt; — the file-association side of the same problem&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://plugins.jetbrains.com/plugin/18663-exceleditor" rel="noopener noreferrer"&gt;JetBrains Marketplace — ExcelEditor reviews&lt;/a&gt; — publicly reported file damage and CSV takeovers in a widely installed plugin&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/nio/file/Files.html#move(java.nio.file.Path,java.nio.file.Path,java.nio.file.CopyOption...)" rel="noopener noreferrer"&gt;Java NIO — atomic file moves&lt;/a&gt; — the &lt;code&gt;ATOMIC_MOVE&lt;/code&gt; guarantee the safe pattern relies on&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Spreadsheet corruption is a save-path problem, not a parsing problem. The three ways it happens — truncated writes, reconstructed packages losing formatting, and inconsistent relationship entries — all stem from the same decision about how much of the file the tool rewrites.&lt;/p&gt;

&lt;p&gt;You do not need to audit the code to judge a tool. Ask what it does when the save is interrupted, ask whether it keeps a backup, and test it on a copy before it touches anything you cannot regenerate. That is enough to separate the tools worth trusting from the ones that will eventually cost you an afternoon.&lt;/p&gt;

</description>
      <category>excel</category>
      <category>jetbrains</category>
      <category>tooling</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Editing .xlsx files without Excel: what actually works in 2026</title>
      <dc:creator>alice kelly</dc:creator>
      <pubDate>Fri, 13 Nov 2026 00:39:36 +0000</pubDate>
      <link>https://dev.to/alice_kelly_68226d164218e/editing-xlsx-files-without-excel-what-actually-works-in-2026-2fp5</link>
      <guid>https://dev.to/alice_kelly_68226d164218e/editing-xlsx-files-without-excel-what-actually-works-in-2026-2fp5</guid>
      <description>&lt;p&gt;A &lt;code&gt;.xlsx&lt;/code&gt; file is a zip archive full of XML. That single fact explains almost everything that goes wrong when developers try to edit spreadsheets outside Excel: the file is not a document you can open as text, it is a small database with a layout, and most tools that touch it either drop the layout or corrupt it outright.&lt;/p&gt;

&lt;p&gt;You can edit an &lt;code&gt;.xlsx&lt;/code&gt; inside your IDE today, and for the work most developers actually do with spreadsheets — fixing a value in a test fixture, adding a row of sample data, pointing at the right sheet — it is faster than alt-tabbing into Excel. But the choice of tool matters more than people expect, and the failure mode is not "it looks wrong", it is "the file is now damaged and you find out two days later".&lt;/p&gt;

&lt;p&gt;This post covers what actually works, where the real risks are, and how to check your file survived.&lt;/p&gt;

&lt;h2&gt;
  
  
  What an xlsx file really is
&lt;/h2&gt;

&lt;p&gt;An &lt;code&gt;.xlsx&lt;/code&gt; file is an OPC package: a zip containing several XML parts. There is a shared strings table, one XML part per worksheet, a styles part, and a relationships index that ties them together. Excel does not store "the grid" as a grid. It stores cells with type annotations, and the styles live elsewhere, referenced by index.&lt;/p&gt;

&lt;p&gt;This matters because it changes what "edit a cell" means. When you change one value, a correct tool rewrites one entry and leaves the rest of the package untouched. A sloppy tool reads the whole workbook into a generic representation and writes back a new package from scratch. The values survive. The column widths, the fills, the merged ranges, the number formats, and sometimes the formulas do not.&lt;/p&gt;

&lt;p&gt;If you have ever opened a spreadsheet after a script touched it and found everything squeezed into default-width columns, you have seen this exact failure. The data was fine. The container was rebuilt badly.&lt;/p&gt;

&lt;h2&gt;
  
  
  Three ways to edit a workbook outside Excel
&lt;/h2&gt;

&lt;p&gt;There is no single right answer here. The three options differ in what they protect and what they cost you.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Excel or LibreOffice.&lt;/strong&gt; Reliable, complete, and completely outside your editor. LibreOffice can run headless for scripted conversion, which is useful for pipelines, but it is heavyweight for "I just need to change one cell".&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A CLI library.&lt;/strong&gt; Apache POI for JVM languages, openpyxl for Python, ExcelJS for JavaScript. These are the libraries the tools are built on, and using one directly gives you full control. The cost is that preserving formatting is entirely your problem, and a wrong write mode can quietly mangle a file.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;An IDE plugin.&lt;/strong&gt; The editor reads the workbook, you change cells in a grid, and it writes back. Convenient, but this category has a bad track record — several popular plugins in the JetBrains marketplace have reviews describing corrupted files and stuck editors.&lt;/p&gt;

&lt;p&gt;The useful question is not which category is best. It is: &lt;strong&gt;does the tool write back the whole package, or does it touch only what changed, and does it protect the original if something fails?&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The part that actually bites: saving
&lt;/h2&gt;

&lt;p&gt;Reading an &lt;code&gt;.xlsx&lt;/code&gt; is a solved problem. Writing one safely is where most of the damage happens, and it almost always comes down to three omissions.&lt;/p&gt;

&lt;p&gt;The first is writing in place. If the tool truncates the original file and then starts streaming a new workbook into it, any failure — a crash, a full disk, a killed process — leaves a half-written file. There is no recovery from that except your version control, and test fixtures are rarely in version control in a useful way.&lt;/p&gt;

&lt;p&gt;The second is no backup. Even a correct write is a destructive operation from the file's point of view. A tool that overwrites the only copy without keeping the previous bytes is asking you to trust it completely.&lt;/p&gt;

&lt;p&gt;The third is holding the file open. On Windows, a lingering file handle makes the atomic replace fail, so the tool falls back to an in-place write — and you are back to the first problem.&lt;/p&gt;

&lt;p&gt;The pattern that avoids all three is boring and well known: copy the original to a &lt;code&gt;.bak&lt;/code&gt;, write the new workbook to a temporary file, then move the temporary file over the original in one operation. If any step fails, the original file is still there. It costs one extra file write and it is the difference between a tool you can trust with a fixture and one you cannot.&lt;/p&gt;

&lt;h2&gt;
  
  
  A workflow that stays safe
&lt;/h2&gt;

&lt;p&gt;Here is the sequence I use when a spreadsheet needs changing and Excel is not the answer.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Confirm it is really an &lt;code&gt;.xlsx&lt;/code&gt;.&lt;/strong&gt; Files with an &lt;code&gt;.xls&lt;/code&gt; extension are a different, older binary format. Some tools handle both, some silently fail. Check before you start.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Work on a copy if the file matters.&lt;/strong&gt; Even with a backup, having the original somewhere else costs nothing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Open it in the editor and check the sheet selector first.&lt;/strong&gt; Multi-sheet workbooks are common, and editing the wrong sheet is a quiet error that only shows up later.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Change the cell, then save once.&lt;/strong&gt; Repeated saves of the same workbook are where tools that rebuild the package tend to drift.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Verify the file after saving.&lt;/strong&gt; Open it again, or open the &lt;code&gt;.bak&lt;/code&gt; next to it and confirm it exists.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Step five is the one people skip, and it is the one that catches the failures. A file that opens is not proof it survived — but a file that fails to open, next to a backup that does, tells you exactly what happened.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where people lose time
&lt;/h2&gt;

&lt;p&gt;The most common mistake is treating &lt;code&gt;.csv&lt;/code&gt; and &lt;code&gt;.xlsx&lt;/code&gt; as interchangeable. They are not, and the difference is not just formatting.&lt;/p&gt;

&lt;p&gt;A CSV has no types. Everything is text, and whether "007" means seven or a product code depends entirely on what reads it next. An &lt;code&gt;.xlsx&lt;/code&gt; stores the type with the cell, so a number stays a number when it round-trips. If your test data has phone numbers, postal codes, or anything with leading zeros, CSV will eat them and you will not notice until a test fails for an unrelated-looking reason.&lt;/p&gt;

&lt;p&gt;The second mistake is letting a plugin claim file types you did not ask it to claim. Several spreadsheet plugins on the JetBrains marketplace take over &lt;code&gt;.csv&lt;/code&gt; when installed, and reviewers describe the result as a permanently broken file association that survives uninstalling the plugin. If a plugin's description does not say explicitly which extensions it claims, assume it claims more than you want.&lt;/p&gt;

&lt;p&gt;The third is expecting an IDE plugin to be a spreadsheet application. It is not. If you need pivot tables, chart editing, or macro execution, you need Excel, and a plugin that pretends otherwise will disappoint you at the worst moment.&lt;/p&gt;

&lt;h2&gt;
  
  
  When a tool is worth it
&lt;/h2&gt;

&lt;p&gt;For a one-off change on a file you will never touch again, opening LibreOffice is fine. The tool case is narrow and specific: a spreadsheet that lives in your repository, that changes often, and whose edits are small. Test fixtures, seed data, configuration workbooks that a non-developer maintains and you have to act on.&lt;/p&gt;

&lt;p&gt;That is the case I built &lt;a href="https://plugins.jetbrains.com/plugin/35810-excel-lite--excel-xlsx-spreadsheet-viewer--editor" rel="noopener noreferrer"&gt;Excel Lite&lt;/a&gt; for, after getting tired of the alt-tab loop. It opens &lt;code&gt;.xlsx&lt;/code&gt; and &lt;code&gt;.xlsm&lt;/code&gt; in an editor tab, edits cells in place, handles row insert and delete, copies and pastes blocks as tab-separated text so they move between the sheet and Excel or Google Sheets, and saves through the backup-and-atomic-replace pattern described above. It deliberately does not claim &lt;code&gt;.csv&lt;/code&gt;, and it does not pretend to be Excel — no formulas you can edit, no charts, no macros.&lt;/p&gt;

&lt;p&gt;The limits are real and worth stating: it loads up to 5,000 rows and 200 columns per sheet, formula cells display their computed value rather than letting you edit the formula, and existing formatting is preserved but not editable. If your workflow needs any of those, this is not the tool.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Can I edit a password-protected workbook?&lt;/strong&gt;&lt;br&gt;
Not with the tools described here. Encryption is a separate layer on top of the package, and most libraries either refuse to open the file or need the password passed explicitly. Check the specific library's documentation before assuming support.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Will editing a spreadsheet in an IDE break my formulas?&lt;/strong&gt;&lt;br&gt;
Reading does not change anything. Writing is the risk: if a tool rebuilds the package, formulas can be replaced by their cached values. A tool that only rewrites changed cells leaves formulas intact. This is a good question to ask before installing anything.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why does my file open in the wrong editor after installing a plugin?&lt;/strong&gt;&lt;br&gt;
File type associations are claimed by extension. A plugin that registers for &lt;code&gt;.csv&lt;/code&gt; or &lt;code&gt;.xls&lt;/code&gt; will take those files over, and some do not release the association when uninstalled. Check the plugin's claimed extensions before installing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Is a &lt;code&gt;.bak&lt;/code&gt; file enough protection?&lt;/strong&gt;&lt;br&gt;
It is enough to recover from a bad save, but it only covers the most recent version. If you save three times and the first save was already wrong, your backup is wrong too. Commit the file to version control if it matters.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Does this work for &lt;code&gt;.xls&lt;/code&gt; files?&lt;/strong&gt;&lt;br&gt;
No. The legacy &lt;code&gt;.xls&lt;/code&gt; format is a completely different binary container, not a zip. Tools either support it separately or not at all, and "it opened but looks empty" is the usual symptom of a tool guessing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://poi.apache.org/components/spreadsheet/" rel="noopener noreferrer"&gt;Apache POI — XSSF and the OPC package model&lt;/a&gt; — the format's structure and what a writer has to preserve&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://ecma-international.org/publications-and-standards/standards/ecma-376/" rel="noopener noreferrer"&gt;ECMA-376 Office Open XML&lt;/a&gt; — the specification behind the zip and XML layout&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://plugins.jetbrains.com/docs/intellij/file-editor.html" rel="noopener noreferrer"&gt;IntelliJ Platform: file editor providers&lt;/a&gt; — how an IDE plugin claims and renders a file type&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://plugins.jetbrains.com/plugin/18663-exceleditor" rel="noopener noreferrer"&gt;Firebase and spreadsheet tooling reviews on JetBrains Marketplace&lt;/a&gt; — the corpus of "it corrupted my file" and "it took over my CSV" complaints quoted above&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://support.microsoft.com/en-us/office/import-or-export-text-txt-or-csv-files-5250ac4c-663c-47ce-937b-339e391393ba" rel="noopener noreferrer"&gt;Microsoft: differences between CSV and xlsx&lt;/a&gt; — the type-preservation difference&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Editing an &lt;code&gt;.xlsx&lt;/code&gt; outside Excel is a normal thing to want, and it works, as long as the tool treats the file as what it is: a container with parts, not a text file. The reading side is easy. The writing side is where the discipline goes, and the backup-plus-atomic-replace pattern is the whole trick.&lt;/p&gt;

&lt;p&gt;Pick the tool by asking what it does when something fails, not by counting features. A tool that keeps your original file intact and tells you what it cannot do is worth more than one that promises to replace Excel.&lt;/p&gt;

</description>
      <category>excel</category>
      <category>jetbrains</category>
      <category>productivity</category>
      <category>tooling</category>
    </item>
    <item>
      <title>How to Find Duplicate Files on Windows 11 Without Deleting the Wrong One</title>
      <dc:creator>alice kelly</dc:creator>
      <pubDate>Thu, 12 Nov 2026 02:06:33 +0000</pubDate>
      <link>https://dev.to/alice_kelly_68226d164218e/how-to-find-duplicate-files-on-windows-11-without-deleting-the-wrong-one-4dmg</link>
      <guid>https://dev.to/alice_kelly_68226d164218e/how-to-find-duplicate-files-on-windows-11-without-deleting-the-wrong-one-4dmg</guid>
      <description>&lt;p&gt;Windows 11 does not have a duplicate file finder. Storage Sense clears temp files, old updates and Recycle Bin contents — it will not touch the three copies of your phone backup sitting in &lt;code&gt;Downloads&lt;/code&gt;, &lt;code&gt;Desktop&lt;/code&gt; and &lt;code&gt;D:\Backup&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;So people go looking for a tool, and the first thing they find is a wall of "1-click, 50 GB free!" apps that pre-select every duplicate for deletion. That pre-selection is the part that costs you a weekend.&lt;/p&gt;

&lt;p&gt;Here's the version that doesn't.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why "same name" and "same size" both fail
&lt;/h2&gt;

&lt;p&gt;There are three ways to decide two files are the same, and only one of them is safe.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Name matching&lt;/strong&gt; finds &lt;code&gt;report (1).docx&lt;/code&gt; next to &lt;code&gt;report.docx&lt;/code&gt;. It misses &lt;code&gt;IMG_4821.jpg&lt;/code&gt; and &lt;code&gt;2024-trip/IMG_4821.jpg&lt;/code&gt;, which are the same photo, and it flags &lt;code&gt;2024-Q1.xlsx&lt;/code&gt; against &lt;code&gt;2024-Q2.xlsx&lt;/code&gt; if someone named them carelessly. Wrong in both directions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Size matching&lt;/strong&gt; is better but still wrong. Two videos can both be exactly 512 MB and have nothing in common. Size narrows the candidates; it does not confirm anything.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Content hashing&lt;/strong&gt; is the only check that actually answers the question. The tool reads the bytes and computes a hash. If two files produce the same hash, they are identical — not similar, identical.&lt;/p&gt;

&lt;p&gt;Good tools do this in three passes, cheapest first: group by size, hash the first 4 KB of everything that survives, and only then read the full file for the handful that still match. That is why a scan over a few hundred thousand files finishes in minutes instead of hours, and why the result isn't a guess.&lt;/p&gt;

&lt;h2&gt;
  
  
  The four steps
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Point it at folders, not the whole drive
&lt;/h3&gt;

&lt;p&gt;Scanning &lt;code&gt;C:\&lt;/code&gt; sounds thorough and is a bad first run. It pulls in &lt;code&gt;Windows\WinSxS&lt;/code&gt;, &lt;code&gt;Program Files&lt;/code&gt; and every app cache on the machine, and you get thousands of "duplicates" that are supposed to be there.&lt;/p&gt;

&lt;p&gt;Start with the three folders duplicates actually accumulate in: &lt;code&gt;Downloads&lt;/code&gt;, &lt;code&gt;Pictures&lt;/code&gt;, &lt;code&gt;Desktop&lt;/code&gt;. Add a backup drive if you keep one.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Scan, then read the groups — don't delete anything yet
&lt;/h3&gt;

&lt;p&gt;Each line is one group: files with identical content in different places. The size next to a group is what you get back if you keep one copy of each.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Open a group and pick the keeper yourself
&lt;/h3&gt;

&lt;p&gt;This is where most cleaners decide for you. Don't let them. Open each group and check three things:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Which path is the original?&lt;/strong&gt; The file in &lt;code&gt;Pictures\2024\&lt;/code&gt; is usually the real one; the one in &lt;code&gt;Downloads\&lt;/code&gt; is usually the copy.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Does anything reference it?&lt;/strong&gt; A photo referenced by a Lightroom catalog, or an attachment embedded in a project file, breaks if you delete it — even though the copy looks identical.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Is it really a duplicate?&lt;/strong&gt; Same content for a different purpose is rare but real: two identical blank templates, for instance.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If a group is ambiguous, skip it. There is no prize for cleaning everything in one pass.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Delete to the Recycle Bin, not permanently
&lt;/h3&gt;

&lt;p&gt;The confirmation dialog should tell you where the files go. If it says "permanently delete", close it. Recycle Bin means a mistake costs you a right-click instead of a file.&lt;/p&gt;

&lt;p&gt;Empty the Recycle Bin a week later, after you have used the machine normally. That week is the entire safety margin, and it is worth the disk space.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this won't fix
&lt;/h2&gt;

&lt;p&gt;Being straight about the limits, since the "50 GB in one click" apps aren't:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;It won't find near-duplicates.&lt;/strong&gt; A photo resized to 50% is a different file with a different hash. So is a video re-encoded at a lower bitrate. Content hashing is exact-match only.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It won't clean up Windows itself.&lt;/strong&gt; &lt;code&gt;WinSxS&lt;/code&gt;, &lt;code&gt;System Volume Information&lt;/code&gt; and hibernation files are a different problem with a different tool (Disk Cleanup, or &lt;code&gt;Dism /Online /Cleanup-Image&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It won't tell you what's safe to delete.&lt;/strong&gt; That judgement is step 3, and no tool can take it over.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One more thing worth knowing: files that look like duplicates but are actually &lt;strong&gt;hard links&lt;/strong&gt; — the same data with two names — free zero bytes when deleted. A tool that counts them as duplicates is lying to you about how much space you will get back. Good ones detect and skip them.&lt;/p&gt;

&lt;h2&gt;
  
  
  The short version
&lt;/h2&gt;

&lt;p&gt;Windows will not find duplicates for you. Sort by size to narrow it down, hash to confirm, keep the copy in the folder you would look in first, and send the rest to the Recycle Bin instead of deleting them.&lt;/p&gt;

&lt;p&gt;I use &lt;a href="https://wappkit.com/tools/filededupe?ref=devto" rel="noopener noreferrer"&gt;FileDedupe&lt;/a&gt; for this. It is free, needs no account, and deletes to the Recycle Bin by default. The Pro version adds CSV export, saved exclusion rules and command-line use — you do not need any of that for a one-off cleanup.&lt;/p&gt;

</description>
      <category>productivity</category>
      <category>tutorial</category>
      <category>windo</category>
      <category>ai</category>
    </item>
    <item>
      <title>Three filters, cheap to expensive: how a duplicate finder avoids hashing your whole disk</title>
      <dc:creator>alice kelly</dc:creator>
      <pubDate>Wed, 11 Nov 2026 13:41:48 +0000</pubDate>
      <link>https://dev.to/alice_kelly_68226d164218e/three-filters-cheap-to-expensive-how-a-duplicate-finder-avoids-hashing-your-whole-disk-3h3i</link>
      <guid>https://dev.to/alice_kelly_68226d164218e/three-filters-cheap-to-expensive-how-a-duplicate-finder-avoids-hashing-your-whole-disk-3h3i</guid>
      <description>&lt;p&gt;Every duplicate file finder starts with the same obvious plan: hash every file, group by&lt;br&gt;
digest. It is correct, it is simple, and on a real drive it is unusable.&lt;/p&gt;

&lt;p&gt;Here is the naive baseline, measured on a 1.09 GB working folder with 877 files:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;naive: 877 files, 1.09 GB, 21.2 s   (SHA-256 over every byte)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;21 seconds for one gigabyte. A 500 GB drive is three hours, and that is before you count&lt;br&gt;
the USB drive that spins down every 30 seconds.&lt;/p&gt;

&lt;p&gt;The fix is not a faster hash. SHA-256 is already fast enough — the CPU is not the&lt;br&gt;
bottleneck, the disk is. The fix is &lt;strong&gt;not reading the bytes at all&lt;/strong&gt; for the files that&lt;br&gt;
cannot possibly be duplicates.&lt;/p&gt;
&lt;h2&gt;
  
  
  Filter 1 — size (free)
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;os.stat&lt;/code&gt; gives you the size without opening the file. Two files with different sizes are&lt;br&gt;
not duplicates, full stop. This filter costs one syscall per file and eliminates the&lt;br&gt;
majority of a normal folder.&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="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;_by_size&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;entries&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;buckets&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;defaultdict&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;list&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;entries&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;buckets&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;size&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;v&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;v&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;buckets&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;items&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Only buckets with more than one member survive. On a typical disk that is a small&lt;br&gt;
fraction of the file count — photos, videos, and documents almost all have unique sizes.&lt;/p&gt;
&lt;h2&gt;
  
  
  Filter 2 — the first 4 KB
&lt;/h2&gt;

&lt;p&gt;Files that share a size are the only candidates left. For those, read 4 KB and hash that.&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="no"&gt;HEAD_BYTES&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;4096&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;_hash_file&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;limit&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;None&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;h&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;hashlib&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sha256&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;remaining&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;limit&lt;/span&gt;
    &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nb"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;_long_path&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"rb"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;want&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;CHUNK&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;remaining&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="kc"&gt;None&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="nb"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;CHUNK&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;remaining&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;want&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="k"&gt;break&lt;/span&gt;
            &lt;span class="n"&gt;chunk&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;want&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;chunk&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="k"&gt;break&lt;/span&gt;
            &lt;span class="n"&gt;h&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;update&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;chunk&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;remaining&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="kc"&gt;None&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="n"&gt;remaining&lt;/span&gt; &lt;span class="o"&gt;-=&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;chunk&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;h&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;hexdigest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;4 KB is not a magic number. It is the point where the cost of the read is negligible&lt;br&gt;
compared to opening the file at all, and where formats diverge: JPEG headers, ZIP local&lt;br&gt;
headers, MP4 &lt;code&gt;ftyp&lt;/code&gt; boxes, and Office files all differ within the first few hundred bytes.&lt;br&gt;
Two files that agree on both size and first 4 KB are either duplicates or deliberately&lt;br&gt;
constructed to look like them.&lt;/p&gt;
&lt;h2&gt;
  
  
  Filter 3 — full SHA-256, only for survivors
&lt;/h2&gt;

&lt;p&gt;Whatever is still standing gets read end to end and hashed properly.&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;groups&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;defaultdict&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;list&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;candidates&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;d&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;_hash_file&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;      &lt;span class="c1"&gt;# full read&lt;/span&gt;
    &lt;span class="n"&gt;groups&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The point of this stage is not speed. It is that &lt;strong&gt;this is the only stage allowed to&lt;br&gt;
decide a file gets deleted&lt;/strong&gt;, and it uses a cryptographic digest, not CRC32, not a size&lt;br&gt;
match, not a filename pattern. Duplicate cleaners get one-star reviews for exactly one&lt;br&gt;
reason: they deleted something that was not a duplicate.&lt;/p&gt;
&lt;h2&gt;
  
  
  What it actually measures
&lt;/h2&gt;

&lt;p&gt;Same folder, same machine, three filters instead of one:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;three-layer: 872 files seen, 279 hashed (32.0%), 42 groups, 107 duplicate files,
             184.6 MB reclaimable, 9.9 s
naive:       877 files, 21.2 s
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;2.1x on 1.09 GB. That number is unimpressive, and it is worth being honest about why:&lt;br&gt;
this folder is small and it is full of build artefacts that genuinely collide on size.&lt;br&gt;
The ratio is not a constant — it is a function of how much of your disk is unique. On a&lt;br&gt;
photo library where every file is a different size, filter 1 alone removes almost&lt;br&gt;
everything and the speedup is an order of magnitude. On a folder of copied installers it&lt;br&gt;
approaches 1x, because most of the data really is duplicate and really does have to be&lt;br&gt;
read.&lt;/p&gt;

&lt;p&gt;The metric that matters is not files hashed. It is &lt;strong&gt;bytes read&lt;/strong&gt;, and filters 1 and 2&lt;br&gt;
exist to make that number small.&lt;/p&gt;
&lt;h2&gt;
  
  
  Two Windows traps that break the naive version
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Hard links.&lt;/strong&gt; &lt;code&gt;st_nlink &amp;gt; 1&lt;/code&gt; means several names point at one inode. They are not&lt;br&gt;
duplicates — deleting either name frees nothing, because the data is still referenced.&lt;br&gt;
A finder that reports them as duplicates and "cleans" them gives the user a fake number&lt;br&gt;
and zero reclaimed space.&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;key&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;st&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;st_dev&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;st&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;st_ino&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;st&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;st_nlink&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;1&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;key&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;seen_inodes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;continue&lt;/span&gt;
    &lt;span class="n"&gt;seen_inodes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Long paths.&lt;/strong&gt; &lt;code&gt;MAX_PATH&lt;/code&gt; is 260 characters and &lt;code&gt;open()&lt;/code&gt; fails past it. Prefixing with&lt;br&gt;
&lt;code&gt;\\?\&lt;/code&gt; bypasses the limit, but only for absolute paths, and only on Windows:&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="k"&gt;if&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;240&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;startswith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"\\\\"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"\\\\?\\"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The 240 threshold, not 260, leaves room for the prefix itself and for the path separator&lt;br&gt;
that gets appended.&lt;/p&gt;

&lt;h2&gt;
  
  
  The shape of the whole thing
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;walk      → os.walk, prune excluded dirs in place, collect (path, size, inode)
by size   → keep only buckets with &amp;gt;1 member
by head   → 4 KB SHA-256 inside those buckets, keep only &amp;gt;1
full hash → SHA-256 end to end, that digest decides
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Four stages, about 40 lines of logic, and the expensive one runs on a third of the files&lt;br&gt;
or fewer. The same shape works for photo libraries, backups, and the &lt;code&gt;Downloads&lt;/code&gt; folder&lt;br&gt;
everyone has been meaning to clean since 2019.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;FileDedupe is a Windows duplicate file finder that uses this pipeline. &lt;a href="https://www.wappkit.com/tools/filededupe?utm_source=devto&amp;amp;utm_medium=community&amp;amp;utm_campaign=filededupe_hash_layers" rel="noopener noreferrer"&gt;Free on the Microsoft Store&lt;/a&gt;. Code excerpts above are from the shipping scanner.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>windows</category>
      <category>showdev</category>
      <category>algorithms</category>
      <category>python</category>
    </item>
    <item>
      <title>Reading Reddit without an API key: RSS endpoints, a parser, and the limits</title>
      <dc:creator>alice kelly</dc:creator>
      <pubDate>Wed, 11 Nov 2026 02:44:14 +0000</pubDate>
      <link>https://dev.to/alice_kelly_68226d164218e/reading-reddit-without-an-api-key-rss-endpoints-a-parser-and-the-limits-4a6i</link>
      <guid>https://dev.to/alice_kelly_68226d164218e/reading-reddit-without-an-api-key-rss-endpoints-a-parser-and-the-limits-4a6i</guid>
      <description>&lt;p&gt;Reddit's login wall is now the default path for a lot of readers. I read public threads for research, and I didn't want another account just to open a link. The official API can do the job, but it means OAuth, an app registration, and a token refresh path before the first request.&lt;/p&gt;

&lt;p&gt;The public RSS feeds are still there. No key, no OAuth, Atom XML. I built a small Android client around them (105 KB, no server, no analytics). This post is about the feed format, the parsing problems, and the limits that decide what kind of reader you can build.&lt;/p&gt;

&lt;h2&gt;
  
  
  The endpoints
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Listing:
https://www.reddit.com/r/{subreddit}/hot.rss?limit=25
https://www.reddit.com/r/{subreddit}/new.rss?limit=25
https://www.reddit.com/r/{subreddit}/top.rss?limit=25

Thread:
https://www.reddit.com/r/{subreddit}/comments/{post_id}/.rss?limit=100
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;{subreddit}&lt;/code&gt; is the name without &lt;code&gt;r/&lt;/code&gt;. &lt;code&gt;hot&lt;/code&gt;, &lt;code&gt;new&lt;/code&gt;, and &lt;code&gt;top&lt;/code&gt; are the listing sorts. The thread URL returns the post plus the comments Reddit includes in the feed.&lt;/p&gt;

&lt;p&gt;A few details that matter:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The response is &lt;code&gt;application/atom+xml&lt;/code&gt;, not JSON.&lt;/li&gt;
&lt;li&gt;The feed caps what it returns. The app asks for 25 posts per listing and 100 entries for a thread. The listing is the latest 25; I haven't found a working pagination parameter.&lt;/li&gt;
&lt;li&gt;Reddit rate-limits these endpoints per IP. Two quick requests to the same subreddit can return HTTP 429. Treat 429 as "back off and retry", not as an empty feed.&lt;/li&gt;
&lt;li&gt;Send a normal browser User-Agent. A bare Java client UA is more likely to get a 403.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What is inside an entry
&lt;/h2&gt;

&lt;p&gt;A listing entry has the fields you'd expect: title, author name, updated timestamp, a permalink in &lt;code&gt;link rel="alternate"&lt;/code&gt;, and an HTML &lt;code&gt;content&lt;/code&gt; block. The &lt;code&gt;id&lt;/code&gt; looks like &lt;code&gt;t3_abc123&lt;/code&gt;, which is handy as a stable key.&lt;/p&gt;

&lt;p&gt;A thread feed uses the same entry shape. The first entry is the post; the rest are comments. Each comment has an author, a timestamp, and HTML content. There is no score, no depth, and no reliable parent pointer in the RSS payload, so comments render as a flat list.&lt;/p&gt;

&lt;h2&gt;
  
  
  Parsing it with XmlPullParser
&lt;/h2&gt;

&lt;p&gt;Android already ships a streaming XML parser, so the RSS mode does not need a third-party XML library. The core loop looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nc"&gt;XmlPullParser&lt;/span&gt; &lt;span class="n"&gt;parser&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Xml&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;newPullParser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;parser&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setFeature&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;XmlPullParser&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;FEATURE_PROCESS_NAMESPACES&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;parser&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setInput&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;connection&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getInputStream&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"UTF-8"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="k"&gt;event&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;parser&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getEventType&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;title&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;author&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;link&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;updated&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;event&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="nc"&gt;XmlPullParser&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;END_DOCUMENT&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;parser&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getName&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;event&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="nc"&gt;XmlPullParser&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;START_TAG&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;switch&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="s2"&gt;"entry"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="n"&gt;title&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;author&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;link&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;updated&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
                &lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="s2"&gt;"title"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="n"&gt;title&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;parser&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;nextText&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
                &lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="s2"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="n"&gt;author&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;parser&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;nextText&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
                &lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="s2"&gt;"updated"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="n"&gt;updated&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;parser&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;nextText&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
                &lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="s2"&gt;"link"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;rel&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;parser&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getAttributeValue&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"rel"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
                &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;rel&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="k"&gt;null&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="s2"&gt;"alternate"&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;equals&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;rel&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                    &lt;span class="n"&gt;link&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;parser&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getAttributeValue&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"href"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
                &lt;span class="p"&gt;}&lt;/span&gt;
                &lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;event&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="nc"&gt;XmlPullParser&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;END_TAG&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="s2"&gt;"entry"&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;equals&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nf"&gt;emit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;author&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;link&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;updated&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;event&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;parser&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;next&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The important part is not the switch statement; it is the event loop. &lt;code&gt;nextText()&lt;/code&gt; reads the text of the current tag and leaves the parser on its end tag. Emit a row on the &lt;code&gt;entry&lt;/code&gt; end tag, and keep the parser streaming so a long thread does not build a DOM in memory.&lt;/p&gt;

&lt;p&gt;Two practical notes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Namespaces are not worth the trouble here. Reddit's Atom feed is simple enough that disabling namespace processing keeps &lt;code&gt;getName()&lt;/code&gt; returning local names.&lt;/li&gt;
&lt;li&gt;If you render &lt;code&gt;content&lt;/code&gt;, sanitize it first. It is HTML from Reddit, and a WebView will execute whatever is in it.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The limits, and why they shape the app
&lt;/h2&gt;

&lt;p&gt;RSS is read-only and shallow:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No score and no comment depth. You get the text, not the ranking.&lt;/li&gt;
&lt;li&gt;No pagination that I could make work. The listing ends at the latest batch.&lt;/li&gt;
&lt;li&gt;No voting, posting, or replying.&lt;/li&gt;
&lt;li&gt;Fields can be missing. Deleted authors and removed comments still show up as entries.&lt;/li&gt;
&lt;li&gt;A shared server is the wrong architecture. If every user fetches through your proxy, Reddit sees one IP and rate-limits everyone together. The app makes the request from the phone's own IP, one request per user action, with no polling.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That last point is also why a web page cannot just do this in the browser: &lt;code&gt;fetch&lt;/code&gt; to reddit.com is blocked by CORS, and Reddit sends &lt;code&gt;X-Frame-Options&lt;/code&gt;, so an iframe stays blank. A native client avoids both.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I shipped
&lt;/h2&gt;

&lt;p&gt;I wrapped the feed into a 105 KB Android app. The RSS mode has a native list for Hot/New/Top and a thread screen; a separate WebView reader handles pages the feeds do not cover. It is free, has no analytics and no background service, and distinguishes 429, 403, and no-connection errors instead of showing a generic failure.&lt;/p&gt;

&lt;p&gt;The app is here: &lt;a href="https://www.wappkit.com/tools/reddit-reader-android?utm_source=devto&amp;amp;utm_medium=community&amp;amp;utm_campaign=reddit_reader_0_2" rel="noopener noreferrer"&gt;https://www.wappkit.com/tools/reddit-reader-android?utm_source=devto&amp;amp;utm_medium=community&amp;amp;utm_campaign=reddit_reader_0_2&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Disclosure: I built the app, so that link is mine. There are no affiliate links in this post.&lt;/p&gt;

&lt;h2&gt;
  
  
  Open question
&lt;/h2&gt;

&lt;p&gt;If you have parsed Reddit's Atom feeds, have you found a pagination parameter that actually works for listings? That is the one limit I have not solved. I would also like to know whether a Play Store listing matters more than extra RSS features for a read-only reader.&lt;/p&gt;

</description>
      <category>rss</category>
      <category>showdev</category>
      <category>android</category>
      <category>java</category>
    </item>
    <item>
      <title>OpenAI-Compatible Base URL 写错时，为什么 SDK 总是报 404</title>
      <dc:creator>alice kelly</dc:creator>
      <pubDate>Fri, 19 Jun 2026 01:46:29 +0000</pubDate>
      <link>https://dev.to/alice_kelly_68226d164218e/openai-compatible-base-url-xie-cuo-shi-wei-shi-yao-sdk-zong-shi-bao-404-2i1n</link>
      <guid>https://dev.to/alice_kelly_68226d164218e/openai-compatible-base-url-xie-cuo-shi-wei-shi-yao-sdk-zong-shi-bao-404-2i1n</guid>
      <description>&lt;p&gt;接 OpenAI-compatible API 时，最容易被误判的问题是 &lt;code&gt;404&lt;/code&gt;。&lt;/p&gt;

&lt;p&gt;很多人看到 &lt;code&gt;404&lt;/code&gt; 会以为服务不可用，或者 SDK 版本坏了。实际更常见的原因是 Base URL、路径前缀、模型名和接口类型没有对上。&lt;/p&gt;

&lt;p&gt;这篇只做一件事：把 &lt;code&gt;404&lt;/code&gt; 的排查顺序讲清楚。&lt;/p&gt;

&lt;h2&gt;
  
  
  第一项：确认 &lt;code&gt;/v1&lt;/code&gt; 有没有写对
&lt;/h2&gt;

&lt;p&gt;OpenAI SDK 通常会在你提供的 &lt;code&gt;base_url&lt;/code&gt; 后面继续拼接接口路径。如果兼容网关要求的入口是：&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://api.wappkit.com/v1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;那你就应该把完整的 &lt;code&gt;/v1&lt;/code&gt; 一起写进去。&lt;/p&gt;

&lt;p&gt;如果只写根域名：&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://api.wappkit.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;SDK 可能会请求到错误路径。错误表现可能是 &lt;code&gt;404&lt;/code&gt;，也可能是看起来像认证失败。&lt;/p&gt;

&lt;p&gt;最小测试代码可以这样写：&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="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;openai&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;OpenAI&lt;/span&gt;

&lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;OpenAI&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;api_key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;your_gateway_key&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;base_url&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://api.wappkit.com/v1&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;chat&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;completions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;gpt-5.5&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;messages&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;role&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;user&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;content&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;return one short sentence&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;}],&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;choices&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;先跑通这段，再接你的业务代码。&lt;/p&gt;

&lt;h2&gt;
  
  
  第二项：模型名是不是当前可用名称
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;model not found&lt;/code&gt; 也经常被包装成 &lt;code&gt;404&lt;/code&gt;。&lt;/p&gt;

&lt;p&gt;不要凭印象写模型名。比如你想用 &lt;code&gt;gpt-5.5&lt;/code&gt;，就去模型列表复制当前暴露的名称。版本号、短横线、大小写、别名都可能导致请求失败。&lt;/p&gt;

&lt;p&gt;如果你正在迁移旧项目，尤其要检查代码里有没有多个地方写死模型名。最容易漏的是：&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;.env&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Docker Compose&lt;/li&gt;
&lt;li&gt;CI 配置&lt;/li&gt;
&lt;li&gt;前端示例代码&lt;/li&gt;
&lt;li&gt;后台默认参数&lt;/li&gt;
&lt;li&gt;测试脚本&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;只改一处不够，所有入口都要统一。&lt;/p&gt;

&lt;h2&gt;
  
  
  第三项：接口类型是否匹配
&lt;/h2&gt;

&lt;p&gt;有些模型只适合 chat completions，有些接口可能要求不同的请求格式。你用 chat SDK 调一个不支持该接口类型的模型，也可能得到不清晰的错误。&lt;/p&gt;

&lt;p&gt;排查时先不要用复杂请求。关掉 stream、工具调用、JSON mode、长上下文，先发一条普通 chat 请求。普通请求通了，再逐项打开其他能力。&lt;/p&gt;

&lt;h2&gt;
  
  
  第四项：环境变量有没有被覆盖
&lt;/h2&gt;

&lt;p&gt;很多项目不是代码写错，而是运行时读到的环境变量不是你以为的值。&lt;/p&gt;

&lt;p&gt;建议启动时打印非敏感配置：&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="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;base_url =&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getenv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;AI_API_BASE_URL&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;model =&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getenv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;AI_MODEL&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;不要打印 API Key。只确认 Base URL 和模型名就够了。&lt;/p&gt;

&lt;p&gt;如果你用的是 Cursor、Cline、Docker、云函数或 PM2，记得这些运行环境可能不会自动读取你当前终端里的变量。&lt;/p&gt;

&lt;h2&gt;
  
  
  第五项：看状态页和请求日志
&lt;/h2&gt;

&lt;p&gt;如果昨天能跑，今天突然 &lt;code&gt;404&lt;/code&gt;，先别急着改代码。&lt;/p&gt;

&lt;p&gt;看两件事：&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;状态页是否有模型维护或上游波动。&lt;/li&gt;
&lt;li&gt;请求日志里实际请求的模型名和路径是什么。&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Wappkit 的接入说明可以先看 &lt;a href="https://api.wappkit.com/docs" rel="noopener noreferrer"&gt;docs&lt;/a&gt;，模型名称以 &lt;a href="https://api.wappkit.com/models" rel="noopener noreferrer"&gt;model list&lt;/a&gt; 为准。如果你能在日志里看到请求路径、模型名和错误信息，排查会快很多。&lt;/p&gt;

&lt;h2&gt;
  
  
  一个简单排查顺序
&lt;/h2&gt;

&lt;p&gt;遇到 &lt;code&gt;404&lt;/code&gt; 时，可以按这个顺序走：&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Base URL 是否包含正确的 &lt;code&gt;/v1&lt;/code&gt;。&lt;/li&gt;
&lt;li&gt;API Key 是否属于当前网关。&lt;/li&gt;
&lt;li&gt;模型名是否从当前模型列表复制。&lt;/li&gt;
&lt;li&gt;接口类型是否匹配。&lt;/li&gt;
&lt;li&gt;环境变量是否被运行环境覆盖。&lt;/li&gt;
&lt;li&gt;状态页和请求日志是否显示异常。&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;这六步比盲目换 SDK 更有效。&lt;/p&gt;

&lt;h2&gt;
  
  
  小结
&lt;/h2&gt;

&lt;p&gt;OpenAI-compatible Base URL 的 &lt;code&gt;404&lt;/code&gt;，大部分不是神秘故障。&lt;/p&gt;

&lt;p&gt;它通常来自路径前缀、模型名、接口类型或运行环境配置不一致。把最小请求跑通，再逐步接回业务代码，问题会清楚很多。&lt;/p&gt;

</description>
      <category>ai</category>
      <category>api</category>
      <category>openai</category>
      <category>debugging</category>
    </item>
    <item>
      <title>A Practical AI API Budget Playbook for Cursor, Cline, and Coding Agents</title>
      <dc:creator>alice kelly</dc:creator>
      <pubDate>Thu, 18 Jun 2026 05:22:43 +0000</pubDate>
      <link>https://dev.to/alice_kelly_68226d164218e/a-practical-ai-api-budget-playbook-for-cursor-cline-and-coding-agents-1gma</link>
      <guid>https://dev.to/alice_kelly_68226d164218e/a-practical-ai-api-budget-playbook-for-cursor-cline-and-coding-agents-1gma</guid>
      <description>&lt;p&gt;AI coding tools can feel cheap during the first few tests and surprisingly expensive after a real work session. The reason is simple: coding agents do not behave like a normal chatbot.&lt;/p&gt;

&lt;p&gt;They read files, inspect errors, propose patches, run commands, retry after failures, and carry context from one step to the next. A single "fix this bug" request may turn into many model calls with large prompts.&lt;/p&gt;

&lt;p&gt;The answer is not to stop using AI coding tools. The answer is to give them a budget system.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Use separate keys for human chat and coding tools
&lt;/h2&gt;

&lt;p&gt;Do not put every workflow behind the same API key.&lt;/p&gt;

&lt;p&gt;At minimum, split keys like this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;one key for Cursor&lt;/li&gt;
&lt;li&gt;one key for Cline&lt;/li&gt;
&lt;li&gt;one key for local scripts&lt;/li&gt;
&lt;li&gt;one key for your application&lt;/li&gt;
&lt;li&gt;one key for experiments&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This makes cost review much easier. If the Cline key spends more than expected, you know the problem is likely an agent loop, too much context, or a task that should have been split into smaller parts.&lt;/p&gt;

&lt;p&gt;If everything shares one key, you only learn that "AI was expensive today." That is not actionable.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Put the base URL and model in environment variables
&lt;/h2&gt;

&lt;p&gt;Many OpenAI-compatible SDKs can be pointed at a gateway by changing the base URL:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;AI_API_BASE_URL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;https://api.wappkit.com/v1
&lt;span class="nv"&gt;AI_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;your_tool_key
&lt;span class="nv"&gt;AI_MODEL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;gpt-5.5
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your app or tool can then read the values:&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="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;openai&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;OpenAI&lt;/span&gt;

&lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;OpenAI&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;api_key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;AI_API_KEY&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="n"&gt;base_url&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;AI_API_BASE_URL&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;model&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getenv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;AI_MODEL&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;gpt-5.5&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This keeps model changes visible. If a task does not need your strongest model, you can switch it without editing source code.&lt;/p&gt;

&lt;p&gt;Before using any model name, copy it from the gateway's model list instead of guessing. Names, aliases, and availability can change.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Match the model to the job
&lt;/h2&gt;

&lt;p&gt;Not every coding task needs the same model.&lt;/p&gt;

&lt;p&gt;Use cheaper or faster models for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;explaining an error message&lt;/li&gt;
&lt;li&gt;summarizing a file&lt;/li&gt;
&lt;li&gt;generating small tests&lt;/li&gt;
&lt;li&gt;rewriting comments or docs&lt;/li&gt;
&lt;li&gt;finding likely causes before editing&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Reserve stronger models for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;complex bug isolation&lt;/li&gt;
&lt;li&gt;multi-file refactors&lt;/li&gt;
&lt;li&gt;architecture decisions&lt;/li&gt;
&lt;li&gt;difficult failing tests&lt;/li&gt;
&lt;li&gt;tasks where a wrong answer costs more than the request&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This one habit can reduce waste without making the workflow feel worse.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Control context before controlling price
&lt;/h2&gt;

&lt;p&gt;The biggest hidden cost in coding agents is context size.&lt;/p&gt;

&lt;p&gt;If a tool sends ten files, terminal logs, previous patches, and a long instruction history, the prompt becomes expensive before the model writes a single token.&lt;/p&gt;

&lt;p&gt;Give the tool a smaller target:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;name the file that likely contains the bug&lt;/li&gt;
&lt;li&gt;paste the exact error&lt;/li&gt;
&lt;li&gt;tell it which files are out of scope&lt;/li&gt;
&lt;li&gt;ask for a plan before edits&lt;/li&gt;
&lt;li&gt;stop after two failed attempts and inspect manually&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Good prompts are not about sounding clever. They are about giving the agent less irrelevant material to carry.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Make retries visible
&lt;/h2&gt;

&lt;p&gt;Retries are useful, but silent retries are dangerous.&lt;/p&gt;

&lt;p&gt;A coding agent may retry when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a patch fails to apply&lt;/li&gt;
&lt;li&gt;tests fail&lt;/li&gt;
&lt;li&gt;a command times out&lt;/li&gt;
&lt;li&gt;the model response is malformed&lt;/li&gt;
&lt;li&gt;the network returns a temporary error&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each retry can include the same large context again. If your gateway logs show retry behavior, review those rows first when cost jumps.&lt;/p&gt;

&lt;p&gt;For important tasks, cap the loop. After two or three failed attempts, ask the tool to summarize what it tried and what evidence it found. Then decide the next step yourself.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Use prepaid balance or small quotas for experiments
&lt;/h2&gt;

&lt;p&gt;For personal projects and early testing, prepaid usage is a useful safety rail. It does not make requests cheaper by itself, but it prevents an experiment from quietly running far beyond your comfort zone.&lt;/p&gt;

&lt;p&gt;The basic workflow is:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;create a separate key for the tool&lt;/li&gt;
&lt;li&gt;assign a small balance or quota&lt;/li&gt;
&lt;li&gt;run a few real tasks&lt;/li&gt;
&lt;li&gt;check request logs and billing&lt;/li&gt;
&lt;li&gt;raise the limit only if usage is predictable&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you use Wappkit, start from the &lt;a href="https://api.wappkit.com/billing" rel="noopener noreferrer"&gt;billing page&lt;/a&gt;, confirm the compatible endpoint in the &lt;a href="https://api.wappkit.com/docs" rel="noopener noreferrer"&gt;docs&lt;/a&gt;, and check the &lt;a href="https://api.wappkit.com/models" rel="noopener noreferrer"&gt;model list&lt;/a&gt; before choosing a default model.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Review the biggest requests, not the average request
&lt;/h2&gt;

&lt;p&gt;Averages hide the problem.&lt;/p&gt;

&lt;p&gt;Your average request may look fine while one agent task sends a huge prompt five times in a row. Review the top requests by prompt tokens and total cost. Those outliers usually teach you more than a daily total.&lt;/p&gt;

&lt;p&gt;Ask:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Was this much context necessary?&lt;/li&gt;
&lt;li&gt;Did the tool read unrelated files?&lt;/li&gt;
&lt;li&gt;Was the model too strong for the task?&lt;/li&gt;
&lt;li&gt;Did a failed command trigger repeated attempts?&lt;/li&gt;
&lt;li&gt;Should this workflow have a lower quota?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This review takes a few minutes and often saves more than changing providers.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final setup
&lt;/h2&gt;

&lt;p&gt;My preferred budget setup for AI coding tools is boring:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;separate keys per tool&lt;/li&gt;
&lt;li&gt;environment-based base URL and model&lt;/li&gt;
&lt;li&gt;small prepaid limits for experiments&lt;/li&gt;
&lt;li&gt;logs that show model, token count, status, and key&lt;/li&gt;
&lt;li&gt;stronger models used intentionally&lt;/li&gt;
&lt;li&gt;manual review after repeated failures&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Once this is in place, Cursor, Cline, and agent scripts become much easier to trust. They can still spend money, but they no longer spend it invisibly.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>api</category>
      <category>coding</category>
      <category>openai</category>
    </item>
    <item>
      <title>OpenAI-Compatible API Gateway Logs: What to Track Before Your AI Bill Gets Weird</title>
      <dc:creator>alice kelly</dc:creator>
      <pubDate>Thu, 18 Jun 2026 05:22:40 +0000</pubDate>
      <link>https://dev.to/alice_kelly_68226d164218e/openai-compatible-api-gateway-logs-what-to-track-before-your-ai-bill-gets-weird-5g6e</link>
      <guid>https://dev.to/alice_kelly_68226d164218e/openai-compatible-api-gateway-logs-what-to-track-before-your-ai-bill-gets-weird-5g6e</guid>
      <description>&lt;p&gt;Most teams do not notice API gateway logs until something goes wrong. The app gets slower, a budget disappears overnight, or a coding assistant suddenly starts making far more requests than expected.&lt;/p&gt;

&lt;p&gt;By then, the question is no longer "which model should we use?" It becomes "what happened, which key did it, and can we prove it?"&lt;/p&gt;

&lt;p&gt;If you use an OpenAI-compatible API gateway, request logs are not a nice dashboard extra. They are the layer that turns AI usage from a guessing game into something you can debug.&lt;/p&gt;

&lt;h2&gt;
  
  
  Start with the real unit of debugging
&lt;/h2&gt;

&lt;p&gt;For normal web apps, you usually debug by route, user, status code, and latency. AI calls need a few more fields.&lt;/p&gt;

&lt;p&gt;At minimum, each request should tell you:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;which API key was used&lt;/li&gt;
&lt;li&gt;which model was requested&lt;/li&gt;
&lt;li&gt;whether the request succeeded&lt;/li&gt;
&lt;li&gt;how many prompt tokens were sent&lt;/li&gt;
&lt;li&gt;how many completion tokens came back&lt;/li&gt;
&lt;li&gt;how long the request took&lt;/li&gt;
&lt;li&gt;what error was returned, if any&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Without those fields, a rising bill is just a vague feeling. With them, you can separate normal growth from a bad loop, a wrong model choice, or a tool that is sending too much context.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why one shared API key is a trap
&lt;/h2&gt;

&lt;p&gt;The easiest setup is also the hardest one to investigate: one API key used everywhere.&lt;/p&gt;

&lt;p&gt;It works for a weekend prototype. It becomes painful as soon as you add more moving pieces:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a web app&lt;/li&gt;
&lt;li&gt;a background job&lt;/li&gt;
&lt;li&gt;Cursor or Cline&lt;/li&gt;
&lt;li&gt;a local script&lt;/li&gt;
&lt;li&gt;a staging environment&lt;/li&gt;
&lt;li&gt;a teammate testing prompts&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If all of them share one key, the usage chart can only say "the key spent money." It cannot tell you which project caused the spike.&lt;/p&gt;

&lt;p&gt;A cleaner setup is to create one key per tool or project. Use a separate key for your app, your coding assistant, your cron jobs, and your experiments. When usage jumps, you know where to look first.&lt;/p&gt;

&lt;h2&gt;
  
  
  Track model choice separately from endpoint choice
&lt;/h2&gt;

&lt;p&gt;OpenAI-compatible gateways make migration easier because many SDKs only need two changes: the API key and the base URL.&lt;/p&gt;

&lt;p&gt;For example:&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="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;openai&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;OpenAI&lt;/span&gt;

&lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;OpenAI&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;api_key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;YOUR_GATEWAY_KEY&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;base_url&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://api.wappkit.com/v1&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;chat&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;completions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;gpt-5.5&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;messages&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;role&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;user&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;content&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Summarize this error log in one paragraph.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;],&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;choices&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That convenience is useful, but do not let it hide model changes. A request to a small model and a request to a stronger model may look identical at the SDK level, while the cost profile is very different.&lt;/p&gt;

&lt;p&gt;Put the model name in configuration, not scattered through code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;AI_API_BASE_URL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;https://api.wappkit.com/v1
&lt;span class="nv"&gt;AI_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;your_project_key
&lt;span class="nv"&gt;AI_MODEL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;gpt-5.5
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then your logs can show whether a cost spike came from more traffic or from a model switch.&lt;/p&gt;

&lt;h2&gt;
  
  
  Watch prompt tokens, not just total requests
&lt;/h2&gt;

&lt;p&gt;Counting requests is not enough. Ten short classification calls may cost less than one coding-agent request with a large context window.&lt;/p&gt;

&lt;p&gt;This matters a lot for AI coding tools. Cursor, Cline, Claude Code, and custom agent scripts often send file snippets, diffs, terminal output, and previous reasoning steps. The visible user message may be tiny, but the actual prompt can be large.&lt;/p&gt;

&lt;p&gt;Good logs should make prompt tokens obvious. If a request used 40,000 prompt tokens, you should be able to see it immediately instead of discovering the cost later.&lt;/p&gt;

&lt;h2&gt;
  
  
  Separate user errors from platform errors
&lt;/h2&gt;

&lt;p&gt;When an AI request fails, the error message matters.&lt;/p&gt;

&lt;p&gt;Useful logs should distinguish:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;invalid API key&lt;/li&gt;
&lt;li&gt;insufficient balance&lt;/li&gt;
&lt;li&gt;model not found&lt;/li&gt;
&lt;li&gt;rate limit&lt;/li&gt;
&lt;li&gt;upstream timeout&lt;/li&gt;
&lt;li&gt;malformed request&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Those errors lead to different fixes. If a model name is wrong, the developer should check the model list. If balance is low, the owner should check billing. If upstream latency is high, retries should be conservative.&lt;/p&gt;

&lt;p&gt;For a gateway such as Wappkit, the practical flow is simple: confirm the OpenAI-compatible setup in the &lt;a href="https://api.wappkit.com/docs" rel="noopener noreferrer"&gt;docs&lt;/a&gt;, copy model names from the &lt;a href="https://api.wappkit.com/models" rel="noopener noreferrer"&gt;model list&lt;/a&gt;, and use the &lt;a href="https://api.wappkit.com/status" rel="noopener noreferrer"&gt;status page&lt;/a&gt; before rewriting working SDK code.&lt;/p&gt;

&lt;h2&gt;
  
  
  Add budgets before you need them
&lt;/h2&gt;

&lt;p&gt;Logs explain what happened. Budgets prevent one bad loop from becoming expensive.&lt;/p&gt;

&lt;p&gt;For development projects, I like this setup:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;one key per project&lt;/li&gt;
&lt;li&gt;one key per AI coding tool&lt;/li&gt;
&lt;li&gt;small prepaid balance or quota for experiments&lt;/li&gt;
&lt;li&gt;stronger models only for tasks that need them&lt;/li&gt;
&lt;li&gt;daily review of high-token requests&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This does not slow down development much. It simply gives each workflow a boundary.&lt;/p&gt;

&lt;h2&gt;
  
  
  A small review checklist
&lt;/h2&gt;

&lt;p&gt;Before you put a gateway into daily use, check whether you can answer these questions from logs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Which key spent the most today?&lt;/li&gt;
&lt;li&gt;Which model created the biggest cost?&lt;/li&gt;
&lt;li&gt;Which request had the largest prompt?&lt;/li&gt;
&lt;li&gt;Which failures were retried?&lt;/li&gt;
&lt;li&gt;Which project would be safe to pause?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you cannot answer those questions, the gateway may still work, but it will be hard to manage.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final thought
&lt;/h2&gt;

&lt;p&gt;An OpenAI-compatible API gateway is useful because it makes integration boring: same SDK style, different base URL, multiple models behind one entry point.&lt;/p&gt;

&lt;p&gt;But the operational value comes from visibility. Keys, quotas, request logs, model names, token counts, and status checks are what make AI usage manageable after the first demo works.&lt;/p&gt;

&lt;p&gt;Do not wait for the bill to get weird. Set up the logs first.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>api</category>
      <category>openai</category>
      <category>devops</category>
    </item>
  </channel>
</rss>
