commit 274354749a4e2569a5493168935eee017b9a2eee
parent d6307e4de2a4a67e0421ab44671101cc061e489e
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Wed, 30 Sep 2026 09:00:20 -0400
editor(e2e): storage-locations — the drive health timing saves to settings.json, reads back on reload, refuses a value out of range, and an emptied field writes nothing
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Diffstat:
1 file changed, 82 insertions(+), 0 deletions(-)
diff --git a/editor/e2e/storage-locations.spec.ts b/editor/e2e/storage-locations.spec.ts
@@ -678,3 +678,85 @@ test("evicting at any age needs the tick as well as the preview", async ({
await page.getByLabel("clip eviction age").selectOption("0");
await expect(page.getByLabel("confirm evicting every window")).not.toBeChecked();
});
+
+// --- THE DRIVE HEALTH TIMING (release 15 slice DT) ---------------------------
+//
+// The five numbers the editor judges "mounted but not answering" by are
+// `settings.storage.health`, edited in a collapsed block at the foot of the
+// page. The claim: a value saved there is in settings.json and is what the page
+// shows on the next load; an empty field is the default and writes nothing; a
+// value out of range is refused with a sentence and writes nothing. (That the
+// saved numbers feed the watchdog is unit-tested in lib/storageHealth.test.ts:
+// no fixture here has a drive that stalls.)
+
+async function storedHealth(): Promise<Record<string, unknown> | undefined> {
+ const s = await readJson<{ storage?: { health?: Record<string, unknown> } }>(
+ "test-settings.json",
+ );
+ return s.storage?.health;
+}
+
+// React has attached its props to the form's button: a click now runs the
+// action through React rather than as a pre-hydration form post.
+async function timingFormHydrated(page: Page): Promise<void> {
+ await page.waitForFunction(() => {
+ const el = document.querySelector('[aria-label="save timing"]');
+ return !!el && Object.keys(el).some((k) => k.startsWith("__reactProps"));
+ });
+}
+
+test("the drive health timing saves to settings.json and reads back", async ({
+ page,
+}) => {
+ test.setTimeout(90_000);
+ await resetData("one-youtube-channel-with-data");
+ await writeSettings({ adminTitle: "Test Admin", minFreeDiskGB: 0 });
+ expect(await storedHealth()).toBeUndefined();
+
+ await page.goto("/storage");
+ const block = page.getByLabel("drive health timing");
+ const summary = block.locator("summary");
+ const budget = block.getByLabel("read budget");
+ // Opened after hydration, so React never meets a `<details open>` it did
+ // not render.
+ await timingFormHydrated(page);
+ // COLLAPSED: the defaults suit a healthy disk.
+ await expect(summary).toContainText("defaults");
+ await expect(budget).toBeHidden();
+ await summary.click();
+ await expect(budget).toBeVisible();
+ // An empty field is its default, which is its placeholder.
+ await expect(budget).toHaveValue("");
+ await expect(budget).toHaveAttribute("placeholder", "3000");
+ await expect(block.getByLabel("reads at once per drive")).toHaveAttribute(
+ "placeholder",
+ "4",
+ );
+
+ await budget.fill("4000");
+ await block.getByLabel("save timing").click();
+ await expect(block.getByLabel("timing saved")).toContainText("A read may take 4 s");
+ // ONLY WHAT DIFFERS FROM A DEFAULT IS WRITTEN: the four empty fields are not.
+ expect(await storedHealth()).toEqual({ budgetMs: 4000 });
+
+ await page.reload();
+ await timingFormHydrated(page);
+ await expect(summary).toContainText("1 changed from the default");
+ await summary.click();
+ await expect(budget).toHaveValue("4000");
+ await expect(block.getByLabel("health check interval")).toHaveValue("");
+
+ // OUT OF RANGE IS REFUSED, not clamped, and nothing is written.
+ await budget.fill("200");
+ await block.getByLabel("save timing").click();
+ await expect(block.getByLabel("timing error")).toHaveText(
+ "Read budget must be between 500 and 60000 ms (got 200 ms).",
+ );
+ expect(await storedHealth()).toEqual({ budgetMs: 4000 });
+
+ // Emptied, it is the default again, and the block is gone from the file.
+ await budget.fill("");
+ await block.getByLabel("save timing").click();
+ await expect(block.getByLabel("timing saved")).toContainText("A read may take 3 s");
+ expect(await storedHealth()).toBeUndefined();
+});