Open
Conversation
ValbuenaVC
reviewed
Apr 9, 2026
Contributor
ValbuenaVC
left a comment
There was a problem hiding this comment.
Two nits, looks good!
| assert CapabilityName.SYSTEM_PROMPT in reqs.required_capabilities | ||
|
|
||
|
|
||
| def test_frozen_dataclass_is_immutable(): |
Contributor
There was a problem hiding this comment.
nit: isn't this guaranteed by Python itself? Or do you want to just make sure that the attribute is frozen rather than that freezing works
|
|
||
|
|
||
| @dataclass(frozen=True) | ||
| class TargetRequirements: |
Contributor
There was a problem hiding this comment.
Nit: I'm not sure I understand the point of this dataclass. What does this do that a validate method attached to TargetConfiguration or TargetCapabilities doesn't? Attaching TargetCapabilities to a consumer object is weird but this class seems like it could be reduced to a private attribute for consumers (_REQUIRED_CAPABILITIES: frozenset) while the validation method is moved elsewhere. Non-blocking comment since this works but worth documenting
rlundeen2
approved these changes
Apr 10, 2026
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.
Description
Adds TargetRequirements, the consumer-side counterpart to TargetConfiguration. Useful for consumers (attacks, converters, scorers) to validate their requirements against a target's configuration at construction time. TargetRequirements is the mechanism for that — a frozen, declarative description of what capabilities a consumer needs, validated in a single call.
for example, a CrescendoAttack would use requirements :
If the target natively supports the capabilities, validation passes. If not, the TargetConfiguration's CapabilityHandlingPolicy is consulted — if the policy is ADAPT, normalization will handle it; if RAISE (or no policy exists), validate() collects all violations and raises a single ValueError eg:
ValueError: Target does not satisfy 2 required capability(ies):
Tests and Documentation