8 of 9 docker agent e2e suites serve an all-zeros beforeHash and apply with --force, so they only prove the --force path; port gem's real-beforeHash probe

Đang mở
#1,970 1 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
42/100
Loại issue
Tái cấu trúc
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
docker, rust
Lĩnh vực
testing

Hướng nghiên cứu

Start with upstream_before_hash in crates/socket-patch-cli/tests/docker_e2e_gem.rs (around L88-L95), the probe to generalise, then compare it with the placeholder beforeHash in docker_e2e_golang.rs (L98) and its forced apply (L194). Move the probe into the shared docker harness that #1968 covers, and serve the real hash in each suite's mock. Done when the non-force scan --sync apply reports applied: 1 in coverage-docker, and reverting the served hash to zeros makes that leg fail.

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

Mô tả

agent:triaged arch-audit priority:p3 refactor

[agent] Filed by the scheduled architecture audit (audit-cli-tests). Register: register comment.

Kind: refactor (test honesty). Register ID: T62.

Problem

The docker agent suites (docker_e2e_<eco>.rs) are the only end-to-end proof that scan → scan --sync → apply works against a real installed package. Eight of the nine serve a placeholder "beforeHash": "000…0" from their wiremock fixture and then run apply --force. For example, golang has the placeholder at L98 and the force apply at L194.

The same pattern, a 64-zero beforeHash plus --force, appears in cargo, composer, deno, golang, maven, npm, nuget and pypi (grep-counted on cbbbdb9).

gem is the exception, and its own doc explains why the pattern is a problem (docker_e2e_gem.rs L88-L95):

Serving this as the fixture's beforeHash — instead of an all-zeros placeholder — is what lets the gated apply paths run: with the placeholder, scan --sync's nested apply hit the variant gate and failed invisibly, so the chain only ever proved the --force path.

As a result, in the other eight suites the nested apply that scan --sync performs is expected to fail. The suites log its exit code instead of gating on it (golang L180: "Exit code is logged for…"). The gated, non-force apply path (beforeHash match → write → afterHash verify) has no container-level proof for those ecosystems.

Proposed change
  1. Generalise gem's upstream_before_hash probe, a once-per-process probe container that computes the real git-blob sha256 of the installed file, into the shared docker harness (see #1968).
  2. Serve the real hash in each suite's mock.
  3. Gate on the nested scan --sync apply's exit code and summary.applied.
  4. Keep at most one --force leg per suite, and name it as a force test.

Do one ecosystem per PR, or all eight at once if CI time allows.

Size

8 test files. About +15 / −10 lines each, plus about 40 shared lines.

Acceptance criteria
  • In each suite, the non-force chain passes in coverage-docker with scan --sync reporting applied: 1.
  • Setting the served beforeHash back to zeros makes the non-force leg fail.
  • Any remaining force legs are named *_force_*.

Related: #1968 (T60).

Ngôn ngữ chính
Rust
Star
9
Fork
2
Merge trung bình
1 ngày 8 giờ
Pull request đã merge (30 ngày)
309

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 SocketDev/socket-patch

Tất cả issue của SocketDev/socket-patch

Issue tương tự

Thêm issue về Rust

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.