Skip to content

Commit 1e40891

Browse files
viswa-uipathclaude
andauthored
feat(core): add EnforcementMode enum to governance contracts (#1727)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent b722091 commit 1e40891

7 files changed

Lines changed: 34 additions & 15 deletions

File tree

packages/uipath-core/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "uipath-core"
3-
version = "0.5.18"
3+
version = "0.5.19"
44
description = "UiPath Core abstractions"
55
readme = { file = "README.md", content-type = "text/markdown" }
66
requires-python = ">=3.11"

packages/uipath-core/src/uipath/core/governance/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@
1818
GovernanceViolation,
1919
Severity,
2020
)
21-
from .models import Action, AuditRecord, LifecycleHook, RuleEvaluation
21+
from .models import Action, AuditRecord, EnforcementMode, LifecycleHook, RuleEvaluation
2222

2323
__all__ = [
2424
# Output models (cross adapter boundary)
2525
"Action",
2626
"AuditRecord",
27+
"EnforcementMode",
2728
"LifecycleHook",
2829
"RuleEvaluation",
2930
# Config

packages/uipath-core/src/uipath/core/governance/config.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
"""Governance configuration.
22
33
Process-level feature-flag gate that decides whether the Python
4-
governance checker runs at all. Enforcement mode is per-policy and
5-
lives in the runtime package alongside the ``/runtime/policy`` client.
4+
governance checker runs at all. The
5+
:class:`uipath.core.governance.EnforcementMode` value type is defined
6+
in :mod:`uipath.core.governance.models`; the per-policy runtime state
7+
that selects a mode (backend-supplied via the ``/runtime/policy``
8+
client) lives in the ``uipath-runtime`` package.
69
"""
710

811
from __future__ import annotations

packages/uipath-core/src/uipath/core/governance/models.py

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
1-
"""Shared governance output types.
2-
3-
These dataclasses cross the adapter boundary — every evaluator
4-
implementation (native, AGT, composite, …) produces them, and every
5-
adapter consumes them. They are kept free of policy-input concepts
6-
(``Rule``/``Check``/``Condition``) so the adapter packages don't
7-
inherit the native policy model.
1+
"""Shared governance contracts.
2+
3+
Two groups of types live here, both kept free of policy-input concepts
4+
(``Rule``/``Check``/``Condition``) so adapter packages don't inherit
5+
the native policy model:
6+
7+
- **Output types** (:class:`Action`, :class:`LifecycleHook`,
8+
:class:`RuleEvaluation`, :class:`AuditRecord`) — cross the adapter
9+
boundary at evaluation time: every evaluator implementation (native,
10+
AGT, composite, …) produces them, and every adapter consumes them.
11+
- **Configuration value types** (:class:`EnforcementMode`) — describe
12+
governance configuration shared by core, runtime, and consumers. The
13+
runtime state that selects an enforcement mode lives in
14+
``uipath-runtime``; only the value type lives here.
815
"""
916

1017
from __future__ import annotations
@@ -35,6 +42,14 @@ class LifecycleHook(str, Enum):
3542
AFTER_TOOL = "after_tool"
3643

3744

45+
class EnforcementMode(str, Enum):
46+
"""Governance enforcement modes."""
47+
48+
AUDIT = "audit" # Evaluate and log; never block.
49+
ENFORCE = "enforce" # Block on DENY rules.
50+
DISABLED = "disabled" # Skip evaluation entirely.
51+
52+
3853
@dataclass
3954
class RuleEvaluation:
4055
"""Result of evaluating a single rule."""

packages/uipath-core/uv.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/uipath-platform/uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/uipath/uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)