bug(gapic-node-processing): setOnlyDefaultSystemTests incorrectly matches substring on absolute path
Maintainer thường phản hồi trong vòng 1 ngày
Đá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:
!normalizedPath.includes(defaultVersion)evaluates tofalse.v3fixture files are not filtered out.v3sample fixtures overwritev2sample fixtures, generating unintended client diffs (e.g.,packages/google-iam/system-test/fixtures/sample/src/index.tsexportingAccessPoliciesClientinstead ofPoliciesClient).
Reference PR & CI Breakage
This issue was observed during Librarian version upgrade in:
- Pull Request: https://github.com/googleapis/google-cloud-node/pull/9340
- Affected Commit:
559da2d4(wheremktemp -dgenerated/tmp/upgrade-nodejs-v2Mp8W) - CI Failure: https://github.com/googleapis/google-cloud-node/actions/runs/34998266744/job/104479939975?pr=9340 (clean CI runner without
v2in path did not generate thev3diffs, causing agit diffdiscrepancy).
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
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của googleapis/google-cloud-node
-
api: spanner
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
googleapis/google-cloud-node#9513 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
google-auth-library: JWT with a JSON keyFile signs without iss since 10.6.1 (invalid_grant: account not found)Có thể đã có người làm @Marinski đã nhận 9 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
googleapis/google-cloud-node#9469 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
priority: p1 samples type: bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
googleapis/google-cloud-node#9367 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
TransferManager uploadFileInChunks does not error when abortedCó thể đã có người làm @Om-singhaI đã nhận 46 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
googleapis/google-cloud-node#9193 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
google-auth-library: getErrorFromOAuthErrorResponse() copies stack as non-writable, breaking error decoration in consumersCó thể đã có người làm @Om-singhaI đã nhận 46 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
googleapis/google-cloud-node#9155 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của googleapis/google-cloud-node
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 84/100
answerLoops/answerLoops#345 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
siyuan-note/siyuan#20313 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
LanternOps/breeze#8254 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 82/100
gofish-graphics/gofish-graphics#1084 ·
Maintainer thường phản hồi trong vòng 1 ngày