docs: capture design from walk-with-me (CONTEXT, DESIGN, ADR-0001)

This commit is contained in:
Julien Calixte
2026-06-26 16:16:05 +01:00
parent 645bd6ff27
commit fc039ac0fc
3 changed files with 199 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
# Match Members to Slack via a cached whole-workspace directory
We resolve Slack **Avatars** by sweeping the entire workspace once with `users.list`
and caching an `email → {imageUrl, slackId}` directory in SQLite, rather than calling
`users.lookupByEmail` per Member. A **Match** is then an in-memory lookup, and an
unmatched Member is simply one whose email isn't in the directory.
## Considered Options
- **`users.lookupByEmail` per Member** — only fetches who you view, but makes N calls
per uncached Project view and is more exposed to per-method rate limits.
- **`users.list` directory sweep (chosen)** — one paginated sweep covers everyone;
repeated Project views cost zero Slack calls; matching is in-memory.
## Consequences
- Cache is a directory snapshot + a single `refreshed_at`, with a **30-day TTL** and a
manual **Refresh** (`POST /api/slack/refresh`) — Avatars change rarely, so staleness is
cheap and the button covers the exceptions.
- If the sweep fails, we still return Members (unmatched) and the UI degrades to initials
Avatars + a warning — a Slack outage never hides the roster.
- Deleted/bot Slack users are filtered out of the directory.