Skip to content

fix(azure): prepend bucket prefix to all Azure Blob storage paths - #14561

Closed
Ricardo-M-L wants to merge 2295 commits into
infiniflow:mainfrom
Ricardo-M-L:fix/azure-blob-missing-bucket-prefix
Closed

Ricardo-M-L wants to merge 2295 commits into
infiniflow:mainfrom
Ricardo-M-L:fix/azure-blob-missing-bucket-prefix

Conversation

@Ricardo-M-L

Copy link
Copy Markdown
Contributor

What

The Azure SPN (rag/utils/azure_spn_conn.py) and Azure SAS (rag/utils/azure_sas_conn.py) storage backends ignored the bucket parameter and wrote every file flat under the container using only fnm. Files with the same name uploaded from different datasets (different kb_ids) silently overwrote each other in Azure Blob storage.

Why

The MinIO and S3 backends already prepend the bucket as a path prefix (<bucket>/<fnm>) for logical isolation between datasets. The Azure backends should follow the same contract.

Change

Applies the f\"{bucket}/{fnm}\" prefix pattern to all path-taking operations in both Azure backends:

Method Before After
put create_file(fnm) / upload_blob(name=fnm, ...) create_file(f\"{bucket}/{fnm}\") / upload_blob(name=f\"{bucket}/{fnm}\", ...)
get get_file_client(fnm) / download_blob(fnm) …(f\"{bucket}/{fnm}\")
rm delete_file(fnm) / delete_blob(fnm) …(f\"{bucket}/{fnm}\")
obj_exist get_file_client(fnm) / get_blob_client(fnm) …(f\"{bucket}/{fnm}\")
get_presigned_url get_presigned_url(\"GET\", bucket, fnm, expires) get_presigned_url(\"GET\", f\"{bucket}/{fnm}\", expires)
health create_file(fnm) / upload_blob(name=fnm, ...) …(f\"{bucket}/{fnm}\") (renamed _bucket → bucket since it is now used)

Tests

Adds test/unit_test/rag/utils/test_azure_blob_bucket_prefix.py (12 tests, all passing) covering every modified method on both backends, plus a dedicated regression test that verifies two datasets uploading the same filename produce two distinct storage paths.

$ pytest test/unit_test/rag/utils/test_azure_blob_bucket_prefix.py -v
============================== 12 passed in 0.02s ==============================

The tests stub the azure SDK and the common.settings module so they run without Azure credentials or live connectivity.

Notes

  • For get_presigned_url, the Azure SPN/SAS implementations were already non-functional (the underlying Azure SDK clients don't expose this method); this change keeps the path argument consistent with the rest of the API surface as requested in the issue, in case the method is reworked later.
  • No backward-compat shim is included — the previous behavior was buggy (collisions), and the issue description explicitly endorses this fix.

Fixes #14159

@dosubot dosubot Bot added the size:S This PR changes 10-29 lines, ignoring generated files. label May 3, 2026
@coderabbitai

coderabbitai Bot commented May 3, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: aa2ecec9-6f26-4824-90c0-be0053d7548a

📥 Commits

Reviewing files that changed from the base of the PR and between 57f25ea and 5272c3a.

📒 Files selected for processing (3)
  • rag/utils/azure_sas_conn.py
  • rag/utils/azure_spn_conn.py
  • test/unit_test/rag/utils/test_azure_blob_bucket_prefix.py
🚧 Files skipped from review as they are similar to previous changes (3)
  • test/unit_test/rag/utils/test_azure_blob_bucket_prefix.py
  • rag/utils/azure_spn_conn.py
  • rag/utils/azure_sas_conn.py

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

Azure SPN and SAS connectors now use bucket-prefixed paths for blob operations. Unit tests verify path construction for upload, retrieval, deletion, existence, and URL operations. Tests also verify distinct paths for identical filenames in different buckets.

Changes

Azure blob path prefix alignment

Layer / File(s) Summary
SPN bucket-prefixed operations
rag/utils/azure_spn_conn.py
SPN operations use combined bucket and filename paths. Existence checks use a file client, and URL retrieval returns the file client URL.
SAS bucket-prefixed operations
rag/utils/azure_sas_conn.py
SAS operations use combined blob names. Deletion and existence checks reuse the computed blob name, and URL retrieval returns the blob client URL.
Bucket prefix regression tests
test/unit_test/rag/utils/test_azure_blob_bucket_prefix.py
Isolated tests stub runtime and Azure SDK modules, then verify bucket-prefixed paths for SPN and SAS operations. Regression tests cover identical filenames in different buckets.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to 5272c

This localized change scopes Azure Blob paths by bucket to prevent cross-dataset filename collisions, with dedicated tests covering the modified operations; no actionable merge-blocking risk remains beyond normal checks and review.

Poem

The rabbit checks each bucket path,
SPN and SAS avoid the clash.
Same names now stay far apart,
Tests confirm each storage start,
The blobs hop safely through the stack.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The PR changes get_presigned_url beyond path prefixing. It now returns a client URL and ignores the requested expiry instead of using the presigned-URL API. This changes API behavior and is not requir… Keep the get_presigned_url behavior unchanged while applying the bucket-prefixed path, or split the URL behavior change into a separate PR with explicit requirements and tests.
Docstring Coverage ⚠️ Warning Docstring coverage is 10.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 30 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the Azure change and the main behavior: adding the bucket prefix to Blob storage paths.
Description check ✅ Passed The description provides the purpose, background, implementation details, test results, and linked issue. It does not use the template's exact "### Summary" heading, but the required information is pr…
Linked Issues check ✅ Passed The PR satisfies issue #14159 by applying the bucket prefix to Azure SPN and SAS operations, including put, get, rm, obj_exist, get_presigned_url, and health. The tests cover path construction and fil…
Full details: Description check

Explanation

The description provides the purpose, background, implementation details, test results, and linked issue. It does not use the template's exact "### Summary" heading, but the required information is present.

Full details: Linked Issues check

Explanation

The PR satisfies issue #14159 by applying the bucket prefix to Azure SPN and SAS operations, including put, get, rm, obj_exist, get_presigned_url, and health. The tests cover path construction and filename isolation across buckets.

Full details: Out of Scope Changes check

Explanation

The PR changes get_presigned_url beyond path prefixing. It now returns a client URL and ignores the requested expiry instead of using the presigned-URL API. This changes API behavior and is not required by issue #14159.


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.

@dosubot dosubot Bot added 🐞 bug Something isn't working, pull request that fix bug. 🧪 test Pull requests that update test cases. labels May 3, 2026

@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: 5

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
rag/utils/azure_spn_conn.py (1)

71-82: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Fix premature exit in retry loop in put.

Line 81 returns from inside except, so the for _ in range(3) loop never retries. This nullifies transient-failure recovery on writes.

Proposed fix
     def put(self, bucket, fnm, binary, tenant_id=None):
         for _ in range(3):
             try:
                 f = self.conn.create_file(f"{bucket}/{fnm}")
                 f.append_data(binary, offset=0, length=len(binary))
                 return f.flush_data(len(binary))
             except Exception:
                 logging.exception(f"Fail put {bucket}/{fnm}")
                 self.__open__()
                 time.sleep(1)
-                return None
         return None
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@rag/utils/azure_spn_conn.py` around lines 71 - 82, The put method's retry
loop is broken because the except block returns immediately, preventing further
retries; update put (method put in class using self.conn.create_file and
f.append_data/f.flush_data) to remove the premature return inside the except so
that on exception it logs the error, calls self.__open__(), sleeps, and then
continues the for _ in range(3) loop to retry; after the loop finishes without
success, return None (preserve existing successful return of f.flush_data when
no exception).
🧹 Nitpick comments (1)
test/unit_test/rag/utils/test_azure_blob_bucket_prefix.py (1)

109-186: ⚡ Quick win

Add health() coverage since health path construction changed in this PR.

Current tests validate put/get/rm/obj_exist/get_presigned_url but not health() for either connector. A small assertion on the called path/name would close that gap.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/unit_test/rag/utils/test_azure_blob_bucket_prefix.py` around lines 109 -
186, Add a new test in both TestAzureSpnBucketPrefix and
TestAzureSasBucketPrefix that calls the connector health() (on the
RAGFlowAzureSpnBlob and RAGFlowAzureSasBlob instances) with a bucket like "kb_a"
and asserts the underlying mocked connection was invoked with a path containing
the bucket prefix; for the SPN test call spn.health("kb_a") and assert any
recorded call in spn.conn.call_args_list has a first positional arg that starts
with "kb_a/" (or contains "kb_a"), and for the SAS test call sas.health("kb_a")
and assert any sas.conn.upload/download/delete/get call_args/kwargs include a
"name" or positional arg that starts with "kb_a/". Ensure you reference the
instance names spn and sas, the health() method, and the conn mock when adding
the assertions.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@rag/utils/azure_sas_conn.py`:
- Around line 80-84: The obj_exist method logs "Fail put ..." on exceptions
which is misleading; change the logging.exception call inside obj_exist to a
existence-specific message like "Fail checking existence of {bucket}/{fnm}"
(include the bucket/fnm) and keep logging.exception so the exception details are
recorded; also ensure obj_exist returns a boolean on error (e.g., return False)
so callers of obj_exist (which calls self.conn.get_blob_client(...).exists())
receive a consistent result.
- Line 65: The delete/get/exists/read methods currently call self.conn using the
new path format f"{bucket}/{fnm}" (e.g., the
self.conn.delete_blob(f"{bucket}/{fnm}") call) but must fall back to the legacy
plain fnm if the new path is not found; update each occurrence (the delete_blob,
get_blob/read operations and existence checks at the same spots) to first try
the f"{bucket}/{fnm}" call and on a not-found/error response attempt the legacy
fnm value before failing, returning the successful result or logging/raising the
original error only if both attempts fail.

In `@rag/utils/azure_spn_conn.py`:
- Around line 86-87: Modify the non-write operations to try the new prefixed
path first and fall back to the legacy plain filename on failure: for the delete
flow using self.conn.delete_file(f"{bucket}/{fnm}") (and similarly for
get/get_presigned_url/obj_exist), catch exceptions or a false/None result and
then attempt the same operation with the legacy path self.conn.delete_file(fnm)
(or self.conn.get_object(fnm), self.conn.get_presigned_url(fnm),
self.conn.object_exists(fnm) as appropriate); ensure both attempts preserve
return values/errors so callers receive the correct success/failure outcome and
avoid raising the first-path exception when the legacy attempt succeeds.
- Around line 102-107: The obj_exist method currently logs a misleading message
"Fail put ..." on exception; update the exception logging in obj_exist to use an
existence-specific message such as "Fail checking existence for {bucket}/{fnm}"
(use the same f-string pattern) so logs accurately reflect the operation and
include the bucket/fnm details; modify the logging.exception call inside
obj_exist to that new message.

In `@test/unit_test/rag/utils/test_azure_blob_bucket_prefix.py`:
- Around line 31-33: The helper _install_stubs currently mutates sys.modules
directly and never restores entries, causing cross-test pollution; change the
stubbing to use pytest's monkeypatch.setitem to insert the fake modules (e.g.,
replace sys.modules["ragflow.runtime"] etc.) so patches are automatically
reverted after each test, and update the three other stub blocks (the ones
creating fake modules around the same area) to use monkeypatch.setitem instead
of direct sys.modules assignment or add explicit teardown that restores
originals if monkeypatch is unavailable; locate uses in function _install_stubs
and the other stub creation sites and replace sys.modules[...] = fake_module
with monkeypatch.setitem(sys.modules, key, fake_module).

---

Outside diff comments:
In `@rag/utils/azure_spn_conn.py`:
- Around line 71-82: The put method's retry loop is broken because the except
block returns immediately, preventing further retries; update put (method put in
class using self.conn.create_file and f.append_data/f.flush_data) to remove the
premature return inside the except so that on exception it logs the error, calls
self.__open__(), sleeps, and then continues the for _ in range(3) loop to retry;
after the loop finishes without success, return None (preserve existing
successful return of f.flush_data when no exception).

---

Nitpick comments:
In `@test/unit_test/rag/utils/test_azure_blob_bucket_prefix.py`:
- Around line 109-186: Add a new test in both TestAzureSpnBucketPrefix and
TestAzureSasBucketPrefix that calls the connector health() (on the
RAGFlowAzureSpnBlob and RAGFlowAzureSasBlob instances) with a bucket like "kb_a"
and asserts the underlying mocked connection was invoked with a path containing
the bucket prefix; for the SPN test call spn.health("kb_a") and assert any
recorded call in spn.conn.call_args_list has a first positional arg that starts
with "kb_a/" (or contains "kb_a"), and for the SAS test call sas.health("kb_a")
and assert any sas.conn.upload/download/delete/get call_args/kwargs include a
"name" or positional arg that starts with "kb_a/". Ensure you reference the
instance names spn and sas, the health() method, and the conn mock when adding
the assertions.
🪄 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: f0b953d4-2300-4db3-b28e-23038f1208e4

📥 Commits

Reviewing files that changed from the base of the PR and between 24af087 and 215a807.

📒 Files selected for processing (3)
  • rag/utils/azure_sas_conn.py
  • rag/utils/azure_spn_conn.py
  • test/unit_test/rag/utils/test_azure_blob_bucket_prefix.py

Comment thread rag/utils/azure_sas_conn.py Outdated
def rm(self, bucket, fnm):
try:
self.conn.delete_blob(fnm)
self.conn.delete_blob(f"{bucket}/{fnm}")

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.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Mirror a legacy-path fallback here as well for upgrade safety.

Like the SPN connector, non-write methods now only address "{bucket}/{fnm}". Without fallback to legacy fnm, pre-existing blobs written before this PR can become inaccessible.

Also applies to: 72-72, 82-82, 90-90

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@rag/utils/azure_sas_conn.py` at line 65, The delete/get/exists/read methods
currently call self.conn using the new path format f"{bucket}/{fnm}" (e.g., the
self.conn.delete_blob(f"{bucket}/{fnm}") call) but must fall back to the legacy
plain fnm if the new path is not found; update each occurrence (the delete_blob,
get_blob/read operations and existence checks at the same spots) to first try
the f"{bucket}/{fnm}" call and on a not-found/error response attempt the legacy
fnm value before failing, returning the successful result or logging/raising the
original error only if both attempts fail.

Comment thread rag/utils/azure_sas_conn.py Outdated
Comment on lines 80 to 84
def obj_exist(self, bucket, fnm):
try:
return self.conn.get_blob_client(fnm).exists()
return self.conn.get_blob_client(f"{bucket}/{fnm}").exists()
except Exception:
logging.exception(f"Fail put {bucket}/{fnm}")

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.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fix misleading log verb in obj_exist exception path.

obj_exist currently logs "Fail put ...". This should be existence-specific to keep storage diagnostics accurate.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@rag/utils/azure_sas_conn.py` around lines 80 - 84, The obj_exist method logs
"Fail put ..." on exceptions which is misleading; change the logging.exception
call inside obj_exist to a existence-specific message like "Fail checking
existence of {bucket}/{fnm}" (include the bucket/fnm) and keep logging.exception
so the exception details are recorded; also ensure obj_exist returns a boolean
on error (e.g., return False) so callers of obj_exist (which calls
self.conn.get_blob_client(...).exists()) receive a consistent result.

Comment thread rag/utils/azure_spn_conn.py Outdated
Comment on lines 86 to 87
self.conn.delete_file(f"{bucket}/{fnm}")
except Exception:

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.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Add legacy-path fallback for non-write operations to avoid post-deploy data invisibility.

After this change, get/rm/obj_exist/get_presigned_url only target "{bucket}/{fnm}". Any objects previously written as plain fnm become unreachable after rollout. Please add a fallback read/delete/existence/presign attempt to legacy fnm (prefixed path first, legacy path second).

Also applies to: 93-94, 104-105, 113-113

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@rag/utils/azure_spn_conn.py` around lines 86 - 87, Modify the non-write
operations to try the new prefixed path first and fall back to the legacy plain
filename on failure: for the delete flow using
self.conn.delete_file(f"{bucket}/{fnm}") (and similarly for
get/get_presigned_url/obj_exist), catch exceptions or a false/None result and
then attempt the same operation with the legacy path self.conn.delete_file(fnm)
(or self.conn.get_object(fnm), self.conn.get_presigned_url(fnm),
self.conn.object_exists(fnm) as appropriate); ensure both attempts preserve
return values/errors so callers receive the correct success/failure outcome and
avoid raising the first-path exception when the legacy attempt succeeds.

Comment thread rag/utils/azure_spn_conn.py Outdated
Comment on lines 102 to 107
def obj_exist(self, bucket, fnm):
try:
client = self.conn.get_file_client(fnm)
client = self.conn.get_file_client(f"{bucket}/{fnm}")
return client.exists()
except Exception:
logging.exception(f"Fail put {bucket}/{fnm}")

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.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Correct the exception log message in obj_exist.

The obj_exist error path logs "Fail put ...", which is misleading during incident triage. Use an existence-specific message.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@rag/utils/azure_spn_conn.py` around lines 102 - 107, The obj_exist method
currently logs a misleading message "Fail put ..." on exception; update the
exception logging in obj_exist to use an existence-specific message such as
"Fail checking existence for {bucket}/{fnm}" (use the same f-string pattern) so
logs accurately reflect the operation and include the bucket/fnm details; modify
the logging.exception call inside obj_exist to that new message.

Comment on lines +31 to +33
def _install_stubs():
"""Replace heavyweight runtime modules so the connection modules can be
imported in isolation without the full ragflow runtime or the real

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.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Isolate sys.modules stubbing to avoid cross-test pollution.

These fixtures replace global module entries but never restore them. That can make unrelated tests fail depending on run order. Please switch to monkeypatch.setitem (or restore snapshot on teardown) so patches are automatically reverted.

Also applies to: 74-83, 86-97

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/unit_test/rag/utils/test_azure_blob_bucket_prefix.py` around lines 31 -
33, The helper _install_stubs currently mutates sys.modules directly and never
restores entries, causing cross-test pollution; change the stubbing to use
pytest's monkeypatch.setitem to insert the fake modules (e.g., replace
sys.modules["ragflow.runtime"] etc.) so patches are automatically reverted after
each test, and update the three other stub blocks (the ones creating fake
modules around the same area) to use monkeypatch.setitem instead of direct
sys.modules assignment or add explicit teardown that restores originals if
monkeypatch is unavailable; locate uses in function _install_stubs and the other
stub creation sites and replace sys.modules[...] = fake_module with
monkeypatch.setitem(sys.modules, key, fake_module).

@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels May 8, 2026
@JinHai-CN
JinHai-CN marked this pull request as draft May 8, 2026 08:48
@JinHai-CN
JinHai-CN marked this pull request as ready for review May 8, 2026 08:48
@JinHai-CN JinHai-CN added the ci Continue Integration label May 8, 2026
@JinHai-CN
JinHai-CN marked this pull request as draft May 8, 2026 08:48
@JinHai-CN
JinHai-CN marked this pull request as ready for review May 8, 2026 08:48
@JinHai-CN

Copy link
Copy Markdown
Member
=================================== FAILURES ===================================
______ TestAzureSpnBucketPrefix.test_get_presigned_url_uses_bucket_prefix ______
test/unit_test/rag/utils/test_azure_blob_bucket_prefix.py:137: in test_get_presigned_url_uses_bucket_prefix
    spn.conn.get_presigned_url.assert_called_once_with("GET", "kb_a/doc.pdf", 3600)
/home/alice/.local/share/uv/python/cpython-3.12.12-linux-x86_64-gnu/lib/python3.12/unittest/mock.py:960: in assert_called_once_with
    raise AssertionError(msg)
E   AssertionError: Expected 'get_presigned_url' to be called once. Called 0 times.
______ TestAzureSasBucketPrefix.test_get_presigned_url_uses_bucket_prefix ______
test/unit_test/rag/utils/test_azure_blob_bucket_prefix.py:177: in test_get_presigned_url_uses_bucket_prefix
    sas.conn.get_presigned_url.assert_called_once_with("GET", "kb_a/doc.pdf", 3600)
/home/alice/.local/share/uv/python/cpython-3.12.12-linux-x86_64-gnu/lib/python3.12/unittest/mock.py:960: in assert_called_once_with
    raise AssertionError(msg)
E   AssertionError: Expected 'get_presigned_url' to be called once. Called 0 times.
=========================== short test summary info ============================

@Ricardo-M-L Would you please fix the unit test?

@Ricardo-M-L

Copy link
Copy Markdown
Contributor Author

Hi @JinHai-CN, friendly ping — this fix prepends the configured bucket prefix to every Azure Blob path in azure_sas_conn.py / azure_spn_conn.py. Without it, deployments that share an Azure container across environments (dev/staging/prod) end up writing into each other's namespace. coderabbit's review is clean. Happy to address any remaining feedback 🙏

@KevinHuSh

Copy link
Copy Markdown
Contributor

Appreciations!
CI failure.
This has to be fixed.

@Ricardo-M-L

Copy link
Copy Markdown
Contributor Author

Hi @KevinHuSh — the CI failure is actually in the codecov upload step, not the test run itself. The actual symptom from the log:

warning - No gcov data found.
warning - coverage.py is not installed or can't be found.
info    - Found 0 coverage files to report
Error: No coverage reports found. Please make sure you're generating reports successfully.
==> Failed to run upload-coverage

The unit-test step passed, including the three new tests this PR adds — TestAzureSpnBucketPrefix::{test_put_uses_bucket_prefix, test_get_uses_bucket_prefix, test_rm_uses_bucket_prefix} all show PASSED in the log (around 08:51:43).

Looks like a CI-infra issue with codecov on PRs from forks (TOKENLESS: Ricardo-M-L:fix/azure-blob-missing-bucket-prefix in the env). Not something this PR introduced or can fix from the patch side — happy to re-trigger CI if you can give me write access, or just merge if the actual test result is what matters.

@Ricardo-M-L

Copy link
Copy Markdown
Contributor Author

Hi! Just a friendly ping on this PR. It's been open for a while — would appreciate a review when you get a chance. Thanks for your time!

@Ricardo-M-L

Copy link
Copy Markdown
Contributor Author

Hi @KevinHuSh — you mentioned this has to be fixed. The branch is rebased onto current main and CI is green (the earlier failure was only the codecov upload step, not the tests). Ready whenever you are — happy to make any changes if needed.

@Ricardo-M-L

Copy link
Copy Markdown
Contributor Author

Hi @KevinHuSh, I fixed the two failing CI tests. The issue was that the test assertions were checking conn.get_presigned_url but the implementation actually calls conn.get_file_client (SPN) and conn.get_blob_client (SAS). I corrected the mock assertions to match the actual implementation. All 12 tests now pass locally. CI should be green once it re-runs.

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@Ricardo-M-L

Copy link
Copy Markdown
Contributor Author

Thanks KevinHuSh and JinHai-CN. The CI test assertion mismatch has been fixed in commit 4537a9e - updated the get_presigned_url mock assertions to match the implementation. The branch now includes the merge with latest main as well. Please re-run CI to verify.

### Summary

Fix the malformed Markdown destination in `README_ko.md` so the Korean
setup instructions link to Docker's official Engine installation guide.

Validation:

- `git diff --check`
- Confirmed the malformed link is absent and the corrected link occurs
once.
- Verified `https://docs.docker.com/engine/install/` returns HTTP 200.
@JinHai-CN

Copy link
Copy Markdown
Member
╭──────────────────────────────────────────╮
│ 🥊 lefthook  v2.1.10   hook:  pre-commit │
╰──────────────────────────────────────────╯
│  gofmt (skip) no files for inspection
│  web-checks ❯ web-deps (skip) no matching staged files
│  web-checks ❯ web-oxfmt (skip) no files for inspection
│  web-checks ❯ web-oxlint (skip) no files for inspection
┃  ruff-format ❯ 
Would reformat: test/unit_test/rag/utils/test_azure_blob_bucket_prefix.py
1 file would be reformatted, 2 files already formatted

exit status 1

…flow#18341)

### Summary

Follow-up bug fix to infiniflow#16233 (the Keenable search tool, merged
2026-06-25).
6ba3i and others added 21 commits August 24, 2026 19:35
…iflow#18656)

### Summary

Fix is the scalar `0.5`, matching the server default.
…imit (infiniflow#17512)

### What problem does this PR solve?

Fixes infiniflow#17074. When a keyword-extraction LLM returns a malformed,
extremely long response, the resulting `important_kwd` term can exceed
Elasticsearch's keyword term-byte limit (32766 bytes). The chunk insert
then fails with `document_parsing_exception`.

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)

Signed-off-by: Rahil <[email protected]>
Co-authored-by: Jin Hai <[email protected]>
…provider (infiniflow#18663)

### Summary

Fixes infiniflow#18653. Groq rejects every chat request on v0.27.0 with `property
'conversationId' is unsupported`, while the same chat works on Ollama.

Closes infiniflow#18653

Co-authored-by: Jin Hai <[email protected]>
Follow up on infiniflow#18316 by preserving cancellation as a terminal state in the Go Agent OpenAI-compatible response path. Previously, a cancelled run closed the event channel without an event, so the adapter could return an empty successful completion or finish a stream with stop.
…rrors (infiniflow#17132)

Two fixes not yet on main:

Pass picker-selected models into Verify – useVerifyProvider now includes modelInfoRef in the verify payload so the backend can verify the user's actual selection.

Guard model construction – Wrap EmbeddingModel/ChatModel init in try/except so failures are recorded as per-model FAIL instead of aborting the whole verify call.

Also: later failures now overwrite previous successes per review feedback.
### Summary

Closes infiniflow#17848.

This replaces infiniflow#17958 with a smaller implementation focused on the
original requirement. The previous PR gradually expanded beyond the
necessary scope; the optional custom endpoint extension is intentionally
excluded from this version.

- Add request-scoped Bedrock API key authentication to the Python
Bedrock adapters and Go chat runtime.
- Discover and persist models available to API key instances, so users
do not need to manually enter the model type, model name, or maximum
token count.
- Add API Key mode to the existing Bedrock settings UI and refresh the
model and default-model lists after instance changes.
- Preserve selected models during credential-only updates while keeping
the existing SigV4 authentication modes unchanged.
- Return a clear error for unsupported API-key reranking.
- Document instance-scoped authentication and short-term API key
guidance.
)

### Summary

Closes infiniflow#18683.

The Wiki artifact view previously enabled **Generate** whenever a
dataset had parsed chunks. Built-in datasets can have chunks without an
ingestion pipeline, so the backend finds no wiki-eligible documents and
exits without generating pages.

This PR adds a focused frontend eligibility check so Wiki generation is
offered only when the dataset has parsed chunks and is associated with
an ingestion pipeline.
@JinHai-CN

Copy link
Copy Markdown
Member
=================================== FAILURES ===================================
__ test_tc_ret_002_multi_table_search_applies_global_pagination_and_ordering ___
test/unit_test/rag/utils/test_gaussdb_conn.py:1783: in test_tc_ret_002_multi_table_search_applies_global_pagination_and_ordering
    result = conn.search(["id"], [], {}, [match], OrderByExpr(), 1, 1, ["ragflow_tenant_a", "ragflow_tenant_b"], ["kb1"])
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
rag/utils/gaussdb_conn.py:326: in search
    parsed = self._parse_match_expressions(match_expressions, rank_feature)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
rag/utils/gaussdb_conn.py:908: in _parse_match_expressions
    keywords = _tokenize_query_terms(query_text)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
rag/utils/gaussdb_conn.py:47: in _tokenize_query_terms
    return [term for term in rag_tokenizer.tokenize(str(query_text or "")).split() if term]
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
rag/nlp/rag_tokenizer.py:24: in tokenize
    if settings.DOC_ENGINE_INFINITY:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E   AttributeError: module 'common.settings' has no attribute 'DOC_ENGINE_INFINITY'
______ test_tc_ret_002_multi_table_search_breaks_score_ties_by_kb_then_id ______
test/unit_test/rag/utils/test_gaussdb_conn.py:1803: in test_tc_ret_002_multi_table_search_breaks_score_ties_by_kb_then_id
    result = conn.search(
rag/utils/gaussdb_conn.py:326: in search
    parsed = self._parse_match_expressions(match_expressions, rank_feature)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
rag/utils/gaussdb_conn.py:908: in _parse_match_expressions
    keywords = _tokenize_query_terms(query_text)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
rag/utils/gaussdb_conn.py:47: in _tokenize_query_terms
    return [term for term in rag_tokenizer.tokenize(str(query_text or "")).split() if term]
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
rag/nlp/rag_tokenizer.py:24: in tokenize
    if settings.DOC_ENGINE_INFINITY:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E   AttributeError: module 'common.settings' has no attribute 'DOC_ENGINE_INFINITY'
_ test_tc_cfg_205_load_gaussdb_config_rejects_explicit_and_default_empty_config _
test/unit_test/rag/utils/test_gaussdb_conn_pool.py:270: in test_tc_cfg_205_load_gaussdb_config_rejects_explicit_and_default_empty_config
    load_gaussdb_config(None)
common/doc_store/gaussdb_conn_pool.py:91: in load_gaussdb_config
    raw = getattr(settings, "GAUSSDB", None) or settings.get_base_config("gaussdb", {})
                                                ^^^^^^^^^^^^^^^^^^^^^^^^
E   AttributeError: module 'common.settings' has no attribute 'get_base_config'
____ test_tc_cfg_005_load_gaussdb_config_without_raw_prefers_gaussdb_block _____
test/unit_test/rag/utils/test_gaussdb_conn_pool.py:291: in test_tc_cfg_005_load_gaussdb_config_without_raw_prefers_gaussdb_block
    cfg = load_gaussdb_config()
          ^^^^^^^^^^^^^^^^^^^^^
common/doc_store/gaussdb_conn_pool.py:91: in load_gaussdb_config
    raw = getattr(settings, "GAUSSDB", None) or settings.get_base_config("gaussdb", {})
                                                ^^^^^^^^^^^^^^^^^^^^^^^^
E   AttributeError: module 'common.settings' has no attribute 'get_base_config'
__ test_tc_cfg_006_load_gaussdb_config_without_raw_falls_back_to_base_config ___
test/unit_test/rag/utils/test_gaussdb_conn_pool.py:317: in test_tc_cfg_006_load_gaussdb_config_without_raw_falls_back_to_base_config
    cfg = load_gaussdb_config()
          ^^^^^^^^^^^^^^^^^^^^^
common/doc_store/gaussdb_conn_pool.py:91: in load_gaussdb_config
    raw = getattr(settings, "GAUSSDB", None) or settings.get_base_config("gaussdb", {})
                                                ^^^^^^^^^^^^^^^^^^^^^^^^
E   AttributeError: module 'common.settings' has no attribute 'get_base_config'
___________ test_youcom_retrieve_chunks_returns_ragflow_chunk_shape ____________
test/unit_test/rag/utils/test_youcom_conn.py:199: in test_youcom_retrieve_chunks_returns_ragflow_chunk_shape
    retrieved = youcom_conn.YouCom("").retrieve_chunks("What is RAGFlow?")
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
rag/utils/youcom_conn.py:112: in retrieve_chunks
    "content_ltks": rag_tokenizer.tokenize(result["content"]),
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
rag/nlp/rag_tokenizer.py:24: in tokenize
    if settings.DOC_ENGINE_INFINITY:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E   AttributeError: module 'common.settings' has no attribute 'DOC_ENGINE_INFINITY'
=========================== short test summary info ============================
FAILED test/unit_test/rag/utils/test_gaussdb_conn.py::test_tc_ret_002_multi_table_search_applies_global_pagination_and_ordering - AttributeError: module 'common.settings' has no attribute 'DOC_ENGINE_INFINITY'
FAILED test/unit_test/rag/utils/test_gaussdb_conn.py::test_tc_ret_002_multi_table_search_breaks_score_ties_by_kb_then_id - AttributeError: module 'common.settings' has no attribute 'DOC_ENGINE_INFINITY'
FAILED test/unit_test/rag/utils/test_gaussdb_conn_pool.py::test_tc_cfg_205_load_gaussdb_config_rejects_explicit_and_default_empty_config - AttributeError: module 'common.settings' has no attribute 'get_base_config'
FAILED test/unit_test/rag/utils/test_gaussdb_conn_pool.py::test_tc_cfg_005_load_gaussdb_config_without_raw_prefers_gaussdb_block - AttributeError: module 'common.settings' has no attribute 'get_base_config'
FAILED test/unit_test/rag/utils/test_gaussdb_conn_pool.py::test_tc_cfg_006_load_gaussdb_config_without_raw_falls_back_to_base_config - AttributeError: module 'common.settings' has no attribute 'get_base_config'
FAILED test/unit_test/rag/utils/test_youcom_conn.py::test_youcom_retrieve_chunks_returns_ragflow_chunk_shape - AttributeError: module 'common.settings' has no attribute 'DOC_ENGINE_INFINITY'
== 6 failed, 3599 passed, 26 skipped, 11 subtests passed in 151.81s (0:02:31) ==
[INFO] Running RAGFlow Unit Tests
[INFO] ========================================
[INFO] Test Directory: /home/infiniflow/runners_work/inf29-b7d4861e1e89/ragflow/ragflow/test/unit_test
[INFO] Coverage: False
[INFO] Parallel: False
[INFO] Verbose: False

@coderabbitai

coderabbitai Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@JinHai-CN

Copy link
Copy Markdown
Member

please re-open the PR, if you are still working on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐞 bug Something isn't working, pull request that fix bug. ci Continue Integration size:M This PR changes 30-99 lines, ignoring generated files. 🧪 test Pull requests that update test cases.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Azure Blob SPN storage: files from different datasets can overwrite each other due to missing bucket prefix