Validation cleanups: library re-checks Options.Validate ranges; TUI labels drift
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
阅读 pkg/subenum/subenum.go 中的 Config.options 以及 internal/scan/options.go 中的 Options.Validate,然后检查 internal/tui/form.go 中的数值解析。添加建议的表格测试,并删除重复的库检查;更新 TUI 解析标签以使用 formFields。运行 go test ./pkg/subenum/ ./internal/tui/,并确认错误信息中包含 Config 字段名和屏幕上显示的标签。
由索引模型根据 Issue 内容生成。
描述
Summary
Two small validation cleanups:
- The library's
Config.optionsre-checks ranges thatscan.Options.Validatealready checks, and its wording has drifted. - The TUI's 154-line
form.validatemixes hard-coded field labels withformFieldsnames.
Where
pkg/subenum/subenum.go:619-641,724-726;internal/scan/options.go:69-95internal/tui/form.go:505-659(in particular569-584)
Details
- Library.
options()rejectsRate < 0,MaxQueries < 0,HitRateoutside 1-100 and a bad resolver, then callsopts.Validate(), which checks the same four things with different text. Only the negative checks for Concurrency, Timeout, Attempts and Depth belong to the library, because 0 means "use the default" there.options.go:21-25says the shared validator exists so that front ends "cannot drift apart in what they accept". - TUI.
num(fieldConcurrency, "Concurrency"),"Timeout","Attempts","Hit rate","Depth","Rate"and"Max queries"are string literals, while the next line usesformFields[fieldRatePerResolver].name(). Renaming a form label leaves parse errors that name the old label.
Suggested fix
Each step is safe on its own:
-
Library:
- Table tests on
Config.ValidateforRate=-1,MaxQueries=-1,HitRate=101withSimulate, and a badResolver, asserting that the error names the Config field. - Delete the four duplicated checks from
options().fieldNamesalready renders tokens as Config field names.
- Table tests on
-
TUI:
- Make
num(f)take its label fromformFields[f].name(). - Optionally extract
parseNumbersandparseListshelpers.
Test first: a table test with one invalid value per numeric field, asserting the error names the field's on-screen label.
- Make
Acceptance criteria
- One source of truth for the library's range checks
- TUI parse errors use the on-screen field labels
Getting started
- Relevant files:
pkg/subenum/subenum.go,internal/scan/options.go,internal/tui/form.go - How to run tests:
go test ./pkg/subenum/ ./internal/tui/ - Related: #262, #331
Filed by repo-audit/full-audit at dd5b156. Severity: low. Effort: S. audit-key: tech-debt|pkg/subenum/subenum.go|Config.options
- 主要语言
- Go
- 星标
- 1
- 派生
- 1
- 平均合并
- 7 小时 18 分钟
- 30 天内合并 PR
- 23
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
TMHSDigital/subenum 的其他 Issue
-
area: tui good first issue severity: low testing
难度 2/5 1-3 小时 新手友好度 82/100
TMHSDigital/subenum#413 ·
维护者通常 1 天内回复
-
good first issue severity: low testing
难度 2/5 1-3 小时 新手友好度 85/100
TMHSDigital/subenum#412 ·
维护者通常 1 天内回复
-
good first issue performance severity: low
难度 2/5 1-3 小时 新手友好度 82/100
TMHSDigital/subenum#411 ·
维护者通常 1 天内回复
-
bug github-actions good first issue severity: low
难度 2/5 1-3 小时 新手友好度 82/100
TMHSDigital/subenum#407 ·
维护者通常 1 天内回复
-
area: cli severity: medium tech-debt
难度 2/5 1-3 小时 新手友好度 75/100
TMHSDigital/subenum#402 ·
维护者通常 1 天内回复
查看 TMHSDigital/subenum 的全部 Issue
相似的 Issue
-
Client execution contract accepts a grant the code never takes可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭area: client enhancement priority: medium
难度 2/5 1-3 小时 新手友好度 78/100
opensro-dev/opensro#3808 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
维护者通常 2 天内回复
-
hive size:simple
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
good first issue
难度 2/5 1-3 小时 新手友好度 86/100
Edwin-metcalf/MetCode#54 ·
维护者通常 1 天内回复
-
gen ctrl: appends duplicate parameterless NewV1()/ControllerV1 when the existing NewV1 takes parameters可能已有人在做 @Lizjunn 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 75/100
维护者通常 1 天内回复