МАТЧАСТЬMASTER PLAN 9 · ARTICLE CONTRACT & BUILDER

Порядок выполнения уточнён

Эта глава входит в готовый комплект из 26 документов. Статус реализации хранится в журнале; требования главы сами по себе не являются выполненной работой.

[9.1] ACB-01 — карточка выполнения. Весь план и его состояние.

Уточнения для этой главы

[9.0.4] Ранние schema/storage/memory проверки используют валидные синтетические Research/Article fixtures с явным evidence_kind=fixture. Полная сборка реального Research Pack доказывается в RSP-10, Article Package — в ACB-10. Fixture PASS не равен production PASS.

[9.0.8] Каждый downstream шаг создаёт новый запечатанный пакет с parent hash. После изменения текста, подписи, картинки или связей инвалидировать относящиеся к ним QA/SEO/approval результаты. На выпуск передаются проверки именно итогового hash, а не раннего текста.

[9.0.9] SHA-256 считается по точным bytes файлов. Manifest включает относительный путь, длину и sha256 каждого payload, но не собственный hash. Package hash — SHA-256 manifest bytes; detached seal хранит его отдельно. Проверять traversal, symlink escape, missing/extra files и повторные имена.

Mathchast / Article Contract & Builder / 9

CONTENT
IN.
PACKAGE OUT.

Writer отдаёт смысл и semantic content. Builder превращает это в стабильный канонический Article Package.

Задача Builder — нормализовать структуру, переиспользовать существующие компоненты, собрать техническую оболочку и подготовить воспроизводимую article version для последующих QA-этапов.

WRITER DOES NOT BUILD THE SITE SHELL. BUILDER DOES NOT REWRITE THE ARTICLE.
Writer artifacts → validate → normalize blocks → Article Package → Fact/Originality Gates.

Separate editorial
from technical assembly.

Builder должен принять contract-valid Writer output и создать устойчивый Article Package: нормализованный контент, metadata, component bindings, source/evidence relations, asset slots, version manifest и технический HTML shell — без SEO finalization и deploy.

PRIMARY OUTCOME
Canonical Article Package.

Один воспроизводимый пакет, который можно прогнать через fact/originality/image/knowledge/SEO/release stages.

REUSE
Existing components first.

68 live HTML examples + `components.json` — исходная база Article Builder. Новые компоненты только после доказанного gap.

BOUNDARY
No prose rewrite.

Builder может нормализовать/валидировать structure and markup, но не должен незаметно переписывать смысл статьи.

VERSIONING
Every build is traceable.

Article version знает Writer task, Research Pack, component manifest, builder version, config_hash и source artifact hashes.

Non-goalBuilder не делает финальную SEO оптимизацию, не генерирует final images и не публикует production. Он готовит каноническую структурную основу.

Audit the 68.
Don't invent the 69th.

ARTICLE BUILDER CAPABILITY AUDIT 1. Inspect: 68 live HTML examples components.json existing visual/media/data/reasoning groups any component renderer / templates / CSS contracts current production article shell listing/category article templates 2. Inspect editorial.article / article_version / asset. 3. Inspect current static-site generation / page assembly scripts. 4. Inspect writer-produced HTML examples if any. 5. Search repo: component, block, article template, renderer, builder, article_version, asset slot, html shell, content fragment. 6. Find tests / fixtures / snapshot tests. 7. Classify capabilities: REUSE → EXTEND → WRAP → MIGRATE → NEW 8. Only then freeze physical builder modules/templates.
✓
Existing component IDs/semantics preserved where possible to avoid breaking live articles.
✓
Existing article shell/template gets preference over new layout system.
✓
`editorial.article_version` should remain canonical version authority if audit confirms it.
×
Не создавать новый parallel component library только потому, что текущая неоднородна.

Blocks need
stable identities.

component definition (logical) component_id name group = visual | media | data | reasoning | structural schema_version allowed_children / nesting rules required_fields optional_fields content constraints asset slots accessibility requirements render template / renderer ref status = ACTIVE | DEPRECATED | INTERNAL introduced_at replacement_id?
MANIFEST
Writer получает versioned allowed-components manifest. Builder использует тот же manifest при validation/rendering.
DEPRECATION
Deprecated block остаётся readable/renderable для старых article versions, но новый Writer его не использует.
NEW COMPONENT
Добавляется только после доказанного editorial gap + schema + renderer + tests + example + manifest update.
NO STYLE LEAK
Writer оперирует semantic block meaning, а не случайными CSS class names.

