Conversation
- kernel: Error 枚举重构为 Copy 的 ErrorCode(按 1000/2000/9800/9900 分段), 新增 events / prometheus / listeners::metrics 模块,logger 支持 HumanReadableFilter 与 MetricsLayer,truncate_for_log 改为字节级截断 - config: [bin.api] 改为 [bin-api] 并启用 deny_unknown_fields - util/http: 接入 OUTBOUND_HTTP_REQUEST metrics,按 timeout/connect/request 分类 错误标签,连接池增加 keepalive 与 idle 配置 - api/middleware: 抽出 read_body_for_log,响应 body 回填改为 Bytes 原始字节 (替代 from_utf8_lossy String),避免非 UTF-8 字节被替换 - 全 crate 适配 Error -> ErrorCode 调用点
- 移除 5 个 Cargo.toml 中 20 处 version 字段的 ~ 前缀,采用 cargo 默认的 caret 语义("x.y.z" 等价于 "^x.y.z") - 同步执行 cargo update 拉取兼容的 minor 升级(如 tokio 1.52.1->1.53.1、reqwest 0.13.3->0.13.4 等) - 更新根 AGENTS.md 的 UNIQUE STYLES 描述,反映约束方式变更
将 access_token / refresh_token 的生成方式从 Uuid::now_v7() 迁移到
Ulid::generate(),生成 26 字符 Crockford Base32 时间排序字符串。
- workspace Cargo.toml 新增 ulid = { version = "3.0.0" } 工作区依赖
- application-database 移除 uuid 依赖,改用 ulid.workspace
- application-api 同步调整依赖分组顺序
- 数据库 varchar(128) 列宽充足,无需 DDL 迁移
- 旧 UUID token 自然过期,前端零改动,平滑过渡
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概述
本次重构聚焦后端可观测性、错误处理现代化与依赖升级,共 6 个提交,涉及 43 个文件(+2437 / -1560)。
主要变更
1. 错误处理重构(5aebd68)
Error枚举重构为Copy的ErrorCode,按 1000/2000/9800/9900 分段Error -> ErrorCode调用点2. Metrics 可观测性层(5aebd68)
application-kernel新增events/prometheus/listeners::metrics模块logger支持HumanReadableFilter与MetricsLayer,truncate_for_log改为字节级截断application-util/http接入OUTBOUND_HTTP_REQUESTmetrics,按 timeout/connect/request 分类错误标签3. Middleware 优化(5aebd68)
read_body_for_logBytes原始字节(替代from_utf8_lossy String),避免非 UTF-8 字节被替换4. 配置结构调整(5aebd68)
[bin.api]改为[bin-api]并启用deny_unknown_fields5. 依赖管理现代化(715f987)
Cargo.toml中 20 处~前缀,采用 cargo 默认 caret 语义cargo update拉取兼容的 minor 升级6. Token 生成迁移(5c36c0)
access_token/refresh_token从Uuid::now_v7()迁移到Ulid::generate()7. Salvo 升级与适配(5f45485, ca85fa1)
兼容性
[bin.api]->[bin-api])验证