Repository navigation
Conversation
Consume explicit deletion directives during per-file merging while preserving nulls and configured strategies. Cover includes, interpolation, empty results, and precomputed/parallel hierarchy processing. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Suppress only Bandit's unrecognized factory-loader false positive, following the existing safe include-loader convention. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Description
Closes #158.
Add an explicit
!deleteYAML tag for removing inherited dictionary keys during hierarchical merging:The resulting dictionary omits
module2;nullretains its existing behavior. Deletion works at any dictionary depth, including removing entire subtrees. Missing keys are no-ops, and later files may recreate deleted keys without restoring their previous contents.Directives are consumed per file before interpolation, through the Python API and both CLIs, including precomputed and parallel processing. Reject payloads and unsupported placements, including anywhere inside lists or sets.
Also correct two directly coupled precomputed-processing cases: allow valid empty results after deleting the final key, and use the actual include-capable loader while computing parents so
!deletein included files works.Type of Change
Testing
Validation on macOS, Python 3.13, from the isolated feature worktree using the existing shared virtualenv. Pytest used:
../../.venv/bin/python -m pytest tests/ -q --cov=himl --cov-report=term-missing --cov-fail-under=80 --basetemp="$TMPDIR/final-pytest" -o addopts= -p no:cacheproviderPATH="../../.venv/bin:$PATH" make lintuvx bandit -r himl/ --severity-level medium../../.venv/bin/python -m build --outdir dist../../.venv/bin/python -m twine check dist/*git diff --checkAdded 35 regression cases covering parsing/cache copies, includes, nested/root/missing keys, nulls and literals, invalid locations, recreation, custom strategies, interpolation, YAML/JSON serialization, empty output, sibling isolation, and all four sequential/parallel and full/precomputed combinations. Multiprocessing tests use real workers, not a mocked pool.
Manual smoke checks imported the final built wheel, asserted that its package was used rather than the checkout, and invoked
himl.main:runandhiml.config_merger:runagainst temporary hierarchy files. Both produced the expected deletion output; merger precomputed mode also passed.A separate read-only correctness review found no high-confidence bugs.
Checklist
Additional Notes
No new runtime dependencies or CLI options; no downstream changes are required.
!deleteuses standard YAML tag syntax but has Himl-specific semantics. Raw-input consumers need a constructor for this tag; generated YAML/JSON contains no deletion markers. It is not a permanent ban or a list-item deletion mechanism.Loader constructors remain scoped to subclasses. The existing include loader receives the constructor directly to retain static-type compatibility; parent precomputation now selects the same include-capable loader as worker processing. Broader existing global-loader behavior is intentionally not redesigned.
The Python-version/OS CI matrix and Docker build were not run locally.