okf: don't end a section at a fenced '#' comment line (bundle_tools)#193
Open
manumishra12 wants to merge 1 commit into
Open
okf: don't end a section at a fenced '#' comment line (bundle_tools)#193manumishra12 wants to merge 1 commit into
manumishra12 wants to merge 1 commit into
Conversation
_section_content_lines treated any line starting with '# ' as a heading, including '#' comment lines inside fenced code blocks. A code fence in a '# Schema' or '# Citations' section therefore ended the section early, so _schema_field_names and _citation_entry_count under-read it and the web-pass augmentation guard in write_concept_doc could compare truncated field or citation sets. Track fenced code blocks (backtick and tilde fences) and only treat '# ' lines outside a fence as headings. Adds regression tests.
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.
Bug
_section_content_lines(inokf/src/reference_agent/tools/bundle_tools.py) treats any line whose stripped form starts with#as a section heading — including#comment lines inside fenced code blocks (shell, Python, YAML, partition expressions, and so on). A code fence inside a# Schemaor# Citationssection therefore ends the section early.Downstream,
_schema_field_namesand_citation_entry_countthen under-read the section, and the web-pass augmentation guard inwrite_concept_doccan compare truncated field or citation sets — for example wrongly concluding that a rewrite drops fields, or missing a real shrinkage.Repro
For a
# Schemasection that lists`id`followed by a fenced code block whose first line is a#comment, then`name`,_schema_field_names(body)returns{"id"}—nameis lost because the fenced#line is mistaken for a heading and ends the section. Expected{"id", "name"}.Fix
Track fenced code blocks (backtick and tilde fences) and only treat
#lines outside a fence as headings. Ordinary content and real headings behave exactly as before.Tests
Adds
test_section_survives_fenced_hash_commentandtest_schema_fields_survive_fenced_hash_comment, each failing before the change and passing after. Fulltest_bundle_tools.pyandtest_viewer.pyremain green (22 passed).