Repository navigation
fix(core): compute repo compliance via calculate_compliance in audit_org - #537
Merged
mlieberman85 merged 2 commits intoOct 7, 2026
Conversation
In aggregate_org_results, repository compliance was computed using a local status-count heuristic (fail_count == 0 and warn_count == 0 and pass + na == total), which drifted from the shared calculate_compliance standard used across single-repo audits, harnesses, and attestations. This updates aggregate_org_results to use calculate_compliance from darnit.tools.audit when check results are available, determining compliance at the audited level, and retaining fallback for summary-only data. Fixes darnitdevorg#515 Assisted-by: Antigravity:eni-gemini-2.5-pro Signed-off-by: Paradox <159635503+i-am-paradox@users.noreply.github.com>
mlieberman85
requested changes
Oct 6, 2026
mlieberman85
left a comment
Contributor
There was a problem hiding this comment.
Thanks for taking this on. There's a problem: line 283 only checks compliance[level], but calculate_compliance scores each level on its own. So L1 FAIL with L2 PASS, audited at level 2, now reports COMPLIANT, where main correctly reports non-compliant. Please:
- Require every level from 1 up to the audited level to pass, the same way the attestation's
level_achievedworks, and add a test for this case. - Drop the fallback (lines 289-299) that keeps the old local rule. Real results always include
results, so update the test mocks instead. - Use
PENDINGinstead ofPENDING_LLMin the tests; it was renamed in 041.
Drafted with Claude Code; reviewed and posted by me.
…test mocks Address review feedback on darnitdevorg#537: - Require all levels from 1 up to audited level to pass for repository compliance, matching attestation level_achieved behavior. - Drop legacy summary-only fallback in aggregate_org_results and update test mocks with check results. - Use PENDING instead of PENDING_LLM in test cases. - Add test verifying that level 2 audit requires level 1 to pass. Signed-off-by: Paradox <159635503+i-am-paradox@users.noreply.github.com>
Contributor
Author
|
Updated in 7a73c29:
|
mlieberman85
approved these changes
Oct 7, 2026
mlieberman85
left a comment
Contributor
There was a problem hiding this comment.
Thanks for the quick turnaround, this looks good.
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
In
packages/darnit/src/darnit/tools/audit_org.py, repository compliance was determined by a local status-count rule (fail_count == 0 and warn_count == 0 and (pass_count + na_count == total)). As noted in #515, this rule drifts from the sharedcalculate_compliancefunction used by single-repo audits, harnesses, and attestations.This updates
aggregate_org_resultsto callcalculate_compliance(check_results, level)when check results are present, determining whether each repository is compliant at the audited level, and recording per-level compliance in the repository summary. A fallback remains in place for summary-only data to preserve backwards compatibility with existing test mocks.Type of Change
Framework Changes Checklist
If this PR modifies the darnit framework (
packages/darnit/):docs/architecture/framework-design.md) if behavior changeduv run python scripts/validate_sync.py --verboseand it passesControl/TOML Changes Checklist
If this PR modifies controls or TOML configuration:
Testing
uv run pytest tests/ -v)uv run ruff check .)Added unit tests in
tests/darnit/test_audit_org.py:test_results_with_warn_error_and_pending_is_non_compliant: verifies that WARN, ERROR, and PENDING controls result in non-compliant status.test_results_with_only_pass_and_na_is_compliant: verifies that repositories with only PASS and N/A controls result in compliant status.test_multi_level_compliance_calculation: verifies level-specific compliance evaluation.All 23 tests in
tests/darnit/test_audit_org.pypass cleanly.uv run python scripts/validate_sync.py --verbosepasses.AI assistance
Assisted by Antigravity (Gemini 2.5 Pro) for test authoring and compliance logic alignment. All changes reviewed, verified, and tested against local pytest suite and sync validator.
Additional Notes
Fixes #515