From 48137f7f3ffdc68269ded37d1e487ddb7437ec19 Mon Sep 17 00:00:00 2001 From: huangsen Date: Wed, 13 May 2026 16:30:53 +0800 Subject: [PATCH] refactor(file_parser): simplify chunk ID generation in LinkedFileParser Remove path and line numbers from chunk ID calculation to improve cache stability. The chunk identity now uses only the content hash instead of including path::start::end coordinates. This change removes the documentation about chunk identity format and updates the hash_text call to use only the text content. --- reme2/component/file_parser/linked_file_parser.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/reme2/component/file_parser/linked_file_parser.py b/reme2/component/file_parser/linked_file_parser.py index 950ce420..a07e0e3f 100644 --- a/reme2/component/file_parser/linked_file_parser.py +++ b/reme2/component/file_parser/linked_file_parser.py @@ -9,11 +9,6 @@ heading level) → recursive chunk (try whole subtree; on overflow walk children — body siblings pack as a run, subsections recurse). Leaf blocks (table / code / list / paragraph) split on internal boundaries and each piece is annotated ``[Part X/N]``. - -``chunk_chars`` constrains content only; the TOC skeleton is additive. -Set ``embed_toc=False`` to drop the wrap. Chunk identity is -``hash_text(path::start::end::text)`` for cache stability across -re-parses of unchanged sections. """ from dataclasses import dataclass, field @@ -437,7 +432,7 @@ class LinkedFileParser(BaseFileParser): when ``embed_toc``, otherwise just ``content``.""" text = _toc_join(before, content, after) if self.embed_toc else content return FileChunk( - id=hash_text(f"{path}::{start_line}::{end_line}::{text}"), + id=hash_text(text), path=path, start_line=start_line, end_line=end_line,