One package.
All downstream context.

article-package/ ├── manifest.json ├── article.json ├── content/ │ ├── article-content.source.html │ ├── article-content.normalized.html │ └── blocks.json ├── writer/ │ └── writer-report.json ├── research/ │ └── research-pack-ref.json ├── evidence/ │ └── claim-source-map.json ├── images/ │ ├── image-plan.json │ └── slots.json ├── knowledge/ │ └── term-refs.json ├── render/ │ ├── article-shell.html │ └── render-report.json └── qa/ └── builder-validation.json
SOURCE COPY
Writer source artifact сохраняется неизменённым для diff/provenance.
NORMALIZED
Builder создаёт normalized content с canonical markup/component representation.
BLOCKS
`blocks.json` даёт структурное представление для QA, images, knowledge linking and later renderers.
CLAIM MAP
Связь article claims/sections с Research Pack evidence сохраняется явно.
MANIFEST
File hashes, schema versions, component manifest version, builder version, Writer/Research refs, article version, config_hash.

Normalize markup.
Preserve meaning.

AllowedForbidden without editorial loop
canonical heading IDs / block wrappersChanging factual claims
normalize whitespace / safe markupAdding unsupported facts
convert allowed semantic markers to registered blocksRemoving caveats/conflicts for style
canonicalize internal metadata refsReframing article angle materially
sanitize unsafe attributes/tagsChanging conclusion meaning
fix structurally invalid but unambiguous nestingGuessing ambiguous structure silently
AMBIGUITY
Если repair меняет возможный смысл — Builder возвращает validation error, а не «угадывает».
DIFF
Builder сохраняет source→normalized diff/report, чтобы downstream видел, что было изменено автоматически.
SANITIZE
Script/style/event-handler/private-path injections запрещены/удаляются по explicit policy with report.

Validate first.
Render second.

READY WRITER OUTPUT ↓ verify writer task / claim / pack version ↓ parse semantic HTML ↓ validate component manifest ↓ normalize blocks / refs ↓ resolve article relation NEW | FOLLOW_UP | UPDATE_EXISTING ↓ bind source/evidence refs ↓ bind image slots ↓ bind knowledge-term refs ↓ create canonical article version ↓ render technical shell ↓ run builder validation ↓ seal Article Package ↓ Fact & Originality Gates
Atomic buildArticle version не становится canonical downstream input, пока весь Builder pipeline не прошёл validation. Partial render не должен заменить предыдущую хорошую version.

Article relation
controls versioning.

NEW
Создаётся/используется новый canonical article identity; URL ещё не финализируется Builder'ом.
FOLLOW_UP
Новый article identity + parent/related relation к существующей статье.
UPDATE_EXISTING
Создаётся новая `article_version` существующего article identity; новый URL не создаётся без отдельного editorial decision.
DUP REJECT
До Builder не должен доходить. Если всё же дошёл из-за race/state bug — fail closed.
VERSION
Version lineage сохраняет previous version, writer task, pack version and Builder manifest.

Page structure.
Not SEO finalization.

article-shell.html may include doctype / language site article template main/article landmarks header/article title region semantic content mount source block mount image/asset placeholders knowledge-link placeholders related-content mounts structured metadata placeholders site-wide safe CSS/JS refs footer/nav shell if existing template owns them Not final here: SEO title/description canonical URL JSON-LD final values sitemap entry IndexNow production asset paths
EXISTING TEMPLATE
Reuse current production static article shell if audit confirms it is canonical/healthy.
PLACEHOLDERS
Downstream stages fill images/knowledge/SEO through explicit slots, not regex hacks.
NO PROD PATH
Builder output is portable artifact; production filesystem knowledge belongs Deployer.

Claims stay tied
to evidence.

claim-source-map.json article_claim_id research_claim_id? section/block id text locator / normalized statement importance source_refs[] fact_refs[] evidence status from Research Pack writer status builder status later fact-check status (empty initially)
NO RESEARCH CLAIM
Новая factual claim, которой нет в Research Pack, помечается для Fact Gate; Builder не пытается подтвердить её сам.
REASONING
Reasoning/opinion/inference маркируется отдельно от factual claim, чтобы QA не требовал source relation там, где это не факт.
LOCATOR
Stable block/claim locators нужны для automated rewrite loop without rewriting whole article blindly.

Reserve meaning.
Not final files.

