Archilyzer · Source

archilyzer

Archilyzer
git clone https://archilyzer.pages.dev/source/archilyzer.git
Log | Files | Refs | README | LICENSE

commit f3245f562a4b6e85dfbac95f11cc0ce7484df9d5
parent a599fb425d13be58785551f2b2a343821837e34b
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Mon, 16 Nov 2026 11:03:11 -0500

cookie screen review fixes: a stale recheck is not ok, the guard always lets go, 409 busy, stale copies swept

- A recheck that answers "stale" or "failed" is remembered as not ok
  (recheckOutcome, lib/cookieRefreshGuard.ts), so the row's "Last recheck"
  line and `get cookies` last.ok match the note the press showed.
- withCookieAction: finding the paths and describe() are inside the try --
  nothing that throws leaves a service marked busy, and a describe() that
  throws costs only the record, never the press's answer.
- recheck-service: a recheck asked while one runs for the service answers
  409 {busy: true} (ops help and COMMANDS.md say so).
- browserCookieAge: a read first sweeps its own copies older than 10 min left
  in the tmp dir by a read that never finished (they hold cookie values).
- The fake Refresh-cookies browser's containment uses real paths, so a
  symlink in the test data cannot point it out.
- cookies/actions.ts: the unused cookieStatusAction endpoint is gone.
- The dashboard's cookie card draws no leading " · " when there is nothing
  before the Cookies link.
- privacy-audit.spec: ISO times are blanked before the byte-identity
  comparison, and /cookies must compare (not be skipped as volatile).

Co-Authored-By: Claude <noreply@anthropic.com>

Diffstat:
MCOMMANDS.md | 2+-
Mcommon/lib/browserCookieAge.test.ts | 20+++++++++++++++++++-
Mcommon/lib/browserCookieAge.ts | 28++++++++++++++++++++++++++--
Mcommon/social/fakeXProfileBrowser.test.ts | 6+++++-
Mcommon/social/fakeXProfileBrowser.ts | 15++++++++++-----
Meditor/app/api/ops/_writes.test.ts | 21+++++++++++++++++++++
Meditor/app/api/ops/recheck-service/route.ts | 5++++-
Meditor/app/components/dashboard/CookieAlertsPanel.tsx | 5+++--
Meditor/app/cookies/actions.ts | 4----
Meditor/app/lib/cookieRefreshGuard.test.ts | 53++++++++++++++++++++++++++++++++++++++++++++++++++++-
Meditor/app/lib/cookieRefreshGuard.ts | 53++++++++++++++++++++++++++++++++++++++++-------------
Meditor/app/operations/serviceCookiesActions.ts | 11++++-------
Meditor/e2e/privacy-audit.spec.ts | 7++++++-
Mscripts/archilyzer-ops.mjs | 2++
14 files changed, 193 insertions(+), 39 deletions(-)

