Полный интеграционный pipeline фабрики контента D30: package contract, validation, media, taxonomy, terms, idempotent upsert, draft-only permissions, review, publish и post-publish jobs.
D30 ↓ Integration Adapter ↓ Payload REST / Local API ↓ Draft ↓ Review ↓ Publish ↓ Jobs ├── Meilisearch ├── Gorse ├── cache invalidation └── analytics/system events
type D30ArticlePackage = {
runId: string
externalId: string
pipelineVersion: string
article: {
title: string
slug?: string
excerpt?: string
category: CategoryRef
topics?: TopicRef[]
terms?: TermCandidate[]
source?: SourceRef
heroImage?: MediaInput
contentBlocks: D30Block[]
d30Score?: number
evidenceStatus?: string
refreshAfter?: string
}
metadata?: {
sourceUrl?: string
sourceHash?: string
inputHash?: string
generatedAt?: string
}
}runIdexternalIdpipelineVersionarticle.titlearticle.categoryarticle.contentBlocks1. Envelope validation 2. Auth / service role validation 3. Schema validation 4. externalId validation 5. Taxonomy resolution 6. Terms resolution 7. Media resolution 8. Blocks validation 9. Quality fields validation 10. Idempotent upsert
service_d30 или Integration Adapter с эквивалентными ограниченными правами.existing = find Article by externalId IF existing: update existing DRAFT action = update ELSE: create new DRAFT action = create never create duplicate for same externalId
if existing.importHash == incoming.inputHash: action = skip reason = identical_input
Это опциональная оптимизация. Она не заменяет проверку по externalId.
D30 category ref ↓ match by stable id/slug ↓ found → use relationship ↓ not found → fail item OR controlled mapping table
D30 term ↓ canonical/alias search ↓ existing term → relation ↓ no match → Term draft candidate ↓ article may reference only approved/existing term or store pending candidate metadata separately
MediaInput ↓ validate URL/file/type/size ↓ download or receive ↓ checksum ↓ dedupe ↓ upload through Payload Media ↓ relationship id
| D30 block | Payload block |
|---|---|
| rich_text | RichTextBlock |
| image | ImageBlock |
| gallery | GalleryBlock |
| table | TableBlock |
| warning | WarningBlock |
| quote | QuoteBlock |
| product | ProductBlock |
| ad | AdBlock |
| related_articles | RelatedArticlesBlock |
| term_reference | TermReferenceBlock |
| Field | D30 может установить | Publish gate |
|---|---|---|
| d30Score | YES | informational/threshold policy |
| evidenceStatus | YES | может требовать review |
| qualityGate | не финальный PASS | финальный PASS только review process |
queued → running → success | partial | failed | cancelled
pending → success action=create|update|skip OR → fail errorCode + errorMessage
AUTH_DENIED SCHEMA_INVALID EXTERNAL_ID_INVALID CATEGORY_NOT_FOUND TOPIC_INVALID TERM_CONFLICT MEDIA_DOWNLOAD_FAILED MEDIA_TYPE_INVALID BLOCK_UNKNOWN BLOCK_INVALID SLUG_CONFLICT PAYLOAD_WRITE_FAILED TIMEOUT INTERNAL_ERROR
Repeated fail ↓ mark ImportItem failed ↓ store diagnostics ↓ manual review / reprocess command
Не нужен отдельный Kafka DLQ на MVP.
Критические CMS changes для одного article package должны быть максимально атомарны, но внешние сервисы Meili/Gorse не входят в DB transaction.
DB/CMS commit draft
↓
success
↓
enqueue downstream jobs
D30 draft ↓ editor/reviewer ↓ check: - title/slug - category/topics - terms - blocks - evidence - media - safety ↓ qualityGate = pass ↓ publish by authorized role
qualityGate == pass.Publish ├── searchIndexArticle ├── syncRecommendation ├── cache invalidation ├── sitemap freshness/invalidation └── ArticleEvent(published)
refreshAfter reached ↓ refreshArticle job ↓ create D30 request/task ↓ new package with same externalId ↓ update DRAFT ↓ review ↓ publish new version
{
"runId": "...",
"externalId": "...",
"status": "success",
"action": "create|update|skip",
"articleId": "...",
"draft": true,
"warnings": []
}{
"runId": "...",
"externalId": "...",
"status": "fail",
"errorCode": "BLOCK_INVALID",
"message": "...",
"retryable": false
}batch package ↓ ImportRun ↓ N items ↓ bounded concurrency ↓ per-item result ↓ aggregate run status
100 → PASS 1,000 → PASS 10,000 → PASS 100,000
| # | Тест | PASS |
|---|---|---|
| D01 | New externalId | draft created |
| D02 | Same externalId retry | no duplicate |
| D03 | Same inputHash | skip optional |
| D04 | Unknown category | controlled fail |
| D05 | Unknown term | draft candidate/manual path |
| D06 | Unknown block | fail/quarantine |
| D07 | Invalid media type | rejected |
| D08 | D30 publish attempt | DENY |
| D09 | D30 delete attempt | DENY |
| D10 | Update published article | draft version only |
| D11 | Transient failure retry | idempotent |
| D12 | Post-publish | jobs enqueued |
1. D30ArticlePackage schema 2. Integration Adapter 3. auth middleware 4. validation pipeline 5. taxonomy resolver 6. term resolver 7. media resolver 8. block mapper 9. idempotent article upsert 10. ImportRun/ImportItem logging 11. retry policy 12. reprocess command 13. refresh workflow 14. acceptance test report 15. load test report 16. deviations.md 17. commit hash
build_11_docker_deploy.html — Docker/Compose, сервисы, networks, env, volumes, PostgreSQL, Payload/Next.js, Meilisearch, Gorse, healthchecks, backup и production deploy.