Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
| """ | ||
| server_controls: list[_ControlAdapter] = [] | ||
|
|
||
| for control in controls: |
There was a problem hiding this comment.
for control in controls:
control_data = control.get("control")
if not isinstance(control_data, dict):
_logger.warning(f"Malformed control payload: {control}")
return True
if control_data.get("execution") != "server":
continue
try:
control_def = ControlDefinition.model_validate(control_data)
server_controls.append(
_ControlAdapter(
id=control["id"],
name=control["name"],
control=control_def,
)
)
except Exception:
_logger.warning(f"Failed to parse server control: {control}")
return True
if not server_controls:
return False
return bool(_get_applicable_controls(server_controls, request, context="server"))
There was a problem hiding this comment.
NOTE: Adding server check, to ensure we are looking at server controls. If the intention is to look at both sdk as well as server controls, then we should rename this function appropriately.
if control_data.get("execution") != "server":
continue
There was a problem hiding this comment.
or atleast call out the details in the DocString
There was a problem hiding this comment.
Good call. The helper only ever receives the server subset after the execution partitioning in check_evaluation_with_local(), so I did not want to add a second execution == "server" check inside it and make the contract even less explicit.\n\nI pushed a small follow-up in 91f4596 that makes that assumption clearer instead: renamed the helper to _has_applicable_prefiltered_server_controls(...), renamed the input to server_control_payloads, and expanded the docstring to say that the caller has already partitioned by execution before calling it.\n\nSo behavior is unchanged, but the boundary should be much less surprising now.
Summary
execution="sdk") and server (execution="server") controls using the same applicability rules before any evaluation work starts.Scope
POST /api/v1/evaluationrequest.Risk and Rollout
Testing
make check(or explained why not)make test, plus targetedruffandmypyon the touched SDK files.Checklist