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

Ouverte
#1,877 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
4/5
Temps estimé
1-2 jours
Accessibilité débutants
73/100
Type d'issue
Refactorisation
Clarté
Clairement spécifiée
Activité
Active
Stack technique
rust
Domaine
cli

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

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.
Langage dominant
Rust
Étoiles
9
Forks
2
Merge moyen
1 j 8 h
PR mergées (30 j)
309

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de SocketDev/socket-patch

Toutes les issues de SocketDev/socket-patch

Issues similaires

Plus d'issues Rust

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.