Problem
ArtifactNormalizer infers role entry for every HTML path ending in index.html, then treats the inferred role as an explicit entrypoint. A normal multi-page artifact therefore marks every nested index document as an entrypoint and MaterializationPlanBuilder maps every page to /.
This surfaced in the production WP Codebox Cloudflare SSI acceptance workload tracked by Automattic/wp-codebox#1975 and Automattic/wp-codebox#2013.
Reproduction
Using automattic/blocks-engine-php-transformer 0.1.15 (5cc48aa0fad87d278d6c9f695c28ad137bf8e1da), compile:
$artifact = array(
'schema' => 'blocks-engine/php-transformer/site-artifact/v1',
'root' => 'website',
'entrypoint' => 'website/index.html',
'files' => array(
array( 'path' => 'website/index.html', 'type' => 'text/html', 'content' => '<h1>Home</h1>' ),
array( 'path' => 'website/api/index.html', 'type' => 'text/html', 'content' => '<h1>API</h1>' ),
),
);
$result = ( new ArtifactCompiler() )->compile( $artifact )->toArray();
var_export( $result['source_reports']['materialization_plan']['routes'] );
Actual: both routes have source_relation: entrypoint and target_path: /.
Expected: only website/index.html is the entrypoint at /; website/api/index.html is a document with a distinct route.
Root cause
ArtifactNormalizer::role() infers entry for every nested index path. normalize() then promotes any normalized entry role into $safeEntrypoints, losing the distinction between an explicitly declared entry role and an inferred document role.
Acceptance criteria
- An artifact-level
entrypoint remains authoritative regardless of file order.
- Nested
*/index.html documents are not implicitly promoted to additional entrypoints.
- An explicitly declared file role/entrypoint remains supported.
- Multi-page materialization plans produce one root entrypoint and distinct nested document routes.
- Add deterministic regression coverage for file ordering and nested index paths.
Problem
ArtifactNormalizerinfers roleentryfor every HTML path ending inindex.html, then treats the inferred role as an explicit entrypoint. A normal multi-page artifact therefore marks every nested index document as an entrypoint andMaterializationPlanBuildermaps every page to/.This surfaced in the production WP Codebox Cloudflare SSI acceptance workload tracked by Automattic/wp-codebox#1975 and Automattic/wp-codebox#2013.
Reproduction
Using
automattic/blocks-engine-php-transformer0.1.15 (5cc48aa0fad87d278d6c9f695c28ad137bf8e1da), compile:Actual: both routes have
source_relation: entrypointandtarget_path: /.Expected: only
website/index.htmlis the entrypoint at/;website/api/index.htmlis a document with a distinct route.Root cause
ArtifactNormalizer::role()infersentryfor every nested index path.normalize()then promotes any normalizedentryrole into$safeEntrypoints, losing the distinction between an explicitly declared entry role and an inferred document role.Acceptance criteria
entrypointremains authoritative regardless of file order.*/index.htmldocuments are not implicitly promoted to additional entrypoints.