diff --git a/figma-transformer/fixtures/README.md b/figma-transformer/fixtures/README.md index 364b40e6..f0e1b2db 100644 --- a/figma-transformer/fixtures/README.md +++ b/figma-transformer/fixtures/README.md @@ -3,3 +3,5 @@ This directory is for local `.fig` files used while developing the Figma transformer. The fixture files themselves are gitignored because they can be large and may contain private or unreleased designs. Keep small synthetic fixtures in tests instead. + +Real-design readiness evidence must materialize fixtures explicitly on the Lab worker, or point the fixture matrix at an out-of-tree absolute path supplied by the operator. Do not replace a missing remote fixture with a checked-in or ad-hoc local surrogate; run the matrix with `--fixture=/absolute/path/to/file.fig` or `--fixture-dir=/absolute/path/to/fixtures` once the Lab fixture assets are available. diff --git a/figma-transformer/src/Html/HtmlArtifactAssembler.php b/figma-transformer/src/Html/HtmlArtifactAssembler.php index 6178f69c..c5c93dc7 100644 --- a/figma-transformer/src/Html/HtmlArtifactAssembler.php +++ b/figma-transformer/src/Html/HtmlArtifactAssembler.php @@ -109,6 +109,7 @@ public function htmlDocument(string $title, string $stylesheetHref, string $body $mainAttributes = array( 'class="figma-root"', 'data-figma-root="true"', + 'data-static-artifact-capture="ignore"', 'data-page-title="' . $this->sanitizeAttribute(html_entity_decode($title, ENT_QUOTES | ENT_HTML5, 'UTF-8')) . '"', 'aria-label="' . $this->sanitizeAttribute(html_entity_decode($title, ENT_QUOTES | ENT_HTML5, 'UTF-8')) . '"', ); diff --git a/figma-transformer/tests/contract/HtmlValidityContract.php b/figma-transformer/tests/contract/HtmlValidityContract.php index 3fc65f8b..257816d0 100644 --- a/figma-transformer/tests/contract/HtmlValidityContract.php +++ b/figma-transformer/tests/contract/HtmlValidityContract.php @@ -186,7 +186,8 @@ function blocks_engine_figma_transformer_run_html_validity_contract(callable $as $html = $fileContent($result, 'index.html'); $links = $result['source_report']['transform_diagnostics']['links'] ?? array(); - $assert(str_contains($html, '
{ + return page.evaluate(({ pagePath: currentPagePath, limit, computedStyleProperties, nodeIdAttr: idAttr, nodeNameAttrs: nameAttrs, staticArtifactCaptureIgnoreAttr }) => { function normalizeText(value) { return String(value ?? '').replace(/\s+/g, ' ').trim().slice(0, limit); } @@ -398,6 +399,7 @@ async function extractElements(page, pagePath, textSampleLimit, nodeIdAttr, node const elements = Array.from(document.querySelectorAll(`[${idAttr}]`)).map(serializeElement); const unidentifiedElements = Array.from(document.body?.querySelectorAll('*') ?? []) .filter((element) => !element.hasAttribute(idAttr)) + .filter((element) => element.getAttribute(staticArtifactCaptureIgnoreAttr) !== 'ignore') .filter((element) => { const rect = element.getBoundingClientRect(); const style = window.getComputedStyle(element); @@ -420,5 +422,6 @@ async function extractElements(page, pagePath, textSampleLimit, nodeIdAttr, node computedStyleProperties: COMPUTED_STYLE_PROPERTIES, nodeIdAttr, nodeNameAttrs, + staticArtifactCaptureIgnoreAttr: STATIC_ARTIFACT_CAPTURE_IGNORE_ATTR, }); }