Let runs compare fail on new findings with --fail-on

Đang mở Phù hợp với người mới
#138 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue nà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
72/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ệ
go
Lĩnh vực
cli

Hướng nghiên cứu

Bắt đầu từ internal/cli/runs.go tại runRunsCompare (khoảng dòng 264-326), nơi mọi đường đi sau khi tải đều trả về ExitOK, rồi kiểm tra cách scan hoặc verify đăng ký --fail-on trong internal/cli/flags.go. Thêm các cờ vào runs compare, thoát với mã 1 khi một phát hiện trong New đạt ngưỡng, và đặt never làm giá trị mặc định. Công việc hoàn thành khi go test ./internal/cli bao phủ cả trường hợp thoát do ngưỡng lẫn trường hợp thoát mặc định không đổi, và docs/ci.md có tài liệu cho cờ này. Lưu ý rằng việc sử dụng trong CI phụ thuộc vào #101.

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

Mô tả

enhancement good first issue severity: low

Summary

spackle runs compare always exits 0, so it cannot fail a CI job on findings a branch introduced. scan, verify and debug all use exit 1 for "something to act on".

Where

  • internal/cli/runs.go:264-326 (runRunsCompare returns ExitOK on every path after loading)
  • internal/mcp/tools.go:208-216 (compare_runs)

Impact

"Fail only on findings this branch introduced" (compare the default-branch run with the PR run) needs a jq script over the JSON output today. With #96 (stable fingerprints), compare would make a strong regression gate, but only if it can fail a job.

Steps to reproduce

spackle runs compare <main-run> <pr-run> with three new critical findings exits 0.

Suggested fix

Register the --fail-on and --fail-on-confidence flags on runs compare, and exit 1 when a finding in New (and optionally one whose change raised its severity) meets them. Default to never so current scripts keep working. Document it in docs/ci.md next to diff-base. In CI this depends on keeping the older run (see #101).

Acceptance criteria

  • runs compare --fail-on high exits 1 when a new finding is high or above, and 0 otherwise.
  • Without the flag, the exit code is unchanged.
  • Tests in internal/cli cover both.

Getting started

  • Relevant files: internal/cli/runs.go, internal/cli/flags.go, docs/ci.md
  • How to run tests: go test ./internal/cli

Related: #96, #101


Filed by repo-audit/full-audit at fffef43. Severity: low. Effort: S. audit-key: enhancement|internal/cli/runs.go|runRunsCompare

Ngôn ngữ chính
Go
Star
0
Fork
1
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

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

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

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 TMHSDigital/Spackle

Tất cả issue của TMHSDigital/Spackle

Issue tương tự

Thêm issue về Go

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.