[CLI] issue create/update --custom_fields の存在しない id が黙って捨てられる

Open Beginner friendly
#548 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
cli

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

ai-assigned ai-reported bug

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_fieldsfetch_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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from kawagh/redi

All issues in kawagh/redi

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.