Template members: compile cluster members as posts on their representative's template

Đang mở
#4,973 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
25/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
php, wordpress
Lĩnh vực
backend, performance

Hướng nghiên cứu

Start by reading the artifact normalization limits, compiler entry points, source provenance mapping, and compiled site report code; inspect the existing fixtures and tests for page compilation. Then trace how post content, entity fields, and per-page styles are produced for a full compile. Done means derived members match full compilation byte-for-byte, header changes escalate with a diagnostic, existing fixtures stay unchanged, and the required real capture comparison is documented.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Part of Automattic/static-site-importer#2742.

Problem

A whole-site capture of a 2,202-route Blogger site produced 2,074 pages: 1,928 of them are verified members of one template cluster (DLA template-clusters.json, cluster t2, all six derivation checks equal). Blocks Engine treats every page as a separate site document. The artifact counts each page plus about 3 inline style/script expansions per page against ArtifactNormalizer::MAX_FILES (5000), and compiles each page in full, including its header, sidebar and footer, which compose later factors out again. The site cannot import.

On this source, members differ from the representative only in:

  • the post entry (.post-outer: title, date, labels, and a body that carries its own <style>);
  • the older/newer pager.

Header, sidebar and footer are identical. In WordPress terms the members are posts on the representative's single template, not new templates.

Desired behavior

  1. Contract. An artifact may declare template members: template_members: [{ path, representative, payload_reference }]. Members are bounded by their own limits (count and bytes), not max_files, because they are content instances rather than site documents.
  2. Compile. The representative compiles in full, as today. For each member, the compiler diffs the member document against the representative's source document and maps every changed node to its block through source provenance (_source_provenance_id).
    • If every change lies inside the representative's post-content region, or in blocks that are dynamic per post (core/post-title, post-date, post-terms, post-navigation-link), the member becomes a post entity:
      • its post_content is converted from its own content region, reusing the representative's session (resolved stylesheets and analysis);
      • its fields (title, date, terms) come from the matching regions;
      • its member-local styles go into the per-page stylesheet output, as for a fully compiled page.
    • Otherwise the member escalates to a full compile and counts against max_files like any page, with a diagnostic naming the region outside the boundary.
  3. Report. The compiled site report lists derived and escalated members with reasons.

Acceptance criteria

  • Equality gate. One test using real markup: a representative and two members with different titles, bodies, a body-local <style>, and pager links. Each member's post_content, entity fields and page stylesheet output are byte-equal to compiling that member as an ordinary page. A third member, differing in the header, escalates.
  • The compiled output of existing fixtures is unchanged.
  • composer test passes.
  • The PR shows, for a sample of members from a real multi-page capture, the same equality against a full compile, plus the compile time per derived member against a full page.

Related: #4939 (shared shells), #2089 (staged compilation at scale).


AI disclosure: designed and written by Claude (Anthropic), acting as the orchestrating coding agent in the Data Liberation loop, from a whole-site import of a real Blogger source.

Ngôn ngữ chính
PHP
Star
25
Fork
3
Merge trung bình
2 giờ 24 phút
Pull request đã merge (30 ngày)
933

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Automattic/blocks-engine

Tất cả issue của Automattic/blocks-engine

Issue tương tự

Thêm issue về PHP

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.