Archilyzer · Source

archilyzer

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

commit 5bd83a4ceb2bf7b30eb3db5d65cdce84b425d11c
parent f13ad6e031760d804a80ae09704c7ad4e48b7d25
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Mon, 16 Nov 2026 09:49:12 -0500

cookie presses: one at a time per service, each outcome remembered

editor/app/lib/cookieRefreshGuard.ts: every button that refreshes, connects or
rechecks a service's cookies runs through withCookieAction -- /settings'
Refresh cookies and Connect X account, archive.today's Connect, a forum
channel's Connect (its body now lib/connectForum.ts, shared with /cookies),
the dashboard's Recheck and ops recheck-service. A second press while one is
in flight for the service, or while a recheck job is queued or running on its
queue (the timer's), is refused with a sentence, never queued behind it; the
outcome is the service's last press in .service-cookies.json.

Refresh cookies takes the fake browser under the e2e test server only
(common/social/fakeXProfileBrowser.ts; each slot names its file in
e2e/servers.ts). /review's X run console links /cookies.

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

Diffstat:
Meditor/app/channels/[slug]/socialActions.ts | 23++++++-----------------
Aeditor/app/lib/connectForum.ts | 45+++++++++++++++++++++++++++++++++++++++++++++
Aeditor/app/lib/cookieRefreshGuard.test.ts | 89+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aeditor/app/lib/cookieRefreshGuard.ts | 96+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Meditor/app/operations/serviceCookiesActions.ts | 20+++++++++++++++-----
Meditor/app/review/components/XRunConsole.tsx | 8++++----
Meditor/app/settings/archiveSessionActions.ts | 21++++++++++++++++++---
Meditor/app/settings/xSessionActions.ts | 27++++++++++++++++++++++++++-
Meditor/e2e/cookie-alerts.spec.ts | 6+++---
Meditor/e2e/servers.ts | 8++++++++
Meditor/playwright.config.ts | 5+++++
11 files changed, 315 insertions(+), 33 deletions(-)

diff --git a/editor/app/channels/[slug]/socialActions.ts b/editor/app/channels/[slug]/socialActions.ts @@ -74,14 +74,12 @@ import { } from "yt-dlp-transcript-common/jobs/streamCommand"; import { importForumPages } from "yt-dlp-transcript-common/controller/importForumPages"; import { - connectForumSession, readForumSessionStatus, type ForumSessionRecord, type ForumSessionStatus, } from "yt-dlp-transcript-common/social/forumSession"; import { parseXenforoThreadUrl } from "yt-dlp-transcript-common/social/xenforoParse"; -import { noteServiceCookieClean } from "yt-dlp-transcript-common/lib/serviceCookies-server"; -import { forumServiceKey } from "yt-dlp-transcript-common/lib/serviceCookies"; +import { connectForumAt } from "../../lib/connectForum"; // Switch which SocialFetcher drives this channel. The fetchers differ in what // they can actually reach — for X, gallery-dl needs credentials for depth, @@ -466,20 +464,11 @@ export async function connectForumSessionAction( ): Promise<{ ok: true; record: ForumSessionRecord } | { ok: false; error: string }> { const ch = await forumChannel(slug); if (!ch.ok) return ch; - try { - const record = await connectForumSession(getPaths(), ch.url, { - onLog: (line) => console.log(`[forum-session] ${line}`), - }); - // A window that closed on the thread clears the forum's cookie refresh - // alert (the dashboard's banner). - if (record.cleared) { - await noteServiceCookieClean(getPaths(), forumServiceKey(ch.host), { url: ch.url, channel: slug }, { by: "connect" }); - } - revalidatePath(`/channels/${slug}`); - return { ok: true, record }; - } catch (e) { - return { ok: false, error: (e as Error).message }; - } + // A window that closed on the thread clears the forum's cookie refresh alert + // (lib/connectForum.ts, shared with the /cookies row). + const res = await connectForumAt(ch.url, ch.host, slug); + if (res.ok) revalidatePath(`/channels/${slug}`); + return res; } // IMPORT: thread pages saved from a browser ("Save page as", .html), read from diff --git a/editor/app/lib/connectForum.ts b/editor/app/lib/connectForum.ts @@ -0,0 +1,45 @@ +// CONNECT A FORUM SESSION — the one body behind the forum channel page's +// "Connect forum session" (channels/[slug]/socialActions.ts) and the /cookies +// row of a forum host (cookies/actions.ts): a HEADED browser window on the +// host's profile (common/social/forumSession.ts), opened at a thread on the +// machine running the editor, for the operator to clear a check and close. A +// window that closed on the thread clears the host's cookie refresh alert. +// Through the one-press-per-service guard (lib/cookieRefreshGuard.ts). + +import { getPaths } from "yt-dlp-transcript-common/lib/paths"; +import { connectForumSession, type ForumSessionRecord } from "yt-dlp-transcript-common/social/forumSession"; +import { noteServiceCookieClean } from "yt-dlp-transcript-common/lib/serviceCookies-server"; +import { forumServiceKey } from "yt-dlp-transcript-common/lib/serviceCookies"; +import { withCookieAction } from "./cookieRefreshGuard"; + +export type ConnectForumResult = { ok: true; record: ForumSessionRecord } | { ok: false; error: string }; + +export async function connectForumAt(url: string, host: string, channel?: string): Promise<ConnectForumResult> { + const service = forumServiceKey(host); + return withCookieAction( + service, + "connect", + async (): Promise<ConnectForumResult> => { + try { + const record = await connectForumSession(getPaths(), url, { + onLog: (line) => console.log(`[forum-session] ${line}`), + }); + if (record.cleared) { + await noteServiceCookieClean(getPaths(), service, { url, ...(channel ? { channel } : {}) }, { by: "connect" }); + } + return { ok: true, record }; + } catch (e) { + return { ok: false, error: (e as Error).message }; + } + }, + (r) => + r.ok + ? { + ok: true, + message: r.record.cleared + ? `Connected: the window closed on the thread (${r.record.cookies} cookies).` + : "The window closed before the thread showed: not cleared.", + } + : { ok: false, message: r.error }, + ); +} diff --git a/editor/app/lib/cookieRefreshGuard.test.ts b/editor/app/lib/cookieRefreshGuard.test.ts @@ -0,0 +1,89 @@ +// One press at a time per service, and its result recorded +// (cookieRefreshGuard.ts). Over a temp transcripts dir; the jobs are handed in. +// +// Run with: pnpm -C editor exec tsx --test app/lib/cookieRefreshGuard.test.ts + +import test from "node:test"; +import assert from "node:assert/strict"; +import { mkdtemp, rm } from "node:fs/promises"; +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"; + +const root = await mkdtemp(path.join(os.tmpdir(), "cookie-guard-")); +const paths = { transcriptsDir: root } as Paths; +test.after(() => rm(root, { recursive: true, force: true })); +const noJobs = () => []; + +test("a second press while the first runs is refused with a sentence, then allowed once it ends", async () => { + let release!: () => void; + const gate = new Promise<void>((r) => (release = r)); + let runs = 0; + const first = withCookieAction( + "x", + "refresh", + async () => { + runs++; + await gate; + return { ok: true as const }; + }, + () => ({ ok: true, message: "Cookies refreshed." }), + { paths, jobs: noJobs }, + ); + // While it runs: shown as running, and a second press is refused, not queued. + assert.equal(runningCookieActions([]).x?.action, "refresh"); + const second = await withCookieAction("x", "refresh", async () => ({ ok: true as const }), () => ({ ok: true, message: "" }), { + paths, + jobs: noJobs, + }); + assert.equal(second.ok, false); + assert.match((second as { error: string }).error, /^X's refresh is already running \(since \d\d:\d\d:\d\d UTC\) — wait for it to finish\.$/); + assert.equal(runs, 1); + // Another service is not held by X's press. + const other = await withCookieAction("rumble", "recheck", async () => ({ ok: true as const }), () => ({ ok: true, message: "clean", result: "clean" }), { + paths, + jobs: noJobs, + }); + assert.equal(other.ok, true); + release(); + assert.deepEqual(await first, { ok: true }); + assert.equal(runningCookieActions([]).x, undefined); + const state = await readServiceCookieState(paths); + assert.equal(state.actions?.x?.message, "Cookies refreshed."); + assert.equal(state.actions?.x?.ok, true); + assert.equal(state.actions?.rumble?.result, "clean"); +}); + +test("a recheck job queued or running on the service's queue counts as in flight", async () => { + const jobs = () => [ + { id: "j1", kind: "recheck-service-cookies", queueKey: "service-cookies:rumble", status: "running", queuedAt: 0, startedAt: Date.parse("2026-11-16T09:31:00Z") }, + { id: "j2", kind: "recheck-service-cookies", queueKey: "service-cookies:youtube", status: "done", queuedAt: 0 }, + { id: "j3", kind: "download", queueKey: "service-cookies:odysee", status: "running", queuedAt: 0 }, + ]; + assert.deepEqual(runningCookieActions(jobs()), { + rumble: { action: "recheck", since: "2026-11-16T09:31:00.000Z", jobId: "j1" }, + }); + let ran = false; + const r = await withCookieAction("rumble", "recheck", async () => { + ran = true; + return { ok: true as const }; + }, () => ({ ok: true, message: "" }), { paths, jobs }); + assert.equal(ran, false); + assert.match((r as { error: string }).error, /Rumble's recheck is already running \(since 09:31:00 UTC\)/); +}); + +test("a press that throws is recorded as failed and the mark is released", async () => { + await assert.rejects( + withCookieAction("archive.today", "connect", async () => { + throw new Error("no display"); + }, () => ({ ok: true, message: "" }), { paths, jobs: noJobs }), + /no display/, + ); + assert.equal(runningCookieActions([])["archive.today"], undefined); + const a = (await readServiceCookieState(paths)).actions?.["archive.today"]; + assert.equal(a?.ok, false); + assert.equal(a?.message, "no display"); + assert.equal(a?.action, "connect"); +}); diff --git a/editor/app/lib/cookieRefreshGuard.ts b/editor/app/lib/cookieRefreshGuard.ts @@ -0,0 +1,96 @@ +// ONE PRESS AT A TIME PER SERVICE, AND ITS RESULT REMEMBERED (the /cookies +// screen, plans/cookie-screen.md). Every button that refreshes, connects or +// rechecks a service's cookies — /cookies, the dashboard banner's Recheck, +// /settings' Refresh cookies and Connect, a forum channel's Connect, `pnpm ops +// recheck-service` — runs through `withCookieAction`: +// +// - a second press while one is in flight for that service is REFUSED with a +// sentence saying so (never queued behind it): an in-process mark per +// service, and a `recheck-service-cookies` job already queued or running +// on the service's queue (the proactive timer's) counts as in flight too; +// - the outcome is recorded as the service's last press +// (noteServiceCookieAction, `.service-cookies.json` `actions`), which the +// screen shows as "last result". +// +// The mark lives on globalThis (one per server process, like the registry). + +import { getPaths, type Paths } from "yt-dlp-transcript-common/lib/paths"; +import { getRegistry } from "yt-dlp-transcript-common/jobs/registry"; +import { noteServiceCookieAction } from "yt-dlp-transcript-common/lib/serviceCookies-server"; +import { serviceLabel, type ServiceCookieActionKind } from "yt-dlp-transcript-common/lib/serviceCookies"; +import type { CookieRunning } from "yt-dlp-transcript-common/lib/cookieStatus"; +import { RECHECK_JOB_KIND } from "yt-dlp-transcript-common/controller/serviceCookieTimer"; + +const QUEUE_PREFIX = "service-cookies:"; +const KEY = Symbol.for("archilyzer.cookieRefresh.inflight"); + +function inflight(): Map<string, CookieRunning> { + const g = globalThis as unknown as Record<symbol, Map<string, CookieRunning>>; + return (g[KEY] ??= new Map()); +} + +type JobLike = { id: string; kind: string; queueKey: string; status: string; queuedAt?: number; startedAt?: number }; + +// What is running per service now: the presses in flight here, and any +// recheck job queued or running on a service's queue. +export function runningCookieActions( + jobs: readonly JobLike[] = getRegistry().list(), +): Record<string, CookieRunning> { + const out: Record<string, CookieRunning> = {}; + for (const j of jobs) { + if (j.kind !== RECHECK_JOB_KIND || !j.queueKey.startsWith(QUEUE_PREFIX)) continue; + if (j.status !== "queued" && j.status !== "running") continue; + const since = j.startedAt ?? j.queuedAt; + out[j.queueKey.slice(QUEUE_PREFIX.length)] = { + action: "recheck", + since: new Date(since ?? Date.now()).toISOString(), + jobId: j.id, + }; + } + for (const [service, r] of inflight()) out[service] = r; + return out; +} + +export function busySentence(service: string, r: CookieRunning): string { + return `${serviceLabel(service)}'s ${r.action} is already running (since ${r.since.slice(11, 19)} UTC) — wait for it to finish.`; +} + +export type CookieActionOutcome = { + ok: boolean; + message: string; + result?: "clean" | "stale" | "failed"; + jobId?: string; +}; + +// Run `fn` as the one press for `service`, or refuse. `describe` turns its +// answer into the recorded outcome. +export async function withCookieAction<T>( + service: string, + action: ServiceCookieActionKind, + fn: () => Promise<T>, + describe: (r: T) => CookieActionOutcome, + opts: { paths?: Paths; jobs?: () => readonly JobLike[] } = {}, +): Promise<T | { ok: false; error: string; busy: true }> { + const running = runningCookieActions(opts.jobs ? opts.jobs() : undefined)[service]; + 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(); + 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 } : {}), + }); + 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,19 +27,29 @@ import { } from "yt-dlp-transcript-common/controller/recheckServiceCookies"; import { retryJobAction } from "../jobs/actions"; import { loadCookieAlerts } from "../lib/cookieAlerts"; +import { withCookieAction } from "../lib/cookieRefreshGuard"; function refuse(service: string): string | null { return isServiceKey(service) ? null : `Not a service: ${service}`; } -export async function recheckServiceCookiesAction( - service: string, -): Promise< +export type RecheckActionResult = | { ok: true; jobId: string; result: RecheckOutcome["result"]; message: string } - | { ok: false; error: string; jobId?: string } -> { + | { ok: false; error: string; jobId?: string }; + +// 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 } : {}) }, + ); +} + +async function recheckNow(service: string): Promise<RecheckActionResult> { const paths = getPaths(); let outcome: RecheckOutcome | null = null; const res = await runManagedFunction({ diff --git a/editor/app/review/components/XRunConsole.tsx b/editor/app/review/components/XRunConsole.tsx @@ -65,9 +65,9 @@ const TIER_TONE: Record<string, string> = { }; // THE JAR, COUNTED DOWN. Ticks every second from the jar's mtime and the -// limit; the poll refreshes both (a refresh on /settings rewrites the jar). +// limit; the poll refreshes both (a refresh on /cookies rewrites the jar). function JarCountdown({ jar, now }: { jar: XRunConsolePayload["jar"]; now: number | null }) { - const href = "/settings"; + const href = "/cookies"; if (jar.alert) { return ( <p role="status" aria-label="x cookie jar" data-jar="alert" className="text-sm text-destructive"> @@ -87,7 +87,7 @@ function JarCountdown({ jar, now }: { jar: XRunConsolePayload["jar"]; now: numbe if (!jar.cookiesUpdatedAt || !jar.staleAt) { return ( <p role="status" aria-label="x cookie jar" data-jar="none" className="text-sm text-destructive"> - No X cookie jar: <Link href={href} className="underline">Connect X account on /settings</Link>. + No X cookie jar: <Link href={href} className="underline">Connect X account on /cookies</Link>. </p> ); } @@ -98,7 +98,7 @@ function JarCountdown({ jar, now }: { jar: XRunConsolePayload["jar"]; now: numbe return ( <p role="status" aria-label="x cookie jar" data-jar="stale" className="text-sm text-warning"> Cookie jar {age(old)} old, past the {jar.maxAgeMinutes} min limit —{" "} - <Link href={href} className="underline">Refresh cookies on /settings</Link>, then Resume. + <Link href={href} className="underline">Refresh cookies on /cookies</Link>, then Resume. </p> ); } diff --git a/editor/app/settings/archiveSessionActions.ts b/editor/app/settings/archiveSessionActions.ts @@ -20,6 +20,7 @@ import { import { isArchiveTodayUrl } from "yt-dlp-transcript-common/lib/archives/mementos"; import { sanitizeArchives, type ArchivesSettings } from "yt-dlp-transcript-common/lib/archives/settings"; import { saveSettings } from "./saveSettings"; +import { withCookieAction } from "../lib/cookieRefreshGuard"; import { noteServiceCookieClean } from "yt-dlp-transcript-common/lib/serviceCookies-server"; import { ARCHIVE_TODAY_SERVICE } from "yt-dlp-transcript-common/lib/serviceCookies"; @@ -29,9 +30,23 @@ export async function archiveSessionStatusAction(): Promise<ArchiveSessionStatus // Open the window at `url` (an archive.today copy the check stood in front // of), else at archive.today's front page on the canonical host. -export async function connectArchiveSessionAction( - url?: string, -): Promise<{ ok: true; record: ArchiveSessionRecord } | { ok: false; error: string }> { +export type ConnectArchiveResult = { ok: true; record: ArchiveSessionRecord } | { ok: false; error: string }; + +// Through the one-press-per-service guard (lib/cookieRefreshGuard.ts). +export async function connectArchiveSessionAction(url?: string): Promise<ConnectArchiveResult> { + return withCookieAction(ARCHIVE_TODAY_SERVICE, "connect", () => connectArchiveNow(url), (r) => + r.ok + ? { + ok: true, + message: r.record.cleared + ? `Connected: the window closed past the check (${r.record.cookies} cookies).` + : "The window closed on a check page: not cleared.", + } + : { ok: false, message: r.error }, + ); +} + +async function connectArchiveNow(url?: string): Promise<ConnectArchiveResult> { const host = getSettings().archives.archiveTodayHost; const at = url?.trim() && isArchiveTodayUrl(url.trim()) ? url.trim() : `https://${host}/`; try { diff --git a/editor/app/settings/xSessionActions.ts b/editor/app/settings/xSessionActions.ts @@ -40,6 +40,8 @@ import { } from "yt-dlp-transcript-common/social/xCookieSource"; import { xPostsVisibility } from "yt-dlp-transcript-common/lib/postsVisibility"; import { saveSettings } from "./saveSettings"; +import { fakeXProfileChromium } from "yt-dlp-transcript-common/social/fakeXProfileBrowser"; +import { withCookieAction } from "../lib/cookieRefreshGuard"; // `social.x` is ONE value to saveSettings, whose merge is one level deep: a // patch naming `social: { x }` replaces the whole X block. So each X choice is @@ -65,7 +67,18 @@ export async function xSessionStatusAction(): Promise<XSessionStatus> { return readXSessionStatus(getPaths()); } +// Connect and Refresh go through the one-press-per-service guard +// (lib/cookieRefreshGuard.ts): a second press while one runs is refused, and +// each outcome is the X row's "last result" on /cookies. export async function connectXAccountAction(): Promise<XSessionActionResult> { + return withCookieAction("x", "connect", connectXAccountNow, (r) => + r.ok + ? { ok: true, message: `Connected${r.browser ? ` with ${r.browser}` : ""}. Cookies exported.` } + : { ok: false, message: r.error }, + ); +} + +async function connectXAccountNow(): Promise<XSessionActionResult> { try { const { browser, ...status } = await connectXAccount(getPaths(), { // Which browser opened, and any fallback, in the editor's log. @@ -88,9 +101,21 @@ export async function connectXAccountAction(): Promise<XSessionActionResult> { } export async function refreshXCookiesAction(): Promise<XSessionActionResult> { + return withCookieAction("x", "refresh", refreshXCookiesNow, (r) => + r.ok ? { ok: true, message: "Cookies refreshed." } : { ok: false, message: r.error }, + ); +} + +async function refreshXCookiesNow(): Promise<XSessionActionResult> { try { - const status = await refreshXCookies(getPaths(), { + const paths = getPaths(); + // Under the e2e test server only, a fake browser (no browser starts, + // nothing asks X): common/social/fakeXProfileBrowser.ts says how it is + // gated. On any other process this is null and the real browser runs. + const chromium = fakeXProfileChromium(paths.transcriptsDir); + const status = await refreshXCookies(paths, { onLog: (line) => console.log(`[x-session] ${line}`), + ...(chromium ? { chromium } : {}), }); return { ok: true, status, source: await sourceNow() }; } catch (e) { diff --git a/editor/e2e/cookie-alerts.spec.ts b/editor/e2e/cookie-alerts.spec.ts @@ -192,7 +192,7 @@ test("X: a stale jar refuses Fetch posts; \"\" is refused; a challenge fails the const stale = await fetchPosts(request, "x-other"); expect(stale.status).toBe(400); expect(stale.body.error).toBe( - "X cookies were last refreshed 16 days ago (limit 60 min): press Refresh cookies (or Connect X account) on /settings, then fetch again.", + "X cookies were last refreshed 16 days ago (limit 60 min): press Refresh cookies (or Connect X account) on /cookies, then fetch again.", ); // A fresh jar; an unqueued fetch is still refused. @@ -227,7 +227,7 @@ test("X: a stale jar refuses Fetch posts; \"\" is refused; a challenge fails the }); await expect(banner).toHaveAttribute("data-state", "stale"); - // The operator refreshes the jar (Refresh cookies on /settings); Recheck clears it. + // The operator refreshes the jar (Refresh cookies on /cookies); Recheck clears it. await xJar(0); await banner.getByRole("button", { name: "Recheck" }).click(); await expect(banner).toHaveAttribute("data-state", "ok-again", { timeout: 30_000 }); @@ -284,7 +284,7 @@ test("X: a fetch refused for an old jar raises the X banner with the jar's age; // Three short lines, no lead paragraph: the age, the one action, the job it refused. await expect(banner.locator("p").first()).toHaveText("X cookies are 3 h old (limit 60 min)"); await expect(banner.getByLabel("X cookies action")).toHaveText( - "Refresh cookies (or Connect X account) on /settings — then Recheck.", + "Refresh cookies (or Connect X account) on /cookies — then Recheck.", ); await expect(banner).toContainText("Refused an X job on x-other."); await expect(banner.locator("code")).toHaveCount(0); diff --git a/editor/e2e/servers.ts b/editor/e2e/servers.ts @@ -73,6 +73,11 @@ export function archiveTodayOriginFile(transcriptsDir: string): string { return join(transcriptsDir, ".fake-archive-today-origin"); } +/** The synthetic cookies a slot's fake "Refresh cookies" browser hands back (common/social/fakeXProfileBrowser.ts; cookies-screen.spec). */ +export function xProfileCookiesFixtureFile(transcriptsDir: string): string { + return join(transcriptsDir, ".fake-x-profile-cookies.json"); +} + /** The saved thread pages a slot's forum fetcher reads (forumFixtureLoader.ts; forum-resume.spec). */ export function forumFixtureDir(transcriptsDir: string): string { return join(transcriptsDir, ".forum-fixture"); @@ -245,6 +250,9 @@ export function slotServers(slot: number, mode: E2EMode, env: Env = process.env) // The forum fetcher's saved pages (forum-resume.spec): the slot's own // directory (common/social/forumFixtureLoader.ts). editorEnv.E2E_FORUM_FIXTURE_DIR = forumFixtureDir(paths.transcriptsDir); + // The fake browser Refresh cookies reads the X profile through while the + // file exists (common/social/fakeXProfileBrowser.ts; cookies-screen.spec). + editorEnv.E2E_FAKE_X_PROFILE_COOKIES_FILE = xProfileCookiesFixtureFile(paths.transcriptsDir); // The same for the stub umtool find-clips.spec starts (lib/umtoolUrl.ts). editorEnv.E2E_UMTOOL_ORIGIN_FILE = umtoolOriginFile(paths.transcriptsDir); // settings.privacy's opt-in rule files (demo epic D4, useSourceRules): the diff --git a/editor/playwright.config.ts b/editor/playwright.config.ts @@ -58,6 +58,11 @@ import { currentSlot } from "./e2e/testPaths"; // reads in place of a browser, with no pause // (common/social/forumFixtureLoader.ts; // forum-resume.spec) +// E2E_FAKE_X_PROFILE_COOKIES_FILE set per slot (e2e/servers.ts): the file +// of SYNTHETIC cookies Refresh cookies' fake browser +// hands back while it exists — no browser starts, +// nothing asks X (common/social/fakeXProfileBrowser.ts; +// cookies-screen.spec); inert without E2E_TEST_ROUTES // E2E_UMTOOL_ORIGIN_FILE set per slot (e2e/servers.ts): the file a spec // writes its stub umtool's loopback origin into, // which Find clips then posts to