verifaied 0.38.1.dev115__tar.gz → 0.38.2.dev116__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/PKG-INFO +1 -1
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/pyproject.toml +1 -1
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/src/verifaied/video_render.js +91 -23
- verifaied-0.38.2.dev116/tests/test_render_parity.py +179 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/tests/test_video_render_runner.py +100 -1
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/uv.lock +1 -1
- verifaied-0.38.1.dev115/tests/test_render_parity.py +0 -67
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/.gitignore +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/LICENSE +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/README.md +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/src/verifaied/__init__.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/src/verifaied/__main__.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/src/verifaied/agent_mcp.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/src/verifaied/agent_steps.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/src/verifaied/analyzer.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/src/verifaied/audit.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/src/verifaied/cli.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/src/verifaied/client.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/src/verifaied/collect_browser.js +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/src/verifaied/collect_browser.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/src/verifaied/config.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/src/verifaied/credentials.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/src/verifaied/failure_text.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/src/verifaied/finishing.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/src/verifaied/instrument.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/src/verifaied/instrument_snippets.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/src/verifaied/instrumenter.js +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/src/verifaied/instrumenter.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/src/verifaied/lanes.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/src/verifaied/logincmd.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/src/verifaied/prompts.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/src/verifaied/proxy.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/src/verifaied/record.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/src/verifaied/recorder_driver.js +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/src/verifaied/recorder_observer.js +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/src/verifaied/recorder_picker.js +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/src/verifaied/recorder_refs.js +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/src/verifaied/recorder_spec.js +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/src/verifaied/replay_harvest.ts +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/src/verifaied/repo_config.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/src/verifaied/run_reporter.js +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/src/verifaied/runner_dir.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/src/verifaied/setupcmd.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/src/verifaied/skill/SKILL.md +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/src/verifaied/skill/reference/commands.md +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/src/verifaied/skillcmd.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/src/verifaied/source_index.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/src/verifaied/stepcheck.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/src/verifaied/subprocess_util.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/src/verifaied/suite_report.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/src/verifaied/testcmd.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/src/verifaied/uploader.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/src/verifaied/varcmd.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/src/verifaied/video_render.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/tests/__init__.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/tests/conftest.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/tests/test_agent_mcp.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/tests/test_audit.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/tests/test_browser_settings_parity.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/tests/test_caption_parity.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/tests/test_check.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/tests/test_check_done.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/tests/test_clear_manual.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/tests/test_cli.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/tests/test_client.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/tests/test_collect_browser.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/tests/test_config.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/tests/test_console_label_parity.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/tests/test_credentials.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/tests/test_finishing.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/tests/test_help_markup.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/tests/test_instrument.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/tests/test_instrument_detect.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/tests/test_instrument_snippets.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/tests/test_instrumenter.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/tests/test_lanes.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/tests/test_login_commands.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/tests/test_logincmd.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/tests/test_pause_parity.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/tests/test_prompt_parity.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/tests/test_proxy.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/tests/test_record.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/tests/test_replay_harvest_runner.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/tests/test_repo_config.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/tests/test_setupcmd.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/tests/test_skill_parity.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/tests/test_skillcmd.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/tests/test_source_index.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/tests/test_stepcheck_parity.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/tests/test_suite_report.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/tests/test_testcmd.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/tests/test_uploader.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/tests/test_varcmd.py +0 -0
- {verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/tests/test_video_render.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: verifaied
|
|
3
|
-
Version: 0.38.
|
|
3
|
+
Version: 0.38.2.dev116
|
|
4
4
|
Summary: Verify what your AI coding agent built: per-function test coverage, recorded browser tests and a done verdict, for Claude Code, Codex and Cursor
|
|
5
5
|
Project-URL: Homepage, https://verifaied.app
|
|
6
6
|
Project-URL: Documentation, https://verifaied.app/documentation
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "verifaied"
|
|
3
|
-
version = "0.38.
|
|
3
|
+
version = "0.38.2.dev116"
|
|
4
4
|
description = "Verify what your AI coding agent built: per-function test coverage, recorded browser tests and a done verdict, for Claude Code, Codex and Cursor"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.10"
|
|
@@ -10,7 +10,9 @@
|
|
|
10
10
|
// bar and the cursor on top, in the order a live run stacks them — and
|
|
11
11
|
// writes it to ffmpeg as many times as it repeats. ffmpeg is Playwright's
|
|
12
12
|
// own, run with the arguments Playwright records its videos with, so a
|
|
13
|
-
// rendered video is the same kind of file a live one is
|
|
13
|
+
// rendered video is the same kind of file a live one is — VP8 from the
|
|
14
|
+
// build Playwright shipped up to 1.64, VP9 from the one it ships since,
|
|
15
|
+
// which has no VP8 encoder at all.
|
|
14
16
|
//
|
|
15
17
|
// One JSON line on stdout is the answer: {"ok": true, "frames": N} or
|
|
16
18
|
// {"ok": false, "error": "..."}.
|
|
@@ -18,7 +20,7 @@
|
|
|
18
20
|
|
|
19
21
|
const fs = require("fs");
|
|
20
22
|
const path = require("path");
|
|
21
|
-
const { spawn } = require("child_process");
|
|
23
|
+
const { spawn, spawnSync } = require("child_process");
|
|
22
24
|
|
|
23
25
|
const ORIGIN = "http://frames.verifaied";
|
|
24
26
|
|
|
@@ -27,10 +29,63 @@ function loadPlaywright() {
|
|
|
27
29
|
return require(entry);
|
|
28
30
|
}
|
|
29
31
|
|
|
30
|
-
//
|
|
31
|
-
//
|
|
32
|
-
|
|
32
|
+
// Which codec an ffmpeg can encode, read from what `ffmpeg -encoders`
|
|
33
|
+
// prints: "vp8", "vp9", or null for neither. Playwright's own build has
|
|
34
|
+
// exactly one of the two — VP8 (`libvpx`) up to ffmpeg-1011, VP9
|
|
35
|
+
// (`libvpx-vp9`) from ffmpeg-1013, which Playwright 1.65 installs — and
|
|
36
|
+
// asking a build for the one it lacks is an ffmpeg that exits before it
|
|
37
|
+
// reads a frame. VP8 first, so an ffmpeg with both renders what it always
|
|
38
|
+
// has.
|
|
39
|
+
function codecOf(encoders) {
|
|
40
|
+
const names = new Set();
|
|
41
|
+
for (const line of String(encoders).split("\n")) {
|
|
42
|
+
const match = /^\s*V[\w.]{5}\s+(\S+)/.exec(line);
|
|
43
|
+
if (match) names.add(match[1]);
|
|
44
|
+
}
|
|
45
|
+
if (names.has("libvpx") || names.has("vp8")) return "vp8";
|
|
46
|
+
if (names.has("libvpx-vp9")) return "vp9";
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function probeCodec(ffmpeg) {
|
|
51
|
+
const probe = spawnSync(ffmpeg, ["-hide_banner", "-encoders"], { encoding: "utf-8" });
|
|
52
|
+
const codec = probe.error ? null : codecOf(probe.stdout);
|
|
53
|
+
if (!codec) {
|
|
54
|
+
throw new Error(
|
|
55
|
+
`${ffmpeg} can encode neither VP8 nor VP9 — run \`npx playwright install ffmpeg\``,
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
return codec;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// What `RecordVideo` in playwright-core hands ffmpeg for the output — 1.60's
|
|
62
|
+
// arguments for VP8, 1.65's for VP9 — with the input rate stated so a
|
|
63
|
+
// frame written once is one 40 ms frame of output.
|
|
64
|
+
function ffmpegArgs(config, codec) {
|
|
33
65
|
const { width, height, fps, out } = config;
|
|
66
|
+
// Playwright 1.65 scales the bitrate and the threads with the pixels a
|
|
67
|
+
// second, against 800x450 at its own 25 fps.
|
|
68
|
+
const scale = Math.max(1, (width * height * fps) / (800 * 450 * 25));
|
|
69
|
+
const threads = Math.min(8, Math.ceil(scale / 4));
|
|
70
|
+
const encode =
|
|
71
|
+
codec === "vp9"
|
|
72
|
+
? [
|
|
73
|
+
"-c:v", "libvpx-vp9",
|
|
74
|
+
"-qmin", "0", "-qmax", "50", "-crf", "8",
|
|
75
|
+
"-deadline", "realtime", "-cpu-used", "8",
|
|
76
|
+
"-lag-in-frames", "0",
|
|
77
|
+
"-b:v", `${Math.round(scale * 1000)}k`,
|
|
78
|
+
"-threads", String(threads),
|
|
79
|
+
"-tile-columns", String(Math.ceil(Math.log2(threads))),
|
|
80
|
+
"-row-mt", "1",
|
|
81
|
+
]
|
|
82
|
+
: [
|
|
83
|
+
"-c:v", "vp8",
|
|
84
|
+
"-qmin", "0", "-qmax", "50", "-crf", "8",
|
|
85
|
+
"-deadline", "realtime", "-speed", "8",
|
|
86
|
+
"-b:v", "1M",
|
|
87
|
+
"-threads", "1",
|
|
88
|
+
];
|
|
34
89
|
return [
|
|
35
90
|
"-loglevel", "error",
|
|
36
91
|
"-f", "image2pipe",
|
|
@@ -43,11 +98,7 @@ function ffmpegArgs(config) {
|
|
|
43
98
|
"-i", "pipe:0",
|
|
44
99
|
"-y", "-an",
|
|
45
100
|
"-r", String(fps),
|
|
46
|
-
|
|
47
|
-
"-qmin", "0", "-qmax", "50", "-crf", "8",
|
|
48
|
-
"-deadline", "realtime", "-speed", "8",
|
|
49
|
-
"-b:v", "1M",
|
|
50
|
-
"-threads", "1",
|
|
101
|
+
...encode,
|
|
51
102
|
"-vf", `pad=${width}:${height}:0:0:gray,crop=${width}:${height}:0:0`,
|
|
52
103
|
out,
|
|
53
104
|
];
|
|
@@ -207,6 +258,7 @@ function write(stream, buffer) {
|
|
|
207
258
|
|
|
208
259
|
async function main() {
|
|
209
260
|
const config = JSON.parse(fs.readFileSync(process.argv[2], "utf-8"));
|
|
261
|
+
const codec = probeCodec(config.ffmpeg);
|
|
210
262
|
const { chromium } = loadPlaywright();
|
|
211
263
|
const browser = await chromium.launch({ args: ["--disable-gpu"] });
|
|
212
264
|
let ffmpeg = null;
|
|
@@ -230,19 +282,31 @@ async function main() {
|
|
|
230
282
|
marks: config.marks,
|
|
231
283
|
actionFontPx: config.actionFontPx,
|
|
232
284
|
});
|
|
233
|
-
ffmpeg = spawn(config.ffmpeg, ffmpegArgs(config), {
|
|
285
|
+
ffmpeg = spawn(config.ffmpeg, ffmpegArgs(config, codec), {
|
|
286
|
+
stdio: ["pipe", "ignore", "pipe"],
|
|
287
|
+
});
|
|
234
288
|
let stderr = "";
|
|
235
289
|
ffmpeg.stderr.on("data", (chunk) => (stderr += chunk));
|
|
236
290
|
const exited = new Promise((resolve) => ffmpeg.on("close", (code) => resolve(code)));
|
|
291
|
+
// An ffmpeg that gives up closes its end of the pipe, and the write
|
|
292
|
+
// that finds it closed says only that — why it gave up is on its
|
|
293
|
+
// stderr. So a failed write waits for the exit and reports that.
|
|
294
|
+
let gone = false;
|
|
295
|
+
ffmpeg.stdin.on("error", () => (gone = true));
|
|
237
296
|
let written = 0;
|
|
238
|
-
|
|
239
|
-
const
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
297
|
+
try {
|
|
298
|
+
for (const entry of config.frames) {
|
|
299
|
+
const buffer = Buffer.from(await page.evaluate(drawFrame, entry), "base64");
|
|
300
|
+
for (let i = 0; i < entry.repeat; i++) {
|
|
301
|
+
await write(ffmpeg.stdin, buffer);
|
|
302
|
+
written += 1;
|
|
303
|
+
}
|
|
243
304
|
}
|
|
305
|
+
ffmpeg.stdin.end();
|
|
306
|
+
} catch (error) {
|
|
307
|
+
if (!gone && !ffmpeg.stdin.destroyed) throw error;
|
|
308
|
+
throw new Error(`ffmpeg exited ${await exited}: ${stderr.trim()}`);
|
|
244
309
|
}
|
|
245
|
-
ffmpeg.stdin.end();
|
|
246
310
|
const code = await exited;
|
|
247
311
|
if (code !== 0) throw new Error(`ffmpeg exited ${code}: ${stderr.trim()}`);
|
|
248
312
|
process.stdout.write(JSON.stringify({ ok: true, frames: written }) + "\n");
|
|
@@ -252,9 +316,13 @@ async function main() {
|
|
|
252
316
|
}
|
|
253
317
|
}
|
|
254
318
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
)
|
|
259
|
-
|
|
260
|
-
})
|
|
319
|
+
module.exports = { codecOf, ffmpegArgs };
|
|
320
|
+
|
|
321
|
+
if (require.main === module) {
|
|
322
|
+
main().catch((error) => {
|
|
323
|
+
process.stdout.write(
|
|
324
|
+
JSON.stringify({ ok: false, error: String(error && error.message ? error.message : error) }) + "\n",
|
|
325
|
+
);
|
|
326
|
+
process.exit(1);
|
|
327
|
+
});
|
|
328
|
+
}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
"""Parity guard: a rendered video draws what a live one does.
|
|
2
|
+
|
|
3
|
+
The harvest (``replay_harvest.ts``) paces a live replay; the renderer
|
|
4
|
+
(``video_render.py`` and its compositor ``video_render.js``) paces a fast
|
|
5
|
+
one afterwards from what the harvest recorded. Nothing joins the three at
|
|
6
|
+
runtime, so a cursor that glides at one speed live and another rendered,
|
|
7
|
+
a caption that lingers longer in one, or a timeline the harvest writes
|
|
8
|
+
under a name the renderer does not look for, would only show up as a
|
|
9
|
+
video that looks wrong. Read the source text and hold each value to one.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
from __future__ import annotations
|
|
13
|
+
|
|
14
|
+
import json
|
|
15
|
+
import re
|
|
16
|
+
import shutil
|
|
17
|
+
import subprocess
|
|
18
|
+
|
|
19
|
+
import pytest
|
|
20
|
+
|
|
21
|
+
from verifaied.testcmd import HARVEST_MODULE_PATH, HOLD_HOOK
|
|
22
|
+
from verifaied.video_render import (
|
|
23
|
+
CAPTION_LINGER_MS,
|
|
24
|
+
FULL_TRAVEL_PX,
|
|
25
|
+
MIN_TRAVEL_FRACTION,
|
|
26
|
+
RENDER_SCRIPT_PATH,
|
|
27
|
+
TIMELINE_FILE,
|
|
28
|
+
TIMELINE_VERSION,
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
HARVEST = HARVEST_MODULE_PATH.read_text(encoding="utf-8")
|
|
32
|
+
COMPOSITOR = RENDER_SCRIPT_PATH.read_text(encoding="utf-8")
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def _const(source: str, name: str) -> str:
|
|
36
|
+
match = re.search(rf"\bconst {name} = ([^;]+);", source)
|
|
37
|
+
assert match is not None, name
|
|
38
|
+
return match.group(1).strip()
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def test_the_cursor_travels_the_same_live_and_rendered():
|
|
42
|
+
assert int(_const(HARVEST, "FULL_TRAVEL_PX")) == FULL_TRAVEL_PX
|
|
43
|
+
assert float(_const(HARVEST, "MIN_TRAVEL_FRACTION")) == MIN_TRAVEL_FRACTION
|
|
44
|
+
# Its easing is the one transition the harvest gives the dot.
|
|
45
|
+
assert "cubic-bezier(0.2, 0.8, 0.2, 1)" in HARVEST
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def test_a_caption_lingers_the_same_live_and_rendered():
|
|
49
|
+
assert int(_const(HARVEST, "CAPTION_LINGER_MS").replace("_", "")) == (
|
|
50
|
+
CAPTION_LINGER_MS
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def test_the_harvest_writes_the_timeline_the_renderer_reads():
|
|
55
|
+
assert _const(HARVEST, "TIMELINE_FILE") == f'"{TIMELINE_FILE}"'
|
|
56
|
+
assert int(_const(HARVEST, "TIMELINE_VERSION")) == TIMELINE_VERSION
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def test_the_hold_hook_is_the_one_the_harvest_defines():
|
|
60
|
+
name = HOLD_HOOK.removeprefix("globalThis.")
|
|
61
|
+
assert f"{name}?: (ms: number) => Promise<void>" in HARVEST
|
|
62
|
+
assert f").{name} =" in HARVEST
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def test_the_cursor_and_the_caption_bar_look_the_same_drawn_either_way():
|
|
66
|
+
for colour in ("rgba(220, 38, 38, 0.9)", "rgba(0, 0, 0, 0.78)"):
|
|
67
|
+
assert colour in HARVEST
|
|
68
|
+
assert colour in COMPOSITOR
|
|
69
|
+
assert '"500 16px/1.35 system-ui' in HARVEST
|
|
70
|
+
assert "500 16px system-ui" in COMPOSITOR
|
|
71
|
+
assert 'bottom: "48px"' in HARVEST
|
|
72
|
+
assert "height - 48 - boxH" in COMPOSITOR
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
# What `ffmpeg -encoders` prints, from the build Playwright shipped up to
|
|
76
|
+
# 1.64 (ffmpeg-1011) and the one it ships from 1.65 (ffmpeg-1013).
|
|
77
|
+
ENCODERS_HEAD = "Encoders:\n V..... = Video\n ------\n"
|
|
78
|
+
VP8_BUILD = (
|
|
79
|
+
ENCODERS_HEAD
|
|
80
|
+
+ " VF...D png PNG (Portable Network Graphics) image\n"
|
|
81
|
+
+ " V....D libvpx libvpx VP8 (codec vp8)\n"
|
|
82
|
+
)
|
|
83
|
+
VP9_BUILD = (
|
|
84
|
+
ENCODERS_HEAD
|
|
85
|
+
+ " VF...D png PNG (Portable Network Graphics) image\n"
|
|
86
|
+
+ " V....D libvpx-vp9 libvpx VP9 (codec vp9)\n"
|
|
87
|
+
)
|
|
88
|
+
NEITHER_BUILD = (
|
|
89
|
+
ENCODERS_HEAD
|
|
90
|
+
+ " VF...D png PNG (Portable Network Graphics) image\n"
|
|
91
|
+
)
|
|
92
|
+
INPUT_ARGS = [
|
|
93
|
+
"-loglevel", "error",
|
|
94
|
+
"-f", "image2pipe",
|
|
95
|
+
"-avioflags", "direct",
|
|
96
|
+
"-fpsprobesize", "0",
|
|
97
|
+
"-probesize", "32",
|
|
98
|
+
"-analyzeduration", "0",
|
|
99
|
+
"-framerate", "25",
|
|
100
|
+
"-c:v", "mjpeg",
|
|
101
|
+
"-i", "pipe:0",
|
|
102
|
+
"-y", "-an",
|
|
103
|
+
"-r", "25",
|
|
104
|
+
] # fmt: skip
|
|
105
|
+
|
|
106
|
+
needs_node = pytest.mark.skipif(
|
|
107
|
+
shutil.which("node") is None, reason="node is not installed"
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
def _compositor(expression: str, *values: object) -> object:
|
|
112
|
+
"""Evaluate ``expression`` against the compositor's exports, with
|
|
113
|
+
``values`` as ``args``."""
|
|
114
|
+
out = subprocess.run(
|
|
115
|
+
[
|
|
116
|
+
"node",
|
|
117
|
+
"-e",
|
|
118
|
+
"const c = require(process.argv[1]);"
|
|
119
|
+
"const args = JSON.parse(process.argv[2]);"
|
|
120
|
+
f"console.log(JSON.stringify({expression}));",
|
|
121
|
+
str(RENDER_SCRIPT_PATH),
|
|
122
|
+
json.dumps(values),
|
|
123
|
+
],
|
|
124
|
+
capture_output=True,
|
|
125
|
+
text=True,
|
|
126
|
+
timeout=30,
|
|
127
|
+
check=True,
|
|
128
|
+
)
|
|
129
|
+
return json.loads(out.stdout)
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
@needs_node
|
|
133
|
+
def test_the_codec_is_the_one_the_ffmpeg_can_encode():
|
|
134
|
+
assert _compositor("c.codecOf(args[0])", VP8_BUILD) == "vp8"
|
|
135
|
+
assert _compositor("c.codecOf(args[0])", VP9_BUILD) == "vp9"
|
|
136
|
+
assert _compositor("c.codecOf(args[0])", NEITHER_BUILD) is None
|
|
137
|
+
# An ffmpeg with both keeps rendering what it always has.
|
|
138
|
+
both = VP9_BUILD + " V....D libvpx libvpx VP8 (codec vp8)\n"
|
|
139
|
+
assert _compositor("c.codecOf(args[0])", both) == "vp8"
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
@needs_node
|
|
143
|
+
def test_a_vp8_ffmpeg_is_run_as_playwright_ran_it_up_to_1_64():
|
|
144
|
+
config = {"width": 1280, "height": 900, "fps": 25, "out": "/tmp/paced.webm"}
|
|
145
|
+
assert _compositor("c.ffmpegArgs(args[0], 'vp8')", config) == [
|
|
146
|
+
*INPUT_ARGS,
|
|
147
|
+
"-c:v", "vp8",
|
|
148
|
+
"-qmin", "0", "-qmax", "50", "-crf", "8",
|
|
149
|
+
"-deadline", "realtime", "-speed", "8",
|
|
150
|
+
"-b:v", "1M",
|
|
151
|
+
"-threads", "1",
|
|
152
|
+
"-vf", "pad=1280:900:0:0:gray,crop=1280:900:0:0",
|
|
153
|
+
"/tmp/paced.webm",
|
|
154
|
+
] # fmt: skip
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
@needs_node
|
|
158
|
+
def test_a_vp9_ffmpeg_is_run_as_playwright_runs_it_from_1_65():
|
|
159
|
+
config = {"width": 1280, "height": 900, "fps": 25, "out": "/tmp/paced.webm"}
|
|
160
|
+
assert _compositor("c.ffmpegArgs(args[0], 'vp9')", config) == [
|
|
161
|
+
*INPUT_ARGS,
|
|
162
|
+
"-c:v", "libvpx-vp9",
|
|
163
|
+
"-qmin", "0", "-qmax", "50", "-crf", "8",
|
|
164
|
+
"-deadline", "realtime", "-cpu-used", "8",
|
|
165
|
+
"-lag-in-frames", "0",
|
|
166
|
+
"-b:v", "3200k",
|
|
167
|
+
"-threads", "1",
|
|
168
|
+
"-tile-columns", "0",
|
|
169
|
+
"-row-mt", "1",
|
|
170
|
+
"-vf", "pad=1280:900:0:0:gray,crop=1280:900:0:0",
|
|
171
|
+
"/tmp/paced.webm",
|
|
172
|
+
] # fmt: skip
|
|
173
|
+
# A bigger picture gets the bitrate, the threads and the tile columns
|
|
174
|
+
# Playwright scales with it.
|
|
175
|
+
big = {"width": 3840, "height": 2160, "fps": 25, "out": "/tmp/paced.webm"}
|
|
176
|
+
args = _compositor("c.ffmpegArgs(args[0], 'vp9')", big)
|
|
177
|
+
assert args[args.index("-b:v") + 1] == "23040k"
|
|
178
|
+
assert args[args.index("-threads") + 1] == "6"
|
|
179
|
+
assert args[args.index("-tile-columns") + 1] == "3"
|
|
@@ -18,6 +18,7 @@ from __future__ import annotations
|
|
|
18
18
|
|
|
19
19
|
import json
|
|
20
20
|
import shutil
|
|
21
|
+
import stat
|
|
21
22
|
import subprocess
|
|
22
23
|
import tempfile
|
|
23
24
|
import time
|
|
@@ -42,6 +43,7 @@ from verifaied.testcmd import (
|
|
|
42
43
|
)
|
|
43
44
|
from verifaied.video_render import (
|
|
44
45
|
PACED_VIDEO_NAME,
|
|
46
|
+
RENDER_SCRIPT_PATH,
|
|
45
47
|
TIMELINE_FILE,
|
|
46
48
|
find_ffmpeg,
|
|
47
49
|
read_timeline,
|
|
@@ -315,7 +317,7 @@ def test_a_fast_run_is_rendered_with_its_cursor_marks_captions_and_holds(
|
|
|
315
317
|
assert b > r and b >= g and (r, g, b) != (255, 255, 255), marked
|
|
316
318
|
# The caption bar sits bottom centre while the check is held.
|
|
317
319
|
assert any(_dark(pixel) for pixel in held_a["pixels"]), held_a
|
|
318
|
-
# The same frame held. VP8
|
|
320
|
+
# The same frame held. VP8 and VP9 keep refining a repeated frame, which moves
|
|
319
321
|
# a pixel here and there by a few levels; a page that moved changes
|
|
320
322
|
# whole regions. So the measure is the mean, not the worst pixel.
|
|
321
323
|
pairs = list(zip(held_a["samples"], held_b["samples"], strict=True))
|
|
@@ -325,3 +327,100 @@ def test_a_fast_run_is_rendered_with_its_cursor_marks_captions_and_holds(
|
|
|
325
327
|
half = sum(_dark(rgb) for rgb in half_typed["pixels"])
|
|
326
328
|
full = sum(_dark(rgb) for rgb in all_typed["pixels"])
|
|
327
329
|
assert 0 < half < full, (half, full)
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
# An ffmpeg that answers the encoder probe ({encoders}) and then gives up
|
|
333
|
+
# on the encode, as a build asked for an encoder it lacks does.
|
|
334
|
+
FAKE_FFMPEG = """#!/bin/sh
|
|
335
|
+
if [ "$2" = "-encoders" ]; then
|
|
336
|
+
echo "{encoders}"
|
|
337
|
+
exit 0
|
|
338
|
+
fi
|
|
339
|
+
echo "Unknown encoder" >&2
|
|
340
|
+
exit 8
|
|
341
|
+
"""
|
|
342
|
+
|
|
343
|
+
FRAME = """
|
|
344
|
+
const entry = require.resolve("@playwright/test", { paths: [process.cwd()] });
|
|
345
|
+
const { chromium } = require(entry);
|
|
346
|
+
(async () => {
|
|
347
|
+
const browser = await chromium.launch({ args: ["--disable-gpu"] });
|
|
348
|
+
const page = await browser.newPage({ viewport: { width: 320, height: 200 } });
|
|
349
|
+
await page.screenshot({ path: process.argv[2], type: "jpeg" });
|
|
350
|
+
await browser.close();
|
|
351
|
+
})();
|
|
352
|
+
"""
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
def _compose(runner_dir: Path, encoders: str) -> subprocess.CompletedProcess[str]:
|
|
356
|
+
"""Run the compositor over one frame with a fake ffmpeg that lists
|
|
357
|
+
``encoders`` and fails every encode."""
|
|
358
|
+
frames = runner_dir / "frames"
|
|
359
|
+
frames.mkdir()
|
|
360
|
+
script = runner_dir / "frame.cjs"
|
|
361
|
+
script.write_text(FRAME, encoding="utf-8")
|
|
362
|
+
subprocess.run(
|
|
363
|
+
["node", str(script), str(frames / "one.jpeg")],
|
|
364
|
+
cwd=runner_dir,
|
|
365
|
+
capture_output=True,
|
|
366
|
+
timeout=120,
|
|
367
|
+
check=True,
|
|
368
|
+
)
|
|
369
|
+
ffmpeg = runner_dir / "fake-ffmpeg"
|
|
370
|
+
ffmpeg.write_text(FAKE_FFMPEG.format(encoders=encoders), encoding="utf-8")
|
|
371
|
+
ffmpeg.chmod(ffmpeg.stat().st_mode | stat.S_IXUSR)
|
|
372
|
+
config = runner_dir / "render.json"
|
|
373
|
+
config.write_text(
|
|
374
|
+
json.dumps(
|
|
375
|
+
{
|
|
376
|
+
"framesDir": str(frames),
|
|
377
|
+
"out": str(runner_dir / PACED_VIDEO_NAME),
|
|
378
|
+
"ffmpeg": str(ffmpeg),
|
|
379
|
+
"width": 320,
|
|
380
|
+
"height": 200,
|
|
381
|
+
"fps": 25,
|
|
382
|
+
"actionFontPx": 16,
|
|
383
|
+
"marks": [],
|
|
384
|
+
"frames": [
|
|
385
|
+
{
|
|
386
|
+
"frame": "one.jpeg",
|
|
387
|
+
"cursor": None,
|
|
388
|
+
"mark": None,
|
|
389
|
+
"caption": "",
|
|
390
|
+
"opacity": 1,
|
|
391
|
+
"repeat": 200,
|
|
392
|
+
}
|
|
393
|
+
],
|
|
394
|
+
}
|
|
395
|
+
),
|
|
396
|
+
encoding="utf-8",
|
|
397
|
+
)
|
|
398
|
+
return subprocess.run(
|
|
399
|
+
["node", str(RENDER_SCRIPT_PATH), str(config)],
|
|
400
|
+
cwd=runner_dir,
|
|
401
|
+
capture_output=True,
|
|
402
|
+
text=True,
|
|
403
|
+
timeout=120,
|
|
404
|
+
check=False,
|
|
405
|
+
)
|
|
406
|
+
|
|
407
|
+
|
|
408
|
+
def test_an_ffmpeg_that_gives_up_is_reported_in_its_own_words(runner_dir: Path):
|
|
409
|
+
run = _compose(runner_dir, " V....D libvpx-vp9 libvpx VP9 (codec vp9)")
|
|
410
|
+
assert run.returncode == 1
|
|
411
|
+
assert json.loads(run.stdout.strip().splitlines()[-1]) == {
|
|
412
|
+
"ok": False,
|
|
413
|
+
"error": "ffmpeg exited 8: Unknown encoder",
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
def test_an_ffmpeg_with_neither_codec_is_refused_before_anything_is_drawn(
|
|
418
|
+
runner_dir: Path,
|
|
419
|
+
):
|
|
420
|
+
run = _compose(runner_dir, " VF...D png PNG image")
|
|
421
|
+
assert run.returncode == 1
|
|
422
|
+
assert json.loads(run.stdout.strip().splitlines()[-1]) == {
|
|
423
|
+
"ok": False,
|
|
424
|
+
"error": f"{runner_dir / 'fake-ffmpeg'} can encode neither VP8 nor VP9"
|
|
425
|
+
" — run `npx playwright install ffmpeg`",
|
|
426
|
+
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"""Parity guard: a rendered video draws what a live one does.
|
|
2
|
-
|
|
3
|
-
The harvest (``replay_harvest.ts``) paces a live replay; the renderer
|
|
4
|
-
(``video_render.py`` and its compositor ``video_render.js``) paces a fast
|
|
5
|
-
one afterwards from what the harvest recorded. Nothing joins the three at
|
|
6
|
-
runtime, so a cursor that glides at one speed live and another rendered,
|
|
7
|
-
a caption that lingers longer in one, or a timeline the harvest writes
|
|
8
|
-
under a name the renderer does not look for, would only show up as a
|
|
9
|
-
video that looks wrong. Read the source text and hold each value to one.
|
|
10
|
-
"""
|
|
11
|
-
|
|
12
|
-
from __future__ import annotations
|
|
13
|
-
|
|
14
|
-
import re
|
|
15
|
-
|
|
16
|
-
from verifaied.testcmd import HARVEST_MODULE_PATH, HOLD_HOOK
|
|
17
|
-
from verifaied.video_render import (
|
|
18
|
-
CAPTION_LINGER_MS,
|
|
19
|
-
FULL_TRAVEL_PX,
|
|
20
|
-
MIN_TRAVEL_FRACTION,
|
|
21
|
-
RENDER_SCRIPT_PATH,
|
|
22
|
-
TIMELINE_FILE,
|
|
23
|
-
TIMELINE_VERSION,
|
|
24
|
-
)
|
|
25
|
-
|
|
26
|
-
HARVEST = HARVEST_MODULE_PATH.read_text(encoding="utf-8")
|
|
27
|
-
COMPOSITOR = RENDER_SCRIPT_PATH.read_text(encoding="utf-8")
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
def _const(source: str, name: str) -> str:
|
|
31
|
-
match = re.search(rf"\bconst {name} = ([^;]+);", source)
|
|
32
|
-
assert match is not None, name
|
|
33
|
-
return match.group(1).strip()
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
def test_the_cursor_travels_the_same_live_and_rendered():
|
|
37
|
-
assert int(_const(HARVEST, "FULL_TRAVEL_PX")) == FULL_TRAVEL_PX
|
|
38
|
-
assert float(_const(HARVEST, "MIN_TRAVEL_FRACTION")) == MIN_TRAVEL_FRACTION
|
|
39
|
-
# Its easing is the one transition the harvest gives the dot.
|
|
40
|
-
assert "cubic-bezier(0.2, 0.8, 0.2, 1)" in HARVEST
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
def test_a_caption_lingers_the_same_live_and_rendered():
|
|
44
|
-
assert int(_const(HARVEST, "CAPTION_LINGER_MS").replace("_", "")) == (
|
|
45
|
-
CAPTION_LINGER_MS
|
|
46
|
-
)
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
def test_the_harvest_writes_the_timeline_the_renderer_reads():
|
|
50
|
-
assert _const(HARVEST, "TIMELINE_FILE") == f'"{TIMELINE_FILE}"'
|
|
51
|
-
assert int(_const(HARVEST, "TIMELINE_VERSION")) == TIMELINE_VERSION
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
def test_the_hold_hook_is_the_one_the_harvest_defines():
|
|
55
|
-
name = HOLD_HOOK.removeprefix("globalThis.")
|
|
56
|
-
assert f"{name}?: (ms: number) => Promise<void>" in HARVEST
|
|
57
|
-
assert f").{name} =" in HARVEST
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
def test_the_cursor_and_the_caption_bar_look_the_same_drawn_either_way():
|
|
61
|
-
for colour in ("rgba(220, 38, 38, 0.9)", "rgba(0, 0, 0, 0.78)"):
|
|
62
|
-
assert colour in HARVEST
|
|
63
|
-
assert colour in COMPOSITOR
|
|
64
|
-
assert '"500 16px/1.35 system-ui' in HARVEST
|
|
65
|
-
assert "500 16px system-ui" in COMPOSITOR
|
|
66
|
-
assert 'bottom: "48px"' in HARVEST
|
|
67
|
-
assert "height - 48 - boxH" in COMPOSITOR
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{verifaied-0.38.1.dev115 → verifaied-0.38.2.dev116}/src/verifaied/skill/reference/commands.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|