惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

IT之家
IT之家
A
About on SuperTechFans
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
N
Netflix TechBlog - Medium
Microsoft Security Blog
Microsoft Security Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 三生石上(FineUI控件)
博客园 - 聂微东
博客园 - Franky
D
Docker
Martin Fowler
Martin Fowler
Engineering at Meta
Engineering at Meta
The Cloudflare Blog
人人都是产品经理
人人都是产品经理
Last Week in AI
Last Week in AI
U
Unit 42
F
Fortinet All Blogs
H
Help Net Security
Blog — PlanetScale
Blog — PlanetScale
Microsoft Azure Blog
Microsoft Azure Blog
罗磊的独立博客
P
Proofpoint News Feed
月光博客
月光博客
G
Google Developers Blog

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Green tests, broken docs. Dogfooding caught what 15 tests...
Mirza Iqbal · 2026-06-11 · via DEV Community

A broken doc still renders.

That is the whole reason documentation rot is so dangerous.

The page looks fine right up to the moment someone clicks the link that went nowhere.

This week I shipped a small tool to catch that, and the tool taught me a lesson I keep relearning.

What the tool does

It scans a folder of markdown and flags three kinds of rot.

A link to a file that moved and now returns a 404.

A table of contents anchor that drifted away from its heading.

And the one most link checkers skip, a doc that nothing else references.

That last one deserves a name. It is dead code wearing a different hat.

Nobody deletes it because nobody is sure it is unused. Nobody reads it because nothing points to it. It sits there and goes stale, quietly lying to the next person who finds it by accident.

If you have ever run a dead code check on a codebase, you already understand the orphan doc. Same idea, applied to markdown.

The part where I got humbled

I wrote 15 tests. They ran on Ubuntu and macOS. All green.

Then I pointed the checker at my own setup, hundreds of real files, and it lit up a long table of contents as completely broken.

Every anchor reported wrong.

Except the anchors were fine. I checked by hand. The links matched the headings.

The bug was mine, and it was a good one.

The bash trap

Here is the heading lookup, simplified.

set -uo pipefail

# does the anchor match any heading slug in the file?
heading_slugs "$file" | grep -Fxq "$anchor" || report_broken "$anchor"

It reads as correct at a glance. Generate the heading slugs, search them for the anchor, and report only when the search fails.

The trap is the interaction between two things you turned on for safety.

grep -q exits the moment it finds a match. It does not read the rest of the input. When it exits, it closes the pipe.

heading_slugs, still writing, gets a broken pipe and dies with a non-zero status.

set -o pipefail then declares the whole pipeline failed, because one stage in it failed, even though the stage that mattered succeeded.

So a real match was reported as a miss. On a one heading doc the producer finishes before grep closes the pipe, so the bug hides. On a forty heading doc it fires every time.

The fix is to keep the producer out of grep's pipeline.

# process substitution. grep's exit status is its own, the producer's death
# is not part of the pipeline, so pipefail stays out of it.
grep -Fxq "$anchor" <(heading_slugs "$file") || report_broken "$anchor"

Two smaller bugs were hiding behind the loud one. The slug list was printed without newlines, so every slug ran together into a single line. And the slug collapsed repeated dashes while the platform that renders the anchors does not, so a heading with a separator mismatched its own valid anchor. The fix for the second one is to normalize both sides through the same function, so any difference cancels.

The two lessons

A passing test suite proves the cases you imagined. It says nothing about the cases you did not.

My tests had one heading because one heading was easy to write. Real docs have forty, and forty is where the bug lived.

The fastest way to find what your tool misses is to turn it on yourself first. The real corpus is the test the synthetic fixtures cannot be.

I shipped a checker for rot, and the checker found rot in the work of the checker's own author. That is the job working as intended.

One question for you

If you write bash, this trap is somewhere in your scripts right now.

A strict mode plus a command that exits early is a quiet false signal, and it only shows up under the inputs you did not test.

I write about the unglamorous parts of building tools that survive real use, the bugs that pass every test and fail on contact with reality.

So tell me. What is the bug your own tests were too polite to catch?