Repository navigation
fix: logging safety, exact 100% statement coverage and comparable benchmarks - #1
Merged
Merged
Conversation
PinableAgents
marked this pull request as ready for review
September 21, 2026 06:10
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.
审计与修复已完成,保持草稿,不自动合并
基线:
a92728a6ccd69370e78379a48c32b50e43ea6fb4;修复提交:15607860637629e4fe79f6f453fc612315b13c9d。主分支未修改。远端严格 CI:全部通过
成功运行:https://github.com/PinableAgents/mlog/actions/runs/35564168911
原版覆盖率仅33.9%,完整race失败。原诊断workflow的continue-on-error已移除。100%为语句覆盖,不代表分支/输入空间100%或无漏洞。安全扫描仅代表本次工具链、平台及漏洞库下未发现已知问题。
修复内容
修复单文件字段丢失、With路由失效、目录越界、特殊writer竞争和无界增长;修复异步字段所有权、Close/重初始化竞争,新增Flush队列屏障及Accepted/Processed/Dropped/Rejected计数;保护配置、安全模式和路径cache;纠正“安全格式化等于自动线程安全”的承诺。
性能摘要(本地环境,不与CI机器数据混合)
Go1.24.13 / linux-amd64 / Xeon8573C / GOMAXPROCS4 / 五次中位数。统一五字段JSON、时间格式、同一rolling writer;关闭caller/压缩/控制台。异步禁止丢弃,排空与Close计时;slog的同schema ReplaceAttr成本计入。
mlog同步比Zap耗时高约8.7%;异步比同步慢约26.4%,不宣称异步一定提速。真实文件含OS页缓存,不是fsync持久化或p99/SLA证据。
交付与评审边界
完整报告:
docs/mlog-audit-20260921.md;用法:README;原始数据:docs/audit-results/;独立比较模块:benchmarks/。CI artifact含coverage.out、精确计数、race/vet/fuzz、基准输出及漏洞扫描。新增InitialZapChecked/Flush/GetAsyncStats/MaxRouteWriters;旧InitialZap仍panic。LoadConfig拒绝未知YAML字段。SafeFormat对map仅输出类型摘要。调用期间共享数据仍需调用方加锁;GLOG是同步Zap接口。根目录需应用控制,符号链接检查不消除本地敌对进程TOCTOU。路由上限是每core而非全局;lumberjack不提供fsync,Processed不等于成功持久化;无自动脱敏/加密/防篡改。Windows/macOS运行时、断电恢复、多进程共写和长时间轮转压缩尚未实测。