Skip to content

FIX: add typehints, remove unnecessary type checks - #149

Open
hanyuone wants to merge 7 commits into
SVF-tools:mainfrom
hanyuone:fix/clean-typechecks
Open

hanyuone wants to merge 7 commits into
SVF-tools:mainfrom
hanyuone:fix/clean-typechecks

Conversation

@hanyuone

@hanyuone hanyuone commented Dec 2, 2026

Copy link
Copy Markdown
Contributor
  • Change MutationEngine to take VerifiableModel, as comments already mention, and remove unnecessary type checks
  • Remove unused initialisation of InputSpecLayer and OutputSpecLayer by **kwargs

@hanyuone
hanyuone marked this pull request as draft December 2, 2026 00:11
@codecov

codecov Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.70%. Comparing base (6831c11) to head (5e19009).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #149   +/-   ##
=======================================
  Coverage   85.69%   85.70%           
=======================================
  Files          97       97           
  Lines       26725    26717    -8     
=======================================
- Hits        22903    22897    -6     
+ Misses       3822     3820    -2     
Flag Coverage Δ
bab 56.84% <85.71%> (+0.02%) ⬆️
backend-float32 52.44% <85.71%> (-0.02%) ⬇️
backend-float64 53.95% <85.71%> (+<0.01%) ⬆️
frontend 34.75% <100.00%> (-0.03%) ⬇️
gui 29.82% <100.00%> (+0.01%) ⬆️
pipeline-fuzz 20.71% <100.00%> (-0.03%) ⬇️
pipeline-verify 43.05% <85.71%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
act/front_end/verifiable_model.py 90.90% <100.00%> (+0.30%) ⬆️
act/pipeline/fuzzing/actfuzzer.py 92.60% <100.00%> (+0.18%) ⬆️
act/pipeline/fuzzing/checker.py 86.36% <100.00%> (-0.21%) ⬇️
act/pipeline/fuzzing/mutations.py 78.19% <100.00%> (-0.12%) ⬇️

... and 4 files with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6831c11...5e19009. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@hanyuone
hanyuone marked this pull request as ready for review December 2, 2026 00:26
@hanyuone

hanyuone commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

@yuleisui @guanqin-123 Ready for review.

@yuleisui

yuleisui commented Dec 2, 2026

Copy link
Copy Markdown
Collaborator

@guanqin-123 review this one please

@guanqin-123

Copy link
Copy Markdown
Contributor

@yuleisui @guanqin-123 Ready for review.

The removals look safe. Two small things before merging, which I believe this is necessary:

  1. In act/pipeline/fuzzing/actfuzzer.py (ACTFuzzer.__init__), replace

    self.output_spec = cast(Optional[OutputSpec], self._extract_spec(OutputSpecLayer))

    with

    self.output_spec = self.model.output_spec.spec

    and update step 4 of the __init__ docstring, which still says the output spec comes from _extract_spec(OutputSpecLayer)?

  2. If needed, in act/pipeline/fuzzing/mutations.py, delete the Raises: block (TypeError / ValueError) from the _resolve_attack_target docstring. This PR removes both exceptions.

And for me, I think it is ok: in PGDMutation.mutate, remove the model: nn.Module annotation. The base MutationStrategy.mutate already declares it, and the other overrides don't repeat it.

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.

3 participants