Commit 651a7dd
refactor(core): type EvaluatorProtocol returns as AuditRecord
Closes doc item 1.2 — every ``evaluate_*`` method on
``EvaluatorProtocol`` returned ``-> Any``, forcing callers to downcast
to the type they already knew the concrete evaluator was returning.
The concrete ``GovernanceEvaluator`` in uipath-runtime-python already
declares ``-> AuditRecord`` on each per-hook method, so narrowing the
protocol contract is structurally compatible — no behavior change, no
downstream code change required.
Narrows the six evaluate_* return types (before_agent / after_agent /
before_model / after_model / tool_call / after_tool) from Any to
AuditRecord, imports the type from uipath.core.governance.models, and
refreshes the class docstring (was claiming the protocol is
intentionally Any because the audit record "lives in the plugin
package" — but AuditRecord lives right here in uipath-core).
Verified
- ruff clean, mypy clean (45 source files), 230 passed + 1 skipped in
uipath-core.
- uipath-runtime-python's test suite (357 passed + 1 skipped) keeps
green when this version of uipath-core is installed — the protocol-
conformance tests in test_evaluator.py still pass because the
concrete GovernanceEvaluator was already returning AuditRecord from
every evaluate_* method.
Rides on the same 0.5.23 version bump as the previous commit — both
changes ship together as one public-surface change on uipath-core.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent da282a9 commit 651a7dd
1 file changed
Lines changed: 17 additions & 14 deletions
Lines changed: 17 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
18 | 20 | | |
19 | 21 | | |
20 | 22 | | |
21 | | - | |
| 23 | + | |
22 | 24 | | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
27 | 30 | | |
28 | 31 | | |
29 | 32 | | |
| |||
34 | 37 | | |
35 | 38 | | |
36 | 39 | | |
37 | | - | |
| 40 | + | |
38 | 41 | | |
39 | 42 | | |
40 | 43 | | |
| |||
45 | 48 | | |
46 | 49 | | |
47 | 50 | | |
48 | | - | |
| 51 | + | |
49 | 52 | | |
50 | 53 | | |
51 | 54 | | |
| |||
58 | 61 | | |
59 | 62 | | |
60 | 63 | | |
61 | | - | |
| 64 | + | |
62 | 65 | | |
63 | 66 | | |
64 | 67 | | |
| |||
69 | 72 | | |
70 | 73 | | |
71 | 74 | | |
72 | | - | |
| 75 | + | |
73 | 76 | | |
74 | 77 | | |
75 | 78 | | |
| |||
82 | 85 | | |
83 | 86 | | |
84 | 87 | | |
85 | | - | |
| 88 | + | |
86 | 89 | | |
87 | 90 | | |
88 | 91 | | |
| |||
94 | 97 | | |
95 | 98 | | |
96 | 99 | | |
97 | | - | |
| 100 | + | |
98 | 101 | | |
99 | 102 | | |
0 commit comments