Skip to content

fix: propagate verification errors and add PassManager integrity test#1066

Open
giwaov wants to merge 2 commits into0xMiden:nextfrom
giwaov:test/pass-manager-verify
Open

fix: propagate verification errors and add PassManager integrity test#1066
giwaov wants to merge 2 commits into0xMiden:nextfrom
giwaov:test/pass-manager-verify

Conversation

@giwaov
Copy link
Copy Markdown

@giwaov giwaov commented Apr 7, 2026

Summary

Fix a bug in OpToOpPassAdaptor::run() where verification errors were
silently dropped after a pass completed successfully. The original code
used result.map_err(|_| verification_result) which is a no-op when
result is Ok(()), meaning verification failures were never propagated
to the caller.

The fix changes this to result = Err(verification_result) so that
verification errors are always reported.

Test

Add a test (pass_manager_detects_broken_invariant) that:

  1. Creates a function with a test::Add operation (a BinaryOp requiring 2 operands)
  2. Runs a CorruptBinaryOp pass that clears the operands of the first BinaryOp it finds
  3. Asserts that the PassManager returns an error when verification is enabled

Without the bug fix, this test would pass silently (the verification error would be dropped).

Closes #605

Fix a bug where verification errors after a pass were silently dropped
because map_err on Ok(()) is a no-op. Change to directly set the result
to Err(verification_result) so verification failures are properly
propagated.

Add a test that creates a BinaryOp, runs a pass that clears its operands
(breaking the 2-operand invariant), and asserts the PassManager detects
the broken invariant when verification is enabled.

Closes 0xMiden#605
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 test to check that the PassManager verifies integrity after modification

2 participants