diff --git a/COMMANDS.md b/COMMANDS.md @@ -196,7 +196,7 @@ Drives a running editor over HTTP (`/api/ops/*`, the same actions its pages run) | `voice-convert` | voice-convert keeps a recording's performance (timing, pitch contour) and swaps its timbre for a STOCK synthetic voice, as voice-enhance's job: the same body plus "voice" — "&lt;tts engine&gt;:&lt;stock voice&gt;" (orpheus:zac, orpheus:leah, kokoro:am\_michael, ...; settings.voice.convert.target); a file, a path or a recording is REFUSED as a target (no real person's voice) — and "engine" (openvoice \| seed-vc, each installed by `archilyzer voice setup --engine <id>`). "pitch" is where the result's pitch comes from (settings.voice.convert.pitch): "target" — the stock voice's own, the read's intonation flattened to it; "source" — the pitch the take was read at (raise your voice and it rises); "contour" — the read's rises and falls, moved as a whole to the stock voice's register. "semitones" (-12 to 12) then moves a followed pitch; left out, a followed pitch takes settings.voice.convert.semitones (0 unless set). source and contour are seed-vc's, on its optional f0 model (`archilyzer voice setup --engine seed-vc --with f0`; slower, 44.1 kHz); openvoice refuses them. The target's reference is synthesized once through the tts op and kept. The result adds target, voice, pitch (semitones and f0 — the medians heard and the move applied — when followed), synthetic: true and the disclosure line. | | | `settings` | settings patches settings.json through the editor's one writer: {"patch": {"&lt;top-level key&gt;": value, …}} (SETTINGS.md). A block's keys merge one level; an array, a scalar or an object nested in a block replaces. Refused before anything is written: an unknown key; a key another writer owns (channelPriority, autoQueue, workers, storage — the refusal names it); a value the schema would not keep as sent (clamped, dropped), named with what would be saved. Answers the saved values. | `pnpm ops settings --json '{"patch":{"diarization":{"cleanAfterCapture":true}}}'`<br>`pnpm ops settings --json '{"patch":{"minFreeDiskGB":20}}'` | | `clear-platform-hold` | clear-platform-hold clears a platform's rate-limit hold, backoff and raised pace, as the lane strip's Clear hold: {"platform"}. Answers the sentence. | | -| `recheck-service` | recheck-service asks a service whose cookie refresh alert is up ONE request through its own path, as the dashboard banner's Recheck: {"service"} ("rumble", "youtube", "odysee", "archive.today", "x" or a forum host). Waits for it: {jobId, result: "clean" \| "stale" \| "failed", message}; "clean" clears the alert (and a yt-dlp service's backoff, as any clean request). For "x" it sends X NO request: clean when the login on disk was renewed after the alert (Refresh cookies on /cookies) — for a jar-age alert, when the jar is within social.x.maxCookieAgeMinutes. The editor also rechecks by itself on a timer (settings.serviceCookies.recheckIntervalMinutes, default 180, 0 = off; `pnpm ops settings --json '{"patch":{"serviceCookies":{"recheckIntervalMinutes":0}}}'`). dismiss-service clears a service's cookie alert by hand: {"service"}. rerun-service-jobs retries every job a service's cookie alert stopped, once it is OK again: {"service"} -&gt; {jobIds, skipped}. --wait follows them. | `pnpm ops recheck-service --json '{"service":"rumble"}'`<br>`pnpm ops recheck-service --json '{"service":"x"}'` | +| `recheck-service` | recheck-service asks a service whose cookie refresh alert is up ONE request through its own path, as the dashboard banner's Recheck: {"service"} ("rumble", "youtube", "odysee", "archive.today", "x" or a forum host). Waits for it: {jobId, result: "clean" \| "stale" \| "failed", message}; "clean" clears the alert (and a yt-dlp service's backoff, as any clean request). For "x" it sends X NO request: clean when the login on disk was renewed after the alert (Refresh cookies on /cookies) — for a jar-age alert, when the jar is within social.x.maxCookieAgeMinutes. The editor also rechecks by itself on a timer (settings.serviceCookies.recheckIntervalMinutes, default 180, 0 = off; `pnpm ops settings --json '{"patch":{"serviceCookies":{"recheckIntervalMinutes":0}}}'`). Asked while a recheck or another press for the service runs (a click, the dashboard's, the timer's): refused, 409 {busy: true}, never queued. dismiss-service clears a service's cookie alert by hand: {"service"}. rerun-service-jobs retries every job a service's cookie alert stopped, once it is OK again: {"service"} -&gt; {jobIds, skipped}. --wait follows them. | `pnpm ops recheck-service --json '{"service":"rumble"}'`<br>`pnpm ops recheck-service --json '{"service":"x"}'` | | `dismiss-service` | — | | | `rerun-service-jobs` | — | | | `workers` | workers switches transcription workers as /workers does: {"op": "enable" \| "disable" \| "drain", "ids": \[...\]} — the live pool; a restart restores the launch default. An unknown id is named; the others still apply. | `pnpm ops workers --json '{"op":"disable","ids":["parakeet-cpu"]}'` | diff --git a/common/lib/browserCookieAge.test.ts b/common/lib/browserCookieAge.test.ts @@ -8,7 +8,7 @@ import { test, after, beforeEach } from "node:test"; import assert from "node:assert/strict"; import { mkdtempSync } from "node:fs"; -import { rm, utimes, writeFile } from "node:fs/promises"; +import { mkdir, readdir, rm, utimes, writeFile } from "node:fs/promises"; import os from "node:os"; import path from "node:path"; import { @@ -16,6 +16,7 @@ import { readBrowserCookieAges, readFirefoxServiceCookieTimes, resetBrowserCookieAgeCache, + STALE_COPY_MS, } from "./browserCookieAge"; import { writeFirefoxCookieStore } from "../social/__fixtures__/firefoxCookieStore"; @@ -142,3 +143,20 @@ test("a file: spec is aged by the file's mtime", async () => { const out = await readBrowserCookieAges(`file:${file}`); assert.deepEqual(out.services.youtube, { service: "youtube", basis: "file", found: true, at: t.toISOString() }); }); + +test("a read sweeps this module's stale copies (they hold values), and leaves fresh ones and others alone", async () => { + const root = path.join(TMP, "sweep"); + await mkdir(root); + const old = path.join(root, "archilyzer-cookieage-old1"); + const fresh = path.join(root, "archilyzer-cookieage-new1"); + const other = path.join(root, "someone-elses-old"); + for (const d of [old, fresh, other]) await mkdir(d); + const past = new Date(Date.now() - STALE_COPY_MS - 60_000); + await utimes(old, past, past); + await utimes(other, past, past); + const dir = path.join(TMP, "p5"); + await writeFirefoxCookieStore(dir, []); + await readFirefoxServiceCookieTimes(path.join(dir, "cookies.sqlite"), { tmpRoot: root }); + // The read's own copy is gone too, once it is done. + assert.deepEqual((await readdir(root)).sort(), ["archilyzer-cookieage-new1", "someone-elses-old"]); +}); diff --git a/common/lib/browserCookieAge.ts b/common/lib/browserCookieAge.ts @@ -21,7 +21,7 @@ // (Check again). A read that fails is an answer — `unknown` with the reason — // never a throw. -import { copyFile, mkdir, mkdtemp, rm, stat } from "node:fs/promises"; +import { copyFile, mkdir, mkdtemp, readdir, rm, stat } from "node:fs/promises"; import os from "node:os"; import path from "node:path"; import { loadSqlite } from "../social/nodeSqlite"; @@ -92,6 +92,28 @@ function allUnknown(why: string, basis?: BrowserCookieAge["basis"]): Record<Brow return out; } +const TMP_PREFIX = "archilyzer-cookieage-"; +// A private copy older than this was left by a read that never finished (the +// process died mid-read): it holds cookie values, so it goes. +export const STALE_COPY_MS = 10 * 60_000; + +// Remove this module's own leftover copies under `tmpRoot`. Never throws. +export async function sweepStaleCookieCopies(tmpRoot: string, now: number = Date.now()): Promise<number> { + let removed = 0; + const names = await readdir(tmpRoot).catch(() => [] as string[]); + for (const name of names) { + if (!name.startsWith(TMP_PREFIX)) continue; + const dir = path.join(tmpRoot, name); + const st = await stat(dir).catch(() => null); + if (!st?.isDirectory() || now - st.mtimeMs < STALE_COPY_MS) continue; + await rm(dir, { recursive: true, force: true }).then( + () => removed++, + () => undefined, + ); + } + return removed; +} + // One read of a Firefox cookies.sqlite for every service (`container` as in a // cookiesFromBrowser spec). export async function readFirefoxServiceCookieTimes( @@ -101,7 +123,9 @@ export async function readFirefoxServiceCookieTimes( const { DatabaseSync } = await loadSqlite(); const scope = await firefoxContainerScope(dbFile, opts.container); const names = [...new Set(BROWSER_COOKIE_SERVICES.flatMap((s) => BROWSER_COOKIE_WANTS[s].names))]; - const tmp = await mkdtemp(path.join(opts.tmpRoot ?? os.tmpdir(), "archilyzer-cookieage-")); + const tmpRoot = opts.tmpRoot ?? os.tmpdir(); + await sweepStaleCookieCopies(tmpRoot); + const tmp = await mkdtemp(path.join(tmpRoot, TMP_PREFIX)); try { const copy = path.join(tmp, "store", "cookies.sqlite"); await mkdir(path.dirname(copy), { mode: 0o700 }); diff --git a/common/social/fakeXProfileBrowser.test.ts b/common/social/fakeXProfileBrowser.test.ts @@ -7,7 +7,7 @@ import test from "node:test"; import assert from "node:assert/strict"; -import { mkdtemp, mkdir, readFile, rm, writeFile } from "node:fs/promises"; +import { mkdtemp, mkdir, readFile, rm, symlink, writeFile } from "node:fs/promises"; import os from "node:os"; import path from "node:path"; import { fakeXProfileChromium, fakeXProfileCookiesFile } from "./fakeXProfileBrowser"; @@ -34,6 +34,10 @@ test("the gate: test server, inside transcriptsDir, the file exists", async () = assert.equal(fakeXProfileCookiesFile(t, { ...env, E2E_FAKE_X_PROFILE_COOKIES_FILE: outside }), null); assert.equal(fakeXProfileCookiesFile(t, { ...env, E2E_FAKE_X_PROFILE_COOKIES_FILE: path.join(t, "..", "elsewhere.json") }), null); assert.equal(fakeXProfileCookiesFile(t, { E2E_TEST_ROUTES: "1" }), null); + // A symlink inside the test data pointing out of it: inert. + const link = path.join(t, "link.json"); + await symlink(outside, link); + assert.equal(fakeXProfileCookiesFile(t, { ...env, E2E_FAKE_X_PROFILE_COOKIES_FILE: link }), null); } finally { await rm(root, { recursive: true, force: true }); } diff --git a/common/social/fakeXProfileBrowser.ts b/common/social/fakeXProfileBrowser.ts @@ -14,7 +14,7 @@ // exists (a spec writes it). The file holds SYNTHETIC cookies only: // { "delayMs"?: number, "fail"?: string, "cookies": [{ name, value, domain, path?, expires? }] } -import { readFileSync } from "node:fs"; +import { readFileSync, realpathSync } from "node:fs"; import path from "node:path"; import type { BrowserContextLike, ChromiumLike, PageLike } from "./playwrightRuntime"; @@ -31,14 +31,19 @@ export function fakeXProfileCookiesFile( if (env.E2E_TEST_ROUTES !== "1") return null; const file = env.E2E_FAKE_X_PROFILE_COOKIES_FILE?.trim(); if (!file) return null; - const rel = path.relative(path.resolve(transcriptsDir), path.resolve(file)); - if (!rel || rel.startsWith("..") || path.isAbsolute(rel)) return null; + // Real paths, so a symlink inside the test data cannot point the fake out + // of it; a file that does not exist answers null here too. + let real: string; + let root: string; try { - readFileSync(file); + real = realpathSync(file); + root = realpathSync(transcriptsDir); } catch { return null; } - return path.resolve(file); + const rel = path.relative(root, real); + if (!rel || rel.startsWith("..") || path.isAbsolute(rel)) return null; + return real; } function readFixture(file: string): FixtureFile { diff --git a/editor/app/api/ops/_writes.test.ts b/editor/app/api/ops/_writes.test.ts @@ -138,6 +138,27 @@ test("the cookie alert's three writes refuse a name that is not a service; rerun assert.match(String(rerun.body.error), /^Rumble has no cookie alert\./); }); +test("recheck-service while a press for the service runs: 409, busy, nothing queued", async () => { + const { withCookieAction } = await import("../../lib/cookieRefreshGuard"); + let release!: () => void; + const held = withCookieAction( + "odysee", + "recheck", + () => new Promise<{ ok: true }>((r) => (release = () => r({ ok: true }))), + () => ({ ok: true, message: "" }), + { jobs: () => [] }, + ); + try { + const res = await callPost(await route("recheck-service"), { service: "odysee" }); + assert.equal(res.status, 409, JSON.stringify(res.body)); + assert.equal(res.body.busy, true); + assert.match(String(res.body.error), /^Odysee's recheck is already running \(since \d\d:\d\d:\d\d UTC\)/); + } finally { + release(); + await held; + } +}); + test("workers: the op and the ids are checked at the door", async () => { const workers = await route("workers"); const op = await callPost(workers, { op: "restart", ids: ["a"] }); diff --git a/editor/app/api/ops/recheck-service/route.ts b/editor/app/api/ops/recheck-service/route.ts @@ -12,10 +12,13 @@ export const dynamic = "force-dynamic"; // at all — the login on disk, renewed since the alert), as a one-step // job (kind `recheck-service-cookies`) the answer waits for: // { ok, jobId, result: "clean" | "stale" | "failed", message }. "clean" -// clears the alert. +// clears the alert. A second ask while one runs for the service (a press, the +// dashboard's, the timer's) is refused: 409 { ok: false, busy: true, error }. export async function POST(request: Request) { return ops(request, ["service"], async (body) => { const res = await recheckServiceCookiesAction(reqString(body, "service")); + // A recheck (or another press) for the service already running: 409, busy. + if (!res.ok && res.busy) return opsFail(res.error, 409, { busy: true }); if (!res.ok) return opsFail(res.error, 400, res.jobId ? { jobId: res.jobId } : {}); return NextResponse.json({ ok: true, jobId: res.jobId, result: res.result, message: res.message }); }); diff --git a/editor/app/components/dashboard/CookieAlertsPanel.tsx b/editor/app/components/dashboard/CookieAlertsPanel.tsx @@ -72,13 +72,14 @@ function AlertCard({ {alert.detail} {alert.family === "forum" && channel && ( <> - {" · "} + {alert.detail ? " · " : null} <Link href={`/channels/${channel}`} className="underline underline-offset-2 hover:text-foreground"> channel page </Link> </> )} - {" · "} + {/* A separator only after something: no leading " · ". */} + {alert.detail || (alert.family === "forum" && channel) ? " · " : null} <Link href="/cookies" className="underline underline-offset-2 hover:text-foreground"> Cookies </Link> diff --git a/editor/app/cookies/actions.ts b/editor/app/cookies/actions.ts @@ -43,10 +43,6 @@ export type CookiePressResult = { status: CookieStatusPayload; }; -export async function cookieStatusAction(fresh = false): Promise<CookieStatusPayload> { - return loadCookieStatus(getPaths(), { fresh: fresh === true }); -} - type Answer = { ok: boolean; message: string; busy?: boolean }; function answerOf(r: { ok: true } | { ok: false; error: string; busy?: true }, okMessage: string): Answer { diff --git a/editor/app/lib/cookieRefreshGuard.test.ts b/editor/app/lib/cookieRefreshGuard.test.ts @@ -10,7 +10,7 @@ import os from "node:os"; import path from "node:path"; import type { Paths } from "yt-dlp-transcript-common/lib/paths"; import { readServiceCookieState } from "yt-dlp-transcript-common/lib/serviceCookies-server"; -import { runningCookieActions, withCookieAction } from "./cookieRefreshGuard"; +import { recheckOutcome, runningCookieActions, withCookieAction } from "./cookieRefreshGuard"; const root = await mkdtemp(path.join(os.tmpdir(), "cookie-guard-")); const paths = { transcriptsDir: root } as Paths; @@ -87,3 +87,54 @@ test("a press that throws is recorded as failed and the mark is released", async assert.equal(a?.message, "no display"); assert.equal(a?.action, "connect"); }); + +test("a recheck that answers stale or failed is remembered as not ok; clean is ok", async () => { + assert.deepEqual(recheckOutcome({ ok: true, jobId: "j", result: "stale", message: "Rumble still refused." }), { + ok: false, + result: "stale", + message: "Rumble still refused.", + jobId: "j", + }); + assert.equal(recheckOutcome({ ok: true, jobId: "j", result: "failed", message: "m" }).ok, false); + assert.equal(recheckOutcome({ ok: true, jobId: "j", result: "clean", message: "m" }).ok, true); + assert.deepEqual(recheckOutcome({ ok: false, error: "ended failed", jobId: "k" }), { ok: false, message: "ended failed", jobId: "k" }); + // Through the guard, as the action records it. + await withCookieAction( + "youtube", + "recheck", + async () => ({ ok: true as const, jobId: "j9", result: "stale" as const, message: "YouTube still refused." }), + recheckOutcome, + { paths, jobs: noJobs }, + ); + const a = (await readServiceCookieState(paths)).actions?.youtube; + assert.equal(a?.ok, false); + assert.equal(a?.result, "stale"); +}); + +test("a describe that throws keeps the press's answer and releases the mark", async () => { + const r = await withCookieAction( + "odysee", + "recheck", + async () => ({ ok: true as const, n: 1 }), + () => { + throw new Error("describe broke"); + }, + { paths, jobs: noJobs }, + ); + assert.deepEqual(r, { ok: true, n: 1 }); + assert.equal(runningCookieActions([]).odysee, undefined); +}); + +test("a throw before the press (finding the paths) never leaves the service marked busy", async () => { + const opts = { + jobs: noJobs, + get paths(): Paths { + throw new Error("no paths"); + }, + }; + await assert.rejects( + withCookieAction("rumble", "recheck", async () => ({ ok: true }), () => ({ ok: true, message: "" }), opts), + /no paths/, + ); + assert.equal(runningCookieActions([]).rumble, undefined); +}); diff --git a/editor/app/lib/cookieRefreshGuard.ts b/editor/app/lib/cookieRefreshGuard.ts @@ -62,6 +62,19 @@ export type CookieActionOutcome = { jobId?: string; }; +// The recorded outcome of a recheck (operations/serviceCookiesActions.ts): ok +// only when the service answered cleanly — a "stale" or "failed" answer is +// remembered as not ok, as the press's own note in the row says it. +export function recheckOutcome( + r: + | { ok: true; jobId: string; result: "clean" | "stale" | "failed"; message: string } + | { ok: false; error: string; jobId?: string }, +): CookieActionOutcome { + return r.ok + ? { ok: r.result === "clean", result: r.result, message: r.message, jobId: r.jobId } + : { ok: false, message: r.error, ...(r.jobId ? { jobId: r.jobId } : {}) }; +} + // Run `fn` as the one press for `service`, or refuse. `describe` turns its // answer into the recorded outcome. export async function withCookieAction<T>( @@ -75,21 +88,35 @@ export async function withCookieAction<T>( if (running) return { ok: false, error: busySentence(service, running), busy: true }; const map = inflight(); map.set(service, { action, since: new Date().toISOString() }); - const paths = opts.paths ?? getPaths(); + // Everything after the mark is inside the try: whatever throws, the finally + // releases it, so a service is never left marked busy. try { - const r = await fn(); - const o = describe(r); - await noteServiceCookieAction(paths, service, { - action, - ok: o.ok, - message: o.message, - ...(o.result ? { result: o.result } : {}), - ...(o.jobId ? { jobId: o.jobId } : {}), - }); + const paths = opts.paths ?? getPaths(); + let r: T; + try { + r = await fn(); + } catch (e) { + await noteServiceCookieAction(paths, service, { action, ok: false, message: (e as Error).message }); + throw e; + } + // A describe that throws only costs the record: the press itself succeeded + // and its answer is returned as it came. + let o: CookieActionOutcome | null = null; + try { + o = describe(r); + } catch { + o = null; + } + if (o) { + await noteServiceCookieAction(paths, service, { + action, + ok: o.ok, + message: o.message, + ...(o.result ? { result: o.result } : {}), + ...(o.jobId ? { jobId: o.jobId } : {}), + }); + } return r; - } catch (e) { - await noteServiceCookieAction(paths, service, { action, ok: false, message: (e as Error).message }); - throw e; } finally { map.delete(service); } diff --git a/editor/app/operations/serviceCookiesActions.ts b/editor/app/operations/serviceCookiesActions.ts @@ -27,7 +27,7 @@ import { } from "yt-dlp-transcript-common/controller/recheckServiceCookies"; import { retryJobAction } from "../jobs/actions"; import { loadCookieAlerts } from "../lib/cookieAlerts"; -import { withCookieAction } from "../lib/cookieRefreshGuard"; +import { recheckOutcome, withCookieAction } from "../lib/cookieRefreshGuard"; function refuse(service: string): string | null { return isServiceKey(service) ? null : `Not a service: ${service}`; @@ -35,18 +35,15 @@ function refuse(service: string): string | null { export type RecheckActionResult = | { ok: true; jobId: string; result: RecheckOutcome["result"]; message: string } - | { ok: false; error: string; jobId?: string }; + // busy: refused because a recheck (or another press) for the service is running. + | { ok: false; error: string; jobId?: string; busy?: true }; // Through the one-press-per-service guard (lib/cookieRefreshGuard.ts): a // second Recheck while one runs (or the timer's) is refused, not queued. export async function recheckServiceCookiesAction(service: string): Promise<RecheckActionResult> { const bad = refuse(service); if (bad) return { ok: false, error: bad }; - return withCookieAction(service, "recheck", () => recheckNow(service), (r) => - r.ok - ? { ok: true, result: r.result, message: r.message, jobId: r.jobId } - : { ok: false, message: r.error, ...(r.jobId ? { jobId: r.jobId } : {}) }, - ); + return withCookieAction(service, "recheck", () => recheckNow(service), recheckOutcome); } async function recheckNow(service: string): Promise<RecheckActionResult> { diff --git a/editor/e2e/privacy-audit.spec.ts b/editor/e2e/privacy-audit.spec.ts @@ -173,9 +173,12 @@ test.afterAll(async () => { test("byte identity: absent and explicit defaults render the same HTML, and the same /storage text", async ({ browser }) => { const statics = appRoutes(APP_DIR).filter((r) => !r.dynamic).map((r) => r.pattern); + // An ISO timestamp is the clock, not the privacy setting: a page that says + // when it read (/cookies' readAt) is compared with its times blanked. + const ISO = /\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(\.\d+)?Z/g; const fetchHtml = async (r: string) => { const res = await fetch(`${baseUrl}${r}`, { redirect: "manual" }); - return `${res.status}\n${await res.text()}`; + return `${res.status}\n${(await res.text()).replace(ISO, "<time>")}`; }; const storageText = async () => { const ctx = await browser.newContext(); @@ -232,6 +235,8 @@ test("byte identity: absent and explicit defaults render the same HTML, and the await settle(); test.info().annotations.push({ type: "byte-identity", description: `${compared} of ${statics.length} static routes compared; volatile, skipped: ${volatile.join(" ") || "none"}` }); expect(compared).toBeGreaterThan(statics.length / 2); + // /cookies stamps its rows with the time read; blanked, it compares. + expect(volatile).not.toContain("/cookies"); expect(bText).toBe(aText); }); diff --git a/scripts/archilyzer-ops.mjs b/scripts/archilyzer-ops.mjs @@ -1439,6 +1439,8 @@ export function usage() { ' (settings.serviceCookies.recheckIntervalMinutes, default 180, 0 = off;', ' `pnpm ops settings', ' --json \'{"patch":{"serviceCookies":{"recheckIntervalMinutes":0}}}\'`).', + ' Asked while a recheck or another press for the service runs (a click,', + ' the dashboard\'s, the timer\'s): refused, 409 {busy: true}, never queued.', 'dismiss-service clears a service\'s cookie alert by hand: {"service"}.', 'rerun-service-jobs retries every job a service\'s cookie alert stopped, once', ' it is OK again: {"service"} -> {jobIds, skipped}. --wait follows them.',