fix(parse): prevent merged filename collision on duplicate headings#1005
Merged
qin-ctx merged 1 commit intovolcengine:mainfrom Mar 26, 2026
Merged
Conversation
_generate_merged_filename() now always appends a content-based hash suffix derived from all section names and indices. This prevents filename collisions when multiple merge groups share the same first heading name and count, which previously caused file overwrites and content loss during markdown resource ingestion. Fixes volcengine#1004.
|
Failed to generate code suggestions for PR |
qin-ctx
approved these changes
Mar 26, 2026
19 tasks
zeattacker
pushed a commit
to zeattacker/OpenViking
that referenced
this pull request
Mar 27, 2026
…olcengine#1005) _generate_merged_filename() now always appends a content-based hash suffix derived from all section names and indices. This prevents filename collisions when multiple merge groups share the same first heading name and count, which previously caused file overwrites and content loss during markdown resource ingestion. Fixes volcengine#1004.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
_generate_merged_filename()now always appends a content-based hash suffix (8-char SHA-256 ofname:indexpairs) to guarantee uniquenessRoot Cause
_generate_merged_filename()generated filenames like{first_heading}_{count}more. The hash suffix only triggered whenlen(name) > MAX_MERGED_FILENAME_LENGTH. Two merge groups sharing the same first heading name and same section count produced identical filenames → file overwrite → content loss.Fix
Always compute and append the hash. Hash input uses
name:section_indexpairs (not just names) because duplicate headings share names — the section index is what differentiates them.Fixes #1004.
Test plan
pytest tests/parse/test_markdown_filename_collision.py)pytest tests/parse/test_markdown_char_limit.py)