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

Aperta
#1,877 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
1-2 giorni
Idoneità per principianti
73/100
Tipo di issue
Refactoring
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
rust
Ambito
cli

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.
Lingua principale
Rust
Stelle
9
Fork
2
Merge medio
1g 8h
PR unite (30g)
309

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di SocketDev/socket-patch

Tutte le issue di SocketDev/socket-patch

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.