Skip to content

Conversation

savacano28
Copy link
Contributor

@savacano28 savacano28 commented Jul 18, 2025

Proposed changes

BackEnd

  • Update expectation result with a computeValue fo expectations or contentInject, if expectations existent then I send them in other case I extract the expectations defined into de inject contract (content). -> New InjectExpectationMapper (logic extraction ExpectationResults)
  • Modifiy dtos with expectationResults: exercise, GlobalScoreBySimulationEndDate, AttackPattern, Inject, Atomic
  • Features related: Injects/atomics/Simualtions/scenarios/Matrix attacks/HomeDahsboards

FrontEnd

  • Refact ResponsePie in order to just show expectations existents.
  • Refact AtomicResult to show only expectation Results existents
  • Refact ScenarioDistributionByExercise to show only result from expectation defined
image image image image image image image image

Testing Instructions

  1. Create inject with x type of expectation
  2. Check the Pie chart in the overview of inject, check also for the targets
  3. For simulation, check pie charts, attacks matrix, and inject results
  4. In Home, check last simaltion, pie charts

Observations/comments:

** In the case where an inject has been executed and the expectations are met, and the user updates the inject content, the expectation result shown is the expectation related to the current execution (then this new type of expectation is not shown).
** Improvements: We should calculate the global score asynchronously as in ScenarioDistributionByExercise.

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

Further comments

If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...

@savacano28 savacano28 self-assigned this Jul 18, 2025
@savacano28 savacano28 added the filigran team use to identify PR from the Filigran team label Jul 18, 2025
Copy link

codecov bot commented Jul 21, 2025

Codecov Report

❌ Patch coverage is 64.77273% with 62 lines in your changes missing coverage. Please review.
✅ Project coverage is 44.89%. Comparing base (3aad4fd) to head (14a0b13).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
.../openbas/utils/mapper/InjectExpectationMapper.java 45.58% 33 Missing and 4 partials ⚠️
...tion/handler/ScenarioNotificationEventHandler.java 0.00% 5 Missing ⚠️
...n/java/io/openbas/service/InjectSearchService.java 0.00% 5 Missing ⚠️
...n/java/io/openbas/rest/statistic/StatisticApi.java 0.00% 3 Missing ⚠️
...vice/targets/search/HelperTargetSearchAdaptor.java 81.25% 2 Missing and 1 partial ⚠️
...pi/src/main/java/io/openbas/utils/ResultUtils.java 57.14% 3 Missing ⚠️
...openbas/rest/exercise/service/ExerciseService.java 66.66% 2 Missing ⚠️
...n/java/io/openbas/utils/mapper/ExerciseMapper.java 0.00% 2 Missing ⚠️
...ain/java/io/openbas/rest/exercise/ExerciseApi.java 0.00% 1 Missing ⚠️
...io/openbas/utils/InjectExpectationResultUtils.java 93.33% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #3661      +/-   ##
============================================
- Coverage     44.97%   44.89%   -0.09%     
- Complexity     2852     2860       +8     
============================================
  Files           771      772       +1     
  Lines         23486    23485       -1     
  Branches       1643     1651       +8     
============================================
- Hits          10564    10543      -21     
- Misses        12325    12343      +18     
- Partials        597      599       +2     

☔ View full report in Codecov by Sentry.
📢 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.

@savacano28 savacano28 force-pushed the bugfix/pie branch 2 times, most recently from 83478cd to d5fd943 Compare July 22, 2025 07:14
@savacano28 savacano28 changed the base branch from release/current to master July 22, 2025 12:41
@savacano28 savacano28 changed the base branch from master to release/current July 22, 2025 12:50
@savacano28 savacano28 changed the base branch from release/current to master July 22, 2025 12:51
@savacano28 savacano28 closed this Jul 22, 2025
@savacano28 savacano28 reopened this Jul 22, 2025
@savacano28 savacano28 force-pushed the bugfix/pie branch 4 times, most recently from 29da12b to 77375aa Compare July 24, 2025 16:17
@savacano28 savacano28 marked this pull request as ready for review July 25, 2025 07:25
@savacano28 savacano28 force-pushed the bugfix/pie branch 2 times, most recently from 8e3cba8 to 439aa54 Compare July 25, 2025 10:39
@RomuDeuxfois RomuDeuxfois self-requested a review July 28, 2025 06:43
@RomuDeuxfois
Copy link
Member

Everything seems to work as expected.
I create an issue which seems not relativ to your code
#3721

@savacano28
Copy link
Contributor Author

@RomuDeuxfois I made the changes, ty!

@savacano28 savacano28 merged commit 6281fb1 into master Jul 29, 2025
11 checks passed
@savacano28 savacano28 deleted the bugfix/pie branch July 29, 2025 08:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
filigran team use to identify PR from the Filigran team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Hide the expectation scores not used
2 participants