Skip to content

Conversation

@RAprogramm
Copy link
Owner

Closes #26

Changes

Added Miri testing workflow for validating all unsafe code in the library.

Workflow Configuration

Created .github/workflows/miri.yml with:

  • Runs on push/PR to main branch
  • Weekly scheduled runs (Mondays at 03:00 UTC)
  • Uses Rust nightly with Miri component
  • Rust cache for faster builds
  • MIRIFLAGS for enhanced checks:
    • -Zmiri-symbolic-alignment-check - validates pointer alignment
    • -Zmiri-disable-isolation - allows system interactions in tests

Unsafe Code Validated

Miri validates all unsafe code in:

  • src/array.rs:84 - Pointer operations in pointer array construction
  • src/array.rs:162-163 - Raw pointer dereferencing in as_ptr
  • src/array.rs:187-189 - Mutable pointer operations
  • tests/integration.rs - Extensive unsafe FFI testing
  • Send/Sync implementations

Test Results

All tests pass under Miri without errors:

  • 34 unit tests
  • 11 integration tests
  • 17 doctests
  • Total: 62 tests

Benefits

  • Soundness: Mathematically proves unsafe code is correct
  • UB Detection: Finds undefined behavior at compile time
  • Confidence: Validates pointer operations and FFI safety
  • Professional: Industry-standard validation for unsafe code
  • FFI Safety: Critical for C interop libraries
  • Continuous Monitoring: Weekly scheduled runs catch regressions

Testing

  • Tested locally: cargo +nightly miri test --all-features
  • All 62 tests pass without Miri errors or warnings
  • Workflow will run on every PR and weekly

References

- Add .github/workflows/miri.yml
- Run Miri on push/PR to main + weekly on Mondays
- Use MIRIFLAGS for symbolic alignment check and isolation disable
- Validates all unsafe code for undefined behavior
- All 62 tests pass under Miri without errors

Benefits:
- Proves unsafe code correctness mathematically
- Detects undefined behavior at compile time
- Validates pointer operations and FFI safety
- Industry-standard validation for unsafe code
@RAprogramm RAprogramm merged commit c379f2d into main Oct 19, 2025
20 checks passed
@RAprogramm RAprogramm deleted the 26 branch October 19, 2025 01:52
@codecov
Copy link

codecov bot commented Oct 19, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

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 Miri testing for unsafe code validation

1 participant