Skip to content

Commit ce83277

Browse files
ci(platform): enforce uipath.platform layering with import-linter
Add an import-linter layers contract over uipath.platform, enforced as a CI step in the lint-uipath-platform job. The contract statically forbids import cycles and upward imports between domain packages — the class of bug behind the 0.1.89 identity/common incident (#1787). Type-checking imports are excluded; the contract is exhaustive so new subpackages must be assigned a layer explicitly. The contract is intentionally committed without ignores: lint-imports fails at this commit on the pre-existing upward imports from common/interrupt_models.py, fixed in the next commit. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent f5c00cc commit ce83277

5 files changed

Lines changed: 149 additions & 0 deletions

File tree

.github/workflows/lint-packages.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,11 @@ jobs:
139139
working-directory: packages/uipath-platform
140140
run: uv run ruff format --check .
141141

142+
- name: Check import contracts
143+
if: steps.check.outputs.skip != 'true'
144+
working-directory: packages/uipath-platform
145+
run: uv run lint-imports
146+
142147
lint-uipath:
143148
name: Lint uipath
144149
needs: detect-changed-packages

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ wheels/
2828

2929
.cache/*
3030
.cache
31+
.import_linter_cache/
3132
site
3233

3334

packages/uipath-platform/CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ pytest tests/services/test_assets_service.py # Single test file
1717
ruff check . # Lint
1818
ruff format --check . # Format check
1919
mypy src tests # Type check
20+
uv run lint-imports # Import-graph layering contract
2021
```
2122

2223
No justfile exists for this package — run commands directly.

packages/uipath-platform/pyproject.toml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ dev = [
4747
"pytest-cov>=4.1.0",
4848
"pytest-mock>=3.11.1",
4949
"pre-commit>=4.1.0",
50+
"import-linter>=2.0",
5051
]
5152

5253
[tool.hatch.build.targets.wheel]
@@ -126,6 +127,25 @@ exclude_lines = [
126127
"@(abc\\.)?abstractmethod",
127128
]
128129

130+
[tool.importlinter]
131+
root_package = "uipath.platform"
132+
exclude_type_checking_imports = true
133+
134+
[[tool.importlinter.contracts]]
135+
id = "platform-layers"
136+
name = "uipath.platform layered architecture"
137+
type = "layers"
138+
containers = ["uipath.platform"]
139+
exhaustive = true
140+
layers = [
141+
"_uipath : guardrails : resume_triggers",
142+
"agenthub : automation_ops : automation_tracker : connections : context_grounding : entities : external_applications : governance : memory : pii_detection : portal : resource_catalog : semantic_proxy",
143+
"orchestrator",
144+
"action_center : attachments : chat : documents : identity",
145+
"common",
146+
"constants : errors",
147+
]
148+
129149
[tool.uv]
130150
exclude-newer = "2 days"
131151

0 commit comments

Comments
 (0)