Embed --vex through one helper: the step is hand-written 8 times, and only scan reports vex_skipped_dry_run under --json

未关闭
#1,877 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
1-2 天
新手友好度
73/100
Issue 类型
重构
描述清晰度
描述清楚
活跃度
活跃
技术栈
rust
领域
cli

调研方向

Start with the cited scan/mod.rs, scan/hosted.rs, scan/vendor_flow, apply.rs, and vendor.rs sections, then compare how each handles --vex and dry-run output. Read the existing tests/e2e_embedded_vex.rs suite for the byte-identical output contract. Done when a shared helper replaces all eight copies, the stated JSON dry-run warnings are covered, and no VexSummary literal remains outside the helper.

由索引模型根据 Issue 内容生成。

描述

agent:triaged arch-audit priority:p3 refactor

[agent] Filed by the scheduled architecture audit (audit-cli-tests). Register: register comment.

Kind: refactor (with one drift). Register ID: T25 (absorbs T07).

Problem

scan, apply and vendor each embed the --vex document by hand. Each copy does the same steps:

  1. skip on --dry-run;
  2. build the params and generate;
  3. build a VexSummary { format: "openvex-0.2.0", .. } literal, using expect("vex_result is Some only when --vex was given");
  4. fold the warnings in;
  5. mark the error.

There are about 8 copies:

The copies have drifted, as seen by reading the code (not executed):

  • Dry-run under --json. Only scan pushes the vex_skipped_dry_run warning (scan/mod.rs L396-L401; also vendor_flow L808 and hosted L1960). apply --vex x --dry-run --json and vendor --vex x --dry-run --json drop the request silently. Their human arms do print format_vex_dry_run_skip (apply.rs L1061-L1064, vendor.rs L1119).
  • Fold order. vendor folds embedded_warnings before mark_error, and scan folds them after.

Proposed change

  • Add one commands::vex::embed(common, vex_args, manifest, &mut Envelope, done_verb) -> i32 that does the dry-run skip in both output modes, generates the document, builds the VexSummary and folds the warnings and the error.
  • Use it at all eight sites, and delete the VexSummary literals and the expects.
  • apply and vendor gain the vex_skipped_dry_run warning that scan already documents. This is additive to warnings[].

Size

3 to 4 files (vex.rs, apply.rs, vendor.rs, scan/{mod,hosted,vendor_flow}.rs). Roughly −150 / +60.

Acceptance criteria

  • Non-dry-run --vex output is byte-identical for all three commands. The existing tests/e2e_embedded_vex.rs suite guards it.
  • New tests: apply --vex --dry-run --json and vendor --vex --dry-run --json each carry one vex_skipped_dry_run warning.
  • No VexSummary { literal remains outside the helper.
主要语言
Rust
星标
9
派生
2
平均合并
1 天 8 小时
30 天内合并 PR
309

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

SocketDev/socket-patch 的其他 Issue

查看 SocketDev/socket-patch 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。