Skip to content

feat(backend): add JPA subclasses for inject expectation refacto (#5379)#6267

Merged
MarineLeM merged 24 commits into
mainfrom
issue/5379-add-jpa-subclasses
Jul 2, 2026
Merged

feat(backend): add JPA subclasses for inject expectation refacto (#5379)#6267
MarineLeM merged 24 commits into
mainfrom
issue/5379-add-jpa-subclasses

Conversation

@GaetanSantucci

@GaetanSantucci GaetanSantucci commented Jun 16, 2026

Copy link
Copy Markdown
Member

Proposed changes

  • Rename InjectExpectation → BaseInjectExpectation (stays concrete, new BaseInjectExpectation() still works)
  • Add @Inheritance(SINGLE_TABLE) + @DiscriminatorColumn("inject_expectation_type") on BaseInjectExpectation
  • Add concrete getSuccessLabel() / getFailureLabel() with default implementation on BaseInjectExpectation
  • Create 2 intermediate abstract subclasses: TechnicalInjectExpectation, TableTopInjectExpectation
  • Create 6 leaf classes with @DiscriminatorValue: DetectionInjectExpectation, PreventionInjectExpectation, VulnerabilityInjectExpectation, ManualInjectExpectation, ChallengeInjectExpectation, ArticleInjectExpectation
  • Introduce InjectExpectationOutput DTO + InjectExpectationMapper — REST API no longer leaks the JPA entity
  • Update all InjectExpectation.* references across backend and frontend

Testing Instructions

  • Check that existing DB rows are mapped to the correct subclass via the discriminator column
  • Verify REST endpoints return the new InjectExpectationOutput shape

Related issues

Checklist

  • I consider the submitted work as finished
  • I tested the code for its functionality
  • I wrote test cases for the relevant uses case
  • I added/update the relevant documentation (either on github or on notion)
  • Where necessary I refactored code to improve the overall quality
  • For bug fix -> I implemented a test that covers the bug

@GaetanSantucci GaetanSantucci self-assigned this Jun 16, 2026
@github-actions github-actions Bot added the filigran team Item from the Filigran team. label Jun 16, 2026
@Filigran-Automation Filigran-Automation changed the title feat(backend): add jpa subclasses for inject expectation refacto(#5379) feat(backend): add JPA subclasses for inject expectation refacto (#5379) Jun 16, 2026
@Filigran-Automation

Copy link
Copy Markdown
Contributor

🤖 [AI-generated]

Hey @GaetanSantucci! 👋 Thanks a lot for opening PR #6267 — this is a substantial refactor and the contribution is really appreciated! 🙏

I just had a quick look and I think the description could be enhanced a little to help reviewers get through 129 changed files faster. I haven't changed anything in your description — just a gentle suggestion:

Area What could help Suggestion
Proposed changes The section is still empty (just * bullets) A few bullets on what the JPA subclasses change and why this refactor is needed
Testing Instructions Still the template placeholder steps A short step-by-step (or note on the test coverage already in the diff) so reviewers know how to validate
Related issues Closes #ISSUE-NUMBER placeholder is still there Replace it with Closes #5379 so the PR is properly linked to its issue

💡 If helpful, the contribution conventions / PR template walk through what to include.

No rush at all — thanks again for contributing to OpenAEV! 🚀

@GaetanSantucci GaetanSantucci marked this pull request as ready for review June 17, 2026 07:44
Copilot AI review requested due to automatic review settings June 17, 2026 07:44
@GaetanSantucci GaetanSantucci force-pushed the issue/5379-add-jpa-subclasses branch from 7ec05e7 to 5687eeb Compare June 17, 2026 07:47

Copilot AI 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.

Pull request overview

This PR refactors inject expectations by renaming the core JPA entity to BaseInjectExpectation, introducing JPA single-table inheritance with discriminator-based subclasses, and updating backend/frontend code to use a new InjectExpectationOutput DTO instead of exposing the JPA entity directly in REST responses.

Changes:

  • Introduce BaseInjectExpectation single-table inheritance with discriminator values and new concrete subclasses (detection/prevention/vulnerability/manual/challenge/article/document).
  • Add InjectExpectationOutput + mapper and update REST endpoints/mappers to return DTOs instead of the JPA entity.
  • Update TypeScript generated types and migrate frontend usage from InjectExpectation to InjectExpectationOutput.

Reviewed changes

Copilot reviewed 127 out of 129 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
openaev-model/src/main/java/io/openaev/helper/InjectModelHelper.java Update enum reference to Base entity
openaev-model/src/main/java/io/openaev/helper/InjectExpectationHelper.java Switch helper imports/Javadoc to Base entity
openaev-model/src/main/java/io/openaev/engine/model/injectexpectation/EsInjectExpectation.java Update ES model enum imports
openaev-model/src/main/java/io/openaev/database/specification/InjectExpectationSpecification.java Switch specs to Base entity generic
openaev-model/src/main/java/io/openaev/database/repository/InjectExpectationRepository.java Repository generics + return types to Base entity
openaev-model/src/main/java/io/openaev/database/model/BaseInjectExpectation.java Rename entity + add inheritance/discriminator + labels
openaev-model/src/main/java/io/openaev/database/model/TechnicalInjectExpectation.java New abstract technical intermediate class
openaev-model/src/main/java/io/openaev/database/model/TableTopInjectExpectation.java New abstract tabletop intermediate class
openaev-model/src/main/java/io/openaev/database/model/DetectionInjectExpectation.java New discriminator leaf entity
openaev-model/src/main/java/io/openaev/database/model/PreventionInjectExpectation.java New discriminator leaf entity
openaev-model/src/main/java/io/openaev/database/model/VulnerabilityInjectExpectation.java New discriminator leaf entity
openaev-model/src/main/java/io/openaev/database/model/ManualInjectExpectation.java New discriminator leaf entity
openaev-model/src/main/java/io/openaev/database/model/ChallengeInjectExpectation.java New discriminator leaf entity
openaev-model/src/main/java/io/openaev/database/model/ArticleInjectExpectation.java New discriminator leaf entity
openaev-model/src/main/java/io/openaev/database/model/DocumentInjectExpectation.java New discriminator leaf entity
openaev-model/src/main/java/io/openaev/database/model/InjectExpectationTrace.java Update relation type to Base entity
openaev-model/src/main/java/io/openaev/database/model/InjectTarget.java Switch status fields to Base enums
openaev-model/src/main/java/io/openaev/database/model/Inject.java Switch expectations collection + filtering to Base enums
openaev-model/src/main/java/io/openaev/database/model/Team.java Switch expectations relation type + streams
openaev-model/src/main/java/io/openaev/database/model/TeamSimple.java Switch expectations list type + streams
openaev-model/src/main/java/io/openaev/database/model/Payload.java Update EXPECTATION_TYPE import source
openaev-front/src/utils/api-types.d.ts Regenerate types to InjectExpectationOutput
openaev-front/src/admin/components/workspaces/custom_dashboards/widgets/WidgetUtils.tsx Switch widget filters/series typing
openaev-front/src/admin/components/workspaces/custom_dashboards/widgets/configuration/histogram/WidgetSecurityCoverageSeriesSelection.tsx Switch perspective typing
openaev-front/src/admin/components/simulations/simulation/validation/expectations/ExpectationUtils.ts Update expectation predicates typing/null checks
openaev-front/src/admin/components/simulations/simulation/overview/ExerciseDistributionScoreOverTimeByTeamInPercentage.tsx Switch chart data typing
openaev-front/src/admin/components/simulations/simulation/overview/ExerciseDistributionScoreOverTimeByTeam.tsx Switch chart data typing
openaev-front/src/admin/components/simulations/simulation/overview/ExerciseDistributionScoreOverTimeByInjectorContract.tsx Switch chart data typing
openaev-front/src/admin/components/simulations/simulation/overview/ExerciseDistributionScoreByTeamInPercentage.tsx Switch chart aggregates typing
openaev-front/src/admin/components/simulations/simulation/overview/ExerciseDistributionScoreByTeam.tsx Switch chart aggregates typing
openaev-front/src/admin/components/simulations/simulation/overview/ExerciseDistributionScoreByPlayer.tsx Switch chart aggregates typing
openaev-front/src/admin/components/simulations/simulation/overview/ExerciseDistributionScoreByOrganization.tsx Switch chart aggregates typing
openaev-front/src/admin/components/simulations/simulation/overview/ExerciseDistributionScoreByInject.tsx Switch chart aggregates typing
openaev-front/src/admin/components/simulations/simulation/overview/ExerciseDistributionByInjectorContract.tsx Switch chart aggregates typing
openaev-front/src/admin/components/common/injects/InjectDistributionByType.tsx Switch distribution typing
openaev-front/src/admin/components/common/injects/expectations/useExpectationExpirationTime.tsx Switch hook param type
openaev-front/src/admin/components/common/injects/expectations/ExpectationPopover.tsx Update casts to new output type
openaev-front/src/admin/components/common/injects/expectations/ExpectationFormCreate.tsx Update casts to new output type
openaev-front/src/admin/components/common/injects/expectations/Expectation.ts Store type migrated to InjectExpectationOutput
openaev-front/src/admin/components/atomic_testings/atomic_testing/target_result/TargetResultsDetail.tsx Simplify active tab resolution
openaev-front/src/admin/components/atomic_testings/atomic_testing/target_result/InjectExpectationResultList.tsx Update agent field typing
openaev-front/src/admin/components/ariane/AskArianePanel.tsx Refactor ChatPanel props into object
openaev-front/src/actions/injects/inject-helper.d.ts Helper API typing to InjectExpectationOutput
openaev-framework/src/main/java/io/openaev/model/inject/form/Expectation.java Update type import to Base enums
openaev-framework/src/main/java/io/openaev/model/expectation/VulnerabilityExpectation.java Update type signatures to Base enums
openaev-framework/src/main/java/io/openaev/model/expectation/PreventionExpectation.java Update imports/type signatures
openaev-framework/src/main/java/io/openaev/model/expectation/ManualExpectation.java Update static import to Base enums
openaev-framework/src/main/java/io/openaev/model/expectation/DetectionExpectation.java Update type signatures to Base enums
openaev-framework/src/main/java/io/openaev/model/expectation/ChannelExpectation.java Update type signatures to Base enums
openaev-framework/src/main/java/io/openaev/model/expectation/ChallengeExpectation.java Update type signatures to Base enums
openaev-framework/src/main/java/io/openaev/model/Expectation.java Update EXPECTATION_TYPE import
openaev-framework/src/main/java/io/openaev/expectation/ExpectationPropertiesConfig.java Update EXPECTATION_TYPE import
openaev-framework/src/main/java/io/openaev/expectation/ExpectationBuilderService.java Update static imports/types
openaev-api/src/main/java/io/openaev/api/expectations/dto/InjectExpectationOutput.java New DTO for expectation output
openaev-api/src/main/java/io/openaev/api/expectations/mapper/InjectExpectationMapper.java New mapper entity → DTO
openaev-api/src/main/java/io/openaev/rest/inject/output/InjectOutput.java Change expectations field to DTO
openaev-api/src/main/java/io/openaev/utils/mapper/InjectMapper.java Populate InjectOutput.expectations via mapper
openaev-api/src/main/java/io/openaev/rest/exercise/ExerciseExpectationApi.java Return DTO list for expectations
openaev-api/src/main/java/io/openaev/rest/atomic_testing/AtomicTestingApi.java Return DTO lists for target results
openaev-api/src/main/java/io/openaev/rest/challenge/response/ChallengeInformation.java Expectation field becomes DTO
openaev-api/src/main/java/io/openaev/service/ChallengeService.java Map expectation entity → DTO in response
openaev-api/src/main/java/io/openaev/utils/ResultUtils.java Switch expectation clone type to Base entity
openaev-api/src/main/java/io/openaev/utils/InjectUtils.java Switch expectation stream/generics
openaev-api/src/main/java/io/openaev/utils/InjectExpectationResultUtils.java Switch generic signatures to Base entity
openaev-api/src/main/java/io/openaev/utils/inject_expectation_result/ExpectationResultBuilder.java Switch signatures to Base entity
openaev-api/src/main/java/io/openaev/service/InjectImportService.java Switch expectation ref type to Base entity
openaev-api/src/main/java/io/openaev/service/InjectExpectationTraceService.java Switch expectation placeholder type to Base entity
openaev-api/src/main/java/io/openaev/service/ExerciseExpectationService.java Return Base entity list from service
openaev-api/src/main/java/io/openaev/service/ChannelService.java Switch expectation generics to Base entity
openaev-api/src/main/java/io/openaev/rest/payload/service/PayloadService.java Switch expectation enum types to Base
openaev-api/src/main/java/io/openaev/rest/payload/output/PayloadOutput.java Switch expectations enum type to Base
openaev-api/src/main/java/io/openaev/rest/payload/form/PayloadCreateInput.java Switch EXPECTATION_TYPE import source
openaev-api/src/main/java/io/openaev/rest/payload/form/PayloadUpdateInput.java Switch default expectations enum type
openaev-api/src/main/java/io/openaev/rest/payload/form/PayloadUpsertInput.java Switch default expectations enum type
openaev-api/src/main/java/io/openaev/rest/injector_contract/InjectorContractContentUtils.java Switch predefined expectations enum type
openaev-api/src/main/java/io/openaev/scheduler/jobs/InjectsExecutionJob.java Switch status enum list type to Base
openaev-api/src/main/java/io/openaev/expectation/ExpectationType.java Switch EXPECTATION_TYPE import source
openaev-api/src/main/java/io/openaev/collectors/expectations_expiration_manager/utils/ExpectationUtils.java Switch signatures to Base entity
openaev-api/src/main/java/io/openaev/collectors/expectations_expiration_manager/service/ExpectationsExpirationManagerService.java Switch paging/list types to Base entity
openaev-api/src/main/java/io/openaev/api/threat_arsenal/dto/CommonActionInput.java Switch expectations enum type
openaev-api/src/main/java/io/openaev/api/threat_arsenal/dto/ThreatArsenalActionCreateInput.java Switch EXPECTATION_TYPE import
openaev-api/src/main/java/io/openaev/api/threat_arsenal/dto/ThreatArsenalActionUpdateInput.java Switch expectations enum type
openaev-api/src/main/java/io/openaev/api/threat_arsenal/dto/ThreatArsenalActionFullOutput.java Switch expectations enum type
openaev-api/src/main/java/io/openaev/migration/V2_63__InjectExpectation_upgrade.java Update static imports to Base enums
openaev-api/src/main/java/io/openaev/injectors/openaev/OpenAEVImplantExecutor.java Update EXPECTATION_TYPE references
openaev-api/src/main/java/io/openaev/service/targets/search/HelperTargetSearchAdaptor.java Switch merged expectations list type
openaev-api/src/main/java/io/openaev/rest/inject/service/InjectService.java Switch extracted expectations stream type
openaev-api/src/main/java/io/openaev/rest/custom_dashboard/WidgetService.java Switch status enum names source
openaev-api/src/main/java/io/openaev/service/ExpectationService.java Switch static imports to Base enums
openaev-api/src/test/java/io/openaev/utils/helpers/InjectTestHelper.java Switch helper save signature to Base entity
openaev-api/src/test/java/io/openaev/utils/fixtures/WidgetFixture.java Switch widget fixture enum types
openaev-api/src/test/java/io/openaev/utils/fixtures/ThreatArsenalInputFixture.java (Now empty) threat arsenal fixture
openaev-api/src/test/java/io/openaev/utils/fixtures/InjectFixture.java Update expectation type in test content
openaev-api/src/test/java/io/openaev/utils/fixtures/InjectExpectationFixture.java Switch fixture return type to Base entity
openaev-api/src/test/java/io/openaev/utils/fixtures/ExpectationResultsByTypeFixture.java Switch status enum import source
openaev-api/src/test/java/io/openaev/utils/fixtures/ExpectationResultByTypeFixture.java Switch status enum import source
openaev-api/src/test/java/io/openaev/utils/fixtures/ExpectationFixture.java Switch expectation type to Base enums
openaev-api/src/test/java/io/openaev/utils/fixtures/composers/InjectExpectationComposer.java Switch composer generic to Base entity
openaev-api/src/test/java/io/openaev/utils/fixtures/composers/InjectComposer.java Switch expectations list type
openaev-api/src/test/java/io/openaev/service/stix/SecurityCoverageServiceTest.java Switch enums/types to Base entity
openaev-api/src/test/java/io/openaev/service/stix/SecurityCoverageSendJobServiceTest.java Switch enums/types to Base entity
openaev-api/src/test/java/io/openaev/service/InjectExpectationTraceServiceTest.java Switch types to Base entity
openaev-api/src/test/java/io/openaev/service/InjectExpectationServiceTest.java Switch test types to Base entity
openaev-api/src/test/java/io/openaev/service/ExerciseExpectationServiceTest.java Switch service return types
openaev-api/src/test/java/io/openaev/service/ChannelServiceTest.java Switch captured types to Base entity
openaev-api/src/test/java/io/openaev/service/ChallengeServiceTest.java Switch created expectations to Base entity
openaev-api/src/test/java/io/openaev/rest/scenario/ScenarioSimulationApiTest.java Stabilize ordering assertion on timestamps
openaev-api/src/test/java/io/openaev/rest/InjectExpectationTraceApiTest.java Switch saved expectation type
openaev-api/src/test/java/io/openaev/rest/inject/service/InjectServiceTest.java Switch expectation type in JSON content
openaev-api/src/test/java/io/openaev/rest/inject/InjectApiTest.java Switch repository result type
openaev-api/src/test/java/io/openaev/rest/inject_expectation/ExpectationsExpirationManagerServiceTest.java Switch expectation types in tests
openaev-api/src/test/java/io/openaev/rest/ExpectationApiTest.java Switch expectation types + helper method params
openaev-api/src/test/java/io/openaev/rest/exercise/service/ExerciseServiceUnitTest.java Switch status enum import source
openaev-api/src/test/java/io/openaev/rest/dashboard/DashboardApiTest.java Switch enums/types to Base entity
openaev-api/src/test/java/io/openaev/rest/AtomicTestingApiTest.java Switch types + update JSON assertions
openaev-api/src/test/java/io/openaev/injects/technical_inject/OpenAEVImplantExecutorTest.java Switch expectation type provider + generics
openaev-api/src/test/java/io/openaev/injects/manual/ManualExecutorTest.java Switch expectation type constant
openaev-api/src/test/java/io/openaev/injects/email/EmailExecutorTest.java Switch expectation typing + comments
openaev-api/src/test/java/io/openaev/injects/atomic_testing/ResultUtilsTest.java Switch expectation type constants
openaev-api/src/test/java/io/openaev/database/model/StepRepositoryTest.java Switch expectation fixture types
openaev-api/src/test/java/io/openaev/api/threat_arsenal/ThreatArsenalApiTest.java Switch expectations array type
Comments suppressed due to low confidence (3)

openaev-api/src/test/java/io/openaev/utils/fixtures/ThreatArsenalInputFixture.java:2

  • issue (blocking): This test fixture file is now empty (no package/class declaration), but it is still imported by multiple threat-arsenal tests. This will fail compilation; either restore the fixture implementation or delete it and update all callers.
    openaev-model/src/main/java/io/openaev/database/model/BaseInjectExpectation.java:32
  • issue (blocking): With SINGLE_TABLE inheritance, existing DB rows with inject_expectation_type = 'TEXT' currently have no matching discriminator mapping (no leaf class for TEXT, and the root entity has no @DiscriminatorValue). Hibernate will typically fail with an "unknown discriminator value" when loading those rows. Map TEXT to the root entity (or add a dedicated TextInjectExpectation entity).
    openaev-model/src/main/java/io/openaev/database/model/BaseInjectExpectation.java:105
  • issue (blocking): type is mapped to the discriminator column but marked insertable = false, updatable = false, so calling setType(...) will NOT persist the expectation type. There are still production call sites that do new BaseInjectExpectation() + setType(...) / setDetection(...) (e.g. InjectExpectationUtils.expectationConverter), which would now persist the discriminator as the root value (after adding @DiscriminatorValue, likely TEXT) and later reload as the wrong subclass/type. To keep behavior stable, creation code needs to instantiate the correct leaf entity (DetectionInjectExpectation, PreventionInjectExpectation, etc.), or the inheritance discriminator must be moved to a different column.

Comment thread openaev-api/src/test/java/io/openaev/utils/fixtures/InjectExpectationFixture.java Outdated
Comment thread openaev-api/src/test/java/io/openaev/utils/fixtures/InjectExpectationFixture.java Outdated
Comment thread openaev-api/src/test/java/io/openaev/utils/fixtures/InjectExpectationFixture.java Outdated
Comment thread openaev-api/src/test/java/io/openaev/utils/fixtures/InjectExpectationFixture.java Outdated
Comment thread openaev-api/src/test/java/io/openaev/utils/fixtures/InjectExpectationFixture.java Outdated
Comment thread openaev-api/src/test/java/io/openaev/utils/fixtures/InjectExpectationFixture.java Outdated
Comment thread openaev-api/src/test/java/io/openaev/utils/fixtures/InjectExpectationFixture.java Outdated
@antoinemzs antoinemzs changed the base branch from main to issue/5378-refacto-inject-expectation-dto June 18, 2026 12:54
@antoinemzs antoinemzs changed the base branch from issue/5378-refacto-inject-expectation-dto to main June 18, 2026 12:54
@GaetanSantucci GaetanSantucci force-pushed the issue/5379-add-jpa-subclasses branch from ee3af78 to 4271962 Compare June 25, 2026 12:47
@codecov

codecov Bot commented Jun 25, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 63.23907% with 143 lines in your changes missing coverage. Please review.
✅ Project coverage is 44.38%. Comparing base (bad4275) to head (4a1bab7).

Files with missing lines Patch % Lines
...a/io/openaev/service/InjectExpectationService.java 70.42% 26 Missing and 16 partials ⚠️
...pi/src/main/java/io/openaev/utils/InjectUtils.java 7.40% 19 Missing and 6 partials ⚠️
...c/main/java/io/openaev/utils/ExpectationUtils.java 66.66% 12 Missing and 3 partials ⚠️
...i/expectations/mapper/InjectExpectationMapper.java 60.00% 6 Missing and 8 partials ⚠️
...io/openaev/scheduler/jobs/InjectsExecutionJob.java 9.09% 9 Missing and 1 partial ⚠️
...ava/io/openaev/service/InjectExpectationUtils.java 79.16% 6 Missing and 4 partials ⚠️
...c/main/java/io/openaev/service/MailingService.java 50.00% 4 Missing and 2 partials ⚠️
...njector_contract/InjectorContractContentUtils.java 0.00% 4 Missing ⚠️
.../service/ExpectationsExpirationManagerService.java 70.00% 0 Missing and 3 partials ⚠️
...t_expectation_result/ExpectationResultBuilder.java 76.92% 2 Missing and 1 partial ⚠️
... and 6 more

❌ Your patch check has failed because the patch coverage (0.00%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.
❌ Your project check has failed because the head coverage (2.89%) is below the target coverage (80.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #6267      +/-   ##
============================================
+ Coverage     44.33%   44.38%   +0.05%     
- Complexity     7472     7485      +13     
============================================
  Files          2313     2313              
  Lines         64052    64150      +98     
  Branches       8522     8543      +21     
============================================
+ Hits          28396    28472      +76     
- Misses        33847    33850       +3     
- Partials       1809     1828      +19     
Flag Coverage Δ
backend 66.77% <63.56%> (-0.03%) ⬇️
e2e 19.02% <ø> (+0.64%) ⬆️
frontend 2.89% <0.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@GaetanSantucci GaetanSantucci force-pushed the issue/5379-add-jpa-subclasses branch 3 times, most recently from f2e0bea to b3e5ebf Compare June 29, 2026 12:25
withExpectedMultiSelectableFlag(
this.expectationBuilderService.buildTextExpectation()));
case DOCUMENT ->
case TEXT, DOCUMENT ->

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.

be careful here, when is type is text we should call buildTextExpectation rather than buildDocumentExpectation

case Expectation ignored when expectation.type() == TEXT -> {
injectExpectation.setType(TEXT);
throw new IllegalStateException(
"TEXT expectation type is deprecated and no longer supported");

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.

Are Text and Document expectations deprecated as of this PR? If yes, should we do the same for document expectation ?

List.of(MANUAL, CHALLENGE, ARTICLE);

private ExpectationUtils() {}

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.

Please restore the documentation in this file


// endregion

@Setter

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.

Fields specific to leaf classes should be moved down to the leaf, not kept in the parent.

@JsonProperty("inject_expectation_traces")
private List<InjectExpectationTrace> traces = new ArrayList<>();

public String getSuccessLabel() {

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.

this function should be defined and handled by the leaf class, wdyt ?


@Entity
@DiscriminatorValue(BaseInjectExpectation.ExpectationTypeString.MANUAL)
public class ManualInjectExpectation extends TechnicalInjectExpectation {

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.

ManualInjectExpectation inherits from TabletopInjectExpectation instead of TechnicalInjectExpectation

}

@Override
public String getSuccessLabel() {

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.

All TabletopInjectExpectation subclasses return the same values for getSuccessLabel and getFailureLabel — these should be moved up to the TabletopInjectExpectation class.

@MarineLeM MarineLeM force-pushed the issue/5379-add-jpa-subclasses branch 3 times, most recently from 81cc7b5 to 27b7655 Compare July 1, 2026 14:51
GaetanSantucci and others added 15 commits July 2, 2026 08:34
…or inject expectation dto

Signed-off-by: Marine LM <marine.lemezo@filigran.io>
…cation

Signed-off-by: Marine LM <marine.lemezo@filigran.io>
Signed-off-by: Marine LM <marine.lemezo@filigran.io>
Signed-off-by: Marine LM <marine.lemezo@filigran.io>
Signed-off-by: Marine LM <marine.lemezo@filigran.io>
Signed-off-by: Marine LM <marine.lemezo@filigran.io>
Signed-off-by: Marine LM <marine.lemezo@filigran.io>
Signed-off-by: Marine LM <marine.lemezo@filigran.io>
@MarineLeM MarineLeM force-pushed the issue/5379-add-jpa-subclasses branch from 5291b54 to 4a1bab7 Compare July 2, 2026 06:34
@gabriel-peze gabriel-peze self-requested a review July 2, 2026 09:21

@gabriel-peze gabriel-peze 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.

LGTM.

Image

@MarineLeM MarineLeM merged commit 2e6edad into main Jul 2, 2026
36 checks passed
@MarineLeM MarineLeM deleted the issue/5379-add-jpa-subclasses branch July 2, 2026 12:44
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.

refactor(inject-expectation): add JPA subclasses without breaking the existing code

6 participants