This commit is contained in:
2026-09-18 18:02:27 +08:00
parent aedfcc3abf
commit 1fb02db516
7 changed files with 368 additions and 108 deletions
+35 -3
View File
@@ -103,6 +103,24 @@ $clientAgents = Read-RequiredText $clientAgentsPath
$pdaAgents = Read-RequiredText $pdaAgentsPath
$overseasPdaAgents = Read-RequiredText $overseasPdaAgentsPath
$backendAgents = Read-RequiredText $backendAgentsPath
$backendIndexPath = Join-Path $backendRoot 'docs/backend-business-index.md'
$lastlegIndexPath = Join-Path $backendRoot 'lastleg-service/docs/business-index.md'
$backendIndex = Read-RequiredText $backendIndexPath
$lastlegIndex = Read-RequiredText $lastlegIndexPath
Assert-Contains $backendAgents 'docs/backend-business-index.md' '后端按需索引入口'
$lastlegEntry = Read-RequiredText (Join-Path $backendRoot 'lastleg-service/AGENTS.md')
Assert-Contains $lastlegEntry 'docs/business-index.md' 'Lastleg 按需索引入口'
foreach ($budget in @(
@{ Name = '后端根'; Text = $backendAgents; Limit = 13000 },
@{ Name = 'Lastleg'; Text = $lastlegEntry; Limit = 18000 }
)) {
$script:checked++
if ($budget.Text.Length -gt $budget.Limit) { Add-Failure "$($budget.Name) 指引超出字符预算 $($budget.Limit),请将细节按需下沉" }
}
Assert-MarkdownTableUnique $backendIndexPath '## 服务路由(按关键词定位)' 0 '后端详细索引'
Assert-MarkdownTableUnique $lastlegIndexPath '## 快速索引' 0 'Lastleg 详细索引'
# 保留全部业务语义断言,只将事实读取范围扩展到明确链接的按需文档。
$backendAgents += "`n" + $backendIndex
# 固定样本只检查目标索引行和真实文件,不递归搜索;字符数是读取量指标,不是耗时或 Token 实测。
$lookupSamples = @(
@@ -118,6 +136,18 @@ $lookupSamples = @(
@{ Key = '退货入库签收与合箱'; Text = $overseasPdaAgents; Entry = 'src/pages/return-packing/return-packing.vue'; Base = 'apps/pda-overseas-uniapp' }
)
$lookupCharacters = 0
foreach ($alias in @(
@{ Term = '转运打托'; Entry = 'apps/pda-overseas-uniapp/src/pages/warehouse-transfer/warehouse-transfer.vue' },
@{ Term = '转运驳回'; Entry = 'apps/admin-web/src/modules/overseas-warehouse/components/WarehouseTransferReviewDialog.vue' },
@{ Term = '退税资料'; Entry = 'apps/client-web/src/modules/first-leg/components/CustomsDocumentsDialog.vue' }
)) {
$aliasSection = (($businessIndex -split '## 常用说法与歧义分流', 2)[1] -split '\r?\n## ', 2)[0]
$hits = @($aliasSection -split '\r?\n' | Where-Object { $_.Contains($alias.Term) })
$script:checked++
if ($hits.Count -ne 1) { Add-Failure "口语入口必须唯一命中: $($alias.Term)"; continue }
Assert-Contains $hits[0] $alias.Entry "口语入口 $($alias.Term)"
Assert-Path $alias.Entry
}
foreach ($sample in $lookupSamples) {
$hits = @($sample.Text -split '\r?\n' | Where-Object { $_.StartsWith('| ' + $sample.Key) })
$script:checked++
@@ -231,7 +261,7 @@ Assert-Path 'baiyue-firstleg/scripts/script-documentation-contract.test.mjs'
Assert-Contains $mapperScanContract 'annotationClass = Mapper.class' 'Mapper 根包注解过滤合同'
Assert-Contains $mapperScanContract '禁止分散维护 MapperScan' 'Mapper 单一扫描入口合同'
$firstlegAgents = Read-RequiredText (Join-Path $backendRoot 'firstleg/AGENTS.md')
$lastlegAgents = Read-RequiredText (Join-Path $backendRoot 'lastleg-service/AGENTS.md')
$lastlegAgents = $lastlegEntry + "`n" + $lastlegIndex
$warehouseAgents = Read-RequiredText (Join-Path $backendRoot 'warehouse/AGENTS.md')
$coloadOpenApi = Read-RequiredText (Join-Path $backendRoot 'firstleg/src/main/resources/openapi/coload-groups-v1.yaml')
Assert-Contains $businessIndex 'modules/unified-orders/api/coLoadGroups.ts' '根同柜不可拆组入口'
@@ -625,7 +655,7 @@ Assert-Contains $adminOceanBookingViewTest 'without detail N+1' 'Admin 订舱列
# 海外出库、派送、异常和回访必须从根路由贯通到 Admin 与 Lastleg;PDA 后端存在不等于设备端已挂载。
$adminOverseasRoutes = Read-RequiredText (Join-Path $workspaceRoot 'apps/admin-web/src/modules/overseas-warehouse/routes.ts')
$lastlegAgents = Read-RequiredText (Join-Path $backendRoot 'lastleg-service/AGENTS.md')
$lastlegAgents = $lastlegEntry + "`n" + $lastlegIndex
foreach ($overseasFulfillmentRoute in @(
'overseas-warehouse/outbounds',
'overseas-warehouse/delivery-orders',
@@ -759,7 +789,7 @@ Assert-Contains $receivingController 'CacheControl.noStore()' '海外 PDA 签收
# 尾程订单按来源柜展示服务端计划进度;整柜确认必须绑定预览快照并编排真实托盘批次。
$lastlegBusinessOpenApi = Read-RequiredText (Join-Path $backendRoot 'lastleg-service/src/main/resources/openapi/overseas-business-v1.yaml')
$lastlegAgents = Read-RequiredText (Join-Path $backendRoot 'lastleg-service/AGENTS.md')
$lastlegAgents = $lastlegEntry + "`n" + $lastlegIndex
$adminLastMileApi = Read-RequiredText (Join-Path $workspaceRoot 'apps/admin-web/src/modules/overseas-warehouse/api/lastMileOrders.ts')
$containerConversionCoordinator = Read-RequiredText (Join-Path $backendRoot 'lastleg-service/src/main/java/com/baiyue/lastleg/inboundplan/service/ContainerInboundPlanConversionCoordinator.java')
$warehousePalletBatchService = Read-RequiredText (Join-Path $backendRoot 'warehouse-overseas-service/src/main/java/com/baiyue/warehouse/service/WarehousePalletBatchService.java')
@@ -1153,6 +1183,8 @@ $indexedAgentFiles = @(
$pdaAgentsPath,
$overseasPdaAgentsPath,
$backendAgentsPath,
$backendIndexPath,
$lastlegIndexPath,
(Join-Path $backendRoot 'firstleg/AGENTS.md'),
(Join-Path $backendRoot 'finance/AGENTS.md'),
(Join-Path $backendRoot 'lastleg-service/AGENTS.md'),
@@ -4,6 +4,8 @@ import test from 'node:test'
const pipeline = (await readFile(new URL('../Jenkinsfile', import.meta.url), 'utf8'))
.replaceAll('\r\n', '\n')
const servicePipeline = (await readFile(new URL('../Jenkinsfile.service', import.meta.url), 'utf8'))
.replaceAll('\r\n', '\n')
test('coordinator releases its builder while waiting for downstream jobs', () => {
assert.match(pipeline, /pipeline \{[\s\S]*?agent none/)
@@ -68,3 +70,14 @@ test('production deploy uses DEPLOY as the single explicit release switch', () =
assert.doesNotMatch(pipeline, /input message:/)
assert.doesNotMatch(pipeline, /\u786e\u8ba4\u90e8\u7f72/)
})
test('production deploy reports one aggregated result to WeCom', () => {
assert.match(pipeline, /credentialsId: 'wecom-prod-webhook'/)
assert.match(pipeline, /node\('java-builder'\) \{[\s\S]*?WECOM_WEBHOOK/)
assert.match(pipeline, /env\.JOB_BASE_NAME == 'backend-java-prod' && params\.DEPLOY/)
assert.match(pipeline, /unstable \{[\s\S]*?'\u90e8\u7f72\u90e8\u5206\u5931\u8d25'/)
assert.match(pipeline, /failure \{[\s\S]*?'\u90e8\u7f72\u5931\u8d25'/)
assert.match(pipeline, /aborted \{[\s\S]*?'\u90e8\u7f72\u5df2\u53d6\u6d88'/)
assert.match(pipeline, /\u4f01\u4e1a\u5fae\u4fe1\u901a\u77e5\u5931\u8d25\uff0c\u4e0d\u5f71\u54cd\u539f\u6784\u5efa\u7ed3\u679c/)
assert.doesNotMatch(servicePipeline, /wecom-prod-webhook|sendProductionWeComNotification/)
})