Skip to content

docs(me api-keys / me oauth-clients): hint --policy (create) vs --policy-id (update) asymmetry#121

Merged
miya0001 merged 3 commits into
geolonia:mainfrom
yuiseki:docs/issue-119-policy-flag-asymmetry
May 11, 2026
Merged

docs(me api-keys / me oauth-clients): hint --policy (create) vs --policy-id (update) asymmetry#121
miya0001 merged 3 commits into
geolonia:mainfrom
yuiseki:docs/issue-119-policy-flag-asymmetry

Conversation

@yuiseki

@yuiseki yuiseki commented May 8, 2026

Copy link
Copy Markdown
Member

Summary

me api-keysme oauth-clients では create のフラグが --policy、update のフラグが --policy-id という命名非対称になっており、ユーザーが詰まる原因になっている (admin api-keys は両方 --policy で対称)。命名統一 (alias 追加) は破壊的影響の検討が要るため本 PR では扱わず、ヘルプ description と README で明示的に案内するに留める。

Closes #119

Changes

  • src/commands/me-api-keys.ts:
    • L104 (create の --policy): description に (NOTE: use --policy-id on update) を追記
    • L249 (update の --policy-id): description に (NOTE: use --policy on create) を追記
  • src/commands/me-oauth-clients.ts: 同様に L51 / L150 を修正
  • README.md: me api-keys / me oauth-clients セクションに「Note on flag naming」を追加 (admin api-keys は両方 --policy で対称、という対比情報も含めた)
  • tests/me-api-keys.test.ts / tests/me-oauth-clients.test.ts: 回帰防止のユニットテストを 4 件追加
  • CHANGELOG.md: [Unreleased] に Docs エントリ追加

TDD

実装変更前にテストを追加して red 確認 → 修正で green、の手順:

$ vitest run tests/me-api-keys.test.ts tests/me-oauth-clients.test.ts (after test addition, before src fix)
 FAIL  --policy description points users to --policy-id on update (api-keys)
 FAIL  --policy-id description points users to --policy on create (api-keys)
 FAIL  --policy description points users to --policy-id on update (oauth-clients)
 FAIL  --policy-id description points users to --policy on create (oauth-clients)
 Tests  4 failed | 47 passed (51)

$ vitest run tests/me-api-keys.test.ts tests/me-oauth-clients.test.ts (after src fix)
 Tests  51 passed (51)

Test plan

  • npm test 全 35 spec / 737 tests pass
  • npm run lint clean
  • npm run typecheck clean
  • CI 通過確認

Out of scope

--policy / --policy-id の alias 追加 (= 長期的に admin 系と一貫性を取る) は別 issue で議論する想定。本 PR はあくまでヘルプとドキュメントの案内強化にとどめる。

Summary by CodeRabbit

リリースノート

  • ドキュメント

    • API キーおよび OAuth クライアント管理コマンドのヘルプテキストを更新し、作成時と更新時で異なるフラグ名(--policy vs --policy-id)の使い分けを明確化しました。
    • README に flag 命名規則の説明を追加しました。
  • バグ修正

    • admin users create コマンドの パラメータを tenantId から primaryTenantId に修正しました。

Review Change Stack

…icy-id (update) asymmetry

`me api-keys` と `me oauth-clients` では create のフラグが `--policy`、update のフラグが `--policy-id` で命名が非対称になっており、ユーザーが詰まる原因になっている。`admin api-keys` は create / update 両方とも `--policy` で対称なので、`me` 系だけ非対称が残っている形。

命名統一 (alias 追加) は破壊的影響の検討が要るため別 issue で扱い、本 PR ではヘルプとドキュメントで明示的に案内するに留める。

修正:

- `src/commands/me-api-keys.ts`:
  - L104 (create の `--policy`): description に `(NOTE: use --policy-id on update)` を追記
  - L249 (update の `--policy-id`): description に `(NOTE: use --policy on create)` を追記
- `src/commands/me-oauth-clients.ts`: 上と同様に L51 / L150 を修正
- `README.md`: `me api-keys` / `me oauth-clients` セクションに「Note on flag naming」を追加 (L231 / L271 相当)

回帰防止としてユニットテストを追加 (`tests/me-api-keys.test.ts`, `tests/me-oauth-clients.test.ts`):

- create の `--policy` option description が `--policy-id` と `update` を含む文字列であること
- update の `--policy-id` option description が `--policy` と `create` を含む文字列であること

実装変更前にテストを追加して 4 件 red 確認 → ヘルプ description 修正で green。lint / typecheck / 全 35 spec / 737 tests いずれも pass。

Closes geolonia#119
@coderabbitai

coderabbitai Bot commented May 8, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a189bc9c-ff9b-4f70-9847-38a55f23e60c

📥 Commits

Reviewing files that changed from the base of the PR and between f163b1a and bc6e05b.

📒 Files selected for processing (6)
  • CHANGELOG.md
  • README.md
  • src/commands/me-api-keys.ts
  • src/commands/me-oauth-clients.ts
  • tests/me-api-keys.test.ts
  • tests/me-oauth-clients.test.ts

📝 Walkthrough

Walkthrough

このプルリクエストは、me api-keys および me oauth-clients コマンドにおけるフラグ命名の非対称性(create では --policy、update では --policy-id)を明確化するための包括的なドキュメント更新と検証テストを追加しています。

Changes

CLI フラグ命名の非対称性の明確化

Layer / File(s) Summary
me api-keys ヘルプテキスト
src/commands/me-api-keys.ts
create サブコマンドの --policy オプション説明に update 時は --policy-id を使用するという注記を追加。update サブコマンドの --policy-id オプション説明に create 時は --policy を使用するという注記を追加。
me oauth-clients ヘルプテキスト
src/commands/me-oauth-clients.ts
create サブコマンドの --policy オプション説明に update 時は --policy-id を使用するという注記を追加。update サブコマンドの --policy-id オプション説明に null で unbind 可能なこと、および create 時は --policy を使用することを明記。
ヘルプテキスト検証テスト
tests/me-api-keys.test.ts, tests/me-oauth-clients.test.ts
create と update のサブコマンドのオプション説明が相手側のフラグ名を正しく参照していることを検証するテストを 4 件追加。
README ドキュメント
README.md
me oauth-clients および me api-keys セクションに「フラグ命名に関する注記」を追加し、create は --policy、update は --policy-id であること、および admin api-keys は両方とも --policy を使用することを説明。
変更ログ
CHANGELOG.md
フラグ命名の非対称性の明確化と検証テストの追加に関する [Unreleased] エントリを記録。

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 --policy--policy-id か、迷いの道も
ヘルプテキストの光で照らし、テストで守り
ドキュメント整い、ユーザー笑顔 ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR タイトルは、me api-keysme oauth-clients のフラグ命名非対称性を明確に説明し、変更内容を正確に反映しています。
Linked Issues check ✅ Passed PR は issue #119 のすべての受け入れ条件を満たしています:ヘルプ description に NOTE を追加、README に注記を追加、CHANGELOG.md に Docs エントリを追加、テストで検証。
Out of Scope Changes check ✅ Passed すべての変更は issue #119 の要件に対応し、スコープ外の変更は見当たりません。フラグ名の統一は意図的に別 issue に延期されています。

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@yuiseki
yuiseki requested a review from miya0001 May 8, 2026 06:17
@yuiseki yuiseki self-assigned this May 8, 2026
@miya0001
miya0001 merged commit da9021e into geolonia:main May 11, 2026
7 checks passed
@miya0001 miya0001 mentioned this pull request May 11, 2026
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs(me api-keys / me oauth-clients): clarify --policy (create) vs --policy-id (update) flag asymmetry in help and README

2 participants