track where each camera's detect resolution came from

The health tab's stream check told users to set the detect resolution whenever a probe returned no size, even when they had already set it, and a camera running on the 1280x720 fallback after a failed startup probe was never flagged unless the stream check was run by hand. The config now records whether the resolution came from the config, a startup probe, or the fallback, and /api/config exposes it per camera. The stream check skips the probe warning when the resolution is set, a camera on the fallback gets a detect settings warning that also shows on the health tab, and cloning detect from a fallback camera no longer copies the fallback size.
This commit is contained in:
Josh Hawkins
2026-11-28 18:20:38 -06:00
parent bd90051a15
commit 63807d753c
13 changed files with 209 additions and 4 deletions
+48
View File
@@ -19,8 +19,19 @@
* and no PUT. That path is covered by unit-level review and manual QA.
*/
import { readFileSync } from "node:fs";
import { resolve, dirname } from "node:path";
import { fileURLToPath } from "node:url";
import { test, expect } from "../fixtures/frigate-test";
const __dirname = dirname(fileURLToPath(import.meta.url));
const CONFIG_SCHEMA = JSON.parse(
readFileSync(
resolve(__dirname, "../fixtures/mock-data/config-schema.json"),
"utf-8",
),
);
async function openCloneDialog(frigateApp: {
page: import("@playwright/test").Page;
}) {
@@ -137,6 +148,43 @@ test.describe("Camera clone dialog @medium @mobile", () => {
).toBeVisible({ timeout: 8_000 });
});
test("does not copy a fallback detect resolution to a new camera", async ({
frigateApp,
}) => {
await frigateApp.installDefaults({
config: {
cameras: { front_door: { detect_resolution_source: "default" } },
},
});
// section payloads need the schema, which the default mock leaves empty
await frigateApp.page.route("**/api/config/schema.json", (route) =>
route.fulfill({ json: CONFIG_SCHEMA }),
);
const requests: unknown[] = [];
await frigateApp.page.route("**/api/config/set", async (route) => {
requests.push(route.request().postDataJSON());
await route.fulfill({ json: { success: true, require_restart: false } });
});
await frigateApp.goto("/settings?page=cameraManagement");
await openCloneDialog(frigateApp);
await selectSource(frigateApp, "Front Door");
await frigateApp.page
.getByPlaceholder(/e\.g\., back_door or Back Door/i)
.fill("clone_target_two");
await frigateApp.page.getByRole("button", { name: /^Clone$/i }).click();
await expect.poll(() => requests.length, { timeout: 10_000 }).toBe(1);
const body = requests[0] as {
config_data: {
cameras: { clone_target_two: { detect?: Record<string, unknown> } };
};
};
const detect = body.config_data.cameras.clone_target_two.detect ?? {};
expect(detect).not.toHaveProperty("width");
expect(detect).not.toHaveProperty("height");
});
test("selects multiple existing destination cameras via a switch popover", async ({
frigateApp,
}) => {
+70
View File
@@ -1072,6 +1072,76 @@ test.describe("System — Health notices sources @medium", () => {
).toHaveCount(0);
});
test("a camera on the fallback detect resolution is flagged", async ({
frigateApp,
}) => {
await frigateApp.installDefaults({
config: { cameras: { garage: { detect_resolution_source: "default" } } },
stats: QUIET_STATS,
});
await frigateApp.goto("/system#health");
const row = frigateApp.page.getByTestId(
"health-problem-config:detect:detect-resolution-not-probed:camera.garage",
);
await expect(row).toBeVisible({ timeout: 15_000 });
await expect(row).toHaveAttribute("data-severity", "warning");
await expect(
frigateApp.page.getByTestId(
"health-problem-config:detect:detect-resolution-not-probed:camera.front_door",
),
).toHaveCount(0);
});
test("an unprobeable resolution is only flagged when Frigate must probe it", async ({
frigateApp,
}) => {
const noSize = [
{
return_code: 0,
stderr: "",
stdout: {
streams: [
{ codec_type: "video", codec_name: "h264" },
{ codec_type: "audio", codec_name: "aac" },
],
},
},
];
await frigateApp.installDefaults({
config: {
cameras: {
backyard: { detect_resolution_source: "probed" },
front_door: { detect_resolution_source: "default" },
},
},
ffprobe: { backyard: noSize, front_door: noSize, garage: noSize },
stats: QUIET_STATS,
});
await frigateApp.goto("/system#health");
await frigateApp.page
.getByRole("button", { name: "Run stream checks" })
.click();
await expect(
frigateApp.page.getByTestId(
"health-problem-stream:backyard:0:resolution-unknown",
),
).toBeVisible({ timeout: 15_000 });
await expect(
frigateApp.page.getByTestId(
"health-problem-stream:garage:0:resolution-unknown",
),
).toHaveCount(0);
// the startup probe's own row already covers this camera
await expect(
frigateApp.page.getByTestId(
"health-problem-stream:front_door:0:resolution-unknown",
),
).toHaveCount(0);
});
test("wizard-only Reolink advice stays off the tab", async ({
frigateApp,
}) => {