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

Aberta
#1,877 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
4/5
Tempo estimado
1-2 dias
Facilidade para iniciantes
73/100
Tipo de issue
Refatoração
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
rust
Domínio
cli

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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.
Linguagem predominante
Rust
Estrelas
9
Forks
2
Merge médio
1d 8h
PRs com merge (30d)
309

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de SocketDev/socket-patch

Todas as issues de SocketDev/socket-patch

Issues semelhantes

Mais issues de Rust

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.