You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
3.1 KiB
3.1 KiB
Map · 客户域 H2 测试 schema 收敛(customer-h2-schema)
- 来源: /improve-codebase-architecture 2026-09-06 报告候选 #2(
.scratch/architecture-review-20260906-102629.html),经 grilling 六决策拍板后单票实施。
Notes
- 缺陷事实:12 个 H2 集成测试类各自手搓同构自举 + 内联 DDL(16 表并集);
CustomerWorkspaceSavedViewIntegrationTest的 customer 表是 30 列精简旧版(缺 22 列,含 D-05 的is_biz_negotiated),靠 MyBatis-Plus NOT_NULL insert 策略静默假绿。 - 实施收口:新增
CustomerH2Schema(16 表单一事实源,340 行)+CustomerH2Harness(组合式静态工厂,96 行)+CustomerH2SchemaConsistencyTest(实体↔DDL 双向对账,73 行);12 类迁移净 -1484 行;mvn -pl crm-customer -am test15 类 165 跑全绿;BOM 719 文件 clean。 - SavedView 类迁到 52 列全量 schema 后无任何用例转红——历史假绿定性为「测不到」(列不在场),非「测错」(无语义依赖)。
- 环境注记:跑 crm-customer 测试必须带
-am(本地仓库 crm-rule 快照过旧;候选 #1 已记录)。
Decisions-so-far
- 一次票全清(不分批):12 处改动同构机械、零语义变化,164 跑回归网现成。→ issues/01
- 载体 = Java 常量类(拒
schema.sql):全工程零src/test/resources/ 零.sql先例;历史物理形态即List<String>常量,收敛零新机制;schema.sql要手写语句分割器(新浅模块)。→ issues/01 - harness 形态 = 组合式静态工厂(拒基类 / 自定义 Extension):JUnit 5 static
@BeforeAll无多态,@TestInstance(PER_CLASS)与自定义 Extension 全工程零先例。interface =bootstrap(dbName, mappers...)一方法 +dataSourceOf(factory)便捷方法。→ issues/01 - 跨域表全收 16 张(含 opportunity / opportunity_customer / user_saved_view 投影):生产 SQL 已跨域 join,DDL 收敛是事实投影非新耦合;同步警示挂在 schema 常量跨域段。→ issues/01
- 对账看守:
CustomerH2SchemaConsistencyTest对 customer 主表做实体(含 BaseEntity)↔ DDL 严格双向列集断言——「实体加列漏改 schema」从半夜 Unknown column 变成对账红。先只对主表(D-05 教训所在地),子表 15 张暂不做。→ issues/01 - 收尾载体:CONTEXT.md 补「H2 测试 schema」词条 + 六决策理由写进
CustomerH2Schema/CustomerH2Harness类 javadoc,不新开 ADR(模块内部实现纪律)。→ issues/01
Fog
无未决问题。报告候选 #3(crm-rule 6 同构 Initializer,@Order 撞号 14×2、12×2)/ #4(crm-preference 三同构偏好栈)仍为开放候选,未出票。opportunity 侧 OpportunityBoardIntegrationTest 有 1 份内联 DDL(单份无重复,rule of three 未触发)——若未来 opportunity 测试增多可参照本 effort 的 harness 形态。