gtaf-runtime 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- gtaf_runtime-0.1.0/LICENSE +21 -0
- gtaf_runtime-0.1.0/MANIFEST.in +3 -0
- gtaf_runtime-0.1.0/PKG-INFO +222 -0
- gtaf_runtime-0.1.0/README.md +209 -0
- gtaf_runtime-0.1.0/gtaf_runtime/__init__.py +13 -0
- gtaf_runtime-0.1.0/gtaf_runtime/enforce.py +257 -0
- gtaf_runtime-0.1.0/gtaf_runtime/errors.py +10 -0
- gtaf_runtime-0.1.0/gtaf_runtime/schemas/dr.schema.json +32 -0
- gtaf_runtime-0.1.0/gtaf_runtime/schemas/drc.schema.json +76 -0
- gtaf_runtime-0.1.0/gtaf_runtime/schemas/rb.schema.json +26 -0
- gtaf_runtime-0.1.0/gtaf_runtime/schemas/runtime_context.schema.json +23 -0
- gtaf_runtime-0.1.0/gtaf_runtime/schemas/sb.schema.json +34 -0
- gtaf_runtime-0.1.0/gtaf_runtime/types.py +18 -0
- gtaf_runtime-0.1.0/gtaf_runtime.egg-info/PKG-INFO +222 -0
- gtaf_runtime-0.1.0/gtaf_runtime.egg-info/SOURCES.txt +23 -0
- gtaf_runtime-0.1.0/gtaf_runtime.egg-info/dependency_links.txt +1 -0
- gtaf_runtime-0.1.0/gtaf_runtime.egg-info/top_level.txt +1 -0
- gtaf_runtime-0.1.0/pyproject.toml +30 -0
- gtaf_runtime-0.1.0/setup.cfg +4 -0
- gtaf_runtime-0.1.0/tests/test_allow.py +57 -0
- gtaf_runtime-0.1.0/tests/test_contract_fixture_root_guard.py +12 -0
- gtaf_runtime-0.1.0/tests/test_deny.py +99 -0
- gtaf_runtime-0.1.0/tests/test_edge_cases.py +92 -0
- gtaf_runtime-0.1.0/tests/test_projection_v0_1_contract.py +227 -0
- gtaf_runtime-0.1.0/tests/test_projection_v0_1_fixtures.py +53 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 TNT Intelligence
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: gtaf-runtime
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Reference implementation of the GTAF Runtime Enforcement Core
|
|
5
|
+
Author-email: TNT Intelligence <contact@tnt-intelligence.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://gtaf.tnt-intelligence.com
|
|
8
|
+
Project-URL: Repository, https://github.com/TNT-Intelligence/gtaf-runtime-py
|
|
9
|
+
Requires-Python: >=3.10
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Dynamic: license-file
|
|
13
|
+
|
|
14
|
+
# GTAF Runtime (Python)
|
|
15
|
+
Official reference implementation of the GTAF Runtime Enforcement core.
|
|
16
|
+
|
|
17
|
+
This repository is `gtaf-runtime-py`.
|
|
18
|
+
|
|
19
|
+
`gtaf-runtime` is a **deterministic, artifact-driven enforcement gate** for delegated actions.
|
|
20
|
+
It consumes evaluated governance outputs (for example DRC + referenced artifacts) and returns binary runtime outcomes.
|
|
21
|
+
|
|
22
|
+
## Status
|
|
23
|
+
This repository is the **runtime enforcement implementation**, not the normative reference.
|
|
24
|
+
Current package version: **0.1.0**.
|
|
25
|
+
|
|
26
|
+
## Scope
|
|
27
|
+
This repository contains:
|
|
28
|
+
- a minimal enforcement API (`enforce`, with backward-compatible `evaluate` alias)
|
|
29
|
+
- deterministic rule evaluation with default-deny behavior
|
|
30
|
+
- machine-readable deny reason codes
|
|
31
|
+
- tests for allow/deny and rule-order edge cases
|
|
32
|
+
|
|
33
|
+
## Runtime Specification
|
|
34
|
+
The runtime projection contract is formally defined in `SPEC.md`.
|
|
35
|
+
|
|
36
|
+
Projection v0.1 documents the exact input surface consumed by `enforce()` and reflects the current implementation without redefining normative GTAF artifacts.
|
|
37
|
+
The canonical Projection v0.1 contract fixture kit is `contract_fixtures/v0.1/`.
|
|
38
|
+
Normative Projection v0.1 runtime contract: `docs/projection-v0.1.md`.
|
|
39
|
+
|
|
40
|
+
## Runtime Stability & Compatibility
|
|
41
|
+
|
|
42
|
+
### Stability Level
|
|
43
|
+
|
|
44
|
+
The current package version is `0.1.x`.
|
|
45
|
+
|
|
46
|
+
The runtime is considered **alpha with respect to API ergonomics**, but the
|
|
47
|
+
**Projection v0.1 semantic contract is frozen**.
|
|
48
|
+
|
|
49
|
+
This means:
|
|
50
|
+
|
|
51
|
+
- Enforcement semantics defined in `docs/projection-v0.1.md` are stable.
|
|
52
|
+
- Evaluation order, first-failure behavior, and reason code meaning are frozen for Projection v0.1.
|
|
53
|
+
- Runtime API ergonomics (e.g., module organization, helper layout) may evolve
|
|
54
|
+
as long as enforcement semantics remain unchanged.
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
### Projection Contract Freeze (v0.1)
|
|
58
|
+
|
|
59
|
+
Projection v0.1 defines a deterministic runtime contract.
|
|
60
|
+
|
|
61
|
+
For Projection version `"0.1"`:
|
|
62
|
+
|
|
63
|
+
- Canonical evaluation order is frozen.
|
|
64
|
+
- First-failure semantics are frozen.
|
|
65
|
+
- Ordering sensitivity rules are frozen.
|
|
66
|
+
- Reason code meaning is frozen.
|
|
67
|
+
|
|
68
|
+
Any change to these semantics requires a **MAJOR version increment**
|
|
69
|
+
of the Projection contract.
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
### Supported Projection Versions
|
|
73
|
+
|
|
74
|
+
The runtime currently supports Projection version:
|
|
75
|
+
|
|
76
|
+
- `"0.1"`
|
|
77
|
+
|
|
78
|
+
If a DRC declares an unsupported `gtaf_ref.version`,
|
|
79
|
+
`enforce()` SHALL return:
|
|
80
|
+
|
|
81
|
+
- `outcome="DENY"`
|
|
82
|
+
- `reason_code="UNSUPPORTED_GTAF_VERSION"`
|
|
83
|
+
|
|
84
|
+
Future Projection versions (e.g. `"0.2"`) require explicit runtime support.
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
### Breaking Changes (MAJOR)
|
|
88
|
+
|
|
89
|
+
The following changes are considered breaking at the Projection contract level
|
|
90
|
+
and require a MAJOR version increment:
|
|
91
|
+
|
|
92
|
+
- Changing evaluation order.
|
|
93
|
+
- Changing first-failure semantics.
|
|
94
|
+
- Changing meaning of any existing reason code.
|
|
95
|
+
- Changing binary outcome semantics (`EXECUTE` / `DENY`).
|
|
96
|
+
- Renaming or removing reason codes.
|
|
97
|
+
- Changing ordering sensitivity behavior for `refs` resolution.
|
|
98
|
+
- Changing the contract-visible `INTERNAL_ERROR` fallback behavior.
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
### Non-Breaking Changes
|
|
102
|
+
|
|
103
|
+
The following are considered non-breaking:
|
|
104
|
+
|
|
105
|
+
- Internal refactoring.
|
|
106
|
+
- Performance improvements.
|
|
107
|
+
- Logging improvements.
|
|
108
|
+
- Documentation updates.
|
|
109
|
+
- CI changes.
|
|
110
|
+
- Non-semantic helper utilities.
|
|
111
|
+
- Internal module reorganization.
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
### Public Runtime Contract Surface
|
|
115
|
+
|
|
116
|
+
The following surface is considered stable and safe for external consumers
|
|
117
|
+
(including `gtaf-sdk-py`):
|
|
118
|
+
|
|
119
|
+
- `gtaf_runtime.enforce(...)`
|
|
120
|
+
- `gtaf_runtime.evaluate(...)` (alias of `enforce`)
|
|
121
|
+
- The `EnforcementResult` output contract shape
|
|
122
|
+
(including `outcome` and `reason_code`)
|
|
123
|
+
- Projection v0.1 semantics as defined in:
|
|
124
|
+
- `docs/projection-v0.1.md`
|
|
125
|
+
- `SPEC.md`
|
|
126
|
+
- `contract_fixtures/v0.1/`
|
|
127
|
+
- The supported Projection version policy (currently `"0.1"`)
|
|
128
|
+
|
|
129
|
+
Structural DRC validation is guaranteed as part of the `enforce()` contract
|
|
130
|
+
flow (first evaluation stage), but no separate validation helper function is
|
|
131
|
+
considered a stable public API.
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
### Internal / Non-Contractual Implementation Details
|
|
135
|
+
|
|
136
|
+
The following are NOT part of the public contract and may change without notice:
|
|
137
|
+
|
|
138
|
+
- Underscore-prefixed helpers (e.g. `_validate_drc_schema`)
|
|
139
|
+
- Internal resolution helpers
|
|
140
|
+
- Internal module layout
|
|
141
|
+
- Private utilities
|
|
142
|
+
- Internal evaluation mechanics
|
|
143
|
+
|
|
144
|
+
Consumers and SDK MUST NOT rely on internal or underscore-prefixed symbols.
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
### Relationship to SDK
|
|
148
|
+
|
|
149
|
+
`gtaf-runtime-py` is the deterministic enforcement core.
|
|
150
|
+
|
|
151
|
+
`gtaf-sdk-py` is optional and layered on top of the runtime.
|
|
152
|
+
|
|
153
|
+
The SDK MUST rely only on the documented public runtime contract surface
|
|
154
|
+
and MUST NOT depend on internal implementation details.
|
|
155
|
+
|
|
156
|
+
The SDK MUST NOT alter or reinterpret runtime enforcement semantics.
|
|
157
|
+
|
|
158
|
+
## JSON Schemas
|
|
159
|
+
|
|
160
|
+
Projection v0.1 is additionally formalized using JSON Schemas under `gtaf_runtime/schemas/`.
|
|
161
|
+
|
|
162
|
+
These schemas describe the exact runtime projection surface consumed by `enforce()` and can be used by integrators or SDKs to validate inputs prior to runtime execution.
|
|
163
|
+
|
|
164
|
+
Packaged schema resources can be accessed via `importlib.resources` from `gtaf_runtime.schemas`.
|
|
165
|
+
|
|
166
|
+
Schema validation is not performed automatically by the runtime core.
|
|
167
|
+
|
|
168
|
+
## Non-Goals
|
|
169
|
+
`gtaf-runtime` is **not**:
|
|
170
|
+
- a governance authoring tool
|
|
171
|
+
- a normative GTAF reference publication
|
|
172
|
+
- a certification or compliance platform
|
|
173
|
+
|
|
174
|
+
## Public API
|
|
175
|
+
```python
|
|
176
|
+
from gtaf_runtime import enforce
|
|
177
|
+
|
|
178
|
+
result = enforce(drc, context, artifacts)
|
|
179
|
+
if result.outcome == "DENY":
|
|
180
|
+
raise PermissionError(result.reason_code)
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
Backward compatibility:
|
|
184
|
+
```python
|
|
185
|
+
from gtaf_runtime import evaluate # alias to enforce
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## Installation
|
|
189
|
+
Install from PyPI:
|
|
190
|
+
```sh
|
|
191
|
+
pip install gtaf-runtime
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Install from local checkout:
|
|
195
|
+
```sh
|
|
196
|
+
pip install .
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
Minimal import verification:
|
|
200
|
+
```sh
|
|
201
|
+
python -c "import gtaf_runtime; from gtaf_runtime import enforce; print('ok')"
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
## Runtime Semantics (Minimal)
|
|
205
|
+
- Outcomes: `EXECUTE` or `DENY`
|
|
206
|
+
- Decision mode: deterministic, first failing rule wins
|
|
207
|
+
- Ambiguity/error handling: deny by default
|
|
208
|
+
- Explainability fields: `outcome`, `drc_id`, `revision`, `valid_until`, `reason_code`, `refs`
|
|
209
|
+
|
|
210
|
+
## Local Development
|
|
211
|
+
Run tests:
|
|
212
|
+
```sh
|
|
213
|
+
python -m unittest discover -s tests -p 'test_*.py' -v
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
## Repository Structure
|
|
217
|
+
- `gtaf_runtime/`: runtime library
|
|
218
|
+
- `tests/`: enforcement behavior tests
|
|
219
|
+
- `gtaf_runtime/schemas/`: packaged Projection v0.1 schema artifacts
|
|
220
|
+
|
|
221
|
+
## License
|
|
222
|
+
See `LICENSE`.
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
# GTAF Runtime (Python)
|
|
2
|
+
Official reference implementation of the GTAF Runtime Enforcement core.
|
|
3
|
+
|
|
4
|
+
This repository is `gtaf-runtime-py`.
|
|
5
|
+
|
|
6
|
+
`gtaf-runtime` is a **deterministic, artifact-driven enforcement gate** for delegated actions.
|
|
7
|
+
It consumes evaluated governance outputs (for example DRC + referenced artifacts) and returns binary runtime outcomes.
|
|
8
|
+
|
|
9
|
+
## Status
|
|
10
|
+
This repository is the **runtime enforcement implementation**, not the normative reference.
|
|
11
|
+
Current package version: **0.1.0**.
|
|
12
|
+
|
|
13
|
+
## Scope
|
|
14
|
+
This repository contains:
|
|
15
|
+
- a minimal enforcement API (`enforce`, with backward-compatible `evaluate` alias)
|
|
16
|
+
- deterministic rule evaluation with default-deny behavior
|
|
17
|
+
- machine-readable deny reason codes
|
|
18
|
+
- tests for allow/deny and rule-order edge cases
|
|
19
|
+
|
|
20
|
+
## Runtime Specification
|
|
21
|
+
The runtime projection contract is formally defined in `SPEC.md`.
|
|
22
|
+
|
|
23
|
+
Projection v0.1 documents the exact input surface consumed by `enforce()` and reflects the current implementation without redefining normative GTAF artifacts.
|
|
24
|
+
The canonical Projection v0.1 contract fixture kit is `contract_fixtures/v0.1/`.
|
|
25
|
+
Normative Projection v0.1 runtime contract: `docs/projection-v0.1.md`.
|
|
26
|
+
|
|
27
|
+
## Runtime Stability & Compatibility
|
|
28
|
+
|
|
29
|
+
### Stability Level
|
|
30
|
+
|
|
31
|
+
The current package version is `0.1.x`.
|
|
32
|
+
|
|
33
|
+
The runtime is considered **alpha with respect to API ergonomics**, but the
|
|
34
|
+
**Projection v0.1 semantic contract is frozen**.
|
|
35
|
+
|
|
36
|
+
This means:
|
|
37
|
+
|
|
38
|
+
- Enforcement semantics defined in `docs/projection-v0.1.md` are stable.
|
|
39
|
+
- Evaluation order, first-failure behavior, and reason code meaning are frozen for Projection v0.1.
|
|
40
|
+
- Runtime API ergonomics (e.g., module organization, helper layout) may evolve
|
|
41
|
+
as long as enforcement semantics remain unchanged.
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
### Projection Contract Freeze (v0.1)
|
|
45
|
+
|
|
46
|
+
Projection v0.1 defines a deterministic runtime contract.
|
|
47
|
+
|
|
48
|
+
For Projection version `"0.1"`:
|
|
49
|
+
|
|
50
|
+
- Canonical evaluation order is frozen.
|
|
51
|
+
- First-failure semantics are frozen.
|
|
52
|
+
- Ordering sensitivity rules are frozen.
|
|
53
|
+
- Reason code meaning is frozen.
|
|
54
|
+
|
|
55
|
+
Any change to these semantics requires a **MAJOR version increment**
|
|
56
|
+
of the Projection contract.
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
### Supported Projection Versions
|
|
60
|
+
|
|
61
|
+
The runtime currently supports Projection version:
|
|
62
|
+
|
|
63
|
+
- `"0.1"`
|
|
64
|
+
|
|
65
|
+
If a DRC declares an unsupported `gtaf_ref.version`,
|
|
66
|
+
`enforce()` SHALL return:
|
|
67
|
+
|
|
68
|
+
- `outcome="DENY"`
|
|
69
|
+
- `reason_code="UNSUPPORTED_GTAF_VERSION"`
|
|
70
|
+
|
|
71
|
+
Future Projection versions (e.g. `"0.2"`) require explicit runtime support.
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
### Breaking Changes (MAJOR)
|
|
75
|
+
|
|
76
|
+
The following changes are considered breaking at the Projection contract level
|
|
77
|
+
and require a MAJOR version increment:
|
|
78
|
+
|
|
79
|
+
- Changing evaluation order.
|
|
80
|
+
- Changing first-failure semantics.
|
|
81
|
+
- Changing meaning of any existing reason code.
|
|
82
|
+
- Changing binary outcome semantics (`EXECUTE` / `DENY`).
|
|
83
|
+
- Renaming or removing reason codes.
|
|
84
|
+
- Changing ordering sensitivity behavior for `refs` resolution.
|
|
85
|
+
- Changing the contract-visible `INTERNAL_ERROR` fallback behavior.
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
### Non-Breaking Changes
|
|
89
|
+
|
|
90
|
+
The following are considered non-breaking:
|
|
91
|
+
|
|
92
|
+
- Internal refactoring.
|
|
93
|
+
- Performance improvements.
|
|
94
|
+
- Logging improvements.
|
|
95
|
+
- Documentation updates.
|
|
96
|
+
- CI changes.
|
|
97
|
+
- Non-semantic helper utilities.
|
|
98
|
+
- Internal module reorganization.
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
### Public Runtime Contract Surface
|
|
102
|
+
|
|
103
|
+
The following surface is considered stable and safe for external consumers
|
|
104
|
+
(including `gtaf-sdk-py`):
|
|
105
|
+
|
|
106
|
+
- `gtaf_runtime.enforce(...)`
|
|
107
|
+
- `gtaf_runtime.evaluate(...)` (alias of `enforce`)
|
|
108
|
+
- The `EnforcementResult` output contract shape
|
|
109
|
+
(including `outcome` and `reason_code`)
|
|
110
|
+
- Projection v0.1 semantics as defined in:
|
|
111
|
+
- `docs/projection-v0.1.md`
|
|
112
|
+
- `SPEC.md`
|
|
113
|
+
- `contract_fixtures/v0.1/`
|
|
114
|
+
- The supported Projection version policy (currently `"0.1"`)
|
|
115
|
+
|
|
116
|
+
Structural DRC validation is guaranteed as part of the `enforce()` contract
|
|
117
|
+
flow (first evaluation stage), but no separate validation helper function is
|
|
118
|
+
considered a stable public API.
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
### Internal / Non-Contractual Implementation Details
|
|
122
|
+
|
|
123
|
+
The following are NOT part of the public contract and may change without notice:
|
|
124
|
+
|
|
125
|
+
- Underscore-prefixed helpers (e.g. `_validate_drc_schema`)
|
|
126
|
+
- Internal resolution helpers
|
|
127
|
+
- Internal module layout
|
|
128
|
+
- Private utilities
|
|
129
|
+
- Internal evaluation mechanics
|
|
130
|
+
|
|
131
|
+
Consumers and SDK MUST NOT rely on internal or underscore-prefixed symbols.
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
### Relationship to SDK
|
|
135
|
+
|
|
136
|
+
`gtaf-runtime-py` is the deterministic enforcement core.
|
|
137
|
+
|
|
138
|
+
`gtaf-sdk-py` is optional and layered on top of the runtime.
|
|
139
|
+
|
|
140
|
+
The SDK MUST rely only on the documented public runtime contract surface
|
|
141
|
+
and MUST NOT depend on internal implementation details.
|
|
142
|
+
|
|
143
|
+
The SDK MUST NOT alter or reinterpret runtime enforcement semantics.
|
|
144
|
+
|
|
145
|
+
## JSON Schemas
|
|
146
|
+
|
|
147
|
+
Projection v0.1 is additionally formalized using JSON Schemas under `gtaf_runtime/schemas/`.
|
|
148
|
+
|
|
149
|
+
These schemas describe the exact runtime projection surface consumed by `enforce()` and can be used by integrators or SDKs to validate inputs prior to runtime execution.
|
|
150
|
+
|
|
151
|
+
Packaged schema resources can be accessed via `importlib.resources` from `gtaf_runtime.schemas`.
|
|
152
|
+
|
|
153
|
+
Schema validation is not performed automatically by the runtime core.
|
|
154
|
+
|
|
155
|
+
## Non-Goals
|
|
156
|
+
`gtaf-runtime` is **not**:
|
|
157
|
+
- a governance authoring tool
|
|
158
|
+
- a normative GTAF reference publication
|
|
159
|
+
- a certification or compliance platform
|
|
160
|
+
|
|
161
|
+
## Public API
|
|
162
|
+
```python
|
|
163
|
+
from gtaf_runtime import enforce
|
|
164
|
+
|
|
165
|
+
result = enforce(drc, context, artifacts)
|
|
166
|
+
if result.outcome == "DENY":
|
|
167
|
+
raise PermissionError(result.reason_code)
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Backward compatibility:
|
|
171
|
+
```python
|
|
172
|
+
from gtaf_runtime import evaluate # alias to enforce
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## Installation
|
|
176
|
+
Install from PyPI:
|
|
177
|
+
```sh
|
|
178
|
+
pip install gtaf-runtime
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Install from local checkout:
|
|
182
|
+
```sh
|
|
183
|
+
pip install .
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Minimal import verification:
|
|
187
|
+
```sh
|
|
188
|
+
python -c "import gtaf_runtime; from gtaf_runtime import enforce; print('ok')"
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
## Runtime Semantics (Minimal)
|
|
192
|
+
- Outcomes: `EXECUTE` or `DENY`
|
|
193
|
+
- Decision mode: deterministic, first failing rule wins
|
|
194
|
+
- Ambiguity/error handling: deny by default
|
|
195
|
+
- Explainability fields: `outcome`, `drc_id`, `revision`, `valid_until`, `reason_code`, `refs`
|
|
196
|
+
|
|
197
|
+
## Local Development
|
|
198
|
+
Run tests:
|
|
199
|
+
```sh
|
|
200
|
+
python -m unittest discover -s tests -p 'test_*.py' -v
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
## Repository Structure
|
|
204
|
+
- `gtaf_runtime/`: runtime library
|
|
205
|
+
- `tests/`: enforcement behavior tests
|
|
206
|
+
- `gtaf_runtime/schemas/`: packaged Projection v0.1 schema artifacts
|
|
207
|
+
|
|
208
|
+
## License
|
|
209
|
+
See `LICENSE`.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from .enforce import evaluate, get_supported_projection_versions, validate_drc_structure
|
|
2
|
+
from .types import EnforcementResult
|
|
3
|
+
|
|
4
|
+
# Public runtime API: enforce. Keep evaluate as backwards-compatible alias.
|
|
5
|
+
enforce = evaluate
|
|
6
|
+
|
|
7
|
+
__all__ = [
|
|
8
|
+
"enforce",
|
|
9
|
+
"evaluate",
|
|
10
|
+
"validate_drc_structure",
|
|
11
|
+
"get_supported_projection_versions",
|
|
12
|
+
"EnforcementResult",
|
|
13
|
+
]
|