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

Abierto
#721 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
55/100
Tipo de issue
Nueva funcionalidad
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
rust, typescript

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
TypeScript
Estrellas
4
Forks
3
Merge medio
1 d 22 h
PR fusionados (30 d)
76

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de vibgrate/cli

Todos los issues de vibgrate/cli

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.