fix(policy): inherit parent unmanaged_files when child omits block#1248
Open
abhinavgautam01 wants to merge 3 commits into
Open
Conversation
Omitted or empty unmanaged_files on an extending policy is transparent (None/None), so org action: deny and directories are not replaced by defaults that looked like explicit ignore.
Author
|
ping @danielmeppiel |
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.
Fixes #1198
Description
Child policies that use
extends:but leave outunmanaged_files:were parsed as if they had the schema defaults (action/ directories), so merge treated them as an explicit ignore posture and orgunmanaged_files.action: denyno longer applied in repo-scopedapm audit --policy.UnmanagedFilesPolicynow usesNonefor “no opinion” (omitted or emptyunmanaged_files), the YAML parser only sets fields when keys are present, and_merge_unmanaged_filesreturns the parent unchanged when the child is fully transparent—matching how allow-lists useNoneduring inheritance. Downstream checks and diagnostics treatNonelike permissive/default where appropriate. Regression test covers the org + child repo override scenario from the issue.Type of change
Testing
uv run pytest tests/unit/policy/ tests/integration/test_policy_discovery_e2e.py(533 passed, 15 skipped).