Skip to content

docs: 全 JSON 入力コマンドのヘルプを改善#72

Merged
miya0001 merged 6 commits into
mainfrom
improve-tenants-create-help
Mar 17, 2026
Merged

docs: 全 JSON 入力コマンドのヘルプを改善#72
miya0001 merged 6 commits into
mainfrom
improve-tenants-create-help

Conversation

@miya0001

@miya0001 miya0001 commented Mar 17, 2026

Copy link
Copy Markdown
Member

Summary

  • 全 JSON 入力コマンドの --help を改善
    • description に JSON payload example を追加(整形済み JSON で表示)
    • examples にインライン JSON・@file・stdin pipe・interactive mode の具体例を追加
  • 対象コマンド: entities, subscriptions, registrations, batch, attrs, temporal, models, rules, admin tenants/users/policies/oauth-clients/cadde
  • CHANGELOG.md に v0.6.2 エントリを追加

Test plan

  • npm run lint パス
  • npm run typecheck パス
  • npm test 全 624 テストパス
  • geonic help <command> create で各コマンドのヘルプ出力を確認

Summary by CodeRabbit

  • ドキュメント
    • JSON入力コマンドのヘルプを大幅に改善。各コマンドにJSONペイロード例を追加し、インラインJSON・ファイル・stdinパイプ・対話モード等の使用例を拡充。CHANGELOGに v0.6.2(2026-03-17)リリース項目と比較リンクを追加しました
  • テスト
    • E2Eログイン処理に再試行と検証を追加して信頼性を向上。テスト環境のクリーンアップを、認証データを保持したまま対象コレクションのデータ削除に変更しました

- description に JSON payload example を追加
- examples にインライン JSON・stdin pipe・interactive mode の具体例を追加
- 対象: entities, subscriptions, registrations, batch, attrs, temporal,
  models, rules, admin tenants/users/policies/oauth-clients/cadde
@coderabbitai

coderabbitai Bot commented Mar 17, 2026

Copy link
Copy Markdown

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

複数のCLIコマンドのヘルプと使用例を拡張し、JSONペイロードのインライン・ファイル・stdin・対話モード例を追加。CHANGELOGにv0.6.2を追記。e2eヘルパーのperformLoginにリトライと/token検証を追加し、テストDBのcleanupでコレクションをdropせず特定データコレクションをdeleteManyでクリアするよう変更。

Changes

Cohort / File(s) Summary
Changelog
CHANGELOG.md
v0.6.2(2026-03-17)リリース追記。Unreleased参照をv0.6.2...HEADに更新、比較リンク追加。
Admin commands
src/commands/admin/oauth-clients.ts, src/commands/admin/policies.ts, src/commands/admin/tenants.ts, src/commands/admin/users.ts
create/update 等のヘルプを多行化し、JSONペイロード例を追加。使用例にインラインJSON、ファイル、stdinパイプ(および対話モードを含むものあり)を追加・整理。
Entity / Batch / Models / Attributes
src/commands/attrs.ts, src/commands/batch.ts, src/commands/entities.ts, src/commands/models.ts
create/update/replace/upsert 等の説明にJSON構造例を追加。例をインラインJSON・ファイル・stdin・対話モードへ拡張。GeoProperty 等のサンプル追加。
Registrations / Rules / Subscriptions / Temporal
src/commands/registrations.ts, src/commands/rules.ts, src/commands/subscriptions.ts, src/commands/temporal.ts
各コマンドの説明を拡張しJSONペイロード例と使用例(インライン、ファイル、stdin、対話)を追加。Temporal は時系列属性(value/observedAt 配列)等の挙動説明を明記。
E2E tests helpers
tests/e2e/support/world.ts, tests/e2e/support/hooks.ts
performLoginに最大3回のリトライと増加遅延、トークン取得後に/meで検証してから設定を書き込み。DBクリーンアップでコレクションを drop せず、特定のデータコレクションのみを deleteMany でクリアするよう変更。

Sequence Diagram(s)

sequenceDiagram
    participant TestRunner as Test Runner
    participant AuthAPI as Auth API
    participant MeAPI as /me Endpoint
    participant FS as Config File
    Note over TestRunner,AuthAPI: performLogin開始(最大3回リトライ、バックオフ)
    TestRunner->>AuthAPI: POST /login (credentials)
    alt login成功
        AuthAPI-->>TestRunner: token (+ refreshToken)
        TestRunner->>MeAPI: GET /me (verify token)
        alt token検証成功
            MeAPI-->>TestRunner: 200 OK
            TestRunner->>FS: write profile config (token, refreshToken?)
            TestRunner-->>TestRunner: return profile
        else token検証失敗
            MeAPI-->>TestRunner: error
            TestRunner-->>AuthAPI: retry (backoff)
        end
    else login失敗
        AuthAPI-->>TestRunner: error
        TestRunner-->>AuthAPI: retry (backoff)
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐇 ぴょんと跳んで書いたよ、
ヘルプに光る小さなJSON、
インラインもファイルもパイプも舞う、
三度のリトライで確かな一歩、
新しいバージョンへ、ぴょん!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 6.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed プルリクエストのタイトルは「docs: 全 JSON 入力コマンドのヘルプを改善」で、変更セットの主要な内容である複数のJSONコマンドのヘルプテキストと例の改善を正確に表現している。

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch improve-tenants-create-help
📝 Coding Plan
  • Generate coding plan for human review comments

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

DB クリーンアップ後にサーバーが admin user を再生成するまでの
レースコンディションで whoami テストがフレーキーに失敗していた。
performLogin に最大3回リトライと /me でのトークン検証を追加。

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@tests/e2e/support/world.ts`:
- Around line 115-143: The retry loop around the login + token verification
should wrap each attempt in a try-catch so network/JSON errors don’t abort
retries: inside the for loop (the logic that builds loginUrl, calls fetch with
TEST_EMAIL/TEST_PASSWORD, awaits res.json() to extract token, then calls /me
using meUrl), enclose that entire per-attempt sequence in a try block and in the
catch set lastError to the caught Error (or new Error with message + err) and
continue to the next attempt; ensure you still set lastError and continue on
non-ok responses (the existing checks for res.ok and meRes.ok remain) so any
thrown exceptions from fetch or res.json() are captured and allow the loop to
retry.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 23b583f9-57ab-4e07-b047-770e455cd149

📥 Commits

Reviewing files that changed from the base of the PR and between 58aaff4 and 601b37a.

📒 Files selected for processing (2)
  • CHANGELOG.md
  • tests/e2e/support/world.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • CHANGELOG.md

Comment thread tests/e2e/support/world.ts
コレクション drop はサーバーのインメモリ状態と不整合を起こし、
直後の /me 呼び出しが 401 を返すフレーキーテストの原因になっていた。
deleteMany でドキュメントのみクリアし、コレクション構造を保持する。
- users コレクションを deleteMany から除外し、サーバーの
  ユーザーキャッシュとDBの不整合を防止
- performLogin のリトライループを try-catch で保護し、
  fetch/json 例外時もリトライが継続するよう修正
ブロックリストではなくホワイトリスト方式に変更。
entities, subscriptions 等のデータコレクションのみクリアし、
auth 関連コレクション(users, tenants, policies 等)を保持する。
- hooks.ts を元の drop() 方式に戻す(DB cleanup は原因ではなかった)
- performLogin から /me 検証を除去(サーバー側の一時的な 401 が原因)
- performLogin のリトライ + try-catch は維持
- cucumber retry を 1 → 2 に引き上げ(サーバー内部の一時的な不整合を吸収)
@miya0001
miya0001 merged commit 5df4b63 into main Mar 17, 2026
7 checks passed
@miya0001
miya0001 deleted the improve-tenants-create-help branch March 17, 2026 05:44
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.

1 participant