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

annotation issues #2775

Closed
jku opened this issue Jan 30, 2025 · 1 comment · Fixed by #2778
Closed

annotation issues #2775

jku opened this issue Jan 30, 2025 · 1 comment · Fixed by #2778

Comments

@jku
Copy link
Member

jku commented Jan 30, 2025

If we enable securesystemslib type checks (which we can't really yet do because secure-systems-lab/securesystemslib#944), it shows two issues in python-tuf:

tuf/api/serialization/json.py:101: error: Item "None" of "str | None" has no attribute "encode"  [union-attr]

This looks trivial to fix: encode_canonical() can return None but only if it's given the output_function argument. We can just do assert canonical_str is not None to silence this

tuf/api/dsse.py:84: error: Incompatible return value type (got "Envelope", expected "SimpleEnvelope[Root]")  [return-value]
tuf/api/dsse.py:84: error: Incompatible return value type (got "Envelope", expected "SimpleEnvelope[Timestamp]")  [return-value]
tuf/api/dsse.py:84: error: Incompatible return value type (got "Envelope", expected "SimpleEnvelope[Snapshot]")  [return-value]
tuf/api/dsse.py:84: error: Incompatible return value type (got "Envelope", expected "SimpleEnvelope[Targets]")  [return-value]

not entirely sure how to fix this one: maybe just typing.cast() call?

@jku
Copy link
Member Author

jku commented Jan 30, 2025

I think SimpleEnvelope should not even have the contained type (like Root in SimpleEnvelope[Root]): SimpleEnvelope does not really know what it contains, unlike Metadata.

That said, maybe the fix here is still just a cast

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 a pull request may close this issue.

1 participant