add accepts Infinity scores and writes records that immediately fail validation
维护者通常 2 天内回复
@vivek-3728 已经在做这个了。
开始于 2026年10月29日。
评估
调研方向
首先找到 add 命令中 score 和 max_score 的解析与验证逻辑,然后将其检查与 validate 命令的数值规则进行比较。使用临时 CSV 重现提供的 CLI 命令,并检查相关测试。完成标准是:add 拒绝非有限值且不写入记录,并且已接受的记录通过 validate。
由索引模型根据 Issue 内容生成。
描述
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.
- 主要语言
- Python
- 星标
- 0
- 派生
- 5
- 平均合并
- 1 天 15 小时
- 30 天内合并 PR
- 27
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
techcsispit/grade-tracker 的其他 Issue
-
feat: add cross-file integrity verification and repair可能已有人在做 @deepmhatre13 于 1 天前认领。 未关闭feature
难度 5/5 一周以上 新手友好度 35/100
techcsispit/grade-tracker#66 ·
维护者通常 2 天内回复
-
Blank credits pass validation but cause valid grade records to disappear可能已有人在做 @vivek-3728 于 10 天前认领。 未关闭bug good first issue
techcsispit/grade-tracker#53 · 1 条评论 · 已指派 1 人 ·
维护者通常 2 天内回复
查看 techcsispit/grade-tracker 的全部 Issue
相似的 Issue
-
infrastructure
难度 2/5 1-3 小时 新手友好度 76/100
NatLabRockies/H2Integrate#977 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 72/100
topoteretes/cognee#6470 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
-
area:docs priority:p2 type:docs wave:9
难度 1/5 1 小时以内 新手友好度 84/100
jejjohnson/radtrax#293 ·
维护者通常 1 天内回复
-
bug core plugins
难度 2/5 1-3 小时 新手友好度 68/100
bunkerity/bunkerweb#4121 · 1 条评论 ·
维护者通常 1 天内回复