Skip to content

fix: japanese file names (backport of #2053)#2098

Merged
edwinjosechittilappilly merged 2 commits into
mainfrom
backport/2053-japanese-file-names
Jul 15, 2026
Merged

fix: japanese file names (backport of #2053)#2098
edwinjosechittilappilly merged 2 commits into
mainfrom
backport/2053-japanese-file-names

Conversation

@edwinjosechittilappilly

@edwinjosechittilappilly edwinjosechittilappilly commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

Backports #2053 from release-saas-ga-0.6.2 to main.

Fixes handling of non-ASCII (e.g. Japanese) filenames for bucket connectors by threading a connector_file_id through document indexing/ingest-token context, independent of the display filename.

Note on conflict resolution: cherry-pick conflicted in src/services/langflow_file_service.py and src/services/langflow_ingest_token_service.py against an unrelated parser/chunk_size/chunk_overlap feature already on main. Both are additive fields on DocumentIndexContext; resolved by keeping both sets of fields together.

Test plan

  • pytest tests/unit/test_document_index_writer_connector_file_id.py tests/unit/test_resolve_document_id_connector_file_id.py tests/unit/connectors/test_bucket_connector_unicode_file_ids.py tests/unit/test_langflow_ingest_callback.py tests/unit/test_connector_processor_filename_dedupe.py tests/unit/connectors/test_update_connector_metadata_filename.py — 47 passed
  • CI passes

Summary by CodeRabbit

  • Bug Fixes

    • Improved connector-file ingestion, chunk cleanup, and metadata updates by consistently using a connector-specific identifier (including connector_file_id.keyword for older mappings).
    • Enhanced handling of renamed files so updates reliably apply to all matching chunks.
    • Ensured bucket-style connector IDs and non-ASCII object keys round-trip correctly.
    • Extended ingestion tokens to carry and restore the connector identifier; stable ASCII document IDs are generated when needed.
  • Tests

    • Added/updated regression coverage for connector identifier propagation, Unicode bucket/blob keys, metadata update matching, and token round-tripping.

* fix japanese file names

Root cause: COS/Azure/S3 connectors build document.id as the raw, non-ASCII object key ("bucket::報告書.pdf"), and that value was reused verbatim as document_id in the default Langflow ingestion path — the only ingestion path that puts non-ASCII text into ASCII-only HTTP headers and an unbounded-length OpenSearch identifier. Google Drive (opaque ASCII ID) and manual upload (content hash) were structurally immune; COS/Azure/S3 were the only paths exposed.

Fix applied (matches the already-proven split used by the non-Langflow ingestion path):
- document_index_writer.py — DocumentIndexContext gained a connector_file_id field, now written onto every indexed chunk when present.
- langflow_file_service.py — _resolve_document_id now hashes any supplied connector_file_id into a stable ASCII document_id, instead of using it verbatim; connector_file_id threads through run_ingestion_flow → _configure_ingest_callback → the JWT context.
- processors.py — the Langflow-path connector branch now passes connector_file_id=document.id (not document_id=document.id), and the post-ingest existence check / metadata sync now match on connector_file_id.
- connectors/service.py — stale comments corrected (dedupe/ACL-sync already matched both fields, no logic change needed there).
- Added 13 new unit tests (test_resolve_document_id_connector_file_id.py, test_document_index_writer_connector_file_id.py, test_bucket_connector_unicode_file_ids.py) — confirmed they fail on the old code and pass on the fix.
- Ran the full unit suite: same 14 pre-existing failures before and after (unrelated to this change — auth/settings/encryption tests), no new regressions.

* style: ruff autofix (auto)

* fix connector File name issue

* ingest fix

* Update processors.py

* review fix

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
@github-actions github-actions Bot added backend 🔷 Issues related to backend services (OpenSearch, Langflow, APIs) tests bug 🔴 Something isn't working. labels Jul 14, 2026
@coderabbitai

coderabbitai Bot commented Jul 14, 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: bf69d998-87d3-4a80-94bc-8059dc41d9bd

📥 Commits

Reviewing files that changed from the base of the PR and between 6d2db71 and 01d6ab5.

📒 Files selected for processing (2)
  • src/connectors/service.py
  • src/models/processors.py
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/models/processors.py
  • src/connectors/service.py

Walkthrough

Connector ingestion now preserves raw connector_file_id values separately from hashed document_id values, propagates them through Langflow context and tokens, and expands OpenSearch matching for ingestion, verification, deletion, and metadata updates.

Changes

Connector identity propagation

Layer / File(s) Summary
Stable connector identity plumbing
src/services/langflow_file_service.py, src/services/document_index_writer.py, src/services/langflow_ingest_token_service.py, tests/unit/...
Langflow hashes connector identifiers into ASCII-safe document IDs while carrying raw connector IDs through ingestion context, JWT tokens, and indexed documents. Tests cover hashing, fallback behavior, token round trips, document propagation, and Unicode bucket keys.
OpenSearch matching and connector processing
src/connectors/service.py, src/models/processors.py, src/utils/acl_utils.py, tests/unit/...
Connector ingestion and metadata operations match document_id, connector_file_id, and connector_file_id.keyword; existence checks accept a selectable field, and cleanup paths use the expanded selectors.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ConnectorService
  participant LangflowFileService
  participant DocumentIndexWriter
  participant OpenSearch
  ConnectorService->>LangflowFileService: Upload with connector_file_id
  LangflowFileService->>DocumentIndexWriter: Pass raw connector ID and hashed document ID
  DocumentIndexWriter->>OpenSearch: Index chunk identifiers
  ConnectorService->>OpenSearch: Update metadata using identifier match clauses
  ConnectorService->>OpenSearch: Verify and delete connector chunks
Loading

Possibly related PRs

Suggested reviewers: mpawlow, ricofurtado

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 23.81% 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
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly reflects the main fix for Japanese/non-ASCII file names and notes it is a backport.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch backport/2053-japanese-file-names

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 github-actions Bot added bug 🔴 Something isn't working. and removed bug 🔴 Something isn't working. labels Jul 14, 2026
@github-actions github-actions Bot added bug 🔴 Something isn't working. and removed bug 🔴 Something isn't working. labels Jul 15, 2026
@github-actions github-actions Bot added the lgtm label Jul 15, 2026
@edwinjosechittilappilly
edwinjosechittilappilly merged commit dd187c4 into main Jul 15, 2026
33 checks passed
@github-actions
github-actions Bot deleted the backport/2053-japanese-file-names branch July 15, 2026 19:02
@mpawlow
mpawlow removed their request for review July 15, 2026 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend 🔷 Issues related to backend services (OpenSearch, Langflow, APIs) bug 🔴 Something isn't working. lgtm tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants