Skip to content

Add assertions when slicing #860

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

tpadioleau
Copy link
Member

No description provided.

@tpadioleau tpadioleau self-assigned this May 23, 2025
@tpadioleau tpadioleau linked an issue May 23, 2025 that may be closed by this pull request
@tpadioleau
Copy link
Member Author

@EmilyBourne We have an out of bound access in SplineBuilder::quadrature_coefficients

@EmilyBourne
Copy link
Collaborator

I had a look. The problem is to do with the handling of the derivatives. They are only required when Hermite boundary conditions are used, so the rest of the time they are initialised to a ChunkSpan of size 0. It seems that your assertion doesn't handle this case

@tpadioleau tpadioleau force-pushed the 858-add-a-bounds-check-on-slicing-operator-in-chunkspan branch from 3fa00f6 to 98206b3 Compare May 24, 2025 08:43
@tpadioleau
Copy link
Member Author

I had a look. The problem is to do with the handling of the derivatives. They are only required when Hermite boundary conditions are used, so the rest of the time they are initialised to a ChunkSpan of size 0. It seems that your assertion doesn't handle this case

Yes I got also confused when trying to add checks in DiscreteDomain. I have modified the assertion, it should be better now.

Also, I would like to add some preconditions in

  • SomeDomain::front,
  • SomeDomain::back,
  • SomeDomain::take_first,
  • SomeDomain::take_last,
  • SomeDomain::remove_first,
  • SomeDomain::remove_last,
  • SomeDomain::remove.

To do so I need to rework some internals of DDC that may violate these preconditions (no worry it is kind of legitimate).

Copy link

codecov bot commented May 24, 2025

Codecov Report

Attention: Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.

Project coverage is 89.92%. Comparing base (9aacefb) to head (98206b3).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
include/ddc/chunk_span.hpp 0.00% 0 Missing and 2 partials ⚠️

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

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #860      +/-   ##
==========================================
- Coverage   90.03%   89.92%   -0.12%     
==========================================
  Files          55       55              
  Lines        2851     2859       +8     
  Branches      969      974       +5     
==========================================
+ Hits         2567     2571       +4     
- Misses         90       92       +2     
- Partials      194      196       +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.

Copy link
Member

@yasahi-hpc yasahi-hpc left a comment

Choose a reason for hiding this comment

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

Some of the modifications are not very clear to me.
If you can improve the error messages, it would be nicer.
Also comments in death-tests would be helpful.

@tpadioleau
Copy link
Member Author

Some of the modifications are not very clear to me. If you can improve the error messages, it would be nicer. Also comments in death-tests would be helpful.

I can try to reformulate, we want to add assertions to help diagnose out of bounds slicing operations.

@tpadioleau tpadioleau merged commit 1277ca6 into main May 27, 2025
140 of 176 checks passed
@tpadioleau tpadioleau deleted the 858-add-a-bounds-check-on-slicing-operator-in-chunkspan branch May 27, 2025 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a bounds check on slicing operator in ChunkSpan
3 participants