feat(import): 全链编排与导入报告
Task 6(Plan 3):四家写入器汇流为默认编排管道。 - import.service:注入 events/pipeline 缺席时走真实事件流(runWxrAdapter 惰性 async generator,mapConfig.locale=site.default_locale 前置事实 8); 分派严格串行 content→term→media→route(禁 Promise.all);finish 硬序 term(sync)→content(sync)→media(await)→route(await);counts 由 ⊕ 覆盖 改为逐 key 求和聚合;新增 stale 回收(同站点 queued/running >24h 一条 SQL 置 stale);报告新增 paths/productsPath+newsPath、issueGroups 六组、 sanitize 清洗统计(事件流 changedRows/byDiffType 聚合)、adapterTiming。 - content-writer:NULL-entry 收编(快照行在而 content_entry 空,五列先验 三分支:无先验新建挂接/同 checksum 挂接 skipped/异 checksum 挂接新版本)。 - route-writer:attachment 降级汇总按去重 sourceId 计(重跑仍必现); normalizeListPath 导出;writeAttachmentRoute 返回 written/resolved/blocked。 - 四家写入器 identity 收敛共享基类型 WriterContext = Pick<ImportJobContext,'db'|'siteId'|'connectionId'>(type-only import, 无运行时环依赖)。 - CLI import 增 --products-path/--news-path(前置事实 9,缺省 /products/ /news/)记入 job 报告。 - 测试:tests/integration/import-full.test.ts 6 例(全链 zh-CN 接线证明 +published 全 NULL/报告四域计数+sanitize+分组/幂等重跑零写语义/ 无 media 快照域缺失不失败/NULL-entry 收编/stale 回收/REPORT_WRITE_FAILED 遗留补测);import-job 契约测试钉死 counts 求和(100⊕3=103)。 全量 323 通过;typecheck/lint 干净。 Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -43,7 +43,7 @@ import type { UniversalRow } from '@sf/contracts'
|
||||
import { entryLocales, mediaAssets, mediaUsages, sourceRecords } from '../../db/schema.js'
|
||||
import { isUniqueViolation, type MediaManifestEntry } from '../source/register.service.js'
|
||||
import { detectMediaType } from './magic-bytes.js'
|
||||
import type { ImportDb, ImportJobContext, ImportPipeline, ImportPipelineOutcome } from './import.service.js'
|
||||
import type { ImportJobContext, ImportPipeline, ImportPipelineOutcome, WriterContext } from './import.service.js'
|
||||
|
||||
const UPLOADS_MARKER = '/wp-content/uploads/'
|
||||
|
||||
@@ -119,10 +119,7 @@ interface SidecarEntry {
|
||||
filePath: string
|
||||
}
|
||||
|
||||
export function createMediaEventHandler(identity: {
|
||||
db: ImportDb
|
||||
siteId: string
|
||||
connectionId: string
|
||||
export function createMediaEventHandler(identity: WriterContext & {
|
||||
snapshotId: string
|
||||
/** 引用行 locale 校验基准(与 content-writer 同拒收口径——不双报) */
|
||||
defaultLocale: string
|
||||
|
||||
Reference in New Issue
Block a user