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

Đang mở
#721 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
55/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
rust, typescript
Lĩnh vực
databases, devtools

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
TypeScript
Star
4
Fork
3
Merge trung bình
1 ngày 22 giờ
Pull request đã merge (30 ngày)
76

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của vibgrate/cli

Tất cả issue của vibgrate/cli

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.