Show what changes, explain why, then apply it everywhere. The diff lives in source control, not a memo.
Before
Imperative session handling
Manual cookie reads, race conditions on rotation, and silent failures when refresh times out.
// Read the refresh token by handconst cookie = req.headers.cookie;const token = parseCookie(cookie, "rt");.if (!token) throw new Error(401);.// Try to refresh, hope it workslet session;try {session = refresh(token);} catch {session = null;}
After
Declarative refresh with retries
One call, typed error states, automatic backoff, and a stale window that survives concurrent requests.
// Single call replaces the whole flowimport { refresh } from "@beste/auth";.const session = await refresh.fromCookies(req, {retry: { on: "5xx", max: 3 },staleAfter: "5s",});.// Errors are typed, not thrown silentlyif (!session.ok) {return reply(session.error);}.return session.value;
12 lines removed · 8 lines added
across 14 files in your repo
Browser-chrome card pairing a before/after code migration — eyebrow + title + description above each pane, monochrome syntax, and an apply-migration footer with diff summary. Every label is editable; no media props required.