Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

bug(gapic-node-processing): setOnlyDefaultSystemTests incorrectly matches substring on absolute path

Đang mở Phù hợp với người mới
#9,342 2 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

@rootkiller6788 đang làm issue này rồi.

Từ ngày 5/10/2026.

  • #9516 của @rootkiller6788 — đang mở

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
88/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
node.js, typescript
Lĩnh vực
build-system, tooling

Hướng nghiên cứu

Bắt đầu trong gapic-node-processing/src/combine-libraries.ts và kiểm tra setOnlyDefaultSystemTests(), tập trung vào cách các đường dẫn tuyệt đối đã được chuẩn hóa được đối sánh. Tái hiện hoặc xem xét trường hợp fixture v2/v3 được mô tả trong issue, sau đó xác minh rằng việc lọc phiên bản không bị ảnh hưởng bởi các tên thư mục không liên quan như /tmp/upgrade-nodejs-v2Mp8W và đầu ra fixture được tạo không còn tạo ra các diff ngoài ý muốn.

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

Mô tả

Description

In gapic-node-processing/src/combine-libraries.ts, setOnlyDefaultSystemTests() filters out sample test fixtures from non-default versions when combining multi-version libraries (e.g., google-iam with v2 and v3).

It currently uses .includes(defaultVersion) on the full absolute file path:

function setOnlyDefaultSystemTests(defaultVersion: string, filePaths: FilePaths[]) {
  const systemTestRegex = new RegExp('system-test/fixtures/sample/src');
  for (let i = filePaths.length - 1; i >= 0; i--) {
    const filePathObj = filePaths[i];
    const normalizedPath = filePathObj.filePath.replace(/\\/g, '/');
    if (systemTestRegex.test(normalizedPath) &&
        !normalizedPath.includes(defaultVersion)) {
      filePaths.splice(i, 1);
    }
  }
}
Bug Behavior

If the workspace or temporary directory path where Librarian/generator runs happens to contain the substring defaultVersion (for example, /tmp/upgrade-nodejs-v2Mp8W containing "v2"), normalizedPath.includes("v2") evaluates to true for all API versions (including v3).

As a result:

  1. !normalizedPath.includes(defaultVersion) evaluates to false.
  2. v3 fixture files are not filtered out.
  3. v3 sample fixtures overwrite v2 sample fixtures, generating unintended client diffs (e.g., packages/google-iam/system-test/fixtures/sample/src/index.ts exporting AccessPoliciesClient instead of PoliciesClient).
Reference PR & CI Breakage

This issue was observed during Librarian version upgrade in:

Suggested Fix

Match the version directory boundary specifically rather than performing an unconstrained substring check across the absolute path:

const versionDirRegex = new RegExp(`(^|/)${defaultVersion}(/|$)`);
if (systemTestRegex.test(normalizedPath) && !versionDirRegex.test(normalizedPath)) {
  filePaths.splice(i, 1);
}
Ngôn ngữ chính
TypeScript
Star
3.2k
Fork
723
Merge trung bình
3 ngày 2 giờ
Pull request đã merge (30 ngày)
172

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 googleapis/google-cloud-node

Tất cả issue của googleapis/google-cloud-node

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.