Skip to content

fix(contracts): predefined expectations no longer emitted after availableExpectations rename #309

Description

@SamuelHassine

Problem

Injector contracts built with pyoaev no longer pre-fill Detection / Prevention (and other) expectations when a user creates an atomic testing or an inject. The expectations picker is empty of defaults, even though every injector declares them.

Root cause

Commit 3ca50c3 (feat(contracts): adding the new availableExpectations field, #306) renamed the ContractExpectations.predefinedExpectations field to availableExpectations and added a per-expectation expectation_is_predefined flag.

However, the OpenAEV platform pre-fills expectations from a field-level predefinedExpectations array on the expectation contract field (see InjectorContractContentUtils / ContractExpectations on the platform, and the frontend InjectContentForm which reads both predefinedExpectations for the defaults and availableExpectations for the "add expectation" picker). The per-expectation expectation_is_predefined flag is not consumed by the platform.

So after #306, pyoaev emits only availableExpectations and never predefinedExpectations, which means nothing is pre-filled. The flag became dead weight.

This is currently only on the unreleased main (not in 2.260717.0), so it would ship as a regression on the next release and break predefined expectations for all Python injectors.

Fix

Restore predefinedExpectations on ContractExpectations (alongside availableExpectations) and auto-derive it from the expectations flagged expectation_is_predefined=True when no explicit list is passed. This keeps the ergonomic single-list API and makes predefined expectations work end-to-end on the platform again.

Scope

  • pyoaev/contracts/contract_config.py: ContractExpectations emits both arrays.
  • Unit tests under test/contracts/.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugType: something isn't working (fix:).needs triageNeeds triage from the Filigran product team.solvedResolved (should be linked to the solving PR).

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions