fix: complete development acceptance paths

This commit is contained in:
2026-09-03 19:10:18 +08:00
parent 4df0ae4811
commit 2063d29d16
13 changed files with 203 additions and 79 deletions
@@ -5,6 +5,26 @@ import { fileURLToPath } from 'node:url'
import { stableLinkSnapshot } from './phase3-loading-model-bridge.mjs'
const source = readFileSync(fileURLToPath(new URL('./phase3-loading-model-bridge.mjs', import.meta.url)), 'utf8')
const unifiedSql = readFileSync(fileURLToPath(new URL('../../deploy/sql/头程数据库统一增量-MySQL8.sql', import.meta.url)), 'utf8')
test('unified migration selects firstleg before creating the loading model bridge', () => {
assert.match(
unifiedSql,
/USE baiyue_firstleg;\s*\/\* Phase 3: link inbound preload plans to one or more container loading plans\. \*\/\s*CREATE TABLE IF NOT EXISTS fl_preload_loading_plan_link/,
)
})
test('unified migration converges declaration ledger table comments before final schema validation', () => {
assert.match(unifiedSql, /queue_table_comment\('baiyue_firstleg', 'fl_order_declaration_event', '[^']*[一-龥][^']*'\)/)
assert.match(unifiedSql, /queue_table_comment\('baiyue_firstleg', 'fl_order_declaration_snapshot', '[^']*[一-龥][^']*'\)/)
for (const column of ['tenant_id', 'event_id', 'order_id', 'order_version', 'request_hash', 'consumed_at']) {
assert.match(unifiedSql, new RegExp(`queue_column_comment\\('baiyue_firstleg','fl_order_declaration_event','${column}','[^']*[一-龥][^']*'\\)`))
}
for (const column of ['tenant_id', 'order_id', 'event_id', 'order_version', 'request_hash', 'customer_remark',
'expected_arrival_at', 'channel_code', 'channel_name', 'cargoes_json', 'changes_json', 'occurred_at', 'created_at', 'updated_at']) {
assert.match(unifiedSql, new RegExp(`queue_column_comment\\('baiyue_firstleg','fl_order_declaration_snapshot','${column}','[^']*[一-龥][^']*'\\)`))
}
})
test('bridge acceptance treats an existing pair as a read-only idempotent replay', () => {
assert.match(source, /已由推送建立的同一桥接 pair 重放返回原关联/)