Repository navigation
Rename the Section fields, require metadata.id and freeze the models - #38
Merged
Merged
Conversation
Section uses header, content and level like OutlineNode, and MarkdownContent is merged into it. SectionMetadata.id is a required int. Section, SectionMetadata and OutlineNode are frozen; model_copy(update=...) returns a changed copy. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015guwcb2VbULqaendfa6d3k
Gal-Gilor
force-pushed
the
refactor/section-fields
branch
from
October 18, 2026 17:24
9bf69d2 to
b5fe741
Compare
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
Section.section_header,section_textandheader_leveltoheader,contentandlevel, matchingOutlineNode, and mergedMarkdownContentintoSection(field order: header, content, level, metadata).to_markdown()andbreadcrumb()use the new names.SectionMetadata.idis a requiredint(description kept).Section,SectionMetadataandOutlineNodehavemodel_config = ConfigDict(frozen=True). The splitter never assigns attributes after construction, so it needed only the renamed keyword arguments. It does rely on appending to a parent node'schildrenlist inget_document_outline, which still works on a frozen model.split_text('# Café')[0].header == 'Café') and the README (field names, examples, Data Models section withoutMarkdownContent, a sentence on frozen models andmodel_copy).MarkdownContent, the requiredmetadata.idand the frozen models. The normalization entry now saysanyascii(section.content).test_header_level_countingandtest_header_levels_up_to_sixtotest_level_countingandtest_levels_up_to_six, because the issue's grep forheader_levelmust print nothing.Testing
uv run ruff check --no-fix .: All checks passeduv run ruff format --check .: 9 files already formatteduv run pytest -q: 99 passed, including the newtest_metadata_requires_id(SectionMetadata(span=(0, 0))raisesValidationError) andtest_models_are_frozen(assigningsection.content,section.metadata.idor an outline node'sheaderraisesValidationError;model_copy(update={"content": "x"})returns a changed copy)doctest.testmodonmarkdown_chunkify.splitter: 13 attempted, 0 failed; onmarkdown_chunkify.models: 0 attempted, 0 faileduv buildand the CI wheel check in a fresh venv: passedgrep -rnE --exclude-dir=__pycache__ "section_header|section_text|header_level|MarkdownContent" markdown_chunkify tests README.md .github: no output