Skip to content

fix: preserve comment-only KDL blocks - #47

Merged
srinivasr merged 1 commit into
srinivasr:mainfrom
tomatotomata:codex/preserve-comment-only-blocks-43
Aug 1, 2026
Merged

fix: preserve comment-only KDL blocks#47
srinivasr merged 1 commit into
srinivasr:mainfrom
tomatotomata:codex/preserve-comment-only-blocks-43

Conversation

@tomatotomata

Copy link
Copy Markdown
Contributor

Summary

  • preserve whether a parsed node had a block, even when the block contains only comments
  • use that block marker when serializing so comment-only blocks keep their braces
  • add a round-trip regression test for a comment-only block followed by another node

Closes #43.

Validation

  • python -m unittest discover -s tests -p 'test_kdl_parser.py' -v: 28 passed; 5 existing Windows mode-bit failures in config-write tests (0o600/0o640/0o6750 assertions)
  • focused comment-only block reproduction passes
  • python -m ruff format --check nirimod/kdl_parser.py tests/test_kdl_parser.py passes
  • git diff --check passes
  • targeted Ruff reports only three pre-existing E501 findings in unchanged lines

The change is limited to the parser state and its regression coverage. Let me know what you think.

@srinivasr

Copy link
Copy Markdown
Owner

@tomatotomata
fix looks good. pulled it locally and tests pass, merging

@srinivasr
srinivasr merged commit 1414c52 into srinivasr:main Aug 1, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

kdl_parser writer drops comments (and the enclosing braces) from comment-only child blocks

2 participants