Skip to content

azure_policy_compliance: unread remediation tasks stay unread, and counts from failed reads are null - #335

Open
Controgon wants to merge 12 commits into
mainfrom
fde-1185
Open

Controgon wants to merge 12 commits into
mainfrom
fde-1185

Conversation

@Controgon

@Controgon Controgon commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #318; GitHub retargets it to main when that merges.

Fixes FDE-1185
Part of FDE-1190

azure_policy_compliance 0.6.0.

  • A remediation task whose deployments couldn't be listed stays unread. A later task's read no longer replaces the record, so deployments_complete can't read true on an incomplete run.
  • A remediation task at a scope the fetcher doesn't recognise now fails the run.
  • When the compliance summary or the remediation task list can't be read, the counts built from them read null, not 0 (provider not registered still reads 0).
  • Instructions and CHANGELOG updated; 7 new unit tests.

Merge with fde-1160: the only conflict was the first "Unreleased > Fixed" CHANGELOG entry; both entries kept.

Changed after review

  • resources_by_compliance_state and policies_by_compliance_state are now null, not {}, when the compliance summary could not be read. This also holds under resource_exclusions. A summary that was read and held nothing in scope still gives {}.
  • non_compliant_states_truncated is null when the non-compliant states query failed (states_read false), not false.
  • remediation_deployments_truncated is null when the task list or any task's deployment list was not read (complete false), not false.
  • Field text for all four now says "null when the summary / list could not be read". CHANGELOG entry for 0.6.0 updated; no further version bump.
  • Tests: the unread cases assert null for all four fields; the read cases keep {} and false. Two existing assertions in the exclusions tests that expected false after a failed read now expect null.

🤖 Generated with Claude Code

Controgon and others added 4 commits November 10, 2026 10:45
…fails on unknown scopes, and nulls counts from failed reads

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…states query fails

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…on an unread summary, and deployment counts on an incomplete list

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Controgon and others added 2 commits November 16, 2026 08:44
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@bruceweygandt bruceweygandt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main change is correct. A failed summary, task list or non-compliant states
read now gives null counts, not 0. An unread task's deployments keep
deployments_complete false. A task at an unknown scope now fails the run.
With the provider not registered the counts still read 0. The tests cover
each read on its own. It merges cleanly with main, the full suite passes, and
CI passes. Two small items remain.

1. fetchers/azure/policy_compliance/fetcher.py:673-674 (should fix)

Problem: When the compliance summary was not read, resources_by_compliance_state
and policies_by_compliance_state are {}. The text says "every value is null
when resources_evaluated is null". An empty map has no values, so the text and
the output do not agree.

Why this is a problem: An empty map can read as "no resource is in any state".
The other counts from the same read are now null.

Fix: Make both maps null when summary_read is false, and say so in the text.
Or change the text to "empty when the summary could not be read".

2. fetchers/azure/policy_compliance/fetcher.py:684 and :881-884 (should fix)

Problem: non_compliant_states_truncated stays false when the non-compliant
states query fails. remediation_deployments_truncated stays false when
complete is false; the loop at line 883 skips it on purpose. The text says
false means "every one is listed".

Why this is a problem: After a failed read, false says the list is complete.
The list counts beside it are null.

Fix: Make each flag null when its list was not read (states_read false, or
complete false). Add "null when the list could not be read" to both fields.

Controgon and others added 6 commits November 17, 2026 12:56
…n their read failed

The two compliance-state maps read {} when the summary was not read, and the
two _truncated flags read false when their list was not read. All four now
read null, and the field text says so.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ed list read

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…when a list was not read

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

2 participants