Engineering Notes

Queues and Thread Pools — Why Submission Order and Completion Order Aren’t the Same

Write code that tries to SSH into several sites in parallel and you’ll quickly run into two questions: how many connections should run at once, and in what order should the results come back? In Python, the foundation for both is the standard library’s queue module, and the concurrent.futures.ThreadPoolExecutor built on top of it. This article looks at how the two relate, and at a property that’s easy to overlook: the order tasks are submitted in is not the same as the order they finish in. What queue.Queue actually is Note: queue.Queue is a FIFO (first-in, first-out) data structure for safely passing items between threads. Conceptually it’s no different from …

Read more
Engineering Notes

Git’s Staging Area — What Actually Happens Between `git add` and `git commit`

Edit a file, run git add ., then git commit -m “…” — for most people these two commands feel like a single operation performed in two keystrokes. But why are they separate commands at all? What happens if you edit the file again after git add but before git commit? Many developers who use Git daily can’t answer either question cleanly. This article walks through the staging area, the mechanism sitting between those two commands. The three-area mental model Note: A common way to understand Git is the three-layer model — the working directory, the staging area (also called the index), and the repository. A change has to pass …

Read more
WordPress Maintenance

TLS Certificate Verification — What “Chain of Trust” Actually Means

TLS Certificate Verification — What “Chain of Trust” Actually Means When a browser’s address bar shows a lock icon, what is actually being guaranteed? “The connection is encrypted” is one part of it, but not the whole story. The other part is: “this domain’s certificate can be verified by following a chain of trusted third parties back to something already trusted.” That chain is what’s called the chain of trust. This post walks through how that verification works, then looks at two places in our own tool’s code where we handle it in opposite ways — one strict, one deliberately relaxed. A certificate only means something once someone else has …

Read more
WordPress Maintenance

DNS Records Explained — What A, CNAME, and TXT Records Actually Point To

DNS Records Explained — What A, CNAME, and TXT Records Actually Point To “Configuring a domain” usually boils down to “adding a DNS record.” Setting up a subdomain, improving email deliverability, proving ownership of a domain to some external service — the goals differ, but the actual task is often the same: add one line in a domain management panel. This post walks through three of the most common DNS record types — A, CNAME, and TXT — what each one actually points to, and two real examples from our own domain. What DNS is resolving Between typing wpmm.jp into a browser and a page actually loading, there’s a lookup …

Read more
Engineering Notes

pip Version Specifiers — What `==`, `>=`, and `~=` Actually Commit You To

Anyone who has written a requirements.txt file has probably paused at the line after the package name. Leave it blank, pin it with ==3.0.0, set a floor with >=3.0.0, or split the difference with ~=3.0.0 — they look similar, but each one makes a completely different promise about what gets installed in the future. This post walks through pip’s version specifier syntax, then looks at why our own tool’s requirements.txt picked one particular style, and what that choice trades away. The question a version specifier is answering Note: pip’s version specifiers follow PEP 440. Writing an operator and a version number after a package name tells pip which range of …

Read more
WordPress Maintenance

Cache-Control vs. ETag: What Each One Actually Controls

Open a browser’s network tab and you’ll see Cache-Control and ETag sitting on the response headers of nearly every image, stylesheet, and script. Most developers recognize both names, but far fewer could explain how they actually divide the work of caching between them. This post walks through the basics of HTTP caching, then looks at how this project’s own OGP image generator uses one of these headers and deliberately skips the other. The Problem These Headers Solve Note: HTTP caching lets a browser (or a CDN in between) hold on to a response it already fetched — an image, a stylesheet, a script — and reuse it on the next …

Read more
Engineering Notes

UTF-8 vs. cp932: Why Some Bugs Only Show Up on Japanese Windows

“It works fine on my Mac, but it crashes the moment we hand it to Windows” is a report a lot of developers eventually hear. More often than not, the culprit is a character encoding mismatch. This post walks through the basics of text encoding, then looks at a real build-pipeline crash this project ran into, and the test written to make sure it never happens again. What an Encoding Actually Is Note: a character encoding is the lookup table a computer uses to convert characters into bytes for storage or transmission. The same character can turn into a completely different byte sequence depending on which encoding is used. When …

Read more
Engineering Notes

Exponential Backoff vs. Fixed-Interval Retries: When Growing Wait Times Actually Help

How to retry a failed operation is a design question every network-facing piece of code eventually has to answer. The textbook technique is exponential backoff — doubling the wait time on each retry — but it isn’t automatically the right answer everywhere. This post works through what problem exponential backoff actually solves, then looks at three real retry paths in this app’s own code where fixed intervals were chosen instead, and why. The Problem Exponential Backoff Solves Note: exponential backoff is a retry strategy where the wait time between attempts grows exponentially — 1s, 2s, 4s, 8s, and so on — instead of staying constant. base = 1 for attempt …

Read more
Engineering Notes

Greedy vs. Non-Greedy Regex: Why the Same Pattern Can Match Differently

A regex quantifier like * or + means “the preceding element can repeat any number of times,” but how much it actually matches depends on whether the engine tries to match as much as possible or as little as possible. That’s the greedy vs. non-greedy distinction, and adding a single ? to a quantifier can produce a completely different result. This post works through that distinction using real parsing code from this app’s WP-CLI output handling. Quantifiers Are Greedy by Default Note: a quantifier is the part of a regex pattern that says how many times the preceding element may repeat — * (zero or more), + (one or more), …

Read more
Engineering Notes

Log Level Design and Rotation: Why Apps Use DEBUG/INFO/WARNING/ERROR

Open any application log and you’ll see the same kind of message tagged with different labels: DEBUG, INFO, WARNING, ERROR. Why not just write down everything that happens, in one uniform stream? This post looks at what log levels actually do, and at the companion problem every long-running app eventually faces: keeping a log file from growing forever (rotation). A Log Level Is a Filtering Threshold Note: logging means recording what happened while a program runs, so it can be reviewed later in a file or on screen. Python’s standard logging module defines five levels: Level Numeric value Meaning DEBUG 10 Fine-grained detail for tracing exactly what the code did …

Read more