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

add accepts Infinity scores and writes records that immediately fail validation

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

@vivek-3728 đang làm issue này rồi.

Từ ngày 29/10/2026.

Đá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
76/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ệ
python
Lĩnh vực
cli

Hướng nghiên cứu

Bắt đầu bằng cách tìm phần phân tích cú pháp và xác thực score, max_score của lệnh add, sau đó so sánh các bước kiểm tra với quy tắc số của lệnh validate. Chạy lại các lệnh CLI được cung cấp với một tệp CSV tạm thời và xem các bài kiểm thử liên quan. Hoàn thành khi add từ chối các giá trị không hữu hạn mà không ghi bản ghi, và các bản ghi được chấp nhận vượt qua validate.

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

Mô tả

Description

I found a bug where the add command accepts inf as both the score and maximum score, even though these are not valid numeric grades.

The command reports success and writes the record to the CSV, but running validate immediately afterward rejects the same record.

This means a normal add operation can turn an otherwise valid grade file into one that fails the application's own validation.

Steps to Reproduce

Run:

python -m grade_tracker --data grades.csv add S1 Math inf inf 2026-10-30 3 1
python -m grade_tracker --data grades.csv validate
Actual Behavior

The add command reports:

Added grade for S1 in Math.

The CSV now contains:

S1,Math,inf,inf,2026-10-30,3.0,1

However, validation reports:

Error: row 2, field score: 'inf' is not a numeric score
Error: row 2, field max_score: 'inf' is not a numeric maximum score
Validation failed: 2 problems found.
Expected Behavior

The add command should reject non-finite values before writing anything to the CSV.

Any record successfully added through the CLI should also pass the application's numeric validation rules.

Likely Cause

The add command relies on numeric range comparisons without explicitly checking whether the values are finite.

Since Python evaluates float("inf") <= float("inf") as True, the invalid values pass the existing checks.

The validation command applies stricter numeric rules and correctly rejects them.

Using math.isfinite() for both score and max_score would prevent Infinity and NaN values from being accepted.

Impact

A successful CLI operation can introduce invalid grade records into an otherwise valid CSV file.

This creates inconsistent behavior between add and validate and may affect subsequent calculations, reporting, or exports.

The issue was reproduced on the latest upstream/main and no matching report was found among the 68 open and closed issues and PRs checked.

Ngôn ngữ chính
Python
Star
0
Fork
5
Merge trung bình
1 ngày 15 giờ
Pull request đã merge (30 ngày)
27

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

  • Không có Dockerfile hay tệp Docker Compose
  • Có mẫu pull request
  • Không có hướng dẫn đóng góp

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 techcsispit/grade-tracker

Tất cả issue của techcsispit/grade-tracker

Issue tương tự

Thêm issue về Python

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.