# Refresh: fetch what is new, check it, update ## What it is A **refresh** is an iteration of an article (kind `refresh`, its parent the iteration refreshed). It is ONE editor job, `report-draft {"task":"refresh"}` on the queue `draft:refresh`. umtool plans it, confirms it, shows what it found and suggests it; the editor runs it. ```sh umtool refresh
[--iteration N] [--no-fetch] [--yes] [--json] # the plan; --yes starts it umtool refresh --check [
] [--force] # the daily check, now pnpm ops report-draft --json '{"task":"refresh","article":"","dryRun":true}' pnpm ops report-draft --json '{"task":"refresh","article":""}' --wait ``` ## Where | Surface | What | |---|---| | the article piece's **⋯** → **Refresh…** | opens the plan | | the Iterations tab's **Refresh…** | the same plan | | `?refresh=1` on the article's address | the same plan; the Next card's and the Inbox card's **Refresh** link here | | the Overview's **Refresh · i** card | the last refresh: its state, line, new recordings, changed quotes, sources gone, fetches and build, spend; **Review in Iterations →** once it has a report | | the Iterations tab | a refresh's line on its card | ## The plan, then Refresh The dialog says, before anything runs: - **Refreshes** — the iteration (i, kind, made, the question). - **Searched again** — the queries, the match set then, the quotes read again. - **Fetch** — each channel's actions (`sync`, `refresh-report`, `transcribe-bucket`, `fetch-posts`), or "skipped — " (a platform held or cooling down). - **Build** — the site whose build holds the channels: "locally, if anything changed — never deployed". - **Update** — model, extractor, "spends up to $X", the rate, today's spend. - Refusals and warnings (an older parent: "changed recordings are not tracked before "). **Refresh** starts it ("Refresh i is running (job …)"); **Cancel** closes it with nothing written. ## The three stages 1. **Fetch (no model).** The report's scope plus every channel its citations touch: the editor's own paced `sync` per video channel, `refresh-report` and `transcribe-bucket` for ONLY what landed, `fetch-posts` per posts channel, then a local `publish build` of the site holding them (through the publish lock; never a deploy). Each step is waited for, up to 6 h, then read as it is. 2. **What changed (no model).** The original enumeration again with the iteration's recorded terms and scope: **new** recordings (ids not matched before, late transcripts included), **changed** ones (matching lines moved), and every cited quote re-read on today's transcript (moved, drifted, missing; deleted or private on the platform; `en` vs `en-orig`). Written as the iteration's `refresh.json`. **Nothing changed → the iteration ends "no change", $0.** 3. **Update (model).** Runs on its own when stage 2 found anything, within the caps: a sweep restricted to the new and changed ids (the sweep's `ids` restriction), then a revision of the parent with those findings and the drift fixes. A cap refusal ends `held-by-cap` with the estimate. The result is an **iteration-ready** card; making it current stays yours (**Use this iteration**). `refresh.json` `status`: `running`, `no-change`, `updated`, `held-by-cap`, `partial` (a capped search with nothing to update: "partial — not reached: …", never "no change"), `failed`, `cancelled`. The iteration ends `done` whatever the refresh's status; only a failed revision or a cancel fails it. ## The daily check and its cards Once a UTC day per active store article with a current report (parked, done and muted skipped), umtool re-runs stage 2's enumeration alone — no fetch, no model, at most 12 queries — over the build the iteration read when it is on this machine and holds every channel of the scope, else Research's local corpus when that does. Neither: the entry is `unchecked` with the reason, never "0 new". Kept in `REPORTS_ROOT/.umtool/refresh-check.json`; checked in the background in the app's server only (`UMTOOL_REFRESH_CHECK=0` turns it off; the e2e server does). | Card | Group | Action | |---|---|---| | `refresh-available` — "3 new recordings mention this since " | Review | **Refresh** | | `refresh-held` — the newest refresh held by the cap | Your call | **Refresh** | A card goes when a refresh made after the check exists or one is running. ## Code | Module | What | |---|---| | `common/lib/report/draft/refresh/` | `refresh.json` (`types.ts`), the basis (`basis.ts`), the delta (`delta.ts`), stage 1 (`fetch.ts`), the task (`task.ts`) | | `common/controller/reportRefresh.ts` | the editor's side: the target iteration, the plan, the enqueue, `fetchScope` (stage 1 for any scope; R5's ticks call it) | | `umtool/lib/articles/refresh.ts` | plan, start, read; `GET/POST /api/articles/refresh` | | `umtool/lib/inbox/refresh.ts` | the daily check and the two cards; `POST /api/articles/refresh/check` | | `umtool/components/articles/Refresh{Dialog,Summary,Watch}.tsx` | the dialog, the Overview's card, its 4 s re-read while running |