Say a missing folder is missing, not empty #115

Closed
opened 2026-08-27 22:28:35 +00:00 by jcoffey-dev · 0 comments
Owner

Closes #111.

A folder id the account does not have rendered the ordinary empty state — "Nothing here. This folder is empty." That's a claim about a folder that isn't there, so a stale link read as a folder that had emptied itself rather than one that was gone.

It now goes to the inbox and says why. Inbox is the kinder landing than a dead end for a bookmark that has outlived its folder — but swapping one folder for another without a word would be its own small lie, so it doesn't do that either.

The part that needed a test

Not the unknown id. The condition guarding it.

The folder list arrives after the first paint, so for a moment every id is unknown — the right one included. Without that gate this redirects on every cold load, away from the folder the reader actually asked for, and looks exactly like a flaky link. That's a worse bug than the one being fixed and a much harder one to notice.

isUnknownMailbox is a small pure function so that case can be pinned down rather than reasoned about, and the test says why it exists.

Why it went unnoticed

Only reachable from outside the app — the sidebar links to ids that exist. A bookmark to a deleted folder, or a folder link passed between accounts, is where it bites.

Verified

Against the mock: an unknown id lands on the inbox with the message and a full list of 29 rows rather than an empty one; a cold load straight into a real folder (/mail/drafts) stays there with nothing said and no spurious toast.

338 web and 77 server tests pass, five new. npm run typecheck clean.

🤖 Generated with Claude Code

Merged 2026-08-27 as coffey-labs/ihasmail@05be820be4

Rebuilt from: git history, session transcript.

Closes #111. A folder id the account does not have rendered the ordinary empty state — **"Nothing here. This folder is empty."** That's a claim about a folder that isn't there, so a stale link read as a folder that had emptied itself rather than one that was gone. It now goes to the inbox and says why. Inbox is the kinder landing than a dead end for a bookmark that has outlived its folder — but swapping one folder for another without a word would be its own small lie, so it doesn't do that either. ### The part that needed a test Not the unknown id. The condition guarding it. The folder list arrives after the first paint, so for a moment **every** id is unknown — the right one included. Without that gate this redirects on every cold load, away from the folder the reader actually asked for, and looks exactly like a flaky link. That's a worse bug than the one being fixed and a much harder one to notice. `isUnknownMailbox` is a small pure function so that case can be pinned down rather than reasoned about, and the test says why it exists. ### Why it went unnoticed Only reachable from outside the app — the sidebar links to ids that exist. A bookmark to a deleted folder, or a folder link passed between accounts, is where it bites. ### Verified Against the mock: an unknown id lands on the inbox with the message and a full list of 29 rows rather than an empty one; a cold load straight into a real folder (`/mail/drafts`) stays there with nothing said and no spurious toast. 338 web and 77 server tests pass, five new. `npm run typecheck` clean. 🤖 Generated with [Claude Code](https://claude.com/claude-code) **Merged** 2026-08-27 as coffey-labs/ihasmail@05be820be47e <sub>Rebuilt from: git history, session transcript.</sub>
This repo is archived. You cannot comment on issues.