diff --git a/packages/blocks-engine/benchmarks/README.md b/packages/blocks-engine/benchmarks/README.md index 8f2e88bf5..54cc4ebdd 100644 --- a/packages/blocks-engine/benchmarks/README.md +++ b/packages/blocks-engine/benchmarks/README.md @@ -82,7 +82,7 @@ local state. Threshold **0**: any drop below baseline trips a non-zero exit. This is the gate. - **Tier B — hook path.** Scored only via cached propose/realize artifacts (`hook-captures/`), replayed deterministically. v1 ships a deterministic stub - hook to prove the seam; a real DLA-hook capture is a fast follow. No live model + hook to prove the seam; a real reference-hook capture is a fast follow. No live model in CI, ever. ## Expected trees (hybrid) diff --git a/packages/blocks-engine/scripts/capture-fixtures.mjs b/packages/blocks-engine/scripts/capture-fixtures.mjs index d0c691899..1fc3b07d4 100644 --- a/packages/blocks-engine/scripts/capture-fixtures.mjs +++ b/packages/blocks-engine/scripts/capture-fixtures.mjs @@ -5,8 +5,11 @@ import { readFile, writeFile } from 'node:fs/promises'; import path from 'node:path'; import { fileURLToPath, pathToFileURL } from 'node:url'; -const DLA_ROOT = process.env.DLA_ROOT ?? '/Users/matt/projects/a8c/data-liberation-agent'; -const BLOCK_FIXER_DIR = path.join(DLA_ROOT, 'scripts/block-fixer'); +const REFERENCE_ROOT = process.env.REFERENCE_ROOT; +if (!REFERENCE_ROOT) { + throw new Error('Set REFERENCE_ROOT to a checkout of the reference implementation.'); +} +const BLOCK_FIXER_DIR = path.join(REFERENCE_ROOT, 'scripts/block-fixer'); const THIS_DIR = path.dirname(fileURLToPath(import.meta.url)); const CASES_PATH = path.resolve(THIS_DIR, '../src/__fixtures__/cases.json'); @@ -199,7 +202,7 @@ function withQuietConsole(fn) { } } -async function loadDlaFunctions() { +async function loadReferenceFunctions() { setupWordPressGlobals(); const requireFromHere = createRequire(import.meta.url); const { convertHtmlToBlocks, fixBlocksInTemplate } = withQuietConsole(() => ({ @@ -208,15 +211,15 @@ async function loadDlaFunctions() { })); try { const { applyBlockRecipe } = await import( - pathToFileURL(path.join(DLA_ROOT, 'src/lib/replicate/apply-block-recipe.ts')).href + pathToFileURL(path.join(REFERENCE_ROOT, 'src/lib/replicate/apply-block-recipe.ts')).href ); const { buildHtmlFallbackBlock } = await import( - pathToFileURL(path.join(DLA_ROOT, 'src/lib/replicate/html-fallback.ts')).href + pathToFileURL(path.join(REFERENCE_ROOT, 'src/lib/replicate/html-fallback.ts')).href ); return { convertHtmlToBlocks, fixBlocksInTemplate, applyBlockRecipe, buildHtmlFallbackBlock }; } catch (error) { throw new Error( - `Unable to import DLA TypeScript modules. Run with DLA tsx, for example: cd ${DLA_ROOT} && ./node_modules/.bin/tsx ${fileURLToPath(import.meta.url)} --check\n${error.message}`, + `Unable to import reference TypeScript modules. Run with the reference checkout's tsx, for example: cd ${REFERENCE_ROOT} && ./node_modules/.bin/tsx ${fileURLToPath(import.meta.url)} --check\n${error.message}`, ); } } @@ -251,7 +254,7 @@ function composeWithFallback(input, applyBlockRecipe, buildHtmlFallbackBlock) { } async function captureCases() { - const { convertHtmlToBlocks, fixBlocksInTemplate, applyBlockRecipe, buildHtmlFallbackBlock } = await loadDlaFunctions(); + const { convertHtmlToBlocks, fixBlocksInTemplate, applyBlockRecipe, buildHtmlFallbackBlock } = await loadReferenceFunctions(); const cases = []; for (const { id, input } of RAW_CASES) { diff --git a/packages/blocks-engine/scripts/capture-native-dispatch-renderer-goldens.mjs b/packages/blocks-engine/scripts/capture-native-dispatch-renderer-goldens.mjs index a1cf787e4..6b63d7a4e 100644 --- a/packages/blocks-engine/scripts/capture-native-dispatch-renderer-goldens.mjs +++ b/packages/blocks-engine/scripts/capture-native-dispatch-renderer-goldens.mjs @@ -4,13 +4,12 @@ import { readFileSync, writeFileSync } from 'node:fs'; import path from 'node:path'; import { fileURLToPath, pathToFileURL } from 'node:url'; -const DLA_COMMIT = '1e393c535850ee1a9482f83459f779d0e225b027'; -const DEFAULT_DLA_ROOT = '/Users/matt/projects/a8c/data-liberation-agent'; +const REFERENCE_COMMIT = '1e393c535850ee1a9482f83459f779d0e225b027'; const __dirname = path.dirname(fileURLToPath(import.meta.url)); const packageRoot = path.resolve(__dirname, '..'); const fixtureUrl = pathToFileURL(path.join(packageRoot, 'src/__fixtures__/native-dispatch-renderer-cases.ts')).href; -const outputPath = path.join(packageRoot, 'src/__fixtures__/native-dispatch-renderer-dla-goldens.json'); +const outputPath = path.join(packageRoot, 'src/__fixtures__/native-dispatch-renderer-reference-goldens.json'); const TSX_BOOTSTRAP_ENV = 'BLOCKS_ENGINE_NATIVE_DISPATCH_GOLDENS_TSX'; function hasTsxLoader() { @@ -34,10 +33,13 @@ const args = new Set(process.argv.slice(2)); const shouldWrite = args.has('--write'); const shouldCheck = args.has('--check'); const shouldStdout = args.has('--stdout') || (!shouldWrite && !shouldCheck); -const dlaRoot = process.env.DLA_ROOT || DEFAULT_DLA_ROOT; +const referenceRoot = process.env.REFERENCE_ROOT; +if (!referenceRoot) { + throw new Error('Set REFERENCE_ROOT to a checkout of the reference implementation at the pinned commit.'); +} function git(args) { - return execFileSync('git', ['-C', dlaRoot, ...args], { encoding: 'utf8' }).trim(); + return execFileSync('git', ['-C', referenceRoot, ...args], { encoding: 'utf8' }).trim(); } function stableJson(value) { @@ -171,23 +173,23 @@ function sandwichedRenderOut(section, result) { function extractCardGroup(markup) { const match = //.exec(markup); - if (!match) throw new Error('Could not extract is-replica-card group from DLA output'); + if (!match) throw new Error('Could not extract is-replica-card group from the reference implementation output'); return match[0]; } const currentCommit = git(['rev-parse', 'HEAD']); -if (currentCommit !== DLA_COMMIT) { - throw new Error(`DLA checkout must be at ${DLA_COMMIT}; got ${currentCommit}`); +if (currentCommit !== REFERENCE_COMMIT) { + throw new Error(`reference checkout must be at ${REFERENCE_COMMIT}; got ${currentCommit}`); } const dirty = git(['status', '--porcelain']); if (dirty) { - throw new Error(`DLA checkout must be clean at ${DLA_COMMIT}; status:\n${dirty}`); + throw new Error(`reference checkout must be clean at ${REFERENCE_COMMIT}; status:\n${dirty}`); } const { nativeDispatchRendererCaseGroups, NATIVE_DISPATCH_RENDERER_DERIVATION } = await import(fixtureUrl); const { reconstructPagePattern } = await import( - pathToFileURL(path.join(dlaRoot, 'src/lib/replicate/page-reconstruct.ts')).href + pathToFileURL(path.join(referenceRoot, 'src/lib/replicate/page-reconstruct.ts')).href ); const cases = nativeDispatchRendererCaseGroups(); @@ -203,7 +205,7 @@ const renderSectionCase = (entry) => { return capture(entry.id, renderOutFromResult(reconstructPagePattern([section], reconstructOptions()))); }; const renderCardGroupCase = (entry) => { - const result = reconstructPagePattern([clone(entry.dlaSection)], reconstructOptions()); + const result = reconstructPagePattern([clone(entry.referenceSection)], reconstructOptions()); return capture(entry.id, { returnValue: extractCardGroup(stripFinalBodyNewline(result.body)), }); @@ -226,7 +228,7 @@ const json = stableJson(parityFile); if (shouldCheck) { const existing = readFileSync(outputPath, 'utf8'); if (existing !== json) { - throw new Error(`${outputPath} is out of date with DLA ${DLA_COMMIT}`); + throw new Error(`${outputPath} is out of date with reference ${REFERENCE_COMMIT}`); } } diff --git a/packages/blocks-engine/scripts/capture-native-section-renderer-goldens.mjs b/packages/blocks-engine/scripts/capture-native-section-renderer-goldens.mjs index cad930476..cdbc35df1 100644 --- a/packages/blocks-engine/scripts/capture-native-section-renderer-goldens.mjs +++ b/packages/blocks-engine/scripts/capture-native-section-renderer-goldens.mjs @@ -4,13 +4,12 @@ import { readFileSync, writeFileSync } from 'node:fs'; import path from 'node:path'; import { fileURLToPath, pathToFileURL } from 'node:url'; -const DLA_COMMIT = '1e393c535850ee1a9482f83459f779d0e225b027'; -const DEFAULT_DLA_ROOT = '/Users/matt/projects/a8c/data-liberation-agent'; +const REFERENCE_COMMIT = '1e393c535850ee1a9482f83459f779d0e225b027'; const __dirname = path.dirname(fileURLToPath(import.meta.url)); const packageRoot = path.resolve(__dirname, '..'); const fixtureUrl = pathToFileURL(path.join(packageRoot, 'src/__fixtures__/native-section-renderer-cases.ts')).href; -const outputPath = path.join(packageRoot, 'src/__fixtures__/native-section-renderer-dla-goldens.json'); +const outputPath = path.join(packageRoot, 'src/__fixtures__/native-section-renderer-reference-goldens.json'); const TSX_BOOTSTRAP_ENV = 'BLOCKS_ENGINE_NATIVE_SECTION_GOLDENS_TSX'; function hasTsxLoader() { @@ -34,10 +33,13 @@ const args = new Set(process.argv.slice(2)); const shouldWrite = args.has('--write'); const shouldCheck = args.has('--check'); const shouldStdout = args.has('--stdout') || (!shouldWrite && !shouldCheck); -const dlaRoot = process.env.DLA_ROOT || DEFAULT_DLA_ROOT; +const referenceRoot = process.env.REFERENCE_ROOT; +if (!referenceRoot) { + throw new Error('Set REFERENCE_ROOT to a checkout of the reference implementation at the pinned commit.'); +} function git(args) { - return execFileSync('git', ['-C', dlaRoot, ...args], { encoding: 'utf8' }).trim(); + return execFileSync('git', ['-C', referenceRoot, ...args], { encoding: 'utf8' }).trim(); } function stableJson(value) { @@ -98,18 +100,18 @@ function renderOutFromResult(result) { } const currentCommit = git(['rev-parse', 'HEAD']); -if (currentCommit !== DLA_COMMIT) { - throw new Error(`DLA checkout must be at ${DLA_COMMIT}; got ${currentCommit}`); +if (currentCommit !== REFERENCE_COMMIT) { + throw new Error(`reference checkout must be at ${REFERENCE_COMMIT}; got ${currentCommit}`); } const dirty = git(['status', '--porcelain']); if (dirty) { - throw new Error(`DLA checkout must be clean at ${DLA_COMMIT}; status:\n${dirty}`); + throw new Error(`reference checkout must be clean at ${REFERENCE_COMMIT}; status:\n${dirty}`); } const { nativeSectionRendererCaseGroups, NATIVE_SECTION_RENDERER_DERIVATION } = await import(fixtureUrl); const { reconstructPagePattern } = await import( - pathToFileURL(path.join(dlaRoot, 'src/lib/replicate/page-reconstruct.ts')).href + pathToFileURL(path.join(referenceRoot, 'src/lib/replicate/page-reconstruct.ts')).href ); const cases = nativeSectionRendererCaseGroups(); @@ -130,7 +132,7 @@ const json = stableJson(parityFile); if (shouldCheck) { const existing = readFileSync(outputPath, 'utf8'); if (existing !== json) { - throw new Error(`${outputPath} is out of date with DLA ${DLA_COMMIT}`); + throw new Error(`${outputPath} is out of date with reference ${REFERENCE_COMMIT}`); } } diff --git a/packages/blocks-engine/scripts/capture-native-text-renderer-goldens.mjs b/packages/blocks-engine/scripts/capture-native-text-renderer-goldens.mjs index ace449820..62f931260 100644 --- a/packages/blocks-engine/scripts/capture-native-text-renderer-goldens.mjs +++ b/packages/blocks-engine/scripts/capture-native-text-renderer-goldens.mjs @@ -4,22 +4,24 @@ import { readFileSync, writeFileSync } from 'node:fs'; import path from 'node:path'; import { fileURLToPath, pathToFileURL } from 'node:url'; -const DLA_COMMIT = '1e393c535850ee1a9482f83459f779d0e225b027'; -const DEFAULT_DLA_ROOT = '/Users/matt/projects/a8c/data-liberation-agent'; +const REFERENCE_COMMIT = '1e393c535850ee1a9482f83459f779d0e225b027'; const __dirname = path.dirname(fileURLToPath(import.meta.url)); const packageRoot = path.resolve(__dirname, '..'); const fixtureUrl = pathToFileURL(path.join(packageRoot, 'src/__fixtures__/native-text-renderer-cases.ts')).href; -const outputPath = path.join(packageRoot, 'src/__fixtures__/native-text-renderer-dla-goldens.json'); +const outputPath = path.join(packageRoot, 'src/__fixtures__/native-text-renderer-reference-goldens.json'); const args = new Set(process.argv.slice(2)); const shouldWrite = args.has('--write'); const shouldCheck = args.has('--check'); const shouldStdout = args.has('--stdout') || (!shouldWrite && !shouldCheck); -const dlaRoot = process.env.DLA_ROOT || DEFAULT_DLA_ROOT; +const referenceRoot = process.env.REFERENCE_ROOT; +if (!referenceRoot) { + throw new Error('Set REFERENCE_ROOT to a checkout of the reference implementation at the pinned commit.'); +} function git(args) { - return execFileSync('git', ['-C', dlaRoot, ...args], { encoding: 'utf8' }).trim(); + return execFileSync('git', ['-C', referenceRoot, ...args], { encoding: 'utf8' }).trim(); } function stableJson(value) { @@ -32,7 +34,7 @@ function stripFinalBodyNewline(markup) { function extractGallery(markup) { const match = markup.match(//); - if (!match) throw new Error('DLA reconstruct output did not contain a wp:gallery block'); + if (!match) throw new Error('reference reconstruct output did not contain a wp:gallery block'); return match[0]; } @@ -85,13 +87,13 @@ function renderOutFromResult(result) { } const currentCommit = git(['rev-parse', 'HEAD']); -if (currentCommit !== DLA_COMMIT) { - throw new Error(`DLA checkout must be at ${DLA_COMMIT}; got ${currentCommit}`); +if (currentCommit !== REFERENCE_COMMIT) { + throw new Error(`reference checkout must be at ${REFERENCE_COMMIT}; got ${currentCommit}`); } const { nativeTextRendererCaseGroups, NATIVE_TEXT_RENDERER_DERIVATION } = await import(fixtureUrl); const { reconstructPagePattern } = await import( - pathToFileURL(path.join(dlaRoot, 'src/lib/replicate/page-reconstruct.ts')).href + pathToFileURL(path.join(referenceRoot, 'src/lib/replicate/page-reconstruct.ts')).href ); const cases = nativeTextRendererCaseGroups(); @@ -147,7 +149,7 @@ const json = stableJson(parityFile); if (shouldCheck) { const existing = readFileSync(outputPath, 'utf8'); if (existing !== json) { - throw new Error(`${outputPath} is out of date with DLA ${DLA_COMMIT}`); + throw new Error(`${outputPath} is out of date with reference ${REFERENCE_COMMIT}`); } } diff --git a/packages/blocks-engine/scripts/capture-region-audit-goldens.mjs b/packages/blocks-engine/scripts/capture-region-audit-goldens.mjs index a2aa4cf98..71f59e080 100644 --- a/packages/blocks-engine/scripts/capture-region-audit-goldens.mjs +++ b/packages/blocks-engine/scripts/capture-region-audit-goldens.mjs @@ -4,13 +4,12 @@ import { readFileSync, writeFileSync } from 'node:fs'; import path from 'node:path'; import { fileURLToPath, pathToFileURL } from 'node:url'; -const DEFAULT_DLA_ROOT = '/Users/matt/projects/a8c/data-liberation-agent'; const TSX_BOOTSTRAP_ENV = 'BLOCKS_ENGINE_REGION_AUDIT_GOLDENS_TSX'; const __dirname = path.dirname(fileURLToPath(import.meta.url)); const packageRoot = path.resolve(__dirname, '..'); const corpusUrl = pathToFileURL(path.join(packageRoot, 'src/__fixtures__/region-audit-corpus.ts')).href; -const outputPath = path.join(packageRoot, 'src/__fixtures__/region-audit-dla-goldens.json'); +const outputPath = path.join(packageRoot, 'src/__fixtures__/region-audit-reference-goldens.json'); function hasTsxLoader() { return process.execArgv.some((arg, index, argv) => { @@ -30,13 +29,13 @@ if (!process.env[TSX_BOOTSTRAP_ENV] && !hasTsxLoader()) { } const { - DLA_REGION_AUDIT_BLOB, - DLA_REGION_AUDIT_COMMIT, - DLA_REGION_AUDIT_PATH, - DLA_REGION_CENSUS_BLOB, - DLA_REGION_CENSUS_PATH, - DLA_SECTION_SELECTOR_BLOB, - DLA_SECTION_SELECTOR_PATH, + REFERENCE_REGION_AUDIT_BLOB, + REFERENCE_REGION_AUDIT_COMMIT, + REFERENCE_REGION_AUDIT_PATH, + REFERENCE_REGION_CENSUS_BLOB, + REFERENCE_REGION_CENSUS_PATH, + REFERENCE_SECTION_SELECTOR_BLOB, + REFERENCE_SECTION_SELECTOR_PATH, runRegionAuditParity, } = await import(corpusUrl); @@ -44,7 +43,10 @@ const args = new Set(process.argv.slice(2)); const shouldWrite = args.has('--write'); const shouldCheck = args.has('--check'); const shouldStdout = args.has('--stdout') || (!shouldWrite && !shouldCheck); -const dlaRoot = process.env.DLA_ROOT || DEFAULT_DLA_ROOT; +const referenceRoot = process.env.REFERENCE_ROOT; +if (!referenceRoot) { + throw new Error('Set REFERENCE_ROOT to a checkout of the reference implementation at the pinned commit.'); +} const explicitModeCount = [shouldWrite, shouldCheck, args.has('--stdout')].filter(Boolean).length; if (explicitModeCount > 1) { @@ -52,7 +54,7 @@ if (explicitModeCount > 1) { } function git(gitArgs) { - return execFileSync('git', ['-C', dlaRoot, ...gitArgs], { encoding: 'utf8' }).trim(); + return execFileSync('git', ['-C', referenceRoot, ...gitArgs], { encoding: 'utf8' }).trim(); } function stableJson(value) { @@ -62,62 +64,62 @@ function stableJson(value) { function verifyBlob(pathName, expectedBlob) { const headBlob = git(['rev-parse', `HEAD:${pathName}`]); if (headBlob !== expectedBlob) { - throw new Error(`DLA ${pathName} HEAD blob must be ${expectedBlob}; got ${headBlob}`); + throw new Error(`reference ${pathName} HEAD blob must be ${expectedBlob}; got ${headBlob}`); } const liveBlob = git(['hash-object', pathName]); if (liveBlob !== expectedBlob) { - throw new Error(`DLA ${pathName} working tree blob must be ${expectedBlob}; got ${liveBlob}`); + throw new Error(`reference ${pathName} working tree blob must be ${expectedBlob}; got ${liveBlob}`); } } -function verifyDlaOracle() { +function verifyReferenceOracle() { const currentCommit = git(['rev-parse', 'HEAD']); - if (currentCommit !== DLA_REGION_AUDIT_COMMIT) { - throw new Error(`DLA checkout must be at ${DLA_REGION_AUDIT_COMMIT}; got ${currentCommit}`); + if (currentCommit !== REFERENCE_REGION_AUDIT_COMMIT) { + throw new Error(`reference checkout must be at ${REFERENCE_REGION_AUDIT_COMMIT}; got ${currentCommit}`); } - verifyBlob(DLA_REGION_AUDIT_PATH, DLA_REGION_AUDIT_BLOB); - verifyBlob(DLA_REGION_CENSUS_PATH, DLA_REGION_CENSUS_BLOB); - verifyBlob(DLA_SECTION_SELECTOR_PATH, DLA_SECTION_SELECTOR_BLOB); + verifyBlob(REFERENCE_REGION_AUDIT_PATH, REFERENCE_REGION_AUDIT_BLOB); + verifyBlob(REFERENCE_REGION_CENSUS_PATH, REFERENCE_REGION_CENSUS_BLOB); + verifyBlob(REFERENCE_SECTION_SELECTOR_PATH, REFERENCE_SECTION_SELECTOR_BLOB); const requiredStatus = git([ 'status', '--porcelain', '--', - DLA_REGION_AUDIT_PATH, - DLA_REGION_CENSUS_PATH, - DLA_SECTION_SELECTOR_PATH, + REFERENCE_REGION_AUDIT_PATH, + REFERENCE_REGION_CENSUS_PATH, + REFERENCE_SECTION_SELECTOR_PATH, ]); if (requiredStatus) { - throw new Error(`DLA required region-audit sources must be clean:\n${requiredStatus}`); + throw new Error(`reference required region-audit sources must be clean:\n${requiredStatus}`); } } function report(mode, parityFile) { process.stderr.write( - `region-audit goldens ${mode}: DLA commit=${DLA_REGION_AUDIT_COMMIT} ` + - `regionAudit=${DLA_REGION_AUDIT_BLOB} regionCensus=${DLA_REGION_CENSUS_BLOB} ` + - `sectionSelector=${DLA_SECTION_SELECTOR_BLOB} cases=${parityFile.cases.length}\n` + `region-audit goldens ${mode}: reference commit=${REFERENCE_REGION_AUDIT_COMMIT} ` + + `regionAudit=${REFERENCE_REGION_AUDIT_BLOB} regionCensus=${REFERENCE_REGION_CENSUS_BLOB} ` + + `sectionSelector=${REFERENCE_SECTION_SELECTOR_BLOB} cases=${parityFile.cases.length}\n` ); } -verifyDlaOracle(); +verifyReferenceOracle(); -const dlaAudit = await import(pathToFileURL(path.join(dlaRoot, DLA_REGION_AUDIT_PATH)).href); -const dlaCensus = await import(pathToFileURL(path.join(dlaRoot, DLA_REGION_CENSUS_PATH)).href); +const referenceAudit = await import(pathToFileURL(path.join(referenceRoot, REFERENCE_REGION_AUDIT_PATH)).href); +const referenceCensus = await import(pathToFileURL(path.join(referenceRoot, REFERENCE_REGION_CENSUS_PATH)).href); const parityFile = runRegionAuditParity({ - reconcileRegions: dlaAudit.reconcileRegions, - extractSourceLandmarksFromHtml: dlaCensus.extractSourceLandmarksFromHtml, - selectorForHtmlRoot: dlaCensus.selectorForHtmlRoot, - landmarkRoleForHtmlRoot: dlaCensus.landmarkRoleForHtmlRoot, + reconcileRegions: referenceAudit.reconcileRegions, + extractSourceLandmarksFromHtml: referenceCensus.extractSourceLandmarksFromHtml, + selectorForHtmlRoot: referenceCensus.selectorForHtmlRoot, + landmarkRoleForHtmlRoot: referenceCensus.landmarkRoleForHtmlRoot, }); const json = stableJson(parityFile); if (shouldCheck) { const existing = readFileSync(outputPath, 'utf8'); if (existing !== json) { - throw new Error(`${outputPath} is out of date with DLA region-audit blobs`); + throw new Error(`${outputPath} is out of date with reference region-audit blobs`); } report('check', parityFile); } diff --git a/packages/blocks-engine/scripts/capture-variation-hoist-goldens.mjs b/packages/blocks-engine/scripts/capture-variation-hoist-goldens.mjs index 5766f960b..8863e3502 100644 --- a/packages/blocks-engine/scripts/capture-variation-hoist-goldens.mjs +++ b/packages/blocks-engine/scripts/capture-variation-hoist-goldens.mjs @@ -4,7 +4,6 @@ import { readFileSync, writeFileSync } from 'node:fs'; import path from 'node:path'; import { fileURLToPath, pathToFileURL } from 'node:url'; -const DEFAULT_DLA_ROOT = '/Users/matt/projects/a8c/data-liberation-agent'; const TSX_BOOTSTRAP_ENV = 'BLOCKS_ENGINE_VARIATION_HOIST_GOLDENS_TSX'; const __dirname = path.dirname(fileURLToPath(import.meta.url)); @@ -12,7 +11,7 @@ const packageRoot = path.resolve(__dirname, '..'); const corpusUrl = pathToFileURL( path.join(packageRoot, 'src/__tests__/fixtures/variation-hoist-corpus.js') ).href; -const outputPath = path.join(packageRoot, 'src/__tests__/fixtures/variation-hoist-dla-goldens.json'); +const outputPath = path.join(packageRoot, 'src/__tests__/fixtures/variation-hoist-reference-goldens.json'); function hasTsxLoader() { return process.execArgv.some((arg, index, argv) => { @@ -32,9 +31,9 @@ if (!process.env[TSX_BOOTSTRAP_ENV] && !hasTsxLoader()) { } const { - DLA_VARIATION_HOIST_BLOB, - DLA_VARIATION_HOIST_COMMIT, - DLA_VARIATION_HOIST_PATH, + REFERENCE_VARIATION_HOIST_BLOB, + REFERENCE_VARIATION_HOIST_COMMIT, + REFERENCE_VARIATION_HOIST_PATH, runVariationHoistParity, } = await import(corpusUrl); @@ -42,7 +41,10 @@ const args = new Set(process.argv.slice(2)); const shouldWrite = args.has('--write'); const shouldCheck = args.has('--check'); const shouldStdout = args.has('--stdout') || (!shouldWrite && !shouldCheck); -const dlaRoot = process.env.DLA_ROOT || DEFAULT_DLA_ROOT; +const referenceRoot = process.env.REFERENCE_ROOT; +if (!referenceRoot) { + throw new Error('Set REFERENCE_ROOT to a checkout of the reference implementation at the pinned commit.'); +} const explicitModeCount = [shouldWrite, shouldCheck, args.has('--stdout')].filter(Boolean).length; if (explicitModeCount > 1) { @@ -50,30 +52,30 @@ if (explicitModeCount > 1) { } function git(gitArgs) { - return execFileSync('git', ['-C', dlaRoot, ...gitArgs], { encoding: 'utf8' }).trim(); + return execFileSync('git', ['-C', referenceRoot, ...gitArgs], { encoding: 'utf8' }).trim(); } function stableJson(value) { return `${JSON.stringify(value, null, 2)}\n`; } -function verifyDlaOracle() { +function verifyReferenceOracle() { const currentCommit = git(['rev-parse', 'HEAD']); - if (currentCommit !== DLA_VARIATION_HOIST_COMMIT) { - throw new Error(`DLA checkout must be at ${DLA_VARIATION_HOIST_COMMIT}; got ${currentCommit}`); + if (currentCommit !== REFERENCE_VARIATION_HOIST_COMMIT) { + throw new Error(`reference checkout must be at ${REFERENCE_VARIATION_HOIST_COMMIT}; got ${currentCommit}`); } - const headBlob = git(['rev-parse', `HEAD:${DLA_VARIATION_HOIST_PATH}`]); - if (headBlob !== DLA_VARIATION_HOIST_BLOB) { + const headBlob = git(['rev-parse', `HEAD:${REFERENCE_VARIATION_HOIST_PATH}`]); + if (headBlob !== REFERENCE_VARIATION_HOIST_BLOB) { throw new Error( - `DLA ${DLA_VARIATION_HOIST_PATH} HEAD blob must be ${DLA_VARIATION_HOIST_BLOB}; got ${headBlob}` + `reference ${REFERENCE_VARIATION_HOIST_PATH} HEAD blob must be ${REFERENCE_VARIATION_HOIST_BLOB}; got ${headBlob}` ); } - const liveBlob = git(['hash-object', DLA_VARIATION_HOIST_PATH]); - if (liveBlob !== DLA_VARIATION_HOIST_BLOB) { + const liveBlob = git(['hash-object', REFERENCE_VARIATION_HOIST_PATH]); + if (liveBlob !== REFERENCE_VARIATION_HOIST_BLOB) { throw new Error( - `DLA ${DLA_VARIATION_HOIST_PATH} working tree blob must be ${DLA_VARIATION_HOIST_BLOB}; got ${liveBlob}` + `reference ${REFERENCE_VARIATION_HOIST_PATH} working tree blob must be ${REFERENCE_VARIATION_HOIST_BLOB}; got ${liveBlob}` ); } @@ -81,33 +83,33 @@ function verifyDlaOracle() { 'status', '--porcelain', '--', - DLA_VARIATION_HOIST_PATH, + REFERENCE_VARIATION_HOIST_PATH, 'src/lib/replicate/form-blocks.ts', ]); if (requiredStatus) { - throw new Error(`DLA required variation-hoist sources must be clean:\n${requiredStatus}`); + throw new Error(`reference required variation-hoist sources must be clean:\n${requiredStatus}`); } } function report(mode, parityFile) { process.stderr.write( - `variation-hoist goldens ${mode}: DLA commit=${DLA_VARIATION_HOIST_COMMIT} blob=${DLA_VARIATION_HOIST_BLOB} cases=${parityFile.cases.length}\n` + `variation-hoist goldens ${mode}: reference commit=${REFERENCE_VARIATION_HOIST_COMMIT} blob=${REFERENCE_VARIATION_HOIST_BLOB} cases=${parityFile.cases.length}\n` ); } -verifyDlaOracle(); +verifyReferenceOracle(); -const dlaVariationHoist = await import(pathToFileURL(path.join(dlaRoot, DLA_VARIATION_HOIST_PATH)).href); +const referenceVariationHoist = await import(pathToFileURL(path.join(referenceRoot, REFERENCE_VARIATION_HOIST_PATH)).href); const parityFile = runVariationHoistParity({ - hoistVariations: dlaVariationHoist.hoistVariations, - applyHoistSwaps: dlaVariationHoist.applyHoistSwaps, + hoistVariations: referenceVariationHoist.hoistVariations, + applyHoistSwaps: referenceVariationHoist.applyHoistSwaps, }); const json = stableJson(parityFile); if (shouldCheck) { const existing = readFileSync(outputPath, 'utf8'); if (existing !== json) { - throw new Error(`${outputPath} is out of date with DLA blob ${DLA_VARIATION_HOIST_BLOB}`); + throw new Error(`${outputPath} is out of date with reference blob ${REFERENCE_VARIATION_HOIST_BLOB}`); } report('check', parityFile); } diff --git a/packages/blocks-engine/scripts/tuner/corpus.ts b/packages/blocks-engine/scripts/tuner/corpus.ts index 2832bd5ec..20678d439 100644 --- a/packages/blocks-engine/scripts/tuner/corpus.ts +++ b/packages/blocks-engine/scripts/tuner/corpus.ts @@ -14,7 +14,7 @@ import { nativeDispatchRendererCaseGroups } from '../../src/__fixtures__/native-dispatch-renderer-cases.js'; import { nativeSectionRendererCaseGroups } from '../../src/__fixtures__/native-section-renderer-cases.js'; import { nativeTextRendererCaseGroups } from '../../src/__fixtures__/native-text-renderer-cases.js'; -import { reconstructBaselineCases } from '../../src/__fixtures__/page-reconstruct-dla-baseline.corpus.js'; +import { reconstructBaselineCases } from '../../src/__fixtures__/page-reconstruct-reference-baseline.corpus.js'; import type { SectionSpec } from '../../src/theme/section-spec.js'; export interface BenchFixture { diff --git a/packages/blocks-engine/scripts/tuner/engines/hook-stub.ts b/packages/blocks-engine/scripts/tuner/engines/hook-stub.ts index 7f9f86215..fb7313a5d 100644 --- a/packages/blocks-engine/scripts/tuner/engines/hook-stub.ts +++ b/packages/blocks-engine/scripts/tuner/engines/hook-stub.ts @@ -1,7 +1,7 @@ /** * Tier-B seam — deterministic stub hook (v1 wiring only, NOT ratcheted). * - * Proves the propose/realize/cache contract the real DLA hook will plug into, + * Proves the propose/realize/cache contract the real reference hook will plug into, * with no model call and no network: * - propose(specs): the costly, non-deterministic step in a real hook (an LLM * polish/repair pass). Here it is a deterministic stand-in, cached by @@ -9,7 +9,7 @@ * cache instead of recomputing. * - realize(raw): the deterministic tail — validate the cached artifact. * - * A real DLA-hook capture lands as a fast follow by populating the cache with + * A real reference-hook capture lands as a fast follow by populating the cache with * actual hook output; nothing in this file's shape changes. */ import { reconstructEngine } from './reconstruct.js'; diff --git a/packages/blocks-engine/src/__fixtures__/native-dispatch-renderer-cases.ts b/packages/blocks-engine/src/__fixtures__/native-dispatch-renderer-cases.ts index 32a0cc4d6..e6ce7ebd8 100644 --- a/packages/blocks-engine/src/__fixtures__/native-dispatch-renderer-cases.ts +++ b/packages/blocks-engine/src/__fixtures__/native-dispatch-renderer-cases.ts @@ -9,7 +9,7 @@ import type { import type { CardGroupPadding } from '../theme/native-renderers-grid.js'; export const NATIVE_DISPATCH_RENDERER_DERIVATION = - 'Mechanically generated from DLA src/lib/replicate/page-reconstruct.ts reconstructPagePattern at DLA commit 1e393c5; renderer markup strips the final reconstruct body newline, and footer/nav renderSection cases are sandwiched between non-chrome sentinels so DLA stripChrome does not remove them before dispatch.'; + 'Mechanically generated from the reference implementation src/lib/replicate/page-reconstruct.ts reconstructPagePattern at reference commit 1e393c5; renderer markup strips the final reconstruct body newline, and footer/nav renderSection cases are sandwiched between non-chrome sentinels so reference stripChrome does not remove them before dispatch.'; export const ALL_RENDER_SECTION_INTERACTION_MODELS: InteractionModel[] = [ 'static', @@ -68,7 +68,7 @@ export interface NativeCardGroupRendererCase { dark: boolean; radius: number; padding: CardGroupPadding | null; - dlaSection: SectionSpec; + referenceSection: SectionSpec; } export interface NativeRenderSectionCase extends NativeRendererSectionCase { @@ -303,7 +303,7 @@ const fullBleedCells = section({ layout: { containerWidth: 1440, padding: '0px', childLayout: 'grid', columnCount: 2, gap: '0px' }, }); -const cardGroupDlaSection = section({ +const cardGroupReferenceSection = section({ sectionIndex: 68, interactionModel: 'static', cells: [ @@ -550,7 +550,7 @@ export function nativeDispatchRendererCaseGroups(): NativeDispatchRendererCaseGr dark: true, radius: 24, padding: { top: 24, right: 32, bottom: 28, left: 32 }, - dlaSection: cardGroupDlaSection, + referenceSection: cardGroupReferenceSection, }, ], renderSection: renderSectionCases(), diff --git a/packages/blocks-engine/src/__fixtures__/native-dispatch-renderer-dla-goldens.json b/packages/blocks-engine/src/__fixtures__/native-dispatch-renderer-reference-goldens.json similarity index 99% rename from packages/blocks-engine/src/__fixtures__/native-dispatch-renderer-dla-goldens.json rename to packages/blocks-engine/src/__fixtures__/native-dispatch-renderer-reference-goldens.json index c5796cbee..de1590958 100644 --- a/packages/blocks-engine/src/__fixtures__/native-dispatch-renderer-dla-goldens.json +++ b/packages/blocks-engine/src/__fixtures__/native-dispatch-renderer-reference-goldens.json @@ -1,6 +1,6 @@ { "version": 1, - "derivation": "Mechanically generated from DLA src/lib/replicate/page-reconstruct.ts reconstructPagePattern at DLA commit 1e393c5; renderer markup strips the final reconstruct body newline, and footer/nav renderSection cases are sandwiched between non-chrome sentinels so DLA stripChrome does not remove them before dispatch.", + "derivation": "Mechanically generated from the reference implementation src/lib/replicate/page-reconstruct.ts reconstructPagePattern at reference commit 1e393c5; renderer markup strips the final reconstruct body newline, and footer/nav renderSection cases are sandwiched between non-chrome sentinels so reference stripChrome does not remove them before dispatch.", "renderers": { "renderCardGrid": [ { diff --git a/packages/blocks-engine/src/__fixtures__/native-low-level-helper-cases.ts b/packages/blocks-engine/src/__fixtures__/native-low-level-helper-cases.ts index 8aac14e39..d5db11b2c 100644 --- a/packages/blocks-engine/src/__fixtures__/native-low-level-helper-cases.ts +++ b/packages/blocks-engine/src/__fixtures__/native-low-level-helper-cases.ts @@ -196,7 +196,7 @@ export function runNativeLowLevelParity(impl: NativeLowLevelImpl): NativeLowLeve return { version: 1, derivation: - 'Mechanically generated from DLA page-reconstruct.ts low-level helpers and footer-color.ts color helpers at DLA commit 1e393c5.', + 'Mechanically generated from the reference implementation page-reconstruct.ts low-level helpers and footer-color.ts color helpers at reference commit 1e393c5.', helpers: { MISSING_IMAGE_PLACEHOLDER: [capture('constant', () => impl.MISSING_IMAGE_PLACEHOLDER)], visibleText: [ diff --git a/packages/blocks-engine/src/__fixtures__/native-low-level-dla-goldens.json b/packages/blocks-engine/src/__fixtures__/native-low-level-reference-goldens.json similarity index 99% rename from packages/blocks-engine/src/__fixtures__/native-low-level-dla-goldens.json rename to packages/blocks-engine/src/__fixtures__/native-low-level-reference-goldens.json index cce692af0..a66cbadee 100644 --- a/packages/blocks-engine/src/__fixtures__/native-low-level-dla-goldens.json +++ b/packages/blocks-engine/src/__fixtures__/native-low-level-reference-goldens.json @@ -1,6 +1,6 @@ { "version": 1, - "derivation": "Mechanically generated from DLA page-reconstruct.ts low-level helpers and footer-color.ts color helpers at DLA commit 1e393c5.", + "derivation": "Mechanically generated from the reference implementation page-reconstruct.ts low-level helpers and footer-color.ts color helpers at reference commit 1e393c5.", "helpers": { "MISSING_IMAGE_PLACEHOLDER": [ { diff --git a/packages/blocks-engine/src/__fixtures__/native-section-renderer-cases.ts b/packages/blocks-engine/src/__fixtures__/native-section-renderer-cases.ts index 6bd846557..03da1c1cf 100644 --- a/packages/blocks-engine/src/__fixtures__/native-section-renderer-cases.ts +++ b/packages/blocks-engine/src/__fixtures__/native-section-renderer-cases.ts @@ -2,7 +2,7 @@ import type { NativeRenderOut } from '../theme/native-reconstruct-types.js'; import type { SectionSpec, SectionSpecImage } from '../theme/section-spec.js'; export const NATIVE_SECTION_RENDERER_DERIVATION = - 'Mechanically generated from DLA src/lib/replicate/page-reconstruct.ts reconstructPagePattern at DLA commit 1e393c5; section renderer markup strips the final reconstruct body newline.'; + 'Mechanically generated from the reference implementation src/lib/replicate/page-reconstruct.ts reconstructPagePattern at reference commit 1e393c5; section renderer markup strips the final reconstruct body newline.'; export interface NativeSectionRendererImpl { renderReviewGrid(section: SectionSpec): NativeRenderOut; diff --git a/packages/blocks-engine/src/__fixtures__/native-section-renderer-dla-goldens.json b/packages/blocks-engine/src/__fixtures__/native-section-renderer-reference-goldens.json similarity index 98% rename from packages/blocks-engine/src/__fixtures__/native-section-renderer-dla-goldens.json rename to packages/blocks-engine/src/__fixtures__/native-section-renderer-reference-goldens.json index 4999cbe2d..538c206d1 100644 --- a/packages/blocks-engine/src/__fixtures__/native-section-renderer-dla-goldens.json +++ b/packages/blocks-engine/src/__fixtures__/native-section-renderer-reference-goldens.json @@ -1,6 +1,6 @@ { "version": 1, - "derivation": "Mechanically generated from DLA src/lib/replicate/page-reconstruct.ts reconstructPagePattern at DLA commit 1e393c5; section renderer markup strips the final reconstruct body newline.", + "derivation": "Mechanically generated from the reference implementation src/lib/replicate/page-reconstruct.ts reconstructPagePattern at reference commit 1e393c5; section renderer markup strips the final reconstruct body newline.", "renderers": { "renderReviewGrid": [ { diff --git a/packages/blocks-engine/src/__fixtures__/native-text-renderer-cases.ts b/packages/blocks-engine/src/__fixtures__/native-text-renderer-cases.ts index 39184a989..bf6ad49cf 100644 --- a/packages/blocks-engine/src/__fixtures__/native-text-renderer-cases.ts +++ b/packages/blocks-engine/src/__fixtures__/native-text-renderer-cases.ts @@ -3,7 +3,7 @@ import type { NativeRenderCtx, NativeRenderOut } from '../theme/native-reconstru import type { SectionSpec, SectionSpecImage } from '../theme/section-spec.js'; export const NATIVE_TEXT_RENDERER_DERIVATION = - 'Mechanically generated from DLA src/lib/replicate/page-reconstruct.ts reconstructPagePattern at DLA commit 1e393c5; section renderer markup strips the final reconstruct body newline, and direct galleryBlock outputs extract the nested wp:gallery block.'; + 'Mechanically generated from the reference implementation src/lib/replicate/page-reconstruct.ts reconstructPagePattern at reference commit 1e393c5; section renderer markup strips the final reconstruct body newline, and direct galleryBlock outputs extract the nested wp:gallery block.'; export interface NativeTextRendererImpl { renderTextBand(section: SectionSpec, ctx: NativeRenderCtx): NativeRenderOut; diff --git a/packages/blocks-engine/src/__fixtures__/native-text-renderer-dla-goldens.json b/packages/blocks-engine/src/__fixtures__/native-text-renderer-reference-goldens.json similarity index 98% rename from packages/blocks-engine/src/__fixtures__/native-text-renderer-dla-goldens.json rename to packages/blocks-engine/src/__fixtures__/native-text-renderer-reference-goldens.json index d5ab4843e..6b5802ccd 100644 --- a/packages/blocks-engine/src/__fixtures__/native-text-renderer-dla-goldens.json +++ b/packages/blocks-engine/src/__fixtures__/native-text-renderer-reference-goldens.json @@ -1,6 +1,6 @@ { "version": 1, - "derivation": "Mechanically generated from DLA src/lib/replicate/page-reconstruct.ts reconstructPagePattern at DLA commit 1e393c5; section renderer markup strips the final reconstruct body newline, and direct galleryBlock outputs extract the nested wp:gallery block.", + "derivation": "Mechanically generated from the reference implementation src/lib/replicate/page-reconstruct.ts reconstructPagePattern at reference commit 1e393c5; section renderer markup strips the final reconstruct body newline, and direct galleryBlock outputs extract the nested wp:gallery block.", "renderers": { "renderTextBand": [ { diff --git a/packages/blocks-engine/src/__fixtures__/page-reconstruct-dla-baseline.corpus.ts b/packages/blocks-engine/src/__fixtures__/page-reconstruct-reference-baseline.corpus.ts similarity index 100% rename from packages/blocks-engine/src/__fixtures__/page-reconstruct-dla-baseline.corpus.ts rename to packages/blocks-engine/src/__fixtures__/page-reconstruct-reference-baseline.corpus.ts diff --git a/packages/blocks-engine/src/__fixtures__/page-reconstruct-dla-baseline.goldens.json b/packages/blocks-engine/src/__fixtures__/page-reconstruct-reference-baseline.goldens.json similarity index 100% rename from packages/blocks-engine/src/__fixtures__/page-reconstruct-dla-baseline.goldens.json rename to packages/blocks-engine/src/__fixtures__/page-reconstruct-reference-baseline.goldens.json diff --git a/packages/blocks-engine/src/__fixtures__/region-audit-corpus.ts b/packages/blocks-engine/src/__fixtures__/region-audit-corpus.ts index 9207346fa..0ce62235d 100644 --- a/packages/blocks-engine/src/__fixtures__/region-audit-corpus.ts +++ b/packages/blocks-engine/src/__fixtures__/region-audit-corpus.ts @@ -4,16 +4,16 @@ import type { SourceLandmark, } from '../theme/index.js'; -export const DLA_REGION_AUDIT_COMMIT = '1e393c535850ee1a9482f83459f779d0e225b027'; -export const DLA_REGION_AUDIT_PATH = 'src/lib/replicate/region-audit.ts'; -export const DLA_REGION_CENSUS_PATH = 'src/lib/replicate/region-census.ts'; -export const DLA_SECTION_SELECTOR_PATH = 'src/lib/replicate/section-selector.ts'; -export const DLA_REGION_AUDIT_BLOB = '3e4bff0205056183fb3b09612df6caf5018a844f'; -export const DLA_REGION_CENSUS_BLOB = 'c447895fe50d42395ea4a4b8786467bef9eeabda'; -export const DLA_SECTION_SELECTOR_BLOB = 'a900bd3d4fe719af039faf9c586b17ae19403c38'; +export const REFERENCE_REGION_AUDIT_COMMIT = '1e393c535850ee1a9482f83459f779d0e225b027'; +export const REFERENCE_REGION_AUDIT_PATH = 'src/lib/replicate/region-audit.ts'; +export const REFERENCE_REGION_CENSUS_PATH = 'src/lib/replicate/region-census.ts'; +export const REFERENCE_SECTION_SELECTOR_PATH = 'src/lib/replicate/section-selector.ts'; +export const REFERENCE_REGION_AUDIT_BLOB = '3e4bff0205056183fb3b09612df6caf5018a844f'; +export const REFERENCE_REGION_CENSUS_BLOB = 'c447895fe50d42395ea4a4b8786467bef9eeabda'; +export const REFERENCE_SECTION_SELECTOR_BLOB = 'a900bd3d4fe719af039faf9c586b17ae19403c38'; export const REGION_AUDIT_DERIVATION = - 'DLA region-audit + region-census over source HTML and explicit placed-region corpus'; + 'reference region-audit + region-census over source HTML and explicit placed-region corpus'; export interface RegionAuditCorpusCase { id: string; @@ -141,16 +141,16 @@ export function runRegionAuditParity(impl: RegionAuditImpl): RegionAuditParityFi version: 1, derivation: REGION_AUDIT_DERIVATION, oracle: { - commit: DLA_REGION_AUDIT_COMMIT, + commit: REFERENCE_REGION_AUDIT_COMMIT, paths: { - regionAudit: DLA_REGION_AUDIT_PATH, - regionCensus: DLA_REGION_CENSUS_PATH, - sectionSelector: DLA_SECTION_SELECTOR_PATH, + regionAudit: REFERENCE_REGION_AUDIT_PATH, + regionCensus: REFERENCE_REGION_CENSUS_PATH, + sectionSelector: REFERENCE_SECTION_SELECTOR_PATH, }, blobs: { - regionAudit: DLA_REGION_AUDIT_BLOB, - regionCensus: DLA_REGION_CENSUS_BLOB, - sectionSelector: DLA_SECTION_SELECTOR_BLOB, + regionAudit: REFERENCE_REGION_AUDIT_BLOB, + regionCensus: REFERENCE_REGION_CENSUS_BLOB, + sectionSelector: REFERENCE_SECTION_SELECTOR_BLOB, }, }, cases: regionAuditCases().map((testCase) => { diff --git a/packages/blocks-engine/src/__fixtures__/region-audit-dla-goldens.json b/packages/blocks-engine/src/__fixtures__/region-audit-reference-goldens.json similarity index 99% rename from packages/blocks-engine/src/__fixtures__/region-audit-dla-goldens.json rename to packages/blocks-engine/src/__fixtures__/region-audit-reference-goldens.json index 886cf11f4..b70614e78 100644 --- a/packages/blocks-engine/src/__fixtures__/region-audit-dla-goldens.json +++ b/packages/blocks-engine/src/__fixtures__/region-audit-reference-goldens.json @@ -1,6 +1,6 @@ { "version": 1, - "derivation": "DLA region-audit + region-census over source HTML and explicit placed-region corpus", + "derivation": "reference region-audit + region-census over source HTML and explicit placed-region corpus", "oracle": { "commit": "1e393c535850ee1a9482f83459f779d0e225b027", "paths": { diff --git a/packages/blocks-engine/src/__tests__/block-contract.test.ts b/packages/blocks-engine/src/__tests__/block-contract.test.ts index 5f58a47cb..c6c976a64 100644 --- a/packages/blocks-engine/src/__tests__/block-contract.test.ts +++ b/packages/blocks-engine/src/__tests__/block-contract.test.ts @@ -34,9 +34,9 @@ describe('validateBlockContract', () => { }); it('skips deliberate non-core blocks and allowlisted core/html untouched', () => { - const markup = ` -
x
- + const markup = ` +
x
+
island
`; diff --git a/packages/blocks-engine/src/__tests__/canonicalize.fixture.test.ts b/packages/blocks-engine/src/__tests__/canonicalize.fixture.test.ts index 19bd3a13d..50a28167d 100644 --- a/packages/blocks-engine/src/__tests__/canonicalize.fixture.test.ts +++ b/packages/blocks-engine/src/__tests__/canonicalize.fixture.test.ts @@ -15,7 +15,7 @@ const canonicalizeCases = (cases as CanonicalizeFixture[]).filter( describe('canonicalize golden fixtures', () => { for (const fixture of canonicalizeCases) { - it(`${fixture.id} is byte-identical to the DLA golden`, () => { + it(`${fixture.id} is byte-identical to the reference golden`, () => { expect(canonicalize(fixture.input)).toMatchObject(fixture.expected); }); } diff --git a/packages/blocks-engine/src/__tests__/compose.fixture.test.ts b/packages/blocks-engine/src/__tests__/compose.fixture.test.ts index f1d24a082..c98c7ad6d 100644 --- a/packages/blocks-engine/src/__tests__/compose.fixture.test.ts +++ b/packages/blocks-engine/src/__tests__/compose.fixture.test.ts @@ -14,7 +14,7 @@ const composeCases = (cases as ComposeFixture[]).filter((fixture) => fixture.op describe('compose golden fixtures', () => { for (const fixture of composeCases) { - it(`${fixture.id} is byte-identical to the DLA golden`, () => { + it(`${fixture.id} is byte-identical to the reference golden`, () => { expect(compose(fixture.input, { url: 'https://x.test/' }, {})).toBe(fixture.expected); }); } diff --git a/packages/blocks-engine/src/__tests__/fixtures/variation-hoist-corpus.d.ts b/packages/blocks-engine/src/__tests__/fixtures/variation-hoist-corpus.d.ts index 5bcdca60e..238149650 100644 --- a/packages/blocks-engine/src/__tests__/fixtures/variation-hoist-corpus.d.ts +++ b/packages/blocks-engine/src/__tests__/fixtures/variation-hoist-corpus.d.ts @@ -1,8 +1,8 @@ import type { HoistedVariation, HoistPage, HoistResult } from '../../theme/index.js'; -export const DLA_VARIATION_HOIST_COMMIT: string; -export const DLA_VARIATION_HOIST_PATH: string; -export const DLA_VARIATION_HOIST_BLOB: string; +export const REFERENCE_VARIATION_HOIST_COMMIT: string; +export const REFERENCE_VARIATION_HOIST_PATH: string; +export const REFERENCE_VARIATION_HOIST_BLOB: string; export const VARIATION_HOIST_DERIVATION: string; export interface VariationHoistCase { diff --git a/packages/blocks-engine/src/__tests__/fixtures/variation-hoist-corpus.js b/packages/blocks-engine/src/__tests__/fixtures/variation-hoist-corpus.js index 46eb60ff3..a433154cc 100644 --- a/packages/blocks-engine/src/__tests__/fixtures/variation-hoist-corpus.js +++ b/packages/blocks-engine/src/__tests__/fixtures/variation-hoist-corpus.js @@ -1,8 +1,8 @@ -export const DLA_VARIATION_HOIST_COMMIT = '1e393c535850ee1a9482f83459f779d0e225b027'; -export const DLA_VARIATION_HOIST_PATH = 'src/lib/replicate/variation-hoist.ts'; -export const DLA_VARIATION_HOIST_BLOB = '62b9cf4c87b62dfc03bffe2e25ffbe4e6109438b'; +export const REFERENCE_VARIATION_HOIST_COMMIT = '1e393c535850ee1a9482f83459f779d0e225b027'; +export const REFERENCE_VARIATION_HOIST_PATH = 'src/lib/replicate/variation-hoist.ts'; +export const REFERENCE_VARIATION_HOIST_BLOB = '62b9cf4c87b62dfc03bffe2e25ffbe4e6109438b'; export const VARIATION_HOIST_DERIVATION = - `Mechanically generated from DLA ${DLA_VARIATION_HOIST_PATH} at commit ${DLA_VARIATION_HOIST_COMMIT} with blob ${DLA_VARIATION_HOIST_BLOB}.`; + `Mechanically generated from the reference implementation ${REFERENCE_VARIATION_HOIST_PATH} at commit ${REFERENCE_VARIATION_HOIST_COMMIT} with blob ${REFERENCE_VARIATION_HOIST_BLOB}.`; const commentEscapeName = 'Alpha \\u002d\\u002d \\u003cunsafe\\u003e \\u0026 \\u0022quoted\\u0022 value'; @@ -81,9 +81,9 @@ export function runVariationHoistParity(impl) { version: 1, derivation: VARIATION_HOIST_DERIVATION, oracle: { - commit: DLA_VARIATION_HOIST_COMMIT, - path: DLA_VARIATION_HOIST_PATH, - blob: DLA_VARIATION_HOIST_BLOB, + commit: REFERENCE_VARIATION_HOIST_COMMIT, + path: REFERENCE_VARIATION_HOIST_PATH, + blob: REFERENCE_VARIATION_HOIST_BLOB, }, cases: variationHoistCases().map((entry) => { const result = impl.hoistVariations(clone(entry.pages), entry.options ?? {}); diff --git a/packages/blocks-engine/src/__tests__/fixtures/variation-hoist-dla-goldens.json b/packages/blocks-engine/src/__tests__/fixtures/variation-hoist-reference-goldens.json similarity index 96% rename from packages/blocks-engine/src/__tests__/fixtures/variation-hoist-dla-goldens.json rename to packages/blocks-engine/src/__tests__/fixtures/variation-hoist-reference-goldens.json index c8e1bd0b6..770c9941e 100644 --- a/packages/blocks-engine/src/__tests__/fixtures/variation-hoist-dla-goldens.json +++ b/packages/blocks-engine/src/__tests__/fixtures/variation-hoist-reference-goldens.json @@ -1,6 +1,6 @@ { "version": 1, - "derivation": "Mechanically generated from DLA src/lib/replicate/variation-hoist.ts at commit 1e393c535850ee1a9482f83459f779d0e225b027 with blob 62b9cf4c87b62dfc03bffe2e25ffbe4e6109438b.", + "derivation": "Mechanically generated from the reference implementation src/lib/replicate/variation-hoist.ts at commit 1e393c535850ee1a9482f83459f779d0e225b027 with blob 62b9cf4c87b62dfc03bffe2e25ffbe4e6109438b.", "oracle": { "commit": "1e393c535850ee1a9482f83459f779d0e225b027", "path": "src/lib/replicate/variation-hoist.ts", diff --git a/packages/blocks-engine/src/__tests__/producer-neutral-source.test.ts b/packages/blocks-engine/src/__tests__/producer-neutral-source.test.ts new file mode 100644 index 000000000..ca63590d5 --- /dev/null +++ b/packages/blocks-engine/src/__tests__/producer-neutral-source.test.ts @@ -0,0 +1,56 @@ +import { readdirSync, readFileSync, statSync } from 'node:fs'; +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; +import { describe, expect, it } from 'vitest'; + +// Blocks Engine carries no knowledge of a specific capture producer; it reads +// capture evidence through its own published vocabulary +// (php-transformer/docs/contracts/capture-evidence.md). The guard is +// case-insensitive and word-ish: a token inside a longer lowercase word +// (`childLayout`) passes, while a camelCase or upper-case token fails. Tokens +// are built from fragments so this file passes its own check. +// php-transformer/tests/contract/producer-neutral-source.php applies the same +// rule to both packages. +const short = 'd' + 'la'; +const long = 'liberation'; +const SHORT_TOKEN = new RegExp( + `(?:(? SHORT_TOKEN.test(text) || LONG_TOKEN.test(text); + +const packageRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../..'); + +function filesUnder(dir: string): string[] { + return readdirSync(dir).flatMap((entry) => { + const full = path.join(dir, entry); + return statSync(full).isDirectory() ? filesUnder(full) : [full]; + }); +} + +function offendingLines(label: string, text: string): string[] { + return text + .split(/\r?\n/) + .flatMap((line, index) => (isProducerToken(line) ? [`${label}:${index + 1}: ${line.trim().slice(0, 140)}`] : [])); +} + +describe('producer-neutral source', () => { + it('keeps capture-producer names out of runtime source and package scripts', () => { + const offenders = filesUnder(path.join(packageRoot, 'src')).flatMap((file) => + offendingLines(path.relative(packageRoot, file), readFileSync(file, 'utf8')) + ); + const manifest = JSON.parse(readFileSync(path.join(packageRoot, 'package.json'), 'utf8')) as { scripts?: Record }; + offenders.push(...offendingLines('package.json scripts', JSON.stringify(manifest.scripts ?? {}, null, 2))); + + expect(offenders).toEqual([]); + }); + + it('recognizes the producer tokens it guards against', () => { + for (const sample of [`${short}-x`, `data-${short}-x`, `${short.toUpperCase()}_ROOT`, `card${'D' + short.slice(1)}Section`, `data-${long}-x`, `${long}-agent`]) { + expect(isProducerToken(sample), sample).toBe(true); + } + for (const sample of ['childLayout', 'headlamp', 'isDirectChildOfAuthorOwnedLayout']) { + expect(isProducerToken(sample), sample).toBe(false); + } + }); +}); diff --git a/packages/blocks-engine/src/__tests__/raw-convert.fixture.test.ts b/packages/blocks-engine/src/__tests__/raw-convert.fixture.test.ts index 5ba9c61f4..773ac582a 100644 --- a/packages/blocks-engine/src/__tests__/raw-convert.fixture.test.ts +++ b/packages/blocks-engine/src/__tests__/raw-convert.fixture.test.ts @@ -15,7 +15,7 @@ const rawConvertCases = (cases as RawConvertFixture[]).filter( describe('rawConvert golden fixtures', () => { for (const fixture of rawConvertCases) { - it(`${fixture.id} is byte-identical to the DLA golden`, () => { + it(`${fixture.id} is byte-identical to the reference golden`, () => { expect(rawConvert(fixture.input)).toEqual(fixture.expected); }); } diff --git a/packages/blocks-engine/src/__tests__/serialize.test.ts b/packages/blocks-engine/src/__tests__/serialize.test.ts index 17b4f7378..7cd34560b 100644 --- a/packages/blocks-engine/src/__tests__/serialize.test.ts +++ b/packages/blocks-engine/src/__tests__/serialize.test.ts @@ -2,7 +2,7 @@ import { describe, expect, it } from 'vitest'; import { serializeBlockAttrs } from '../serialize'; -function dlaSerializeBlockAttrs(attrs: Record): string { +function referenceSerializeBlockAttrs(attrs: Record): string { return JSON.stringify(attrs) .replace(/--/g, '\\u002d\\u002d') .replace(/ { expect(JSON.parse(serialized)).toEqual({ label: 'A "quoted" value' }); }); - it('matches the DLA form-blocks serializer on a shared corpus', () => { + it('matches the reference form-blocks serializer on a shared corpus', () => { const corpus: Array> = [ {}, { name: 'plain' }, @@ -36,7 +36,7 @@ describe('serializeBlockAttrs', () => { ]; for (const attrs of corpus) { - expect(serializeBlockAttrs(attrs)).toBe(dlaSerializeBlockAttrs(attrs)); + expect(serializeBlockAttrs(attrs)).toBe(referenceSerializeBlockAttrs(attrs)); } }); }); diff --git a/packages/blocks-engine/src/__tests__/site-to-theme.e2e.test.ts b/packages/blocks-engine/src/__tests__/site-to-theme.e2e.test.ts index e97ad5bc6..4e780f97c 100644 --- a/packages/blocks-engine/src/__tests__/site-to-theme.e2e.test.ts +++ b/packages/blocks-engine/src/__tests__/site-to-theme.e2e.test.ts @@ -569,7 +569,7 @@ describe('site-to-theme P0-3 orchestration', () => { expect(carried.themeJson).not.toMatchObject({ settings: { spacing: { blockGap: false } } }); // ...while a CSS rule zeroes the gap on the carried align:full section wrappers // so reconstructed sections sit flush. CSS-only keeps the block markup - // byte-identical to the DLA reference. + // byte-identical to the reference implementation. expect(carried.styleCss).toContain( ':where(.is-layout-flow, .is-layout-constrained) > .wp-block-group.alignfull{margin-block-start:0}' ); diff --git a/packages/blocks-engine/src/__tests__/theme-chrome-parts-builders-parity.test.ts b/packages/blocks-engine/src/__tests__/theme-chrome-parts-builders-parity.test.ts index a97726d68..f6b74b49c 100644 --- a/packages/blocks-engine/src/__tests__/theme-chrome-parts-builders-parity.test.ts +++ b/packages/blocks-engine/src/__tests__/theme-chrome-parts-builders-parity.test.ts @@ -12,8 +12,8 @@ import { type NavLink, } from '../theme/index.js'; -describe('chrome-parts builders DLA parity', () => { - it('buildHeaderPart emits DLA-faithful native nav markup with inNav preference', () => { +describe('chrome-parts builders reference parity', () => { + it('buildHeaderPart emits reference-faithful native nav markup with inNav preference', () => { const nav: NavLink[] = [ { fromSlug: 'home', toSlug: 'home', label: 'Brand Co' }, { fromSlug: 'home', toSlug: 'home', label: 'Home', inNav: true }, @@ -71,14 +71,14 @@ describe('chrome-parts builders DLA parity', () => { `\n` + `\n` + `\n` + - `\n` + - `\n` + - `` + `\n` + + `\n` + + `` ); expect(blockMarkupRoundtrips(html)).toEqual({ ok: true }); }); - it('buildFooterPart applies DLA footer normalization, href rewrite, and token wrapper around converted markup', async () => { + it('buildFooterPart applies reference footer normalization, href rewrite, and token wrapper around converted markup', async () => { const footer: ChromePartSection = { id: 'footer', role: 'footer', @@ -110,7 +110,7 @@ describe('chrome-parts builders DLA parity', () => { expect(blockMarkupRoundtrips(html)).toEqual({ ok: true }); }); - it('findChromeMounts discovers DLA JS-rendered chrome mounts around main', () => { + it('findChromeMounts discovers reference JS-rendered chrome mounts around main', () => { const page = `

Sale

@@ -125,7 +125,7 @@ describe('chrome-parts builders DLA parity', () => { }); }); - it('mountPartMarkup emits DLA anchored empty group markup with optional sticky state', () => { + it('mountPartMarkup emits reference anchored empty group markup with optional sticky state', () => { const html = mountPartMarkup( { id: 'siteHeader', classes: ['chrome'] }, { kind: 'sticky', toggleClass: 'is-scrolled', offset: 24 } @@ -136,9 +136,9 @@ describe('chrome-parts builders DLA parity', () => { `\n` + `\n` + `\n` + - `\n` + - `\n` + - `` + `\n` + + `\n` + + `` ); expect(blockMarkupRoundtrips(html)).toEqual({ ok: true }); }); diff --git a/packages/blocks-engine/src/__tests__/theme-chrome-signature-parity.test.ts b/packages/blocks-engine/src/__tests__/theme-chrome-signature-parity.test.ts index a61173714..03c0644a0 100644 --- a/packages/blocks-engine/src/__tests__/theme-chrome-signature-parity.test.ts +++ b/packages/blocks-engine/src/__tests__/theme-chrome-signature-parity.test.ts @@ -6,8 +6,8 @@ import { stripActiveNavState, } from '../theme/index.js'; -describe('chrome signature DLA parity', () => { - it('strips active nav state exactly like DLA chrome-canonicalize', () => { +describe('chrome signature reference parity', () => { + it('strips active nav state exactly like reference chrome-canonicalize', () => { expect( stripActiveNavState( 'Home' diff --git a/packages/blocks-engine/src/__tests__/theme-contracts.test.ts b/packages/blocks-engine/src/__tests__/theme-contracts.test.ts index 0b245f4e3..e830bb6a5 100644 --- a/packages/blocks-engine/src/__tests__/theme-contracts.test.ts +++ b/packages/blocks-engine/src/__tests__/theme-contracts.test.ts @@ -536,7 +536,7 @@ describe('theme public contract', () => { }); -describe('fallback diagnostics DLA parity', () => { +describe('fallback diagnostics reference parity', () => { it('emits dropped_images reasonCode with media-first precedence when text coverage is also below floor', () => { const section = diagnosticSection({ sectionIndex: 7, @@ -576,7 +576,7 @@ describe('fallback diagnostics DLA parity', () => { }); }); - it('emits text_coverage_below_floor reasonCode when text is below the DLA floor without dropped media', () => { + it('emits text_coverage_below_floor reasonCode when text is below the reference floor without dropped media', () => { const section = diagnosticSection({ sectionIndex: 3, interactionModel: 'cta', @@ -681,7 +681,7 @@ describe('fallback diagnostics DLA parity', () => { ]); }); - it('matches the DLA decorative_asset_triaged diagnostic record shape', () => { + it('matches the reference decorative_asset_triaged diagnostic record shape', () => { expect( buildTriageRemovalDiagnostic({ page: '/about', @@ -713,7 +713,7 @@ describe('fallback diagnostics DLA parity', () => { }); }); -describe('formToBlocks DLA parity', () => { +describe('formToBlocks reference parity', () => { it('lets a consumer supply a provider-neutral form materializer', () => { const custom: FormMaterializer = { name: 'custom-provider', @@ -748,7 +748,7 @@ describe('formToBlocks DLA parity', () => { ]); }); - it('exports the DLA form-blocks surface and emits jetpack/field-* blocks for every mapped field kind', () => { + it('exports the reference form-blocks surface and emits jetpack/field-* blocks for every mapped field kind', () => { const formToBlocksType: (form: SectionSpecForm) => FormBlocksResult = formToBlocks; void formToBlocksType; @@ -774,7 +774,7 @@ describe('formToBlocks DLA parity', () => { } }); - it('keeps authored options in DLA attr grammar for radio, select, and checkbox groups', () => { + it('keeps authored options in reference attr grammar for radio, select, and checkbox groups', () => { const radio = formToBlocks( sectionForm([formField({ kind: 'radio', label: 'Size', options: ['Small', 'Large', 'Medium'] })]), ); @@ -812,7 +812,7 @@ describe('formToBlocks DLA parity', () => { assertBalanced(result.markup); }); - it('matches the DLA multi-field golden, including stable attr order and skipped fields', () => { + it('matches the reference multi-field golden, including stable attr order and skipped fields', () => { const result = formToBlocks( sectionForm( [ @@ -850,7 +850,7 @@ describe('formToBlocks DLA parity', () => { expect(result.markup).not.toContain('Campaign id'); }); - it('matches the DLA zero-field golden and escapes hostile labels like the DLA serializer', () => { + it('matches the reference zero-field golden and escapes hostile labels like the reference serializer', () => { const result = formToBlocks(sectionForm([], 'Continue')); expect(result.markup).toBe( diff --git a/packages/blocks-engine/src/__tests__/theme-font-faces.test.ts b/packages/blocks-engine/src/__tests__/theme-font-faces.test.ts index 00b9929fa..f84545114 100644 --- a/packages/blocks-engine/src/__tests__/theme-font-faces.test.ts +++ b/packages/blocks-engine/src/__tests__/theme-font-faces.test.ts @@ -122,7 +122,7 @@ describe('stripUnusedFontFaces', () => { }); }); -describe('font helper DLA parity surface', () => { +describe('font helper reference parity surface', () => { it('extractGoogleFontCssUrls finds unique css/css2 URLs and decodes HTML ampersands', () => { const urls = extractGoogleFontCssUrls([ '', @@ -136,7 +136,7 @@ describe('font helper DLA parity surface', () => { ]); }); - it('parseCapturedFontFaces preserves the DLA third-party host filter', () => { + it('parseCapturedFontFaces preserves the reference third-party host filter', () => { const faces = parseCapturedFontFaces(` @font-face { font-family: "Roboto"; @@ -221,7 +221,7 @@ describe('font helper DLA parity surface', () => { ); }); - it('absolutizeFontUrl and fontFilename match DLA golden behavior', () => { + it('absolutizeFontUrl and fontFilename match reference golden behavior', () => { expect(absolutizeFontUrl('//cdn.example.com/fonts/acme.woff2')).toBe( 'https://cdn.example.com/fonts/acme.woff2' ); @@ -240,7 +240,7 @@ describe('font helper DLA parity surface', () => { expect(fontFilename(face)).toBe('Acme-Display-400.woff2'); }); - it('buildFontFaceCss emits the DLA self-hosted source-font block', () => { + it('buildFontFaceCss emits the reference self-hosted source-font block', () => { const faces: LocalFontFace[] = [ { family: 'Acme Display', @@ -289,7 +289,7 @@ describe('font helper DLA parity surface', () => { ).toBe('a{}b{}'); }); - it('stripUnusedCarryFontFaces returns kept URLs and DLA stripped count', () => { + it('stripUnusedCarryFontFaces returns kept URLs and reference stripped count', () => { const usedFace = "@font-face{font-family:'Libre Baskerville';src:url(/fonts/libre.woff2) format('woff2')}"; const unusedFace = diff --git a/packages/blocks-engine/src/__tests__/theme-html-fallback-surface.test.ts b/packages/blocks-engine/src/__tests__/theme-html-fallback-surface.test.ts index 5663558ca..f28ee485e 100644 --- a/packages/blocks-engine/src/__tests__/theme-html-fallback-surface.test.ts +++ b/packages/blocks-engine/src/__tests__/theme-html-fallback-surface.test.ts @@ -41,7 +41,7 @@ describe('theme html fallback public surface', () => { ); }); - it('classifies WordPress layout markup by the DLA marker set', () => { + it('classifies WordPress layout markup by the reference marker set', () => { expect( [ '
', @@ -137,7 +137,7 @@ describe('theme html fallback public surface', () => { ); }); - it('rewrites internal hrefs with DLA path, host, fragment, and quote semantics', () => { + it('rewrites internal hrefs with reference path, host, fragment, and quote semantics', () => { const missed: string[] = []; const linkMap: InternalLinkMap = new Map([ ['example.test/contact', '/contact/'], @@ -158,7 +158,7 @@ describe('theme html fallback public surface', () => { expect(missed).toEqual(['/missing']); }); - it('reports DLA injection vectors and allows sanctioned theme PHP forms', () => { + it('reports reference injection vectors and allows sanctioned theme PHP forms', () => { expect( scanForInjection( '', diff --git a/packages/blocks-engine/src/__tests__/theme-ingest.test.ts b/packages/blocks-engine/src/__tests__/theme-ingest.test.ts index 51e92166a..b9d5466da 100644 --- a/packages/blocks-engine/src/__tests__/theme-ingest.test.ts +++ b/packages/blocks-engine/src/__tests__/theme-ingest.test.ts @@ -70,7 +70,7 @@ describe('theme ingest', () => { expect(services?.html).toContain('Blocks Engine Services'); }); - it('maps nested paths to DLA-compatible slugs', () => { + it('maps nested paths to reference-compatible slugs', () => { expect(slugFromRelPath(join('index.html'))).toBe('home'); expect(slugFromRelPath(join('blog', 'index.html'))).toBe('blog'); expect(slugFromRelPath(join('blog', 'Launch Notes.html'))).toBe('blog-launch-notes'); diff --git a/packages/blocks-engine/src/__tests__/theme-native-low-level-parity.test.ts b/packages/blocks-engine/src/__tests__/theme-native-low-level-parity.test.ts index a5f165513..a7e47cd33 100644 --- a/packages/blocks-engine/src/__tests__/theme-native-low-level-parity.test.ts +++ b/packages/blocks-engine/src/__tests__/theme-native-low-level-parity.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest'; -import expectedGoldens from '../__fixtures__/native-low-level-dla-goldens.json' with { type: 'json' }; +import expectedGoldens from '../__fixtures__/native-low-level-reference-goldens.json' with { type: 'json' }; import { runNativeLowLevelParity, type NativeLowLevelImpl, @@ -101,8 +101,8 @@ function collectDiffs(actual: NativeLowLevelParityFile, expected: NativeLowLevel return diffs; } -describe('native low-level helper DLA-today parity', () => { - it('matches mechanically derived DLA helper outputs byte-for-byte and is stable on rerun', () => { +describe('native low-level helper reference parity', () => { + it('matches mechanically derived reference helper outputs byte-for-byte and is stable on rerun', () => { const first = runNativeLowLevelParity(engineImpl); const second = runNativeLowLevelParity(engineImpl); expect(stableJson(first)).toBe(stableJson(second)); diff --git a/packages/blocks-engine/src/__tests__/theme-native-renderers-dispatch-parity.test.ts b/packages/blocks-engine/src/__tests__/theme-native-renderers-dispatch-parity.test.ts index 6e1e71f1d..214f4cc4a 100644 --- a/packages/blocks-engine/src/__tests__/theme-native-renderers-dispatch-parity.test.ts +++ b/packages/blocks-engine/src/__tests__/theme-native-renderers-dispatch-parity.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest'; -import expectedGoldens from '../__fixtures__/native-dispatch-renderer-dla-goldens.json' with { type: 'json' }; +import expectedGoldens from '../__fixtures__/native-dispatch-renderer-reference-goldens.json' with { type: 'json' }; import { ALL_RENDER_SECTION_INTERACTION_MODELS, nativeDispatchRenderCtx, @@ -97,8 +97,8 @@ function renderDirectTarget(entry: NativeRenderSectionCase): NativeRenderOut { } } -describe('native dispatch renderer DLA-today parity', () => { - it('matches mechanically derived DLA renderer outputs byte-for-byte and is stable on rerun', () => { +describe('native dispatch renderer reference parity', () => { + it('matches mechanically derived reference renderer outputs byte-for-byte and is stable on rerun', () => { const first = runNativeDispatchRendererParity(engineImpl); const second = runNativeDispatchRendererParity(engineImpl); expect(stableJson(first)).toBe(stableJson(second)); diff --git a/packages/blocks-engine/src/__tests__/theme-native-renderers-section-parity.test.ts b/packages/blocks-engine/src/__tests__/theme-native-renderers-section-parity.test.ts index 6326514b6..6e5ae75e3 100644 --- a/packages/blocks-engine/src/__tests__/theme-native-renderers-section-parity.test.ts +++ b/packages/blocks-engine/src/__tests__/theme-native-renderers-section-parity.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest'; -import expectedGoldens from '../__fixtures__/native-section-renderer-dla-goldens.json' with { type: 'json' }; +import expectedGoldens from '../__fixtures__/native-section-renderer-reference-goldens.json' with { type: 'json' }; import { runNativeSectionRendererParity, type NativeSectionRendererImpl, @@ -46,8 +46,8 @@ function collectDiffs(actual: NativeSectionRendererParityFile, expected: NativeS return diffs; } -describe('native section renderer DLA-today parity', () => { - it('matches mechanically derived DLA renderer outputs byte-for-byte and is stable on rerun', () => { +describe('native section renderer reference parity', () => { + it('matches mechanically derived reference renderer outputs byte-for-byte and is stable on rerun', () => { const first = runNativeSectionRendererParity(engineImpl); const second = runNativeSectionRendererParity(engineImpl); expect(stableJson(first)).toBe(stableJson(second)); diff --git a/packages/blocks-engine/src/__tests__/theme-native-renderers-text-parity.test.ts b/packages/blocks-engine/src/__tests__/theme-native-renderers-text-parity.test.ts index 15ba4666b..c1c826ee1 100644 --- a/packages/blocks-engine/src/__tests__/theme-native-renderers-text-parity.test.ts +++ b/packages/blocks-engine/src/__tests__/theme-native-renderers-text-parity.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest'; -import expectedGoldens from '../__fixtures__/native-text-renderer-dla-goldens.json' with { type: 'json' }; +import expectedGoldens from '../__fixtures__/native-text-renderer-reference-goldens.json' with { type: 'json' }; import { runNativeTextRendererParity, type NativeTextRendererImpl, @@ -53,8 +53,8 @@ function collectDiffs(actual: NativeTextRendererParityFile, expected: NativeText return diffs; } -describe('native text renderer DLA-today parity', () => { - it('matches mechanically derived DLA renderer outputs byte-for-byte and is stable on rerun', () => { +describe('native text renderer reference parity', () => { + it('matches mechanically derived reference renderer outputs byte-for-byte and is stable on rerun', () => { const first = runNativeTextRendererParity(engineImpl); const second = runNativeTextRendererParity(engineImpl); expect(stableJson(first)).toBe(stableJson(second)); diff --git a/packages/blocks-engine/src/__tests__/theme-page-reconstruct-helpers-parity.test.ts b/packages/blocks-engine/src/__tests__/theme-page-reconstruct-helpers-parity.test.ts index 2bafddcaf..48ffe9058 100644 --- a/packages/blocks-engine/src/__tests__/theme-page-reconstruct-helpers-parity.test.ts +++ b/packages/blocks-engine/src/__tests__/theme-page-reconstruct-helpers-parity.test.ts @@ -40,7 +40,7 @@ function section(partial: Partial): SectionSpec { } describe('page reconstruct helper public surface', () => { - it('exports the DLA page-reconstruct helper surface from theme/index', () => { + it('exports the reference page-reconstruct helper surface from theme/index', () => { expect(theme).toEqual( expect.objectContaining({ normalizeCopy: expect.any(Function), @@ -70,14 +70,14 @@ describe('page reconstruct helper public surface', () => { }); }); -describe('normalizeCopy DLA parity', () => { +describe('normalizeCopy reference parity', () => { it('collapses whitespace and strips soft-hyphen and zero-width copy noise', () => { expect(normalizeCopy(' foo\u00ad\u200b bar\n baz ')).toBe('foo bar baz'); expect(normalizeCopy('\ufeffA\u200c\tB\u200d\r\nC\u00ad')).toBe('A B C'); }); }); -describe('sanitizePatternHeaderField DLA parity', () => { +describe('sanitizePatternHeaderField reference parity', () => { it('strips PHP doc-comment and PHP-tag delimiters without rewriting visible text', () => { expect(sanitizePatternHeaderField('*/ evil(); /*')).toBe('evil();'); expect(sanitizePatternHeaderField('a c')).toBe('a php b c'); @@ -87,7 +87,7 @@ describe('sanitizePatternHeaderField DLA parity', () => { }); }); -describe('stripChrome DLA parity', () => { +describe('stripChrome reference parity', () => { it('drops leading header chrome and trailing footer/nav chrome while preserving middle content', () => { const out = stripChrome([ section({ @@ -129,7 +129,7 @@ describe('stripChrome DLA parity', () => { }); }); -describe('sanitizeSvgAsset DLA parity', () => { +describe('sanitizeSvgAsset reference parity', () => { it('removes active SVG content and keeps inert icon markup as concrete goldens', () => { expect( sanitizeSvgAsset( diff --git a/packages/blocks-engine/src/__tests__/theme-reconstruct-dla-baseline-parity.test.ts b/packages/blocks-engine/src/__tests__/theme-reconstruct-reference-baseline-parity.test.ts similarity index 87% rename from packages/blocks-engine/src/__tests__/theme-reconstruct-dla-baseline-parity.test.ts rename to packages/blocks-engine/src/__tests__/theme-reconstruct-reference-baseline-parity.test.ts index 198896f3c..1adfcddc8 100644 --- a/packages/blocks-engine/src/__tests__/theme-reconstruct-dla-baseline-parity.test.ts +++ b/packages/blocks-engine/src/__tests__/theme-reconstruct-reference-baseline-parity.test.ts @@ -6,7 +6,7 @@ import { reconstructBaselineCases, type FrozenConvertedSection, type FrozenReconstructCase, -} from '../__fixtures__/page-reconstruct-dla-baseline.corpus.js'; +} from '../__fixtures__/page-reconstruct-reference-baseline.corpus.js'; import { reconstructNativeAggregate } from '../theme/reconstruct.js'; import type { SectionRenderOptions } from '../theme/native-reconstruct-types.js'; @@ -35,7 +35,7 @@ interface BaselineFile { } const GOLDEN_PATH = fileURLToPath( - new URL('../__fixtures__/page-reconstruct-dla-baseline.goldens.json', import.meta.url), + new URL('../__fixtures__/page-reconstruct-reference-baseline.goldens.json', import.meta.url), ); function hydrateOptions(testCase: FrozenReconstructCase): SectionRenderOptions { @@ -84,7 +84,7 @@ function runCorpus(): BaselineFile { function readGolden(): BaselineFile { if (!existsSync(GOLDEN_PATH)) { - throw new Error(`Missing DLA reconstruct baseline golden: ${GOLDEN_PATH}`); + throw new Error(`Missing reference reconstruct baseline golden: ${GOLDEN_PATH}`); } return JSON.parse(readFileSync(GOLDEN_PATH, 'utf8')) as BaselineFile; } @@ -119,14 +119,14 @@ function collectDiffs(actual: BaselineFile, expected: BaselineFile): string[] { return diffs; } -describe('theme reconstruct DLA-today baseline parity', () => { - it('matches the 35-case DLA baseline and is byte-stable across two runs', () => { +describe('theme reconstruct reference baseline parity', () => { + it('matches the 35-case reference baseline and is byte-stable across two runs', () => { const first = runCorpus(); const second = runCorpus(); expect(collectDiffs(first, second)).toEqual([]); const diffs = collectDiffs(first, readGolden()); - console.info(`Engine reconstruct DLA baseline parity: cases=${first.cases.length} diffs=${diffs.length}`); + console.info(`Engine reconstruct reference baseline parity: cases=${first.cases.length} diffs=${diffs.length}`); expect(diffs).toEqual([]); }); }); diff --git a/packages/blocks-engine/src/__tests__/theme-region-audit-parity.test.ts b/packages/blocks-engine/src/__tests__/theme-region-audit-parity.test.ts index a6335c65f..24be2b1c8 100644 --- a/packages/blocks-engine/src/__tests__/theme-region-audit-parity.test.ts +++ b/packages/blocks-engine/src/__tests__/theme-region-audit-parity.test.ts @@ -1,4 +1,4 @@ -import expectedGoldens from '../__fixtures__/region-audit-dla-goldens.json' with { type: 'json' }; +import expectedGoldens from '../__fixtures__/region-audit-reference-goldens.json' with { type: 'json' }; import { regionAuditCases, runRegionAuditParity, @@ -26,7 +26,7 @@ function collectDiffs(actual: RegionAuditParityFile, expected: RegionAuditParity for (const actualCase of actual.cases) { const expectedCase = expectedById.get(actualCase.id); if (!expectedCase) { - diffs.push(`${actualCase.id}: missing from checked-in DLA goldens`); + diffs.push(`${actualCase.id}: missing from checked-in reference goldens`); continue; } if (stableJson(actualCase.input) !== stableJson(expectedCase.input)) { @@ -53,8 +53,8 @@ function collectDiffs(actual: RegionAuditParityFile, expected: RegionAuditParity return diffs; } -describe('region audit DLA parity', () => { - it('matches checked-in DLA region census and reconciliation goldens byte-for-byte', () => { +describe('region audit reference parity', () => { + it('matches checked-in reference region census and reconciliation goldens byte-for-byte', () => { const first = runRegionAuditParity({ extractSourceLandmarksFromHtml, selectorForHtmlRoot, diff --git a/packages/blocks-engine/src/__tests__/theme-section-coverage.test.ts b/packages/blocks-engine/src/__tests__/theme-section-coverage.test.ts index ed1bd7fde..9da144f12 100644 --- a/packages/blocks-engine/src/__tests__/theme-section-coverage.test.ts +++ b/packages/blocks-engine/src/__tests__/theme-section-coverage.test.ts @@ -166,7 +166,7 @@ describe('theme section coverage contract', () => { }); }); - describe('measureConvertedCoverage DLA parity', () => { + describe('measureConvertedCoverage reference parity', () => { it('reports full converted text and image coverage as not lost', () => { const result = measureConvertedCoverage( captured(['Hero headline', 'Detailed copy', 'Start now'], ['assets/hero.jpg']), @@ -223,7 +223,7 @@ describe('theme section coverage contract', () => { expect(result.lost).toBe(true); }); - it('folds glyph variants like the DLA section coverage oracle', () => { + it('folds glyph variants like the reference section coverage oracle', () => { expect( foldText( '\u2018Smart\u2019 \u201cquotes\u201d \u2013 \u2014 \u2012 wait\u2026\nagain' diff --git a/packages/blocks-engine/src/__tests__/theme-segment-parity.test.ts b/packages/blocks-engine/src/__tests__/theme-segment-parity.test.ts index 5c6767f78..b28604185 100644 --- a/packages/blocks-engine/src/__tests__/theme-segment-parity.test.ts +++ b/packages/blocks-engine/src/__tests__/theme-segment-parity.test.ts @@ -3,7 +3,7 @@ import { describe, expect, it } from 'vitest'; import * as theme from '../theme/index.js'; import { segmentPage } from '../theme/index.js'; -describe('segmentPage DLA parity', () => { +describe('segmentPage reference parity', () => { it('exposes the additive segmentPage public surface from theme/index', () => { expect(theme).toEqual( expect.objectContaining({ @@ -12,7 +12,7 @@ describe('segmentPage DLA parity', () => { ); }); - it('identifies header, nav, footer, and body sections on a DLA fixture', () => { + it('identifies header, nav, footer, and body sections on a reference fixture', () => { const html = '

Hi

Feat

(c)

'; @@ -70,7 +70,7 @@ describe('segmentPage DLA parity', () => { ]); }); - it('segments a no-chrome page and escapes loose decoded text like DLA', () => { + it('segments a no-chrome page and escapes loose decoded text like reference', () => { const html = '
Hello <b>bold</b>

S text

'; diff --git a/packages/blocks-engine/src/__tests__/theme-source-assets-parity.test.ts b/packages/blocks-engine/src/__tests__/theme-source-assets-parity.test.ts index 2bdd45521..78fedc6e7 100644 --- a/packages/blocks-engine/src/__tests__/theme-source-assets-parity.test.ts +++ b/packages/blocks-engine/src/__tests__/theme-source-assets-parity.test.ts @@ -14,7 +14,7 @@ import { WP_COMPAT_CSS, } from '../theme/index.js'; -const DLA_WP_COMPAT_CSS = `/* wp-compat: neutralize WP wrapper interference for carried source CSS */ +const REFERENCE_WP_COMPAT_CSS = `/* wp-compat: neutralize WP wrapper interference for carried source CSS */ /* NOTE deliberately NO .wp-block-template-part{display:contents} here: our parts use tagName header/footer, so the wrapper IS the semantic element — display:contents would destroy the box that source header{}/footer{} rules @@ -83,7 +83,7 @@ function writeFixture(dir: string, relPath: string, contents = ''): void { writeFileSync(abs, contents, 'utf8'); } -describe('source assets DLA parity', () => { +describe('source assets reference parity', () => { it('exposes the additive source-assets public surface from theme/index', () => { expect(theme).toEqual( expect.objectContaining({ @@ -105,8 +105,8 @@ describe('source assets DLA parity', () => { ); }); - it('keeps the WP compat CSS byte-for-byte equal to the DLA golden string', () => { - expect(WP_COMPAT_CSS).toBe(DLA_WP_COMPAT_CSS); + it('keeps the WP compat CSS byte-for-byte equal to the reference golden string', () => { + expect(WP_COMPAT_CSS).toBe(REFERENCE_WP_COMPAT_CSS); }); it('replays source nav anchor rules against core/navigation wrapper markup', () => { @@ -206,7 +206,7 @@ describe('source assets DLA parity', () => { }); }); - it('collects local HTML img src refs with DLA regex and path resolution semantics', () => { + it('collects local HTML img src refs with reference regex and path resolution semantics', () => { withTempDir((dir) => { writeFixture(dir, 'pages/deep/img/double.png'); writeFixture(dir, 'pages/deep/img/single.jpg'); @@ -309,7 +309,7 @@ describe('source assets DLA parity', () => { expect(result.jsFiles).toEqual(['assets/js/lib.js', 'assets/js/app.js']); expect(result.skippedUnlinked).toEqual(['stale.js', 'style.css']); const expectedBase = - DLA_WP_COMPAT_CSS + + REFERENCE_WP_COMPAT_CSS + [ '\n.base { background: url(media/bg.png); color: black; }', '.base { color: white; }', diff --git a/packages/blocks-engine/src/__tests__/theme-variation-hoist-parity.test.ts b/packages/blocks-engine/src/__tests__/theme-variation-hoist-parity.test.ts index e759d856b..17e5ceefa 100644 --- a/packages/blocks-engine/src/__tests__/theme-variation-hoist-parity.test.ts +++ b/packages/blocks-engine/src/__tests__/theme-variation-hoist-parity.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest'; -import expectedGoldens from './fixtures/variation-hoist-dla-goldens.json' with { type: 'json' }; +import expectedGoldens from './fixtures/variation-hoist-reference-goldens.json' with { type: 'json' }; import { runVariationHoistParity, variationHoistCases, @@ -58,7 +58,7 @@ function collectDiffs(actual: VariationHoistParityFile, expected: VariationHoist for (const actualCase of actual.cases) { const expectedCase = expectedById.get(actualCase.id); if (!expectedCase) { - diffs.push(`${actualCase.id}: missing from checked-in DLA goldens`); + diffs.push(`${actualCase.id}: missing from checked-in reference goldens`); continue; } if (stableJson(actualCase.options) !== stableJson(expectedCase.options)) { @@ -82,8 +82,8 @@ function collectDiffs(actual: VariationHoistParityFile, expected: VariationHoist return diffs; } -describe('variation hoist DLA parity', () => { - it('matches checked-in DLA hoistVariations and applyHoistSwaps goldens byte-for-byte', () => { +describe('variation hoist reference parity', () => { + it('matches checked-in reference hoistVariations and applyHoistSwaps goldens byte-for-byte', () => { const first = runVariationHoistParity(engineImpl) as VariationHoistParityFile; const second = runVariationHoistParity(engineImpl) as VariationHoistParityFile; expect(stableJson(first)).toBe(stableJson(second)); diff --git a/packages/blocks-engine/src/theme/assemble.ts b/packages/blocks-engine/src/theme/assemble.ts index 9e67bef10..ca3d5702d 100644 --- a/packages/blocks-engine/src/theme/assemble.ts +++ b/packages/blocks-engine/src/theme/assemble.ts @@ -100,7 +100,7 @@ export function assemble(parts: ThemeAssemblyParts): ThemeModel { * global block gap would otherwise inject a ~24px margin above every section after * the first, reading as a stray stripe above full-bleed bands. This neutralizes the * block gap on those wrappers only — via CSS, so the section block markup stays - * byte-identical to the DLA reference. Blocks the user adds in the editor are not + * byte-identical to the reference implementation. Blocks the user adds in the editor are not * align:full, so they keep WordPress's default block gap. The selector outweighs * core's zero-specificity `:where(...) > * + *` gap rule. */ diff --git a/packages/blocks-engine/src/theme/chrome-parts-builders.ts b/packages/blocks-engine/src/theme/chrome-parts-builders.ts index 84f3ddf81..c840b5cdb 100644 --- a/packages/blocks-engine/src/theme/chrome-parts-builders.ts +++ b/packages/blocks-engine/src/theme/chrome-parts-builders.ts @@ -218,10 +218,10 @@ function stickyStateBlock(sticky: StickyBehavior): string { '\\u0027' ); return ( - `\n\n` + - `