feat: 一阶段
All checks were successful
序列化结构检查 / serialization-schema-check (push) Successful in 1s

This commit is contained in:
2026-07-15 16:48:46 +08:00
parent 14f9f1fce7
commit e88408e9b6
16 changed files with 789 additions and 37 deletions

View File

@@ -141,9 +141,10 @@ com/codechecker/serialization-schema-checker/1.0.0/
| 无法获取 before / exit 2 | 浅克隆未取到对象、服务端禁 fetch SHA | 看日志中的 deepen确认 Gitea 允许按 SHA fetch |
| 下载 jar 失败 | Nexus 地址/版本错误 | 检查 env 变量 |
| 未收到企微 | Secret 未配 / notify.enabled=false / webhook_url 空 | 检查配置 |
| 大量误报 | 锁/计数器未过滤 | 补充 ignore.key_patterns |
| 大量 Redis 误报 | 锁/计数器未过滤 | 补充 ignore.key_patterns |
| 大量 MQ 误报 | 压测/临时 topic | 补充 ignore.mq_destinations |
| commit 数显示为 1实际多个 | 浅克隆下 `rev-list` 看不到中间提交 | 已修复:优先事件 `commits` 长度;并 deepen 到 before 为祖先 |
| 漏报(模式/模块) | W0x 未开 / include_modules 过窄 | 确认 W01~W05检查模块过滤 |
| 漏报(模式/模块) | W0x/MQ 未开 / include_modules 过窄 | 确认 W01~W05 与 mq_patterns;检查模块过滤 |
| 类型展开不完整 | 类型在依赖 jar 中 | 补充 `manual_mappings.value_type` |
---

View File

@@ -1,8 +1,8 @@
# MQ 消息体序列化结构变更检测 — 方案
> 版本v0.2
> 版本v0.3
> 日期2026-07-15
> 状态:**方案已落地(含 Kafka开发未启动**
> 状态:**Phase M1 已实现**MQ01/MQ02 + MQ-K01/MQ-K02M2/M3 未启动
> 关联:复用 `serialization-schema-checker` 的 Schema 提取、Diff、企微通知与 CI 框架
> 业务样本仓:`jnpf-java-cloud`**RocketMQ + Kafka**
@@ -333,7 +333,7 @@ manual_mappings:
## 10. 下一步
1. 评审本方案RocketMQ + Kafka 模式表
2. **Phase M1** 开发MQ01/02 + MQ-K01/K02
3. 回写 `配置说明.md` / `CI集成说明.md` 正式配置项
4. 验收 Topic 建议:`capital-topic:WALLET_DEDUCT`RocketMQ、巡店/值班 Kafka topic
1. ~~按 Phase M1 开发~~ **已完成**MQ01/02 + MQ-K01/K02
2. Phase M2MQ03~05、MQ-K03/K04、MQ-R 读侧补强
3. 业务仓验收 Topic`capital-topic:WALLET_DEDUCT`RocketMQ、巡店/值班 Kafka topic
4. 观察期按需扩大 `include_modules`

View File

@@ -43,8 +43,11 @@ include_modules:
`redisCheck` 仓库维护,随 jar 发布,默认包含:
- `detection.patterns`**W01~W05**JSON 字符串写入 + Template 直写 + Hash
- `detection.mq_patterns`**MQ01/MQ02、MQ-K01/MQ-K02**RocketMQ / Kafka 生产侧)
- `detection.read_hints_enabled`W06 读侧反序列化类型辅助(默认 true
- `detection.mq_read_hints_enabled`MQ 读侧补强Phase M2默认 false
- `ignore.key_patterns`(锁 / 计数器 / token
- `ignore.mq_destinations`MQ destination 忽略,默认真空)
- `detection.min_confidence``max_field_depth`
- `mode: notify``enabled: true`
@@ -97,6 +100,9 @@ ignore:
# 忽略的写入方法(类全名#方法名)
writer_methods: []
# 忽略的 MQ destinationtopic 或 topic:tagglob
mq_destinations: []
# 检测规则
detection:
# 启用的写入模式(默认已全部开启)
@@ -107,9 +113,19 @@ detection:
- W04 # redisTemplate 直写对象
- W05 # opsForHash().put
# MQ 生产侧投递Phase M1
mq_patterns:
- MQ01 # rocketMQTemplate.syncSend
- MQ02 # asyncSend / syncSendOrderly / sendOneWay
- MQ-K01 # kafkaTemplate.send(topic, payload)
- MQ-K02 # kafkaTemplate.send(topic, key, payload)
# W06读侧反序列化类型辅助不产生独立告警
read_hints_enabled: true
# MQ-R 读侧补强Phase M2默认关闭
mq_read_hints_enabled: false
# 类型推断最低置信度,低于此值标记为低置信度提示
min_confidence: 0.6
@@ -223,7 +239,8 @@ detection:
- **不是写入模式**:不会单独因为「多了一处 parse」而告警
- 能关联到 `redis get(key)` 时,还可补强 unresolved key
- 覆盖优先级:`manual_mappings` > W06 > 写侧 AST
- 覆盖优先级:`manual_mappings` > W06 > 写侧 AST
- **仅补强 Redis 写入点**MQ 投递点不走 W06MQ-R 为 Phase M2
关闭示例:
@@ -232,6 +249,18 @@ detection:
read_hints_enabled: false
```
### 3.5.2 detection.mq_patterns / ignore.mq_destinationsMQ Phase M1
| 配置项 | 说明 |
|--------|------|
| `mq_patterns` | `MQ01`/`MQ02`RocketMQ`MQ-K01`/`MQ-K02`Kafka默认已开启 |
| `mq_read_hints_enabled` | MQ-R 读侧补强,**默认 false** |
| `ignore.mq_destinations` | 忽略 destinationglob`benchmark:*` |
企微 MQ 块:`- Topic --> ...`,并带 `> **通道**: RocketMQ|Kafka`
详见:[MQ序列化结构检测方案.md](./MQ序列化结构检测方案.md)
### 3.6 manual_mappings
当自动推断不准确时使用。匹配优先级 **高于** 自动推断(按 `类全名#方法名` 覆盖 key 模式与 value 类型)。
@@ -346,10 +375,10 @@ include_modules: [] # 全仓
---
## 7. 扩展:MQ 消息体检测(方案阶段
## 7. MQ 消息体检测(Phase M1 已落地
MQ**RocketMQ + Kafka**)消息体 Schema 变更监控方案已单独成文,**实现前不要求业务仓增配**
同一 jar 默认启用 RocketMQ / Kafka **生产侧**投递检测(`detection.mq_patterns`),与 Redis 共用 Diff、骨架与企微模板
详见:[MQ序列化结构检测方案.md](./MQ序列化结构检测方案.md)
届时预计新增:`detection.mq_patterns`(含 `MQ01~``MQ-K01~`)、`detection.mq_read_hints_enabled``ignore.mq_destinations`
- 配置说明见 §3.5.2
- 读侧 MQ-R、`MessageBuilder` / `ProducerRecord` 等见方案 Phase M2
- 完整设计:[MQ序列化结构检测方案.md](./MQ序列化结构检测方案.md)