Skip to content

Enable the access rights modification feature(#63818) - #1951

Merged
Ooka-Masashi merged 1 commit into
develop_v2.1.0from
fix/issue63818_note5
Oct 28, 2026
Merged

Ooka-Masashi merged 1 commit into
develop_v2.1.0from
fix/issue63818_note5

Conversation

@ivis-miyachi

@ivis-miyachi ivis-miyachi commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary by Sourcery

New Features:

  • Add configuration to enable access-rights correction for search indexes.

@coderabbitai

coderabbitai Bot commented Oct 28, 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: 2b18c44a-6a64-4783-83e0-71a44601e4a6

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.

@sourcery-ai

sourcery-ai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Enables search-index access-rights modification through a new instance configuration setting, enabled by default.

File-Level Changes

Change Details Files
Add a configuration flag to enable access-rights correction for search indexes.
  • Define WEKO_SEARCH_FIX_ACCESSRIGHTS with a default value of True.
  • Document that the setting controls whether search-index access rights are fixed.
scripts/instance.cfg

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

@github-actions

Copy link
Copy Markdown

🔍 Claude レビュー統合

Claude の追加指摘 1 件 — 🔴 高 0 / 🟠 中 0 / 🟡 低 1

# 出所 箇所 指摘 判定 修正案
1 Claude scripts/instance.cfg:893 ファイル末尾に改行がない 🟡 追加指摘(低) あり

1. 🟡 [低] ファイル末尾に改行がない(Claude の追加指摘)

scripts/instance.cfg:893

追加した docstring の行の末尾に改行がありません(差分に \ No newline at end of file と出ています)。POSIX のテキストファイルの慣習に反します。今後このファイルへ追記すると、この行が差分に余計に出ます。

修正案

最終行の末尾に改行を追加してください。

根拠
"""Fix access rights for search indexes. True if fixing access rights."""\ No newline at end of file

確認: 差分と scripts/instance.cfg:889-893 を確認しました。


次にすること: 外部データに具体的な指摘はありません。CodeRabbit は自動レビューをスキップしており、その旨の通知があるだけです。WEKO_SEARCH_FIX_ACCESSRIGHTS は weko-search-ui/config.py:805 で既定値 False として定義されており、各モジュールが同名のキーを参照しています。このため、instance.cfg で True に上書きするのは意図した使い方と判断しました。作者は、instance.cfg の末尾に改行を追加してください。


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

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

@github-actions

Copy link
Copy Markdown

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

台帳ブランチ: develop_v2.1.0

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

ベースラインとの差分

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

台帳との突き合わせ

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

ソース由来の経路検知

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

@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 found 2 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="scripts/instance.cfg" line_range="892" />
<code_context>
 WEKO_RECORDS_UI_S3_TRANSFER_MAX_CONCURRENCY = 10
 """Number of threads for multipart upload/download for S3 compatible service transfer. Default is 10."""

+WEKO_SEARCH_FIX_ACCESSRIGHTS = True
+"""Fix access rights for search indexes. True if fixing access rights."""
\ No newline at end of file
</code_context>
<issue_to_address>
**Harvest fails on timestamp dates**

When a file’s `dateValue` is present but is not exactly `YYYY-MM-DD`, such as a valid date-time value, `Record.updated` passes the file’s `dateValue` directly to `datetime.strptime(..., "%Y-%m-%d")`, raising `ValueError`; OAI-PMH response generation then fails when it reads `record.updated`.

Validate or safely parse `dateValue` before calling `strptime`, and skip values that cannot be parsed as dates.
</issue_to_address>

### Comment 2
<location path="scripts/instance.cfg" line_range="892" />
<code_context>
 WEKO_RECORDS_UI_S3_TRANSFER_MAX_CONCURRENCY = 10
 """Number of threads for multipart upload/download for S3 compatible service transfer. Default is 10."""

+WEKO_SEARCH_FIX_ACCESSRIGHTS = True
+"""Fix access rights for search indexes. True if fixing access rights."""
\ No newline at end of file
</code_context>
<issue_to_address>
**Indexing adds per-record database work**

When a bulk indexing or reindexing job processes many records, indexing reads `record.updated` in `_prepare_record`; with this setting enabled, that property queries record metadata and resolves its item-type mapping for each record. Bulk indexing therefore adds per-record database and mapping work, slowing reindexing and other indexing workloads.

Avoid per-record metadata queries during indexing, for example by batching the required metadata or reusing data already loaded for the record.
</issue_to_address>

Sourcery assessment

Needs a human reviewer. 2 findings to address first, and enabling this setting can change access rights applied to search indexes; if it grants access to records that should be restricted, those records may be exposed before the issue is noticed. Reverting the setting stops future fixes but may not restore rights already changed in the indexes.

Blocking findings: scripts/instance.cfg:892, scripts/instance.cfg:892


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

Comment thread scripts/instance.cfg
WEKO_RECORDS_UI_S3_TRANSFER_MAX_CONCURRENCY = 10
"""Number of threads for multipart upload/download for S3 compatible service transfer. Default is 10."""

WEKO_SEARCH_FIX_ACCESSRIGHTS = True

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Medium · Harvest fails on timestamp dates

When a file’s dateValue is present but is not exactly YYYY-MM-DD, such as a valid date-time value, Record.updated passes the file’s dateValue directly to datetime.strptime(..., "%Y-%m-%d"), raising ValueError; OAI-PMH response generation then fails when it reads record.updated.

Validate or safely parse dateValue before calling strptime, and skip values that cannot be parsed as dates.

Prompt for AI agents
In `scripts/instance.cfg` at line 892:

**Harvest fails on timestamp dates**

When a file’s `dateValue` is present but is not exactly `YYYY-MM-DD`, such as a valid date-time value, `Record.updated` passes the file’s `dateValue` directly to `datetime.strptime(..., "%Y-%m-%d")`, raising `ValueError`; OAI-PMH response generation then fails when it reads `record.updated`.

Validate or safely parse `dateValue` before calling `strptime`, and skip values that cannot be parsed as dates.

Comment thread scripts/instance.cfg
WEKO_RECORDS_UI_S3_TRANSFER_MAX_CONCURRENCY = 10
"""Number of threads for multipart upload/download for S3 compatible service transfer. Default is 10."""

WEKO_SEARCH_FIX_ACCESSRIGHTS = True

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Medium · Indexing adds per-record database work

When a bulk indexing or reindexing job processes many records, indexing reads record.updated in _prepare_record; with this setting enabled, that property queries record metadata and resolves its item-type mapping for each record. Bulk indexing therefore adds per-record database and mapping work, slowing reindexing and other indexing workloads.

Avoid per-record metadata queries during indexing, for example by batching the required metadata or reusing data already loaded for the record.

Prompt for AI agents
In `scripts/instance.cfg` at line 892:

**Indexing adds per-record database work**

When a bulk indexing or reindexing job processes many records, indexing reads `record.updated` in `_prepare_record`; with this setting enabled, that property queries record metadata and resolves its item-type mapping for each record. Bulk indexing therefore adds per-record database and mapping work, slowing reindexing and other indexing workloads.

Avoid per-record metadata queries during indexing, for example by batching the required metadata or reusing data already loaded for the record.

@Ooka-Masashi
Ooka-Masashi merged commit a7f7da9 into develop_v2.1.0 Oct 28, 2026
149 of 161 checks passed
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.

2 participants