fix(cli): address review — clip-duration audit in check, failure classing, crop observability

Port validate's per-media-element clip audit into check's session
(clip_media_fit findings): an intrinsic duration meaningfully shorter
than the data-duration slot silently shortens the slot at render time,
and neither lint nor the runtime listeners can see it. A linter crash
now reports as check_lint_failure instead of masquerading as a runtime
failure. Finding-crop capture failures stay non-gating but emit a
stderr note and a telemetry error event so rollouts can measure the
second-session failure rate.
This commit is contained in:
Miguel Angel Simon Sierra
2026-07-10 17:53:04 -04:00
parent 96cb5e39dd
commit 67cdf0fdb7
4 changed files with 61 additions and 5 deletions
+10 -3
View File
@@ -1,6 +1,6 @@
import { mkdirSync, writeFileSync } from "node:fs";
import { join, relative } from "node:path";
import { trackCheckReport } from "../telemetry/events.js";
import { trackCheckReport, trackCommandFailure } from "../telemetry/events.js";
import { getRunId } from "../telemetry/runId.js";
import type { ProjectDir } from "./project.js";
import { lintProject, shouldBlockRender, type ProjectLintResult } from "./lintProject.js";
@@ -518,7 +518,10 @@ export async function runCheckPipeline(
try {
lintResult = await dependencies.lintProject(project.dir);
} catch (error) {
return failureReport(options, runtimeFailure(error));
// The linter itself crashed (unreadable file, internal error) — distinct
// from lint findings; a runtime-failure code would send the agent hunting
// for a script problem that doesn't exist.
return failureReport(options, runtimeFailure(error, "check_lint_failure"));
}
const lint = buildLintSection(lintResult);
@@ -589,7 +592,11 @@ async function withFindingCrops(
try {
const findingFiles = await dependencies.captureFindingCrops(project, options, cropRequests);
return { ...report, snapshots: { ...report.snapshots, findingFiles } };
} catch {
} catch (error) {
// Still non-gating, but observable: rollouts need the crop-failure rate
// (a second Chrome launch failing/timing out) without failing the run.
console.error(" finding crops skipped: " + normalizeErrorMessage(error));
trackCommandFailure("check-finding-crops", error);
return report;
}
}