Skip to content

[GRDM-63554] ci: item_type.sql の JSON-LD マッピングをアイテムタイプの検証・修正 - #1950

Draft
yacchin1205 wants to merge 3 commits into
RCOSDP:develop_v2.1.0from
yacchin1205:ci/initial-data-consistency
Draft

yacchin1205 wants to merge 3 commits into
RCOSDP:develop_v2.1.0from
yacchin1205:ci/initial-data-consistency

Conversation

@yacchin1205

@yacchin1205 yacchin1205 commented Oct 28, 2026 •

Copy link
Copy Markdown

概要 (Summary)

  • install.sh は scripts/demo/item_type.sql からアイテムタイプと JSON-LD マッピングを一緒に投入するが、投入直後のマッピングが JsonLdMapper.validate() を通らない。
    • 30001 デフォルトマッピング(シンプル): 30件
    • 30002 デフォルトマッピング(フル): 12件(カタログ.Thumbnail、カタログ.Hosting Institution、出版者情報.出版地.言語、Funding Reference.助成機関識別子.助成機関識別子URI 等がアイテムタイプに無い)
    • develop_v2.0.0 → develop_v2.1.0 で、item_type.sql のアイテムタイプ(30001・30002)とプロパティは変わっておらず、マッピングだけが書き換わっている。
  • ui-tests.yml に、投入済みの全マッピングを validate() にかけるステップを追加した(scripts/ci/validate_jsonld_mappings.py)。エラーの内容は Step Summary に出る。不一致があればステップは失敗する。
  • 寄与者所属名の JSON-LD パス jpcoar:affiliationjpcoar:affiliationName のドット欠落を jpcoar:affiliation.jpcoar:affiliationName に直した(30001・30002 の本体と版履歴、計12か所)。
    • item_type.sql は「手で編集しないこと」とある生成ファイルだが、手で直している。
    • validate() はマッピングのキーしか見ないため、この修正で上記の件数は変わらない。
  • ui-tests.yml の Python を 3.9 から 3.11 にした。ubuntu-latest が ubuntu-26.04 になり 3.9 が提供されないため、10/22 以降 UI Tests は「Set up Python」で落ちていた(例: docs: WEKO_ACCOUNTS_IDP_ENTITY_ID の docstring を SP のエンティティ ID に訂正 #1948)。他のワークフローは 3.11。

[WIP] 不一致そのものは直していないので、追加したステップは現状失敗する。アイテムタイプとマッピングのどちらに合わせるべきかを相談したい。

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

  • GRDM-63554

変更タイプ (Type of Change)

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

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

  • fork からの PR のためスキップされる。API の追加・変更なし

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

  • 該当なし

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

  • 該当なし

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

  • 該当なし

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

  • 該当なし(item_type.sql 以外の初期データ・マイグレーション SQL は変更していない)

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

  • 更新不要な場合(理由): CI と初期データのみの変更

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

テスト実行結果

この PR の UI Tests(ubuntu-26.04、Python 3.11)で、UI テストは 3 passed, 1 xfailed、追加したステップのみ上記の件数で失敗する。

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Oct 28, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • 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.

@sourcery-ai

sourcery-ai Bot commented Oct 28, 2026

Copy link
Copy Markdown

Reviewer's Guide

初期データとして投入される全 JSON-LD マッピングを対応するアイテムタイプに対して CI で検証し、不一致の詳細を Step Summary に表示して検出できるようにした。あわせて寄与者所属の JSON-LD パス欠落を修正しているが、現時点では既存のアイテムタイプとマッピング間の不一致が残るため、追加した検証ステップは失敗する状態である。

Sequence diagram for JSON-LD mapping validation in UI Tests

sequenceDiagram
    participant CI as UI Tests
    participant Script as validate_jsonld_mappings.py
    participant App as create_app()
    participant DB as ItemTypeJsonldMapping
    participant Mapper as JsonLdMapper
    participant Summary as Step Summary

    CI->>Script: execute script
    Script->>App: create_app()
    Script->>DB: query active mappings
    loop each mapping
        Script->>Mapper: validate()
        Mapper-->>Script: validation errors
    end
    Script->>Summary: print Markdown report
    alt errors found
        Script-->>CI: exit code 1
    else no errors
        Script-->>CI: exit code 0
    end
Loading

Flow diagram for detecting item type mapping drift

flowchart TD
    A[install.sh loads item types and JSON-LD mappings] --> B[UI Tests run validate_jsonld_mappings.py]
    B --> C[Load active ItemTypeJsonldMapping records]
    C --> D["JsonLdMapper.validate() for each mapping"]
    D --> E{Validation errors?}
    E -->|Yes| F[Show error details in Step Summary]
    F --> G[Fail CI step]
    E -->|No| H[Pass CI step]
Loading

File-Level Changes

Change Details Files
CI に、初期投入済みの JSON-LD マッピングと対応アイテムタイプの整合性検証を追加。
  • サービス起動後、UI テストの成否にかかわらず検証スクリプトを実行するステップを追加
  • 削除済みを除く全マッピングを取得し、JsonLdMapper.validate() の結果を Markdown の Step Summary に出力
  • 不一致があれば終了コード 1 として CI を失敗させる
  • サービス待機ステップに ID を付与し、起動成功時のみ検証を実行
.github/workflows/ui-tests.yml
scripts/ci/validate_jsonld_mappings.py
初期 JSON-LD マッピングの寄与者所属パスの誤りを修正。
  • jpcoar:affiliationjpcoar:affiliationName を jpcoar:affiliation.jpcoar:affiliationName に変更
  • 30001・30002 の本体および版履歴に含まれる該当箇所を修正
scripts/demo/item_type.sql

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

@yacchin1205
yacchin1205 force-pushed the ci/initial-data-consistency branch from ba51872 to d1ee7f2 Compare October 28, 2026 00:05
@yacchin1205 yacchin1205 changed the title [WIP] ci: item_type.sql の JSON-LD マッピングをアイテムタイプに対して検証し、寄与者所属のドット欠落を直す [GRDM-63554] ci: item_type.sql の JSON-LD マッピングをアイテムタイプに対して検証し、寄与者所属のドット欠落を直す Oct 28, 2026
@yacchin1205 yacchin1205 changed the title [GRDM-63554] ci: item_type.sql の JSON-LD マッピングをアイテムタイプに対して検証し、寄与者所属のドット欠落を直す [GRDM-63554] ci: item_type.sql の JSON-LD マッピングをアイテムタイプの検証・修正 Oct 28, 2026
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