修复变更、增加筛选条件

This commit is contained in:
andy
2026-09-11 21:22:14 +08:00
parent 712ec51d68
commit e06afc8c33
137 changed files with 35872 additions and 275 deletions

View File

@@ -143,17 +143,21 @@ ${row}
预订客户:辽宁康辉
出发日期:2026-09-03
文件类型:联泰客户确认单`
}
},
{ routeId: 'arrangement_guide_update', action: 'arrangement_guide', input: '安排导游变更\n团号:LW-TEST\n导游搜索:测试导游' },
{ routeId: 'arrangement_vehicle_update', action: 'arrangement_vehicle', input: '安排用车变更\n团号:LW-TEST\n用车日期:2026-09-15到2026-09-16\n结算单位搜索:测试车队\n数量:2' },
{ routeId: 'arrangement_transport_update', action: 'arrangement_transport', input: '安排大交通变更\n团号:LW-TEST\n交通日期:2026-09-15\n结算单位搜索:测试航空\n数量:2' },
{ routeId: 'arrangement_other_update', action: 'arrangement_other', input: '安排其他/备案变更\n团号:LW-TEST\n业务日期:2026-09-15\n结算单位搜索:测试备案' }
];
test('the machine registry contains the 19 independent routes exactly once', () => {
assert.equal(BUSINESS_ROUTES.length, 19);
assert.equal(new Set(BUSINESS_ROUTES.map((route) => route.routeId)).size, 19);
assert.equal(new Set(BUSINESS_ROUTES.map((route) => route.directive)).size, 19);
test('the machine registry contains the 23 independent routes exactly once', () => {
assert.equal(BUSINESS_ROUTES.length, 23);
assert.equal(new Set(BUSINESS_ROUTES.map((route) => route.routeId)).size, 23);
assert.equal(new Set(BUSINESS_ROUTES.map((route) => route.directive)).size, 23);
assert.deepEqual(BUSINESS_ROUTES.map((route) => route.routeId), routeCases.map((route) => route.routeId));
assert.deepEqual(
[...BUSINESS_ROUTES].sort((left, right) => left.releaseOrder - right.releaseOrder).map((route) => route.releaseOrder),
Array.from({ length: 19 }, (_, index) => index + 1)
Array.from({ length: 23 }, (_, index) => index + 1)
);
assert.equal(BUSINESS_ROUTES.find((route) => route.releaseOrder === 1)?.routeId, 'confirmation_export');
assert.equal(BUSINESS_ROUTES.find((route) => route.releaseOrder === 18)?.routeId, 'order_update_independent');
@@ -161,11 +165,12 @@ test('the machine registry contains the 19 independent routes exactly once', ()
});
test('machine routes stay synchronized with their declared Program or Agent boundary', async () => {
const [template, registry, initialMigration, batchMigration] = await Promise.all([
const [template, registry, initialMigration, batchMigration, updateMigration] = await Promise.all([
readFile(new URL('../../agent设计规范/templates/business-input-templates.md', import.meta.url), 'utf8'),
readFile(new URL('../../agent设计规范/business-adaptation-registry.md', import.meta.url), 'utf8'),
readFile(new URL('../migrations/013_business_parser_modes.sql', import.meta.url), 'utf8'),
readFile(new URL('../migrations/022_shared_child_order_batch_create.sql', import.meta.url), 'utf8')
readFile(new URL('../migrations/022_shared_child_order_batch_create.sql', import.meta.url), 'utf8'),
readFile(new URL('../migrations/024_arrangement_update_routes.sql', import.meta.url), 'utf8')
]);
for (const route of BUSINESS_ROUTES) {
const directivePattern = new RegExp(route.directive.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'));
@@ -176,7 +181,7 @@ test('machine routes stay synchronized with their declared Program or Agent boun
} else {
assert.match(registry, actionPattern, route.routeId);
}
assert.match(`${initialMigration}\n${batchMigration}`, new RegExp(`'${route.routeId}'`), route.routeId);
assert.match(`${initialMigration}\n${batchMigration}\n${updateMigration}`, new RegExp(`'${route.routeId}'`), route.routeId);
}
});
@@ -184,7 +189,7 @@ test('versioned sanitized gold corpus replays deterministically', async () => {
const corpus = JSON.parse(await readFile(
new URL('../../samples/business-parser-gold-corpus.json', import.meta.url), 'utf8'
));
assert.equal(corpus.version, 'ltjt-program-parser-v1.0.7');
assert.equal(corpus.version, 'ltjt-program-parser-v1.0.11');
assert.ok(corpus.cases.length >= 28);
for (const candidate of corpus.cases) {
const parse = () => parseProgramInput({
@@ -202,7 +207,7 @@ test('versioned sanitized gold corpus replays deterministically', async () => {
}
});
test('all 19 official-format examples produce contract-valid operations', async () => {
test('all 23 official-format examples produce contract-valid operations', async () => {
for (const candidate of routeCases) {
const result = await parseProgramInput({ rawText: candidate.input, receivedAt });
assert.equal(result.business_route_id, candidate.routeId, candidate.routeId);