Skip to content

feat: make blob storage size threshold configurable - #16806

Merged
JinHai-CN merged 2 commits into
infiniflow:mainfrom
taek105:feat/16634-configurable-blob-storage-threshold
Jul 10, 2026
Merged

JinHai-CN merged 2 commits into
infiniflow:mainfrom
taek105:feat/16634-configurable-blob-storage-threshold

Conversation

@taek105

@taek105 taek105 commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Make BLOB_STORAGE_SIZE_THRESHOLD configurable through an environment variable.
  • Preserve the existing 20 MiB default.
  • Add tests for the default and configured values.

Why

Blob storage, Seafile, and WebDAV connectors currently use a hardcoded 20 MiB limit. Self-hosted users
cannot raise this limit without modifying the source code inside the container.

Testing

  • test/unit_test/data_source/test_config.py: 2 passed
  • ruff check common/data_source/config.py test/unit_test/data_source/test_config.py

Fixes #16634

@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Jul 10, 2026
@coderabbitai

coderabbitai Bot commented Jul 10, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

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: 30371692-41d7-4d64-b6ee-b045b27c0112

📥 Commits

Reviewing files that changed from the base of the PR and between 23859d9 and a71dea6.

📒 Files selected for processing (2)
  • common/data_source/config.py
  • test/unit_test/data_source/test_blob_storage_size_threshold_config.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • common/data_source/config.py

📝 Walkthrough

Walkthrough

BLOB_STORAGE_SIZE_THRESHOLD now reads an integer from the environment, defaults to 20 MB when unset, and raises a clear ValueError for invalid input. New tests cover default, override, and invalid-value behavior.

Changes

Blob storage threshold configuration

Layer / File(s) Summary
Environment-backed threshold
common/data_source/config.py
The threshold is parsed from BLOB_STORAGE_SIZE_THRESHOLD, falls back to 20 MB when unset, and re-raises invalid integer input with a specific error message.
Threshold behavior tests
test/unit_test/data_source/test_blob_storage_size_threshold_config.py
Tests load fresh configuration state and verify unset, numeric, and non-integer environment values.

Estimated code review effort: 2 (Simple) | ~10 minutes

Poem

A rabbit tweaked the threshold with care,
Letting bigger blobs hop through the air.
Twenty megabytes wait when none is supplied,
Numbers are welcomed; bad text is denied.
“Configurable burrows!” the bunny cried.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 57.14% 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
Title check ✅ Passed The title clearly and concisely describes the main change: making the blob storage threshold configurable.
Description check ✅ Passed The description includes the required Summary and adds useful Why and Testing context, so it is sufficiently complete.
Linked Issues check ✅ Passed The changes satisfy #16634 by making BLOB_STORAGE_SIZE_THRESHOLD env-configurable with the existing default and coverage for error handling.
Out of Scope Changes check ✅ Passed The PR stays focused on the threshold configuration and its tests, with no obvious unrelated code changes.

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
test/unit_test/data_source/test_config.py (1)

34-47: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Add a test for invalid env var values.

The two tests cover the happy paths (default and valid integer override). A test for a non-integer env var value (e.g., "20MB") would verify the error-handling behavior once graceful fallback is added to config.py. This is the most likely misconfiguration scenario for self-hosted users.

🧪 Suggested test for invalid input
+def test_blob_storage_size_threshold_invalid_value_falls_back(monkeypatch):
+    monkeypatch.setenv("BLOB_STORAGE_SIZE_THRESHOLD", "20MB")
+
+    config = _load_config()
+
+    assert config.BLOB_STORAGE_SIZE_THRESHOLD == 20 * 1024 * 1024
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/unit_test/data_source/test_config.py` around lines 34 - 47, Add a test
alongside test_blob_storage_size_threshold_uses_default and
test_blob_storage_size_threshold_uses_environment_variable that sets
BLOB_STORAGE_SIZE_THRESHOLD to a non-integer value such as "20MB", loads the
configuration via _load_config(), and asserts the expected graceful fallback
behavior, typically the default 20 * 1024 * 1024.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@common/data_source/config.py`:
- Line 117: Handle invalid BLOB_STORAGE_SIZE_THRESHOLD environment values
without an opaque import-time ValueError: define a default, parse the
environment value in a try/except, and fall back to the default when conversion
fails (including empty strings), or raise a clear actionable configuration
error. Update the BLOB_STORAGE_SIZE_THRESHOLD initialization accordingly.

---

Nitpick comments:
In `@test/unit_test/data_source/test_config.py`:
- Around line 34-47: Add a test alongside
test_blob_storage_size_threshold_uses_default and
test_blob_storage_size_threshold_uses_environment_variable that sets
BLOB_STORAGE_SIZE_THRESHOLD to a non-integer value such as "20MB", loads the
configuration via _load_config(), and asserts the expected graceful fallback
behavior, typically the default 20 * 1024 * 1024.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c7c27f61-d7b7-4598-b49b-d72ff6f0cfd6

📥 Commits

Reviewing files that changed from the base of the PR and between 7db3982 and 23859d9.

📒 Files selected for processing (2)
  • common/data_source/config.py
  • test/unit_test/data_source/test_config.py

Comment thread common/data_source/config.py Resolved
@taek105 taek105 closed this Jul 10, 2026
@taek105 taek105 reopened this Jul 10, 2026
@taek105

taek105 commented Jul 10, 2026

Copy link
Copy Markdown
Contributor Author

Updated the configuration to raise a clear, actionable error when BLOB_STORAGE_SIZE_THRESHOLD is not an integer.
I also added a focused test covering the invalid environment variable case.

@JinHai-CN JinHai-CN added the ci Continue Integration label Jul 10, 2026
@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.16%. Comparing base (eca8e87) to head (a71dea6).
⚠️ Report is 17 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #16806   +/-   ##
=======================================
  Coverage   93.16%   93.16%           
=======================================
  Files          10       10           
  Lines         717      717           
  Branches      118      118           
=======================================
  Hits          668      668           
  Misses         29       29           
  Partials       20       20           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JinHai-CN
JinHai-CN merged commit 9b60870 into infiniflow:main Jul 10, 2026
7 checks passed
@taek105
taek105 deleted the feat/16634-configurable-blob-storage-threshold branch July 11, 2026 06:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continue Integration size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request]: Make BLOB_STORAGE_SIZE_THRESHOLD configurable via environment variable

2 participants