Skip to content

Fix functions order check in Task class dtor#380

Merged
allnes merged 4 commits intolearning-process:masterfrom
aobolensk:task-order-fix
May 13, 2025
Merged

Fix functions order check in Task class dtor#380
allnes merged 4 commits intolearning-process:masterfrom
aobolensk:task-order-fix

Conversation

@aobolensk
Copy link
Copy Markdown
Member

@aobolensk aobolensk commented May 12, 2025

Prevent creating Task class with public API usage ignored by checking for invalid API calls order (or its absence) in dtor

@aobolensk aobolensk requested a review from allnes May 12, 2025 22:11
@allnes allnes enabled auto-merge May 12, 2025 22:14
@aobolensk aobolensk requested a review from Copilot May 12, 2025 22:24
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 addresses an issue with the order check of functions in the Task class destructor. The changes introduce a validation in the destructor that compares the current functions order with the expected order and terminates the program with an error message if they do not match.

  • Added conditional check in the destructor to compare functions order
  • Added an error message and program termination when the order is incorrect

Comment thread modules/core/task/src/task.cpp Outdated
@github-actions github-actions Bot added the core label May 13, 2025
@aobolensk aobolensk requested a review from allnes May 13, 2025 11:40
@aobolensk
Copy link
Copy Markdown
Member Author

@allnes please take a look one more time, I have reworked the checker solution

@allnes
Copy link
Copy Markdown
Member

allnes commented May 13, 2025

@aobolensk please provide test case of student which show that new scheme is worked (we discussed it as I remember) and we have 1 test for wrong order

@aobolensk
Copy link
Copy Markdown
Member Author

@aobolensk please provide test case of student which show that new scheme is worked (we discussed it as I remember) and we have 1 test for wrong order

Unfortunately, this test case cannot be added in unit tests, cause now it causes std::terminate, before it was just ignored.

The task case is basically the following: you create Task class and do not call any of these 4 functions

@allnes allnes disabled auto-merge May 13, 2025 12:53
@allnes allnes merged commit bfaa28f into learning-process:master May 13, 2025
7 checks passed
@codecov
Copy link
Copy Markdown

codecov Bot commented May 13, 2025

Codecov Report

Attention: Patch coverage is 46.66667% with 8 lines in your changes missing coverage. Please review.

Project coverage is 93.49%. Comparing base (a1fa76b) to head (fba723c).
Report is 4 commits behind head on master.

Files with missing lines Patch % Lines
modules/core/task/src/task.cpp 46.66% 6 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #380      +/-   ##
==========================================
- Coverage   94.94%   93.49%   -1.46%     
==========================================
  Files          26       26              
  Lines         495      507      +12     
  Branches      145      149       +4     
==========================================
+ Hits          470      474       +4     
- Misses         12       18       +6     
- Partials       13       15       +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.

@aobolensk
Copy link
Copy Markdown
Member Author

@aobolensk please provide test case of student which show that new scheme is worked (we discussed it as I remember) and we have 1 test for wrong order

Unfortunately, this test case cannot be added in unit tests, cause now it causes std::terminate, before it was just ignored.

The task case is basically the following: you create Task class and do not call any of these 4 functions

Eventually, I have created a test case for that #386

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants