Skip to content
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

Typing errors after downtime #1262

Closed
qstokkink opened this issue Jan 16, 2024 · 3 comments · Fixed by #1263
Closed

Typing errors after downtime #1262

qstokkink opened this issue Jan 16, 2024 · 3 comments · Fixed by #1263
Labels
priority: high Bugs, broken functionality or critical features

Comments

@qstokkink
Copy link
Collaborator

qstokkink commented Jan 16, 2024

Our mypy check was silently passing after the Jenkins upgrade. I fixed this today and uncovered several hidden type inconsistencies:

Outdated inconsistencies (see below for recent ones)
ipv8/REST/base_endpoint.py:35: error: Argument "middlewares" to "Application" has incompatible type "Iterable[Union[Callable[[Request, Callable[[Request], Awaitable[StreamResponse]]], Awaitable[StreamResponse]], Callable[[Application, Callable[[Request], Awaitable[StreamResponse]]], Awaitable[Callable[[Request], Awaitable[StreamResponse]]]]]]"; expected "Iterable[Callable[[Request, Callable[[Request], Awaitable[StreamResponse]]], Awaitable[StreamResponse]]]"  [arg-type]
ipv8/messaging/anonymization/tunnel.py:645: error: Argument 1 to "sum" has incompatible type "list[Union[list[IntroductionPoint], BaseException]]"; expected "Iterable[list[Union[list[IntroductionPoint], BaseException]]]"  [arg-type]
ipv8/messaging/anonymization/tunnel.py:646: error: Argument 1 to "on_success" has incompatible type "list[Union[list[IntroductionPoint], BaseException]]"; expected "list[IntroductionPoint]"  [arg-type]
ipv8/dht/community.py:640: error: Incompatible types in assignment (expression has type "list[Union[list[Node], list[tuple[bytes, Optional[bytes]]], tuple[list[tuple[bytes, Optional[bytes]]], Crawl]]]", variable has type "Union[list[list[Node]], list[list[tuple[bytes, Optional[bytes]]]], list[tuple[list[tuple[bytes, Optional[bytes]]], Crawl]]]")  [assignment]
ipv8/messaging/anonymization/hidden_services.py:175: error: List comprehension has incompatible type List[Union[list[IntroductionPoint], None, BaseException]]; expected List[Optional[IntroductionPoint]]  [misc]
ipv8/messaging/anonymization/exit_socket.py:14: error: Module "ipv8.messaging.anonymization.tunnel" has no attribute "RoutingObject"  [attr-defined]
ipv8/messaging/anonymization/exit_socket.py:263: error: "Hop" has no attribute "address"  [attr-defined]
ipv8/messaging/anonymization/crypto.py:19: error: Module "ipv8.messaging.anonymization.tunnel" has no attribute "BACKWARD"  [attr-defined]
ipv8/messaging/anonymization/crypto.py:19: error: Module "ipv8.messaging.anonymization.tunnel" has no attribute "FORWARD"  [attr-defined]
ipv8/messaging/anonymization/crypto.py:210: error: "RelayRoute" has no attribute "hop"  [attr-defined]
ipv8/messaging/anonymization/crypto.py:211: error: "RelayRoute" has no attribute "hop"  [attr-defined]
ipv8/messaging/anonymization/crypto.py:214: error: "RelayRoute" has no attribute "direction"  [attr-defined]
ipv8/messaging/anonymization/crypto.py:216: error: "RelayRoute" has no attribute "hop"  [attr-defined]
ipv8/messaging/anonymization/crypto.py:218: error: "RelayRoute" has no attribute "hop"  [attr-defined]
ipv8/messaging/anonymization/crypto.py:226: error: "RelayRoute" has no attribute "hop"  [attr-defined]
ipv8/messaging/anonymization/crypto.py:243: error: "Circuit" has no attribute "hop"; maybe "hops"?  [attr-defined]
ipv8/messaging/anonymization/crypto.py:243: error: Argument 2 to "Hop" has incompatible type "SessionKeys"; expected "Optional[list[int]]"  [arg-type]
ipv8/messaging/anonymization/crypto.py:249: error: "RelayRoute" has no attribute "hop"  [attr-defined]
ipv8/messaging/anonymization/crypto.py:253: error: "RelayRoute" has no attribute "direction"  [attr-defined]
ipv8/messaging/anonymization/crypto.py:253: error: "RelayRoute" has no attribute "hop"  [attr-defined]
ipv8/messaging/anonymization/crypto.py:279: error: "Circuit" has no attribute "hop"; maybe "hops"?  [attr-defined]
ipv8/messaging/anonymization/crypto.py:279: error: Argument 2 to "Hop" has incompatible type "SessionKeys"; expected "Optional[list[int]]"  [arg-type]
ipv8/messaging/anonymization/crypto.py:295: error: "Hop" has no attribute "keys"  [attr-defined]
ipv8/messaging/anonymization/crypto.py:300: error: "Hop" has no attribute "keys"  [attr-defined]
ipv8/messaging/anonymization/crypto.py:315: error: "Hop" has no attribute "keys"  [attr-defined]
ipv8/messaging/anonymization/crypto.py:320: error: "Hop" has no attribute "keys"  [attr-defined]

Found 26 errors in 6 files (checked 233 source files)

This will fail every PR that is introduced on IPv8: high priority. Not quite a network-wide catastrophe but still very bad.

@qstokkink qstokkink added the priority: high Bugs, broken functionality or critical features label Jan 16, 2024
@qstokkink

This comment was marked as outdated.

@qstokkink
Copy link
Collaborator Author

I forced a workspace clear before running, now we have less inconsistencies:

ipv8/REST/base_endpoint.py:35: error: Argument "middlewares" to "Application" has incompatible type "Iterable[Union[Callable[[Request, Callable[[Request], Awaitable[StreamResponse]]], Awaitable[StreamResponse]], Callable[[Application, Callable[[Request], Awaitable[StreamResponse]]], Awaitable[Callable[[Request], Awaitable[StreamResponse]]]]]]"; expected "Iterable[Callable[[Request, Callable[[Request], Awaitable[StreamResponse]]], Awaitable[StreamResponse]]]"  [arg-type]
ipv8/messaging/anonymization/tunnel.py:645: error: Argument 1 to "sum" has incompatible type "list[Union[list[IntroductionPoint], BaseException]]"; expected "Iterable[list[Union[list[IntroductionPoint], BaseException]]]"  [arg-type]
ipv8/messaging/anonymization/tunnel.py:646: error: Argument 1 to "on_success" has incompatible type "list[Union[list[IntroductionPoint], BaseException]]"; expected "list[IntroductionPoint]"  [arg-type]
ipv8/dht/community.py:640: error: Incompatible types in assignment (expression has type "list[Union[list[Node], list[tuple[bytes, Optional[bytes]]], tuple[list[tuple[bytes, Optional[bytes]]], Crawl]]]", variable has type "Union[list[list[Node]], list[list[tuple[bytes, Optional[bytes]]]], list[tuple[list[tuple[bytes, Optional[bytes]]], Crawl]]]")  [assignment]
ipv8/messaging/anonymization/hidden_services.py:175: error: List comprehension has incompatible type List[Union[list[IntroductionPoint], None, BaseException]]; expected List[Optional[IntroductionPoint]]  [misc]
Found 5 errors in 4 files (checked 231 source files)

@qstokkink
Copy link
Collaborator Author

I can verify the above locally: these are actual inconsistencies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: high Bugs, broken functionality or critical features
Development

Successfully merging a pull request may close this issue.

1 participant