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 摘要。