Skip to content

feat(contracts): declare expected security platform types on expectations (#313)#314

Merged
SamuelHassine merged 4 commits into
mainfrom
feat/expectation-expected-security-platforms
Jul 20, 2026
Merged

feat(contracts): declare expected security platform types on expectations (#313)#314
SamuelHassine merged 4 commits into
mainfrom
feat/expectation-expected-security-platforms

Conversation

@SamuelHassine

@SamuelHassine SamuelHassine commented Jul 20, 2026

Copy link
Copy Markdown
Member

Goal

Closes #313.

Add an optional expectation_expected_security_platform_types field and a SecurityPlatformType enum (EDR, XDR, SIEM, SOAR, NDR, ISPM, LLM_FIREWALL, AI_GATEWAY) to the contract Expectation dataclass.

Why

On OpenAEV, technical expectations (DETECTION / PREVENTION / VULNERABILITY) are pre-seeded with a pending result for every connected security platform, so the target-results view lists all of them. Letting a contract declare which security platform TYPES are expected to fulfil an expectation lets the platform focus the technical results on the relevant platforms only.

Behaviour

  • The field is optional and defaults to an empty list.
  • Empty list means any security platform (unchanged behaviour); typically empty for MANUAL expectations.
  • It serializes on both availableExpectations and the derived predefinedExpectations.

Changes

  • pyoaev/contracts/contract_config.py: SecurityPlatformType enum + expectation_expected_security_platform_types field on Expectation.
  • Tests for default-empty and serialization on both arrays.

No manual version bump: the version is bumped automatically by the release process.

Test plan

  • pytest test/contracts/ passes (6 tests).
  • black / isort clean.
  • Enum values verified against SecurityPlatform.SECURITY_PLATFORM_TYPE in openaev-model and the field name against the expectation_expected_security_platform_types JsonProperty on the framework Expectation form.

This is the blocking library change for the platform + injectors rework.

Copilot AI review requested due to automatic review settings July 20, 2026 09:27
@github-actions github-actions Bot added the filigran team Item from the Filigran team. label Jul 20, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR extends the contracts model to let an Expectation declare which security platform types (e.g., EDR/XDR/SIEM) are expected to fulfill it, enabling the OpenAEV platform to scope which connected platforms should be considered for technical expectations.

Changes:

  • Added SecurityPlatformType enum and expectation_expected_security_platform_types field to the Expectation dataclass.
  • Added tests covering default-empty behavior and JSON serialization on both availableExpectations and derived predefinedExpectations.
  • Bumped pyoaev.__version__ to 2.260720.0.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
pyoaev/contracts/contract_config.py Introduces SecurityPlatformType and adds the new Expectation field with a default empty list.
test/contracts/test_contract_expectations.py Adds unit tests validating defaulting and serialization for the new field.
pyoaev/__init__.py Version bump to ship the new contract surface area.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pyoaev/contracts/contract_config.py Outdated
Comment thread pyoaev/contracts/contract_config.py Outdated
…ng (#313)

The SecurityPlatformType docstring and the Expectation field comment only
mentioned detection/prevention while VULNERABILITY is also a technical
expectation seeded per security platform.
@SamuelHassine

Copy link
Copy Markdown
Member Author

Review-and-fix pass complete:

  • Independent review done against the platform counterparts: the SecurityPlatformType values match SecurityPlatform.SECURITY_PLATFORM_TYPE in openaev-model exactly (EDR, XDR, SIEM, SOAR, NDR, ISPM, LLM_FIREWALL, AI_GATEWAY), and the field name matches the expectation_expected_security_platform_types JsonProperty on the framework Expectation form, so the wire contract lines up. The default_factory list default is correct (no shared mutable default), serialization propagates to both availableExpectations and the derived predefinedExpectations, and the version bump is picked up by pyproject dynamic versioning.
  • Addressed both Copilot comments in 4bc78b6: the SecurityPlatformType docstring and the Expectation field comment now cover all technical expectation types (DETECTION / PREVENTION / VULNERABILITY) instead of only detection/prevention. Both threads replied to and resolved.
  • Verified locally: pytest test/contracts/ passes (6 tests), black and isort clean. All CI checks are green on the new head, both commits are signed, the PR is linked to feat(contracts): declare expected security platform types on expectations #313 and the title matches the repository convention.

Note: I cannot approve this PR since I am its author - it needs an approving review from another maintainer to unblock merge.

@SamuelHassine

Copy link
Copy Markdown
Member Author

Dropped the manual version bump in a58b99d - the version is bumped automatically by the release process, so pyoaev/init.py is back to 2.260717.0 and the PR description was updated accordingly. CI is green on the new head.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread test/contracts/test_contract_expectations.py
…types (#313)

The test helper forced expectation_expected_security_platform_types to []
even when omitted, so the default-empty test never covered the dataclass
default. The field is now only passed when declared.
@SamuelHassine

Copy link
Copy Markdown
Member Author

Second review-and-fix pass complete:

  • Addressed the new Copilot comment in 5d1d17f: the test helper only passes expectation_expected_security_platform_types when the caller declares it, so test_expected_security_platform_types_default_empty now exercises the real dataclass default_factory path instead of an explicit empty list. Thread replied to and resolved.
  • No other findings on re-review: the diff is otherwise unchanged since the previous pass (enum values and field name verified against the openaev-model / framework counterparts, manual version bump already dropped in a58b99d).
  • Verified locally: pytest test/contracts/ passes (6 tests), black and isort clean. All CI checks are green on the new head and all 4 commits are signed.

Still pending: an approving review from another maintainer (I cannot approve my own PR).

@SamuelHassine
SamuelHassine merged commit 0422cf2 into main Jul 20, 2026
13 checks passed
@SamuelHassine
SamuelHassine deleted the feat/expectation-expected-security-platforms branch July 20, 2026 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

filigran team Item from the Filigran team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(contracts): declare expected security platform types on expectations

3 participants