mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-10-30 17:27:09 +00:00
test(producer): widen the rootBodyMismatch diagnostic to compare import paths
Still not a real fix. The previous diagnostic (ca4e73983) proved the
imported HTML_BODY_CSS_WIDTH_FIRST_RE has 4 capture groups in the failing
CI run instead of the 2 the source and production code expect, but it used
a dynamic import(), which can resolve through a different codepath than
renderOrchestrator.ts's static import. This adds a static import of the
same binding, a require.resolve() of the resolved file path, and a direct
read of that file's own regex line, so the next run can rule in or out a
static/dynamic resolution split versus a genuinely different file on disk.
Locally both imports agree (2 groups, same object, correct file). To be
removed once the CI answer lands.
Co-Authored-By: Miguel Ángel <miguel.sierra@heygen.com>
This commit is contained in:
co-authored by
Miguel Ángel
parent
ca4e739837
commit
e2e384c8e6
@@ -10,6 +10,9 @@ import {
|
||||
mergeWorkerFrames,
|
||||
} from "@hyperframes/engine";
|
||||
import type { CompiledComposition } from "./htmlCompiler.js";
|
||||
// TEMPORARY: static import mirroring renderOrchestrator.ts's own import, to check
|
||||
// whether a dynamic import() resolves the same regex object CI actually uses.
|
||||
import { HTML_BODY_CSS_WIDTH_FIRST_RE as TEMP_STATIC_WIDTH_FIRST_RE } from "@hyperframes/parsers";
|
||||
|
||||
// Replace only the two engine functions the adaptive-retry loop uses to touch
|
||||
// disk; everything else (distributeFrames, types, etc.) stays real so the loop
|
||||
@@ -2328,8 +2331,26 @@ describe("shouldPreferSingleWorkerDrawElement (DE priority inversion)", () => {
|
||||
// TEMPORARY diagnostic for a CI-only failure that will not reproduce locally.
|
||||
// Remove once the CI log gives us enough to fix or revert.
|
||||
it("TEMP diagnostic: dumps intermediate regex state for the exact-match fixture", async () => {
|
||||
const { HTML_BODY_CSS_WIDTH_FIRST_RE, HTML_BODY_CSS_HEIGHT_FIRST_RE } =
|
||||
await import("@hyperframes/parsers");
|
||||
const { HTML_BODY_CSS_WIDTH_FIRST_RE, default: pkgDefault } =
|
||||
(await import("@hyperframes/parsers")) as Record<string, unknown> as {
|
||||
HTML_BODY_CSS_WIDTH_FIRST_RE: RegExp;
|
||||
default: unknown;
|
||||
};
|
||||
const { createRequire } = await import("node:module");
|
||||
const require = createRequire(import.meta.url);
|
||||
let resolvedPath = "<resolve threw>";
|
||||
let resolvedFileRegexLine = "<read threw>";
|
||||
try {
|
||||
resolvedPath = require.resolve("@hyperframes/parsers");
|
||||
const fs = await import("node:fs");
|
||||
const contents = fs.readFileSync(resolvedPath, "utf8");
|
||||
const line = contents
|
||||
.split("\n")
|
||||
.find((l) => l.includes("HTML_BODY_CSS_WIDTH_FIRST_RE ="));
|
||||
resolvedFileRegexLine = line ?? "<no matching line found in resolved file>";
|
||||
} catch (err) {
|
||||
resolvedFileRegexLine = `<error: ${String(err)}>`;
|
||||
}
|
||||
const rootRe = /<[a-zA-Z][-a-zA-Z0-9]*\b[^>]*\bdata-composition-id=["'][^"']*["'][^>]*>/i;
|
||||
const input = html(1080, 1920, "html, body { width: 1080px; height: 1920px; }");
|
||||
const rootTag = input.match(rootRe)?.[0];
|
||||
@@ -2339,10 +2360,14 @@ describe("shouldPreferSingleWorkerDrawElement (DE priority inversion)", () => {
|
||||
rootTag,
|
||||
dataWidthMatch: rootTag?.match(/\bdata-width=["'](\d+)["']/i)?.[1],
|
||||
dataHeightMatch: rootTag?.match(/\bdata-height=["'](\d+)["']/i)?.[1],
|
||||
widthFirstMatch: input.match(HTML_BODY_CSS_WIDTH_FIRST_RE),
|
||||
heightFirstMatch: input.match(HTML_BODY_CSS_HEIGHT_FIRST_RE),
|
||||
widthFirstReSource: HTML_BODY_CSS_WIDTH_FIRST_RE.source,
|
||||
widthFirstReFlags: HTML_BODY_CSS_WIDTH_FIRST_RE.flags,
|
||||
dynamicImportWidthFirstMatch: input.match(HTML_BODY_CSS_WIDTH_FIRST_RE),
|
||||
staticImportWidthFirstMatch: input.match(TEMP_STATIC_WIDTH_FIRST_RE),
|
||||
dynamicWidthFirstReSource: HTML_BODY_CSS_WIDTH_FIRST_RE.source,
|
||||
staticWidthFirstReSource: TEMP_STATIC_WIDTH_FIRST_RE.source,
|
||||
sameRegexObject: HTML_BODY_CSS_WIDTH_FIRST_RE === TEMP_STATIC_WIDTH_FIRST_RE,
|
||||
hasDefaultExport: pkgDefault !== undefined,
|
||||
resolvedPath,
|
||||
resolvedFileRegexLine,
|
||||
}),
|
||||
);
|
||||
expect(true).toBe(true);
|
||||
|
||||
Reference in New Issue
Block a user