kawagh / kawagh/redi

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

Open Beginner friendly
#548 0 comments 0 reactions 0 assignees View on GitHub
ai-assigned ai-reported bug
Dominant language
Python
Stars
4
Forks
0
Avg merge
13h
Merged PRs (30d)
103

Description

## What do you want to do? / 何をどうしたいか?

`redi issue create` / `redi issue update` の `--custom_fields` に存在しないカスタムフィールド id を渡したとき、送信前にエラーにして rc=1 で終了したい。

```console
$ redi issue create "検証" -t 1 -d "x" --custom_fields "9999=x"
カスタムフィールドが見つかりません: 9999
$ echo $?
1
```

## Why do you want it? / そのようにしたいのは何故か?

現状は存在しない id を渡してもエラーにも警告にもならず、イシューが作成される。作成されたイシューにその値は当然入っていない。

```console
$ redi issue create "検証" -t 1 -d "x" --custom_fields "9999=x"
イシューを作成しました: 211 /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

Contributor guide

Open the contributing guide

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.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.