Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

CI run against latest deps is failing #16100

Closed
github-actions bot opened this issue Aug 11, 2023 · 3 comments · Fixed by #16213
Closed

CI run against latest deps is failing #16100

github-actions bot opened this issue Aug 11, 2023 · 3 comments · Fixed by #16213
Labels
T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks.

Comments

@github-actions
Copy link
Contributor

github-actions bot commented Aug 11, 2023

See https://github.com/matrix-org/synapse/actions/runs/6026417807

@DMRobertson
Copy link
Contributor

Oh, this has been failing for three weeks.

Run poetry run mypy
synapse/handlers/initial_sync.py:203: error: Argument 1 to "addCallback" of "Deferred" has incompatible type "Callable[[Dict[str, Mapping[Tuple[str, str], EventBase]]], Mapping[Tuple[str, str], EventBase]]"; expected "Callable[[Dict[str, Mapping[Tuple[str, str], EventBase]]], Failure]"  [arg-type]
synapse/handlers/initial_sync.py:203: error: Redundant cast to "Mapping[Tuple[str, str], EventBase]"  [redundant-cast]
synapse/handlers/initial_sync.py:203: error: Incompatible return value type (got "Mapping[Tuple[str, str], EventBase]", expected "Failure")  [return-value]
Found 3 errors in 1 file (checked 853 source files)

We might need to suppress redundant casts like we do in the twisted trunk job---but there's more going on here.

@DMRobertson DMRobertson closed this as not planned Won't fix, can't repro, duplicate, stale Aug 29, 2023
@DMRobertson DMRobertson reopened this Aug 29, 2023
@DMRobertson
Copy link
Contributor

...that was the wrong issue

@DMRobertson DMRobertson added the T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks. label Aug 29, 2023
@DMRobertson
Copy link
Contributor

The redundant cast is

lambda states: cast(StateMap[EventBase], states[event.event_id])

which mypy can deduce for itself using the latest twisted annotations. If we make mypy ignore the redundant cast, or remove the cast entirely, then it passes. So I think the extra complains that mypy makes are false positives---something to do with mypy's overload resolution?

Fix is to port over the ignore-redundant-casts change from #16121

Later, when we bump the lockfile to use the latest twisted, we can remove the cast entirely.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant