Skip to content

docs: WEKO_ACCOUNTS_IDP_ENTITY_ID の docstring を SP のエンティティ ID に訂正 - #1948

Open
mhaya wants to merge 1 commit into
develop_v2.1.0from
fix/idp-entity-id-docstring
Open

mhaya wants to merge 1 commit into
develop_v2.1.0from
fix/idp-entity-id-docstring

Conversation

@mhaya

@mhaya mhaya commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

概要 (Summary)

  • WEKO_ACCOUNTS_IDP_ENTITY_ID には、設定名に反してリポジトリの Shibboleth SP のエンティティ ID を設定する(運用手順書 weko-document/docs/operation/gakunin.md・scripts/instance.cfg の記載どおり)。一方 weko_accounts/config.py の docstring は「IdP entity ID that institution owned」となっていた。
  • docstring どおり IdP のエンティティ ID を設定すると、create_fqdn_from_entity_id() が作る Redis キーが weko-group-cache-db の書き込むキー(SP の FQDN から生成)と一致せず、sync_shib_gakunin_map_groups() がエラーを出さずに何もしない。誤設定を防ぐため説明を訂正する。
  • 変更は docstring とコメントのみで、コードの動作は変わらない。
    • config.py
      • WEKO_ACCOUNTS_IDP_ENTITY_ID の docstring を SP のエンティティ ID に訂正し、用途と誤設定時の影響を記載
      • WEKO_ACCOUNTS_GAKUNIN_DEFAULT_GROUP_MAPPING の設定例のキーを IdP の URL から SP のエンティティ ID に変更(実装は WEKO_ACCOUNTS_IDP_ENTITY_ID の値をそのままキーに使う)
    • api.py:_get_roles_to_add / create_fqdn_from_entity_id / _is_gakunin_map_configured の docstring を訂正

関連Issue / チケット (Related Issues)

変更タイプ (Type of Change)

  • 🚀 新機能追加 (Feature)
  • 🐛 バグ修正 (Bug Fix)
  • 🔒 セキュリティ修正 (Security Fix)
  • 🚫 機能のクローズ・非公開化・削除 (Feature Deprecation/Disable)
  • ⚠️ 破壊的変更・データ移行を伴う修正 (Breaking Change / Migration)
  • 📚 仕様書・マニュアル・APIリストの更新 (Documentation)

🤖 0. CI 自動チェック (API Inventory Drift)

  • CI が PASS している、または FAIL の各項目に対処済み(CI 結果待ち)
  • API の追加・変更なし

🔒 1. セキュリティ & API アクセス制御チェック

  • 該当なし(docstring・コメントのみの変更)

🧪 2. テストコード観点チェック

  • 該当なし(動作の変更なし)

🛡️ 3. データ保護 & 破壊的変更防止チェック

  • 該当なし

⚙️ 4. マイグレーション & システム影響チェック

  • 該当なし(設定のデフォルト値は変更していない)

📚 5. ドキュメント・仕様書更新チェック (weko-document)

📋 6. 動作検証エビデンス (Verification Evidence)

テスト実行結果

  • scripts/ci/run-local.sh weko-accounts は、手元の環境でコンテナ内ユーザーがソースツリーに書き込めず(mkdir('/code/modules/weko-accounts/.tox') が EACCES)、テスト実行前に失敗した。README-TEST.md の「Adjust file permissions」に該当する環境側の問題で、本変更とは無関係。合否は本 PR の CI(Unit Tests)で確認する。
  • flake8:変更前後で api.py(60件)・config.py(20件)の指摘件数が変わらないこと(新規の指摘がないこと)を確認した。

手動で確認したこと

  • 変更後の docstring の記述を実装(create_fqdn_from_entity_id、_get_roles_to_add、_is_gakunin_map_configured)と突き合わせた。

🤖 Generated with Claude Code

Summary by Sourcery

Correct the GakuNin mAP configuration documentation to prevent entity ID misconfiguration without changing runtime behavior.

Documentation:

  • Clarify that WEKO_ACCOUNTS_IDP_ENTITY_ID must contain the repository’s Shibboleth SP entity ID, including its use for GakuNin mAP group-cache keys and default mappings.
  • Update related API docstrings to accurately describe GakuNin mAP role resolution and SP entity ID handling.

@sourcery-ai

sourcery-ai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Documentation-only changes align configuration and API docstrings with the implementation: WEKO_ACCOUNTS_IDP_ENTITY_ID must contain the repository’s SP entity ID, which is required for matching GakuNin mAP Redis cache keys and group synchronization; runtime behavior and configuration defaults are unchanged.

File-Level Changes

Change Details Files
Corrected configuration and API docstrings to consistently identify WEKO_ACCOUNTS_IDP_ENTITY_ID as the repository’s Shibboleth SP entity ID.
  • Documented the setting’s purpose, Redis cache-key dependency, and silent synchronization failure caused by configuring an IdP entity ID.
  • Updated the default GakuNin mAP mapping example to use an SP entity ID and clarified that the key is used as-is.
  • Clarified API documentation for group-role resolution, FQDN/key generation, and required mAP configuration checks.
modules/weko-accounts/weko_accounts/config.py
modules/weko-accounts/weko_accounts/api.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai

coderabbitai Bot commented Oct 26, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e3daee71-b6f8-406e-a773-22aecd2769a4

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@github-actions

Copy link
Copy Markdown

🔍 Claude レビュー統合

指摘はありません。


次にすること: 差分は docstring とコメントのみの変更で、動作は変わりません。api.py の _get_roles_to_add(336-375行)と create_fqdn_from_entity_id(687-702行)を読み、追記された説明が実装と一致することを確認しました。内容は、isMemberOf が空のときに WEKO_ACCOUNTS_IDP_ENTITY_ID をキーとして GAKUNIN_DEFAULT_GROUP_MAPPING を引くこと、FQDN の . と - が _ に置換されることです。外部データはレビューの要約と自動レビューのスキップ通知だけで、裁定する指摘スレッドはなく、補完で挙げる問題もありません。そのままマージして問題ありません。


モデル sonnet / 2 回実行して和集合 / コスト $0.1671。同じ入力でも結果が揺れるため複数回まわし、一部のパスでしか挙がらなかったものには回数を添えています

他レビューを踏まえた自動レビューです。誤りが含まれることがあります。

@sourcery-ai sourcery-ai 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.

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Approved.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

設定名に反して、WEKO_ACCOUNTS_IDP_ENTITY_ID にはリポジトリの Shibboleth SP の
エンティティ ID を設定する(運用手順書・scripts/instance.cfg と同じ)。
docstring が「IdP entity ID」となっており、IdP の値を設定すると
weko-group-cache-db が書き込む Redis キーと一致せず、mAP グループの同期が
エラーを出さずに行われなくなるため、説明を訂正する。

- config.py: WEKO_ACCOUNTS_IDP_ENTITY_ID の docstring を訂正し、
  WEKO_ACCOUNTS_GAKUNIN_DEFAULT_GROUP_MAPPING の設定例のキーを SP の
  エンティティ ID に変更
- api.py: _get_roles_to_add / create_fqdn_from_entity_id /
  _is_gakunin_map_configured の docstring を訂正

コードの動作は変更しない。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

API インベントリ差分(件数のみ)

台帳ブランチ: develop_v2.1.0

明細は公開できないため件数のみ表示しています。該当箇所はプライベートリポジトリ側の台帳・レポートで確認してください。

ベースラインとの差分

API インベントリ差分レポート

  • 旧: b572c442d v2.0.4-577-gb572c442d (profile=default) endpoints=933 (外部ライブラリ由来 359)
  • 新: 6ed162995 v2.0.4-675-g6ed162995 (profile=default) endpoints=933 (外部ライブラリ由来 359)

判定: ❌ FAIL (FAIL 1 / WARN 3)

サマリ

分類 件数
ADDED 0
REMOVED 0
RULE_CHANGED 0
METHODS_CHANGED 0
AUTH_CHANGED 35
IMPL_CHANGED 9
ATTRS_UNKNOWN_NEW 0
ModelView 追加 0
ModelView 削除 0
ModelView フラグ変化 0
config 変化 2
コメントアウト認証の増加 0
依存パッケージの版変化 2

[FAIL] G2 認証系デコレータが削除された — 3件

件数のみ。該当の経路名はプライベートリポジトリ側の完全版レポートを参照。

[WARN] W2 実装本体が変化(data_op / 情報露出を再確認) — 9件

件数のみ。該当の経路名はプライベートリポジトリ側の完全版レポートを参照。

[WARN] W6 依存パッケージの版が変化した — 2件

  • distlib — 0.4.3 -> 0.4.4
  • pbr — 7.0.3 -> 7.1.3

[WARN] W5 監視対象 config が変化した — 2件

件数のみ。該当の経路名はプライベートリポジトリ側の完全版レポートを参照。


台帳との突き合わせ

(生成されませんでした)

ソース由来の経路検知

(生成されませんでした)

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