feat: add auditable trace cleanup and artifact verification - #10
Open
Qiyuanqiii wants to merge 4 commits into
Open
feat: add auditable trace cleanup and artifact verification#10Qiyuanqiii wants to merge 4 commits into
Qiyuanqiii wants to merge 4 commits into
Conversation
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.
目标
完成 issue #5,为 VulnGym
trace提供保守、可配置、可审计且可重复验证的结构清理流程,覆盖重复节点、同文件边界异常、整数/区间行号和跨文件调用链保护。Closes #5
对比结论与差异化
巡查了 issue #5 当前关联的 14 个实现。#30 的产物重建不变量较完整,#58/#67 对“源码行号不等于运行时顺序”的处理更保守;本 PR 吸收这些可验证思路,但保留自己的实现和交付结构:
"start-end"区间执行完整边界分类,重叠区间始终进入人工复核。safe、drop-all、none三种重复节点策略和独立的顺序修复策略。verify=1默认只记录不修改;7 个重复候选均因desc冲突被安全保留。verify=0节点;critical 之后节点继续保留复核。本 PR 不重复 #50 已提供的
plan -> decision -> apply人工决策闭环;两者定位互补:#10 负责结构扫描、保守修复和生成产物可信度,#50 负责人工决策的防过期应用。默认策略
mode=check:只扫描和报告。mode=fix:默认仅允许修改verify=0。duplicate_fix_policy=safe:仅在不会丢失冲突desc时合并重复节点。order_fix_policy=entry-before-only:只删除完全早于同文件入口的节点。desc冲突全部保留人工复核。全量扫描结果
desc冲突并保留entry-00103、entry-00320)交付文件
scripts/trace_cleanup.py:扫描、策略判断、修复和产物生成scripts/verify_trace_cleanup_artifacts.py:独立的防过期与不变量验证器tests/test_trace_cleanup.py:清理策略单元测试tests/test_trace_cleanup_artifacts.py:产物、哈希、有序子序列和优先样本测试data/entries.trace_fixed.jsonl:408 行修复后数据reports/trace_fix_diff.csv:2 条真实改动的结构化前后值及描述哈希reports/trace_review_queue.csv:255 条按 entry/event 聚合的复核项reports/trace_fix_report.json/.md:统计、策略和 SHA-256reports/trace_cleanup_acceptance_matrix.md:issue 【2026犀牛鸟】清理 VulnGym 调用链顺序异常和重复节点 #5 验收映射scripts/README_trace_cleanup.md:使用方式、策略和限制详细的逐节点 JSON 日志仍可由脚本生成,但不提交 700 KB 以上的冗长文件。
验证
验证结果:
Ran 14 tests,OKtrace字段保持不变????或常见 mojibake 标记验证截图:
