[CLI] issue create/update --custom_fields の存在しない id が黙って捨てられる
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
Research direction
Trace the create and update entry points through parse_custom_fields, fetch_custom_fields, and fetch_project_issue_custom_field_ids, comparing the existing validation pattern from #462. Verify that an unknown custom-field id is reported before submission with exit code 1, while valid ids continue to work for both commands and unavailable metadata preserves the documented fallback.
Written by the indexing model from the issue text.
Description
What do you want to do? / 何をどうしたいか?
redi issue create / redi issue update の --custom_fields に存在しないカスタムフィールド id を渡したとき、送信前にエラーにして rc=1 で終了したい。
$ redi issue create "検証" -t 1 -d "x" --custom_fields "9999=x"
カスタムフィールドが見つかりません: 9999
$ echo $?
1
Why do you want it? / そのようにしたいのは何故か?
現状は存在しない id を渡してもエラーにも警告にもならず、イシューが作成される。作成されたイシューにその値は当然入っていない。
$ redi issue create "検証" -t 1 -d "x" --custom_fields "9999=x"
イシューを作成しました: 211 <redmine>/issues/211
$ echo $?
0
id を typo しても気付けない。#462 (--tracker_id の不正値が silent 成功) や #457 (--add-watcher の不正値が silent 成功) と同じ形の問題で、それらは既に送信前検証で弾くようになっている。
Proposed solution (optional) / どうしたら解決すると思うか?
parse_custom_fieldsの結果の id を、対象プロジェクト・トラッカーで使えるイシュー用カスタムフィールドの id 集合と突き合わせ、含まれない id があればeprintして exit 1 するcreate/updateとも既にfetch_custom_fieldsとfetch_project_issue_custom_field_idsを呼んでいるので、その結果を流用できる
fetch_custom_fieldsは非管理者だとNoneを返す (/custom_fields.jsonが管理者限定) ので、その場合は検証を諦めてそのまま送る- 管理者でなくても、
fetch_project_issue_custom_field_ids(プロジェクトのissue_custom_fields) だけで「そのプロジェクトで使えない id」は弾ける可能性がある
- 管理者でなくても、
#462の_ensure_known_idと同じ形にそろえる
関連
- #462 :
--tracker_id/--status_idの不正値が silent 成功する (redmine#66) - #457 :
--add-watcherの不正値が silent 成功する (redmine#144)
redi version / 使用している redi のバージョン
0.0.78
redmine#212
- Dominant language
- Python
- Stars
- 4
- Forks
- 0
- Avg merge
- 14h 17m
- Merged PRs (30d)
- 101
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from kawagh/redi
-
ai-assigned ai-reported bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
ai-assigned ai-reported bug TUI
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 52/100
-
ai-reported bug
-
ai-assigned ai-reported bug
Difficulty 3/5 1-2 days Newbie friendliness 74/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100