Carry hosted stale-install and takeover warnings as RunWarning, not serde_json::Value round-tripped through run_warning_of

Offen
#1,879 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
66/100
Issue-Typ
Refactoring
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
rust
Bereich
cli

Rechercherichtung

Read scan/hosted.rs first, especially run_warning_of and run_redirect_selected_untracked, then trace the warning fields and constructors in scan/hosted/python.rs, scan/hosted/nuget.rs, scan/hosted/takeover.rs, and vlt_heal.rs. Convert these paths to carry RunWarning, mapping RewriteWarning once. Run the named hosted and redirect end to end suites; done when their human and JSON warning output is unchanged and no listed file contains a json! warning literal.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

agent:triaged arch-audit priority:p3 refactor

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

Kind: refactor. Register ID: T27 (part of T21, the warning sink).

Problem

Several hosted helpers build their warnings as untyped serde_json::json!({"code": .., "detail": ..}) values:

  • the gem probe: scan/hosted.rs L300, L309;
  • scan/hosted/python.rs L201;``
  • scan/hosted/nuget.rs L75;````
  • vlt_heal.rs L373, L417;
  • scan/hosted/takeover.rs L161, L238, L286, L382, L492, L609, L623. takeover even converts typed core RewriteWarnings into JSON values.

The caller then parses them back with run_warning_of, scan/hosted.rs L162-L167:`````

RunWarning::new(
    w["code"].as_str().unwrap_or_default(),
    w["detail"].as_str().unwrap_or_default(),
)

A typo in a key silently becomes an empty code. The fold in run_redirect_selected_untracked (hosted.rs L1863-L1898) juggles four warning shapes at once: RewriteWarning, Value, the go audit's (String, String), and RunWarning.

Proposed change

  • Make StaleInstallOutcome.warnings and takeover::Finished.warnings (and the vlt heal outcome) a Vec<RunWarning>.
  • Build those warnings with RunWarning::new at each site.
  • Map RewriteWarning → RunWarning once with a From impl.
  • Delete run_warning_of.

Size

5 files (scan/hosted.rs, scan/hosted/{python,nuget,takeover}.rs, vlt_heal.rs). Roughly −40 / +20.

Acceptance criteria

  • --json warnings[] and the human output are unchanged. The e2e hosted suites (e2e_hosted_production.rs, e2e_redirect_*) guard them.
  • No json!({"code" warning literal remains in these files.
Vorherrschende Sprache
Rust
Sterne
9
Forks
2
Ø Merge
18 Std. 47 Min.
Gemergte PRs (30 T.)
637

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus SocketDev/socket-patch

Alle Issues in SocketDev/socket-patch

Ähnliche Issues

Weitere Issues zu Rust

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.