commit 3240571994585fd098839df6051545114192ded2
parent c31b6543294c1d33e38838ef1f7427fbb4414be1
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Tue, 20 Oct 2026 18:30:25 -0400
forum: Retry after a block's Turn off removes the key (social merges one level deep); the X patch left as it was
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
4 files changed, 14 insertions(+), 17 deletions(-)
diff --git a/editor/app/channels/[slug]/socialActions.ts b/editor/app/channels/[slug]/socialActions.ts
@@ -426,20 +426,19 @@ export async function importForumPagesAction(
}
// RETRY AFTER A BLOCK — `settings.social.xenforo.retryOnBlock`, the forum
-// Fetch posts button's default (release 37 lane G). Null turns it off (the key
-// is removed). The rest of `social` is carried as it is: saveSettings merges
-// one level deep.
+// Fetch posts button's default (release 37 lane G). Null turns it off: the
+// key is written as undefined, which saveSettings' one-level merge of `social`
+// then drops from the file.
export async function setForumRetryOnBlockAction(
retry: RetryOnBlock | null,
): Promise<{ ok: true; retryOnBlock: RetryOnBlock | null } | { ok: false; error: string }> {
const problem = retry ? retryOnBlockProblem(retry) : null;
if (problem) return { ok: false, error: problem };
const social = getSettings().social;
- const { retryOnBlock: _was, ...restXf } = social.xenforo ?? {};
- const xenforo = retry ? { ...restXf, retryOnBlock: retry } : restXf;
- const { xenforo: _old, ...rest } = social;
try {
- await saveSettings({ social: { ...rest, ...(Object.keys(xenforo).length > 0 ? { xenforo } : {}) } });
+ await saveSettings({
+ social: { ...social, xenforo: retry ? { ...social.xenforo, retryOnBlock: retry } : undefined },
+ });
} catch (e) {
return { ok: false, error: (e as Error).message };
}
diff --git a/editor/app/settings/xSessionActions.ts b/editor/app/settings/xSessionActions.ts
@@ -39,16 +39,14 @@ import {
import { xPostsVisibility } from "yt-dlp-transcript-common/lib/postsVisibility";
import { saveSettings } from "./saveSettings";
-// `social` is ONE value to saveSettings, whose merge is one level deep: a
-// patch naming `social: { x }` replaces the whole social block. So each X choice is
+// `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
// written over the block as it is now, with only its own key changed — the
// login source keeps the visibility, and the visibility keeps the source.
function socialXPatch(
change: (x: XSocialSettings) => XSocialSettings,
): { social: { x: XSocialSettings } } {
- // The rest of the block (a forum thread's `xenforo`) is carried as it is.
- const social = getSettings().social;
- return { social: { ...social, x: change({ ...social.x }) } };
+ return { social: { x: change({ ...getSettings().social.x }) } };
}
// Every session action returns the source in use beside the profile's status:
diff --git a/editor/e2e/forum-resume.spec.ts b/editor/e2e/forum-resume.spec.ts
@@ -129,11 +129,11 @@ test("a forum thread: Fetch posts resumes the history, Full re-walk asks first,
expect(await archived()).toEqual(thread.ids().sort());
// RETRY AFTER A BLOCK: off until set; saved to settings.social.xenforo.
- await expect(page.getByLabel("retry after a block")).toContainText("Fetch posts: off");
+ await expect(page.getByLabel("retry after a block", { exact: true })).toContainText("Fetch posts: off");
await page.getByLabel("retry minutes").fill("30");
await page.getByLabel("retry tries").fill("12");
await page.getByRole("button", { name: "save retry after a block" }).click();
- await expect(page.getByLabel("retry after a block")).toContainText("wait 30 min after a block, up to 12 tries");
+ await expect(page.getByLabel("retry after a block", { exact: true })).toContainText("wait 30 min after a block, up to 12 tries");
await expect
.poll(async () => (await readJson<{ social?: { xenforo?: unknown } }>(testPaths().settingsFile)).social?.xenforo)
.toEqual({ retryOnBlock: { minutes: 30, max: 12 } });
@@ -141,7 +141,7 @@ test("a forum thread: Fetch posts resumes the history, Full re-walk asks first,
await page.getByRole("button", { name: "save retry after a block" }).click();
await expect(page.getByRole("alert").filter({ hasText: "minutes must be a whole number from 5" })).toBeVisible();
await page.getByRole("button", { name: "turn off retry after a block" }).click();
- await expect(page.getByLabel("retry after a block")).toContainText("Fetch posts: off");
+ await expect(page.getByLabel("retry after a block", { exact: true })).toContainText("Fetch posts: off");
await expect
.poll(async () => (await readJson<{ social?: { xenforo?: unknown } }>(testPaths().settingsFile)).social?.xenforo)
.toBeUndefined();
diff --git a/plans/FACTS.md b/plans/FACTS.md
@@ -11270,8 +11270,8 @@ parsed to 0 cues, indexing the video textless) is CLOSED by `200a3105` (transcri
`minutes` when the result's `block` is `"challenge"` or `"blocked"` (403/429); `max` is tries IN ALL; minutes
5–1440, max 1–48 (`retryOnBlockProblem`). `PostFetchResult.block` carries the `ForumBlockKind`. Default for the
forum Fetch posts button: `settings.social.xenforo.retryOnBlock` (absent = off; the button passes `"settings"`,
- ops `true`). Note `saveSettings` merges ONE level deep: a `social` patch replaces the block, so
- `socialXPatch` (xSessionActions.ts) now spreads the rest of `social`.
+ ops `true`). `saveSettings` merges `social` one level deep (`{...old.social, ...patch.social}`), so turning it
+ off writes `xenforo: undefined`, which JSON drops.
- **Test seam**: `E2E_FORUM_FIXTURE_DIR` (test audience) makes `xenforoFetcher.fetch` read
`<dir>/<threadId>/page-<N>.html` (`page-<N>.<status>.html` served in its place while it exists) with no pause
(`common/social/forumFixtureLoader.ts`); `editor/e2e/servers.ts` sets it per slot to `test-transcripts/.forum-fixture`.