Skip to content

fix: remove redundant file_path_placeholder lookup in _merge_edges_then_upsert#2877

Merged
danielaskdd merged 1 commit intoHKUDS:mainfrom
jwchmodx:fix/2635-duplicate-file-path-placeholder
Apr 3, 2026
Merged

fix: remove redundant file_path_placeholder lookup in _merge_edges_then_upsert#2877
danielaskdd merged 1 commit intoHKUDS:mainfrom
jwchmodx:fix/2635-duplicate-file-path-placeholder

Conversation

@jwchmodx
Copy link
Copy Markdown
Contributor

@jwchmodx jwchmodx commented Apr 3, 2026

Summary

Fixes #2635

In _merge_edges_then_upsert (lightrag/operate.py), file_path_placeholder was retrieved from global_config twice:

  1. First at the top of the block (line ~2164), before iterating over already_file_paths
  2. Second inside the if len(file_paths_list) > max_file_paths: branch (line ~2191), where the variable is already in scope from the first lookup

The second lookup is dead code — it shadows the already-defined variable with an identical value. This PR removes it.

Changes

  • lightrag/operate.py: Removed duplicate global_config.get("file_path_more_placeholder", ...) call inside _merge_edges_then_upsert

Test plan

  • Ran full unit test suite (pytest tests/ excluding infra-dependent tests): 217 passed, 0 failed
  • No behaviour change — purely a dead code removal

🤖 Generated with Claude Code

…en_upsert

`file_path_placeholder` was fetched from `global_config` twice in the same
function — once before building the file paths list (line ~2164) and again
inside the `> max_file_paths` branch (line ~2191). The second lookup is dead
code because the variable was already in scope.

Fixes HKUDS#2635

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@danielaskdd
Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielaskdd danielaskdd merged commit 2dd2ab6 into HKUDS:main Apr 3, 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.

[Bug]: 一行无用函数

2 participants