You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ANISE currently contains instances where unreachable panics occur within match statements, as well as cases where malformed structs may cause panics during type conversions. To improve safety and robustness, this issue proposes introducing new struct and enum types that enforce invariants at the type level, preventing invalid states from being representable.
By encoding constraints directly in the type system, we can eliminate unreachable panics and reduce the risk of runtime failures due to malformed data.
Requirements
Prevent parsing from creating structs with invalid internal state
Replace unstructured types with domain-specific types
Test plans
Include regression tests that reproduce original error
Ensure that regression tests pass following implementation
Design
Replace match arms with unreachable statements with exhausting enums
Use the newtype pattern to prevent invalid data from being constructed
Use TryFrom to gracefully handle fallible conversions
Where necessary, annotate enums as non_exhaustive to prevent introducing breaking changes
The text was updated successfully, but these errors were encountered:
Thanks for creating all of these issues Johnathan, I think they're spot-on. One thing to keep in mind is the Python interface, which doesn't support the same level of generics as the Rust code. Let me know if the documentation needs clarifications on how to set up the Rust or Python development environments.
High level description
ANISE currently contains instances where unreachable panics occur within match statements, as well as cases where malformed structs may cause panics during type conversions. To improve safety and robustness, this issue proposes introducing new struct and enum types that enforce invariants at the type level, preventing invalid states from being representable.
By encoding constraints directly in the type system, we can eliminate unreachable panics and reduce the risk of runtime failures due to malformed data.
Requirements
Test plans
Design
TryFrom
to gracefully handle fallible conversionsnon_exhaustive
to prevent introducing breaking changesThe text was updated successfully, but these errors were encountered: