Repository navigation
test: cover OPA adapter validation and decision boundaries - #73
Merged
imran-siddique merged 2 commits intoOct 1, 2026
Merged
Conversation
rajnisht7
reviewed
Oct 1, 2026
Member
There was a problem hiding this comment.
Reviewed head 7ccbac8, it meets the #71 done criteria opa.py error paths and deny/not_applicable mapping are covered, each new validation asserts its exact message, and production source is unchanged. Helper is clean.
a few non-blocking coverage gaps that can be addressed:
- ids element-level invalid values (e.g. [123], [""]) - the current tests only hit the non-list side of the check
- successful mapper results for "challenge" and "error" (allow/deny/not_applicable are covered; unsupported "permit" is covered)
- missing result key vs explicit result: null (both map to not_applicable via .get; only explicit null is tested)
- unhashable mapper return (e.g. {}) raises TypeError instead of the adapter ValueError
imran-siddique
approved these changes
Oct 1, 2026
imran-siddique
approved these changes
Oct 1, 2026
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
Closes #71.
Add test-only coverage for missing/invalid decision IDs, unsupported mapper results, malformed labels, missing versions, invalid durations, the 32-ID limit, deny/not_applicable mapping, and timestamp validation. Positive boundary cases cover zero duration, exactly 32 IDs, and whole-second UTC timestamps. Each newly covered validation error asserts its message.
Contract impact
Evidence
Validated on Python 3.12 with the repository's hash-pinned test dependencies:
OTEL_TRACES_SAMPLER=always_on pytest --cov=agentrust_telemetry: 138 passed, 2 skipped; OPA adapter 100% line coverage.OTEL_TRACES_SAMPLER=always_on python -m unittest discover -s tests -q: 140 tests run, OK (2 skipped).git diff --checkpassed.The sampler override prevents this execution environment's 1% sampling configuration from dropping spans expected by unrelated tests.
python tools/sync_schemas.pypython tools/check_schemas.py(covered by repository gate tests)python conformance/runner/validate.py(covered by repository gate tests)python -m unittest discover -s tests -v(run with-qand sampler override above)python -m buildPrivacy and security
Limits
Only
tests/test_adapters.pychanges; production source is unchanged. Coverage verifies the existing OPA adapter behavior, not integration with a running OPA server. The optional Cedar stretch is outside this PR. Package builds and the upstream CI matrix have not been run locally.