Repository navigation
MAINT: Fix ty unsound-assignment findings (UA-3) - #4520
Merged
Roman Lutz (romanlutz) merged 7 commits intoNov 22, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the typing and runtime-validation changes.
No open issues 🎉
What changed in this PR
Advances UA-3 of #4402 by resolving ty unsound-assignment findings in authentication, embeddings, and prompt targets, allowing seven files to leave the temporary override list.
Changes:
- Adds runtime validation for embedding settings, Azure SAS tokens, and OpenAI error payloads, with focused unit tests.
- Preserves decorated function signatures in
pyrit_target_retryand tightens local typing. - Removes the seven resolved paths from the temporary type-checking exemptions.
| File | Description |
|---|---|
tests/unit/prompt_target/target/test_prompt_target_azure_blob_storage.py |
Tests rejection of non-string SAS tokens. |
tests/unit/prompt_target/target/test_openai_error_handling.py |
Tests dictionary key validation and clarifies a test docstring. |
tests/unit/embedding/test_azure_text_embedding.py |
Tests rejection of non-string endpoints and model names. |
pyrit/prompt_target/prompt_shield_target.py |
Uses object annotations for values checked only for truthiness. |
pyrit/prompt_target/openai/openai_response_target.py |
Separates the extra-tools variable from existing typed state. |
pyrit/prompt_target/openai/openai_error_handling.py |
Validates string-keyed error payload dictionaries. |
pyrit/prompt_target/common/discover_target_capabilities.py |
Uses floating-point exponentiation for retry backoff. |
pyrit/prompt_target/azure_blob_storage_target.py |
Validates the resolved SAS token type. |
pyrit/exceptions/exception_classes.py |
Preserves retry-decorated parameter and return types. |
pyrit/embedding/openai_text_embedding.py |
Validates resolved endpoint and model-name types. |
pyrit/auth/browser_session_copilot_authenticator.py |
Explicitly types the token future with a justified cast. |
pyproject.toml |
Removes seven resolved unsound-assignment exemptions. |
Review effort: Balanced
Roman Lutz (romanlutz)
approved these changes
Nov 21, 2026
# Conflicts: # pyproject.toml
… into investigate/4402-ua3
Roman Lutz (romanlutz)
enabled auto-merge
November 22, 2026 07:59
# Conflicts: # pyproject.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Relates to #4402 (UA-3).
tyunsound-assignmentfindings acrosspyrit/prompt_target,pyrit/embedding, andpyrit/auth.pyrit_target_retryto resolve an OpenAI Response target typing error.tyoverrides inpyproject.toml.Validation
ty 0.0.99: No remainingunsound-assignmentdiagnostics in the assigned directories.git diff --checkpassed.The broader type check still reports diagnostics associated with unavailable optional dependencies (
a2a,copilot, andlitellm).Scope
The shared retry decorator typing change is included because its previous
Callable[..., Any]signature erased the return type of the decorated OpenAI Response target method.The separately identified Prompt Shield response-count validation issue is not included in this PR.