Enhancement: apply Cargo `[patch]` tables the same way Go `replace` is applied

Aperta
#721 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
3-5 giorni
Idoneità per principianti
55/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
rust, typescript

Direzione di ricerca

Start with src/core-open/scanners/rust-scanner.ts, especially cargoDependencyHeader and parseCargoToml, then compare the existing handling in test/go-replace.test.ts and workspace inheritance tests. Add tests beside test/cargo-workspace-inheritance.test.ts for registry, git, path, named registry, and later-patch behavior. Done means the acceptance cases pass, including keeping path crates out of lockfile and SBOM components.

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

Descrizione

enhancement help wanted
  • Difficulty: medium
  • Area: Cargo / Rust scanner
Problem

cargoDependencyHeader / parseCargoToml in src/core-open/scanners/rust-scanner.ts (around lines 150–180 and 445–500) only read [dependencies], [dev-dependencies], [build-dependencies], and the target. / sub-table variants. [patch.crates-io] and [patch."<url>"] are ignored.

A workspace that patches serde to a git rev or a path crate is still looked up on crates.io at the version declared under [dependencies]. That is the same class of miss that go.mod replace already handles (test/go-replace.test.ts).

The deliberate Cargo SBOM rule still stands and is not part of this issue: the project’s own crate and local path crates stay out of the SBOM / lockfile component list.

Expected behaviour

After reading the manifest (and workspace inheritance), apply [patch] entries for the same crate name. A patch with a registry version overwrites the requirement used for crates.io / lockfile lookup, the way a module replace does. A git or path patch keeps the row visible but must not invent a crates.io version or query the registry for that crate (mirror local Go replace). Path patches must not reintroduce the excluded root / path crate into vg sbom export. [patch.crates-io] and named extra registries should both work. A later patch for the same name wins, or document a different pinned rule. Cargo.lock still supplies resolvedVersion when the locked package is a registry crate.

Acceptance
  • New tests next to test/cargo-workspace-inheritance.test.ts / test/go-replace.test.ts.
  • [patch.crates-io] serde = { version = "1.0.200" } is the version used for a serde = "1.0" dependency.
  • A git patch does not query crates.io and does not invent a registry version.
  • A path patch is not emitted as a lockfile / SBOM component.
  • Manifests without [patch] are unchanged.

Lingua principale
TypeScript
Stelle
4
Fork
3
Merge medio
1g 22h
PR unite (30g)
76

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 vibgrate/cli

Tutte le issue di vibgrate/cli

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.