Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

add accepts Infinity scores and writes records that immediately fail validation

Aperta Adatta ai principianti
#69 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

@vivek-3728 ci sta già lavorando.

Dal 29/10/2026.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
76/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
cli

Direzione di ricerca

Inizia individuando l’analisi e la convalida di score e max_score nel comando add, poi confronta i suoi controlli con le regole numeriche del comando validate. Riproduci i comandi CLI forniti con un CSV temporaneo ed esamina i test pertinenti. Il risultato atteso è che add rifiuti i valori non finiti senza scrivere un record e che i record accettati superino validate.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
Python
Stelle
0
Fork
5
Merge medio
1g 15h
PR unite (30g)
27

Preparare l'ambiente

  • Nessun Dockerfile né file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di techcsispit/grade-tracker

Tutte le issue di techcsispit/grade-tracker

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.