Desk Clarity

A field guide to everyday digital problems.

The guidebook / 181 guides

Developer tools

Code, configuration and workflows. Source-linked checks to help you move forward.

Developer tools · GUIDE

Awaiting ForEach Finishes Too Early: Own the Callback Promises Explicitly

Compare forEach, sequential for...of and Promise.all with immediate/later traces, result order and a rejection-without-cancellation example.

3 min readSource-linked guide
Developer tools · GUIDE

JSON Decode Fails at the First Character: Check the HTTP Body Contract

Compare JSON, HTML, empty 204 and mislabeled responses before parsing or replacing a missing body with invented JSON data.

3 min readSource-linked guide
Developer tools · GUIDE

Exists Is False but the Name Already Exists: Inspect a Broken Symlink Separately

Compare target-following existence with the link entry before interpreting FileExistsError or replacing an occupied path.

3 min readSource-linked guide
Developer tools · GUIDE

Python Accepts NaN JSON but the Consumer Rejects It: Check Nonfinite Values

Test allow_nan=False, parse_constant and a strict Node consumer, while keeping named constants separate from numeric overflow and schema policy.

3 min readSource-linked guide
Developer tools · GUIDE

URLSearchParams Changes a Base64 Plus to a Space: Serialize the Raw Value Once

Compare literal query interpolation, append and double encoding, then verify both the restored string and decoded bytes across Node and a browser.

3 min readSource-linked guide
Developer tools · GUIDE

Decimal Still Rounds Like a Float: Check How the Value Was Constructed

Compare Decimal(float) with Decimal(text), then test half-even and half-up ties separately from binary representation and display formatting.

3 min readSource-linked guide
Developer tools · GUIDE

Fromisoformat Rejects a Trailing Z: Check the Version and Preserve UTC

Compare older and current Python parsing, normalize a final Z without losing the offset, and distinguish a literal Z from a timezone directive.

3 min readSource-linked guide
Developer tools · GUIDE

Re.sub Replacement Starts With Digits: Check Group References and Silent Octal Output

Test numeric replacement values, delimited backreferences and literal callback data before trusting a substitution that returns without an error.

3 min readSource-linked guide
Developer tools · GUIDE

Bash Pipeline Hides a Failure: Check Pipefail and Each Stage’s Status

Compare default, pipefail, handled failure and early-reader cases before treating CI success as proof every command succeeded.

3 min readSource-linked guide
Developer tools · GUIDE

Rstrip Removes Too Much of a Filename: Use an Exact Suffix Contract

Compare rstrip, removesuffix and Path.stem with collision-revealing filenames before applying a rename or output-path operation.

3 min readSource-linked guide
Developer tools · GUIDE

Node JSON Import Fails at Assert: Check Native ESM Import Attributes

Compare missing, old and current JSON import syntax in a native .mjs fixture, including dynamic options and the default-export boundary.

3 min readSource-linked guide
Developer tools · GUIDE

Jq Key Contains a Hyphen: Pass Dynamic Names as Data With --arg

Select hyphenated or dotted JSON keys without inserting shell variable content into the jq program, and distinguish literal keys from nested paths.

3 min readSource-linked guide
Developer tools · GUIDE

Bash Read Skips the Last Line: Preserve a Partial Record at EOF

Use read status and assigned data together for an unterminated final text record, then verify blank, empty and newline-terminated cases.

3 min readSource-linked guide
Developer tools · GUIDE

Curl Data From a File Loses Newlines: Verify --data-binary by Bytes

Compare --data and --data-binary against a local receiver, then separate exact payload bytes from media type and application acceptance.

3 min readSource-linked guide
Developer tools · GUIDE

Copytree Destination Exists: Decide Whether You Want a Merge or a Mirror

Test dirs_exist_ok with overwritten, new and destination-only files before using copytree on an existing directory.

3 min readSource-linked guide
Developer tools · GUIDE

SQLite Objects Created in a Thread: Keep Connection Ownership in the Worker

Reproduce Python’s SQLite cross-thread error and compare a worker-owned connection without treating check_same_thread=False as a concurrency design.

3 min readSource-linked guide
Developer tools · GUIDE

Pathlib Glob Finds Hidden Files: Compare the Whole Relative Path

Audit dot-prefixed files and nested hidden directories when replacing glob.glob with pathlib, using a small fixture and a full path-set comparison.

3 min readSource-linked guide
Developer tools · GUIDE

Python CSV Header Has a BOM: Decode Before DictReader Splits Columns

Check UTF-8 opening bytes and a quoted first header before using utf-8-sig; verify the complete field list instead of renaming a damaged key.

3 min readSource-linked guide