fix(llm): keep .yaml/.yml out of the splittable-document set (#5078 follow-up)

The doc-bisect fix added .yaml/.yml to _SPLITTABLE_TEXT_SUFFIXES, but those are
code, not documents (reclassified document->code in #2214), and never reach the
semantic pass, so slicing them at prose boundaries is meaningless. Drop the two
suffixes and their test parametrization; the core truncation-bisect fix stands.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
safishamsiandClaude Opus 4.8 committed 2026-11-09 16:45:05 +00:00
1 parent 76a80a838c
commit caa6a0783b
2 files changed
+7 -9

No files matched your search

+5 -4
View File
@@ -32,16 +32,17 @@ from graphify.extractors.base import _read_source_text
# This set has to keep pace with ``detect.DOC_EXTENSIONS``: anything classified
# as a document reaches the semantic pass, and anything the pass sees that is
# NOT listed here is silently cut at ``_FILE_CHAR_CAP`` by ``_read_files``. The
# two lists drifted as DOC_EXTENSIONS grew — .qmd, .skill, .html, .yaml and .yml
# were documents that never got sliced, so a 38k-character one reached the model
# as its first 20k with no warning and no partial marker (#2900).
# two lists drifted as DOC_EXTENSIONS grew — .qmd, .skill and .html were
# documents that never got sliced, so a 38k-character one reached the model as
# its first 20k with no warning and no partial marker (#2900). .yaml/.yml are
# intentionally NOT here: they are code, not documents (reclassified in #2214),
# and never reach the semantic pass.
# ``tests/test_oversized_document_slicing.py`` pins the relationship so a future
# addition to DOC_EXTENSIONS fails loudly instead of quietly losing content.
_SPLITTABLE_TEXT_SUFFIXES = frozenset({
".md", ".mdx", ".markdown", ".txt", ".rst",
".qmd", ".skill", ".html",
".j2", ".jinja", ".jinja2",
".yaml", ".yml",
})
# Document types whose BYTES are not what the model is shown. `llm._file_to_text`
@@ -13,17 +13,14 @@ from graphify.file_slice import (
)
@pytest.mark.parametrize("ext", [".yaml", ".yml", ".md", ".txt", ".rst"])
@pytest.mark.parametrize("ext", [".md", ".txt", ".rst"])
def test_splittable_document_under_cap_bisects_on_truncation(tmp_path, ext):
"""When a splittable document below _FILE_CHAR_CAP truncates (finish_reason='length'),
adaptive retry should promote the raw Path unit to a full-range FileSlice and bisect it,
completing without being marked partial (#5072).
"""
path = tmp_path / f"dense{ext}"
if ext in (".yaml", ".yml"):
content = "records:\n" + "".join(f" item{i}: value{i}\n" for i in range(80))
else:
content = "# Title\n\n" + "".join(f"Paragraph {i} with some content.\n\n" for i in range(40))
content = "# Title\n\n" + "".join(f"Paragraph {i} with some content.\n\n" for i in range(40))
path.write_text(content, encoding="utf-8")
text = unit_source_text(path)
assert len(text) < llm._FILE_CHAR_CAP