image slot binding slot_id block/placement id purpose subject evidence refs source-image refs priority layout capability caption intent alt intent status = PLANNED final_asset_id = null
PRESERVE
Builder сохраняет Writer image intent, но не генерирует окончательный prompt/asset.
LAYOUT
Slot знает какие existing components/layouts допустимы для будущего visual.
MISSING
Отсутствующий optional image не ломает Article Package; required explanatory visual может стать downstream gate.

Mark terms now.
Link later.

TERM REFS
Writer/Builder сохраняют recognized canonical term IDs + aliases/locations.
NO FINAL LINKS
Builder может сохранить placeholder/ref, но final internal-link decisions принадлежат Knowledge Base & Internal Linking stage.
NO OVERLINK
Не линковать каждое повторение термина на этапе Builder.

Assets are references
until resolved.

AUTHORITY
Reuse `editorial.asset` and existing media pipeline if audit confirms contract.
SOURCE ASSET
Research image-source record ≠ publishable final asset. Builder keeps relation but not publication assumption.
GENERATED
Final generated/redrawn image later receives canonical asset identity and replaces slot reference.
PORTABILITY
Article Package references assets by logical IDs/content hashes, not hard-coded production absolute paths.

Know exactly
what was built.

manifest.json article_id article_version_id article_relation previous_article_version_id? writer_task_id writer_output_hashes research_pack_id / version component_manifest_version / hash builder_version article_schema_version shell_template_version / hash knowledge_dictionary_version? config_hash created_at files[] + hashes build_status validation_report_ref
DETERMINISM
Same inputs + same component/template/builder/config versions should produce semantically equivalent normalized package.
CACHE
Hash-addressable intermediate artifacts may be reused where safe, but never bypass validation after contract/version change.

Structure must
be green first.

GatePass condition
writer provenanceActive/accepted Writer output and exact Research Pack pin resolve.
HTML parseSource semantic fragment parses without unsafe constructs.
component manifestEvery custom block resolves to ACTIVE/allowed component definition.
nestingBlock hierarchy obeys component structural rules.
article identityNEW/FOLLOW_UP/UPDATE semantics match Duplicate Guard decision.
claimsFactual claim locators/source map generated; unresolved refs explicitly flagged.
asset refsAll logical asset/image slot refs valid or intentionally unresolved.
knowledge refsTerm refs resolve or are flagged for later dictionary update.
shellRendered technical shell parses and required mounts exist.
securityNo disallowed script/style/event handler/private path/secret leakage.
manifestHashes/versions/input lineage internally consistent.
Builder PASS ≠ article truthStructural green only means the Article Package is ready for Fact & Originality Gates. It does not certify factual correctness or originality.

Version the article.
Preserve history.

UPDATE_EXISTING existing article identity ↓ current published article_version ↓ new Writer output + Research Pack ↓ Builder creates candidate article_version N+1 ↓ QA / images / knowledge / SEO ↓ Release swaps published version atomically later Old version: remains stored/history-visible can be rollback target preserves original evidence/build metadata
DIFF
Builder should emit structural/content diff metadata for UPDATE_EXISTING to support review and downstream fact-check scope.
NO IN-PLACE EDIT
Не перезаписывать текущую опубликованную version во время build.
ROLLBACK
Release stage later can restore previous known-good article version because history remains intact.

Builder behavior
is versioned policy.

Setting familyPurpose
builder.component_manifestApproved manifest version/reference.
builder.shell_templateCanonical article shell version/reference.
builder.auto_repair_policyWhich safe structural repairs may be automatic.
builder.sanitize_policyUnsafe tag/attribute policy.
builder.strict_claim_mappingRequired behavior for unmapped factual claims.
builder.snapshot_validationHTML/component snapshot regression policy.
builder.update_diff_policyHow detailed UPDATE_EXISTING diffs are retained.

Trace every
article version.

VOLUME
Builds started/passed/failed, NEW/FOLLOW_UP/UPDATE distribution.
VALIDATION
HTML parse errors, invalid components, unsafe markup, unresolved refs, auto-repair counts.
COMPONENTS
Usage frequency by component, deprecated block attempts, unknown component requests.
VERSIONS
Article versions created, update diffs, failed candidate versions, rollback-target availability.
TIME
Builder duration, renderer duration, validation p95, package size.
TRACE
article_id/version, writer_task, pack version, component manifest, builder version, shell template, config_hash.

Audit components.
Build one package.

ACB-01

Audit component + article stack

68 live examples, components.json, article shell, article/article_version/asset, static build scripts, tests and consumers.
DONE: reuse matrix + canonical authorities proven.
ACB-02

Freeze component manifest v1

Stable component IDs, groups, schemas, nesting, deprecation and renderer refs based on existing live components.
DONE: every approved component has schema + example + renderer/test path.
ACB-03

Freeze Article Package schema

Manifest/content/blocks/writer/research/evidence/images/knowledge/render/qa contracts.
DONE: package fixtures validate.
ACB-04

Implement parser + normalizer

Parse Writer semantic HTML, map components, sanitize, safe repairs, emit source→normalized diff.
DONE: meaning-preserving normalization verified.
ACB-05

Implement claim/block maps

Stable block IDs, factual claim locators, Research Pack claim/source refs, reasoning distinction.
DONE: downstream can address one claim/block deterministically.
ACB-06

Implement article version build

NEW/FOLLOW_UP/UPDATE_EXISTING semantics using canonical article/article_version authority.
DONE: update builds N+1 without touching published N.
ACB-07

Technical shell renderer

Reuse canonical production shell/template; explicit mounts/placeholders for images, sources, knowledge and later SEO.
DONE: rendered shell valid and portable.
ACB-08

Image / asset / knowledge slots

Bind image plan and term refs to logical slots without final assets/links.
DONE: downstream stages have stable slot IDs.
ACB-09

Builder validation suite

Component/nesting/security/identity/claim-ref/manifest/shell/snapshot tests.
DONE: malformed package cannot advance.
ACB-10

Real NEW + UPDATE pilot

Build one new article package and one update-existing package from contract-valid Writer outputs.
DONE: both packages sealed and reproducible.
ACB-11

Work + checkpoint

Article version/build status, component validation and package artifacts in Work; HANDOFF/Project State sync.
DONE: checkpoint 9 PASS.
Split ruleЕсли audit покажет, что component registry и shell renderer — независимые большие contracts, вынести их в 9.x после ACB-01. Но не создавать новый design system до полного разбора живых 68 компонентов.

Structure must
be deterministic.

TestExpected result
unknown componentFail with actionable error; no silent arbitrary rendering.
deprecated component in old versionReadable/renderable under historical manifest.
deprecated component in new Writer outputReject or migrate by explicit policy.
unsafe script/event handlerSanitize/reject according to policy and report it.
ambiguous malformed HTMLFail; do not guess meaning.
same inputs + same versionsEquivalent normalized package and stable hashes where deterministic.
UPDATE_EXISTINGCreates candidate N+1, leaves published N unchanged.
FOLLOW_UPNew article identity + explicit relation preserved.
unmapped factual claimFlagged for Fact Gate; not silently dropped.
image slot unresolvedPackage valid if optional; required visual policy can gate later.
knowledge term unknownFlag for knowledge stage; Builder does not invent page.
manifest tamperHash verification fails.
shell missing mountBuilder validation fails.
source vs normalized diffOnly allowed structural transformations appear.
×
Не считать full rendered HTML единственным source-of-truth статьи.
×
Не позволять Builder переписывать текст ради красивого layout.
×
Не смешивать SEO canonical/meta logic с Builder contract.
×
Не hardcode production absolute paths в Article Package.

Article package
is canonical and portable.

CHECKPOINT 9 PASS WHEN: ✓ 68 live HTML examples + components.json audited reuse-first ✓ existing article shell/build scripts audited ✓ canonical component manifest v1 exists ✓ no parallel component library introduced without proof ✓ Article Package schema is frozen/versioned ✓ Writer source artifact is preserved ✓ normalized content + blocks.json are produced ✓ source→normalized changes are auditable ✓ NEW/FOLLOW_UP/UPDATE_EXISTING semantics are enforced ✓ editorial.article/article_version authority is reused if valid ✓ factual claim locators/evidence refs are preserved ✓ image / asset / knowledge slots are stable ✓ technical shell uses explicit mounts/placeholders ✓ no final SEO/deploy responsibility leaks into Builder ✓ manifest captures all input/template/component/config versions ✓ NEW + UPDATE real pilots pass ✓ structural/security/component tests are green ✓ Work exposes build/version/package state ✓ HANDOFF points to Fact & Originality Gates next

Продолжить выполнение

Следующий шаг выбирает журнал задач. Все главы уже подготовлены.

[9.1] ACB-01 — карточка выполнения