1
0

feat: 重构配置生命周期为 Authoring/Normalized/Resolved 三层

将变量替换和 expect 简写展开统一放入 Normalized 阶段,
运行时 AJV 使用 Normalized schema,导出 schema 面向 Authoring Config。

主要变更:
- 新增 normalizer.ts 实现 normalizeAuthoringConfig()
- 拆分 Authoring/Normalized 双 schema,checker 接口支持 authoring/normalized 片段
- config-loader 流程:normalize → Normalized AJV → semantic → resolve
- validator 兼容层自动分派 raw/normalized expect 形态
- 删除 rawExpect,store.expect 列写入 null
- Authoring schema 对 integer/boolean/enum 字段接受变量引用
- 修复 DB/HTTP validate 入口守卫和 LLM options integer 变量引用
- 优化 compact() 避免 undefined 覆盖隐患
- 移除 content.ts 恒为 true 的前置条件
- 同步 5 个主规范并归档 change
This commit is contained in:
2026-05-22 14:00:47 +08:00
parent 6e53c8130d
commit cf847ccd7a
56 changed files with 1717 additions and 656 deletions

View File

@@ -314,7 +314,7 @@ describe("TcpChecker resolve", () => {
expect(target.name).toBeNull();
expect(target.intervalMs).toBe(30000);
expect(target.timeoutMs).toBe(10000);
expect(target.rawExpect).toBeUndefined();
expect("rawExpect" in target).toBe(false);
expect(target.expect).toEqual({ connected: true });
});
@@ -343,7 +343,11 @@ describe("TcpChecker resolve", () => {
test("expect 配置解析", () => {
const target = checker.resolve(
{
expect: { banner: [{ contains: "ESMTP" }], connected: false, durationMs: { lte: 5000 } },
expect: {
banner: [{ kind: "value", matcher: { contains: "ESMTP" } }],
connected: false,
durationMs: { lte: 5000 },
},
id: "t",
tcp: { host: "127.0.0.1", port: 80, readBanner: true },
type: "tcp",
@@ -355,7 +359,7 @@ describe("TcpChecker resolve", () => {
connected: false,
durationMs: { lte: 5000 },
});
expect(target.rawExpect).toEqual({ banner: [{ contains: "ESMTP" }], connected: false, durationMs: { lte: 5000 } });
expect("rawExpect" in target).toBe(false);
});
test("name 和 group 解析", () => {