The notebook index
Post archive
36 posts.
- Go’s new JSON packages separate syntax from meaning
Go 1.27’s stable JSON v2 API separates JSON text processing from mapping JSON values to Go types. Its stricter defaults can expose assumptions at an interface boundary, so migration is a data-contract change to test deliberately.
- A cache key is a claim that two requests mean the same thing
A cache key decides which computations or responses may be reused. Treat it as an explicit equivalence rule, and separate identity, freshness, privacy and invalidation when deciding whether reuse is correct.
- Python’s tar filter shows what a security boundary must cover
Python 3.15.2 fixed a path escape in tarfile’s explicit tar filter. The flaw shows why extraction safety depends on the order of archive entries, while the release’s separate TLS fix illustrates a very different kind of trust decision.
- Go generic methods add abstraction inside a receiver’s namespace
Go 1.27 adds generic methods, but keeps interface method sets non-generic. That boundary changes where reusable operations belong and what an interface can promise.
- A directory descriptor can bound a pathname, but only with the right resolution rules
A directory file descriptor gives relative operations a stable starting point, but it does not by itself prevent `..`, symlink, or mount traversal. Linux openat2 and Python dir_fd make the boundary explicit in different ways.
- Context variables follow asyncio tasks, not just threads
ContextVar gives asynchronous code task-local state without threading.local() leaking values between coroutines. Task creation, token reset and thread handoffs define where that state begins and ends.
- Descriptors turn attribute access into an interface policy
A descriptor lets a class attribute mediate reads and writes. Understanding its precedence, owner binding and storage name helps decide when the protocol is clearer than a property or ordinary method.
- A process pool is an import and serialization boundary
Python process workers may start from a fresh interpreter, a fork server or a forked parent. Put work in importable functions, guard process creation, and choose a context deliberately.
- Python 3.15 makes deferred imports explicit—and changes when failure happens
Python 3.15 adds opt-in lazy imports that defer module loading until first use. The startup win comes with a changed point of execution: errors and import-time effects move to the path that touches the name.
- A fast wire layout still needs a trust boundary
Cap’n Proto’s word-aligned layout supports efficient traversal, but a receiver still has to validate bounds and resource use. Serialization also says nothing by itself about who sent a message or what that sender may do.
- Promise pipelining removes a wait, not a dependency
Promise pipelining lets a client send a call against a result that has not arrived yet. It can collapse sequential network waits into one round trip, while preserving the dependency and its failure modes.
- A useful setup log starts with the question it can answer
A compact diagnostic record should let someone reproduce a specific observation: state the question, environment, command, exit status, and relevant output. Keep that setup transcript distinct from an inventory of files or storage.
- A command line is an argument vector before it is a shell string
Passing subprocess arguments as a sequence preserves argument boundaries and avoids shell parsing by default. It prevents shell metacharacters from becoming syntax, while leaving program-specific option handling as a separate concern.
- Endianness belongs in the format, not in a lucky host assumption
Binary formats must specify byte order and layout instead of inheriting a machine’s memory conventions. A two-byte example shows why explicit endianness is more portable than native alignment assumptions.
- A virtual environment has an interpreter boundary
A Python virtual environment is selected by the interpreter that runs your program. Learn how pyvenv.cfg, interpreter prefixes, shell activation, and python -m pip reveal which environment owns installed packages.
- Make an invalid state unrepresentable at the interface
A result type makes success and failure explicit in a function’s interface. In Haskell, Either lets callers distinguish failures by constructor while still requiring validation at untrusted input boundaries.
- Rolling back NixOS does not roll back a database
NixOS generations let you select an earlier system configuration, while database files and other mutable data follow their own lifecycle and compatibility rules.
- The grain is a useful boundary for application state
A Sandstorm grain is an application instance with persistent state. Treating it as a boundary clarifies sharing, ownership, backup contents, and what a restore must recover.
- Pass a capability instead of looking up ambient authority
A capability combines an object reference with permission to use it. Passing a narrow read-only handle can make authority explicit and limited to the resource and operations the recipient needs.
- Validate CSV headers before building dictionaries
Check CSV header uniqueness, required names and row widths before mapping fields, preserving IDs such as 007 as strings.
- Testing a schedule cache across feed revisions
Include feed and revision in cache identity to isolate updated schedule data; demonstrate failed loads and pruning in memory.
- A durable idempotency key in one SQLite transaction
Use a SQLite key, payload digest and counter in one transaction to demonstrate retries, conflicts and persistence across reopen.
- Parsing GTFS times beyond midnight
Parse GTFS service times as seconds from the service day’s start, allowing hours above 23 while rejecting malformed values.
- CSV round trips: commas, quotes and embedded newlines
Use Python’s CSV reader and writer to round-trip commas, quotes and newlines while accounting for type loss and spreadsheet formula risks.
- A byte stream does not know where your messages end
TCP delivers an ordered byte stream, so an application protocol must define message boundaries. A four-byte length prefix provides one simple framing rule, with explicit size limits and buffering for incomplete or coalesced frames.
- Reading Tempest as a systems project
Tempest’s repository describes an experimental replacement for Sandstorm, with sandbox setup work and HTTP plumbing already present. Its README is a map of questions to investigate, not evidence for production guarantees.
- IRC presence is not an appointment to answer
IRC exposes connection state and an explicit away message, but neither is a promise about when a person will reply. Treat messaging as asynchronous and write bug reports that include a reproducible exchange.
- ActivityPub has actor identity, object identity and delivery identity
ActivityPub uses actors to identify accounts, objects to identify content, and activities to describe actions delivered between inboxes. Keeping those identities separate is central to reliable handling of retries.
- Read the ownership boundary before upgrading an RPC binding
Before upgrading a Haskell Cap’n Proto binding, separate schema-generated types, message data ownership, serialization, and RPC behavior. Then check project status, protocol assumptions, and the API changes an upgrade may introduce.
- Why len(x) is not just x.__len__() in disguise
Implicit operations such as len use a type-level special method protocol, which differs from ordinary attribute lookup on an instance.