merge: 恢复077c649内容(开发原则/K tests/spec/prd paths) + 保留flicker-free EasyTier/RDP + Linux兼容改善
- dashboard.html: 应用fI()闪烁修复到077c649版本(create-once/update-state pattern) - dashboard.py: 新增 /api/tests 端点 (import tests_api) - dashboard.py: /api/git 改用 git log 命令优先, 降级到 reflog - dashboard.py: /api/monitor + /api/expected 增加 Linux 支持(systemd timer/crontab) - dashboard.py: /api/spec + /api/prd 增加 246 venv 路径候选 - dashboard.py: /api/metagrowth git路径探测改善 - 恢复: meta_growth.py, tests_api.py, checklist_audit.py, service_registry.py - 恢复: sync-venv.sh, post-deploy-check.sh, meta-growth-design.md
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
# meta_growth.py — 元成长回路设计
|
||||
|
||||
## 核心逻辑
|
||||
|
||||
每次修复型 commit 后,分析变更模式 → 自动生成/扩展检测规则 → 注入 Tier1/2/3 检测管线。
|
||||
|
||||
```
|
||||
git log (merge commit diff)
|
||||
→ 提取 fix 类型 (根据文件路径 + 变更内容)
|
||||
→ 匹配规则模板
|
||||
→ 生成规则 JSON
|
||||
→ 写入 grow_rules/ 目录
|
||||
→ checklist_audit.py / health_checks 读取规则并执行
|
||||
```
|
||||
|
||||
## 修复类型分类
|
||||
|
||||
| 类型 | 触发模式 | 生成的规则 |
|
||||
|------|----------|-----------|
|
||||
| `port_misconfig` | 变更涉及端口号、health endpoint 路径 | 新增 port_check 规则 |
|
||||
| `path_error` | 变更涉及文件路径、`os.path.join`、`Path()` | 新增 file_exists 检查 |
|
||||
| `env_var` | 变更涉及 `os.environ.get`、环境变量 | 新增 env_var 检查 |
|
||||
| `cmd_arg` | 变更涉及 subprocess 参数、命令行参数 | 新增 cmd_availability 检查 |
|
||||
| `timeout` | 变更涉及 timeout 值、重试逻辑 | 新增 timeout_threshold 规则 |
|
||||
| `import_fix` | 变更涉及 import 语句 | 新增 dependency_check 规则 |
|
||||
| `permission` | 变更涉及权限、文件模式 | 新增 permission_check 规则 |
|
||||
|
||||
## 规则存储格式
|
||||
|
||||
```json
|
||||
{
|
||||
"rule_id": "meta-growth-001",
|
||||
"source_commit": "abc1234",
|
||||
"source_msg": "fix: xmpp_bot health check timeout",
|
||||
"category": "timeout",
|
||||
"check_type": "http_timeout",
|
||||
"target": {"port": 5802, "endpoint": "/health", "timeout": 5},
|
||||
"confidence": 0.7,
|
||||
"stage": 1,
|
||||
"created": "2026-07-14T15:00:00",
|
||||
"active": false
|
||||
}
|
||||
```
|
||||
|
||||
`active: false` 表示 Stage 1(安全模式)——人工确认后才激活。
|
||||
|
||||
## Stage 控制
|
||||
|
||||
| Stage | 条件 | 行为 |
|
||||
|-------|------|------|
|
||||
| 1 | 默认 | 规则生成但不激活,写入 `grow_rules/` + 日志 |
|
||||
| 2 | 连续 3 次同类修复无退回 | 规则自动激活,注入 Tier1 检测 |
|
||||
| 3 | 连续 5 次泛化无退回 | 规则自动扩展到同类组件 |
|
||||
|
||||
## 输出消费方
|
||||
|
||||
- `grow_rules/*.json` → `checklist_audit.py` 读取 → K 测试中显示"元生长规则"子项
|
||||
- 激活的规则 → `agents_health_check.py` 提取 → 加入 Tier1 检测
|
||||
|
||||
## 文件结构
|
||||
|
||||
```
|
||||
gateway/scripts/
|
||||
├── meta_growth.py # 主逻辑
|
||||
├── grow_rules/ # 规则输出目录(自动创建)
|
||||
│ └── growth_meta.json # 累计规则清单
|
||||
└── pattern_templates/ # 规则模板定义(手写)
|
||||
└── templates.json
|
||||
```
|
||||
Reference in New Issue
Block a user