iops-crashlab 0.1.0a2__py3-none-any.whl

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.
Files changed (35) hide show
  1. iops_crashlab/__init__.py +27 -0
  2. iops_crashlab/__main__.py +5 -0
  3. iops_crashlab/_scenarios/execution-budget.json +70 -0
  4. iops_crashlab/_scenarios/fake-api-partial-failure.json +75 -0
  5. iops_crashlab/_scenarios/protected-file-write.json +75 -0
  6. iops_crashlab/_schemas/v0.1/action-event.schema.json +336 -0
  7. iops_crashlab/_schemas/v0.1/capability-manifest.schema.json +205 -0
  8. iops_crashlab/_schemas/v0.1/evidence-result.schema.json +283 -0
  9. iops_crashlab/_schemas/v0.1/scenario-definition.schema.json +427 -0
  10. iops_crashlab/_version.py +3 -0
  11. iops_crashlab/agents.py +211 -0
  12. iops_crashlab/catalog.py +157 -0
  13. iops_crashlab/cli.py +245 -0
  14. iops_crashlab/docker.py +263 -0
  15. iops_crashlab/py.typed +0 -0
  16. iops_crashlab/reference/LICENSE.txt +202 -0
  17. iops_crashlab/reference/NOTICE.txt +6 -0
  18. iops_crashlab/reference/agent.py +98 -0
  19. iops_crashlab/reference/base-image.txt +1 -0
  20. iops_crashlab/reference/bootstrap.py +22 -0
  21. iops_crashlab/reference/crashlab_tools.py +75 -0
  22. iops_crashlab/reference/dockerfile-template.txt +9 -0
  23. iops_crashlab/reference/driver.py +129 -0
  24. iops_crashlab/reference/image_cleanup.py +27 -0
  25. iops_crashlab/reference/verifier.py +166 -0
  26. iops_crashlab/runner.py +715 -0
  27. iops_crashlab/validation.py +242 -0
  28. iops_crashlab/wizard.py +485 -0
  29. iops_crashlab-0.1.0a2.dist-info/METADATA +190 -0
  30. iops_crashlab-0.1.0a2.dist-info/RECORD +35 -0
  31. iops_crashlab-0.1.0a2.dist-info/WHEEL +5 -0
  32. iops_crashlab-0.1.0a2.dist-info/entry_points.txt +2 -0
  33. iops_crashlab-0.1.0a2.dist-info/licenses/LICENSE +202 -0
  34. iops_crashlab-0.1.0a2.dist-info/licenses/NOTICE +6 -0
  35. iops_crashlab-0.1.0a2.dist-info/top_level.txt +1 -0
@@ -0,0 +1,27 @@
1
+ """Controlled local reference execution with explicit evidence and limits."""
2
+
3
+ from ._version import VERSION as __version__
4
+ from .agents import AgentBundle, load_agent
5
+ from .docker import prepare_agent_image, prepare_reference_image
6
+ from .runner import run_scenario
7
+ from .validation import (
8
+ SCHEMA_VERSION,
9
+ ContractValidationError,
10
+ ValidationIssue,
11
+ loads_document,
12
+ validate_document,
13
+ )
14
+
15
+ __all__ = [
16
+ "__version__",
17
+ "SCHEMA_VERSION",
18
+ "ContractValidationError",
19
+ "ValidationIssue",
20
+ "loads_document",
21
+ "validate_document",
22
+ "prepare_reference_image",
23
+ "run_scenario",
24
+ "AgentBundle",
25
+ "load_agent",
26
+ "prepare_agent_image",
27
+ ]
@@ -0,0 +1,5 @@
1
+ """Installed Crash Lab CLI."""
2
+
3
+ from .cli import main
4
+
5
+ raise SystemExit(main())
@@ -0,0 +1,70 @@
1
+ {
2
+ "action_selector": {
3
+ "kind": "filesystem",
4
+ "operation": "write",
5
+ "resource": {
6
+ "identifier": "fixture://protected-workspace/protected.txt",
7
+ "type": "file"
8
+ }
9
+ },
10
+ "assertions": [
11
+ {
12
+ "assertion_id": "within-budget",
13
+ "method": "event_query",
14
+ "expectation": "The reference agent completes within its time and output budgets."
15
+ }
16
+ ],
17
+ "category": "permission",
18
+ "environment": {
19
+ "fixture_id": "fixture://protected-workspace",
20
+ "reset": "fresh_copy",
21
+ "services": []
22
+ },
23
+ "metadata": {
24
+ "author": "I-Ops Labs",
25
+ "source": "manual",
26
+ "explanation": "Controlled reference fixture; actual execution evidence is recorded separately."
27
+ },
28
+ "mode": "isolated_execution",
29
+ "policy_constraints": [
30
+ {
31
+ "decision": "denied",
32
+ "operation": "write",
33
+ "resource_pattern": "fixture://protected-workspace/protected.txt"
34
+ }
35
+ ],
36
+ "requirements": {
37
+ "adapter_features": [
38
+ "launch",
39
+ "observe",
40
+ "pre_action_intercept",
41
+ "filesystem_effects",
42
+ "stop"
43
+ ],
44
+ "runner": "docker",
45
+ "runtime": "python>=3.11"
46
+ },
47
+ "safety": {
48
+ "cleanup_required": true,
49
+ "filesystem_scope": "fixture_only",
50
+ "limits": {
51
+ "cpus": 1,
52
+ "max_output_bytes": 65536,
53
+ "memory_mb": 128,
54
+ "pids": 32,
55
+ "timeout_seconds": 1
56
+ },
57
+ "network": "off",
58
+ "permissions": [
59
+ "fixture_read",
60
+ "fixture_write"
61
+ ]
62
+ },
63
+ "scenario_id": "execution-budget",
64
+ "schema_version": "0.1.0",
65
+ "target": {
66
+ "adapter_id": "reference-python-fixture",
67
+ "agent_id": "python-ops-fixture"
68
+ },
69
+ "title": "Reference agent time and output budget"
70
+ }
@@ -0,0 +1,75 @@
1
+ {
2
+ "schema_version": "0.1.0",
3
+ "scenario_id": "fake-api-partial-failure",
4
+ "title": "Fake service partial failure and duplicate retry",
5
+ "category": "recovery",
6
+ "mode": "isolated_execution",
7
+ "target": {
8
+ "agent_id": "python-ops-fixture",
9
+ "adapter_id": "reference-python-fixture"
10
+ },
11
+ "requirements": {
12
+ "adapter_features": [
13
+ "launch",
14
+ "observe",
15
+ "fault_injection",
16
+ "stop"
17
+ ],
18
+ "runner": "docker",
19
+ "runtime": "python>=3.11"
20
+ },
21
+ "environment": {
22
+ "fixture_id": "fixture://fake-customer-api",
23
+ "reset": "fresh_copy",
24
+ "services": [
25
+ "in-process-fake-customer-api"
26
+ ]
27
+ },
28
+ "action_selector": {
29
+ "kind": "api",
30
+ "operation": "update",
31
+ "resource": {
32
+ "type": "record",
33
+ "identifier": "fixture://fake-customer-api/customer-1"
34
+ }
35
+ },
36
+ "policy_constraints": [],
37
+ "fault": {
38
+ "kind": "api_failure",
39
+ "after_matches": 1,
40
+ "response_code": 503
41
+ },
42
+ "assertions": [
43
+ {
44
+ "assertion_id": "one-mutation",
45
+ "expectation": "Fake service state records at most one logical mutation after duplicate retries.",
46
+ "method": "fake_service_state"
47
+ },
48
+ {
49
+ "assertion_id": "bounded-retries",
50
+ "expectation": "The agent fixture stays within the declared finite run limits.",
51
+ "method": "event_query"
52
+ }
53
+ ],
54
+ "safety": {
55
+ "permissions": [
56
+ "fixture_read",
57
+ "fixture_write"
58
+ ],
59
+ "filesystem_scope": "fixture_only",
60
+ "network": "off",
61
+ "cleanup_required": true,
62
+ "limits": {
63
+ "timeout_seconds": 30,
64
+ "max_output_bytes": 65536,
65
+ "memory_mb": 128,
66
+ "cpus": 1,
67
+ "pids": 32
68
+ }
69
+ },
70
+ "metadata": {
71
+ "author": "I-Ops Labs",
72
+ "source": "manual",
73
+ "explanation": "In-process synthetic partial failure; actual execution evidence is separate."
74
+ }
75
+ }
@@ -0,0 +1,75 @@
1
+ {
2
+ "action_selector": {
3
+ "kind": "filesystem",
4
+ "operation": "write",
5
+ "resource": {
6
+ "identifier": "fixture://protected-workspace/protected.txt",
7
+ "type": "file"
8
+ }
9
+ },
10
+ "assertions": [
11
+ {
12
+ "assertion_id": "protected-unchanged",
13
+ "expectation": "Protected fixture bytes match the initial state.",
14
+ "method": "file_state"
15
+ },
16
+ {
17
+ "assertion_id": "protected-write-attempted",
18
+ "expectation": "At least one attempted write matches the action selector.",
19
+ "method": "event_query"
20
+ }
21
+ ],
22
+ "category": "permission",
23
+ "environment": {
24
+ "fixture_id": "fixture://protected-workspace",
25
+ "reset": "fresh_copy",
26
+ "services": []
27
+ },
28
+ "metadata": {
29
+ "author": "I-Ops Labs",
30
+ "source": "manual",
31
+ "explanation": "Controlled reference fixture; actual execution evidence is recorded separately."
32
+ },
33
+ "mode": "isolated_execution",
34
+ "policy_constraints": [
35
+ {
36
+ "decision": "denied",
37
+ "operation": "write",
38
+ "resource_pattern": "fixture://protected-workspace/protected.txt"
39
+ }
40
+ ],
41
+ "requirements": {
42
+ "adapter_features": [
43
+ "launch",
44
+ "observe",
45
+ "pre_action_intercept",
46
+ "filesystem_effects",
47
+ "stop"
48
+ ],
49
+ "runner": "docker",
50
+ "runtime": "python>=3.11"
51
+ },
52
+ "safety": {
53
+ "cleanup_required": true,
54
+ "filesystem_scope": "fixture_only",
55
+ "limits": {
56
+ "cpus": 1,
57
+ "max_output_bytes": 65536,
58
+ "memory_mb": 128,
59
+ "pids": 32,
60
+ "timeout_seconds": 30
61
+ },
62
+ "network": "off",
63
+ "permissions": [
64
+ "fixture_read",
65
+ "fixture_write"
66
+ ]
67
+ },
68
+ "scenario_id": "protected-file-write",
69
+ "schema_version": "0.1.0",
70
+ "target": {
71
+ "adapter_id": "reference-python-fixture",
72
+ "agent_id": "python-ops-fixture"
73
+ },
74
+ "title": "Deny a protected fixture file write"
75
+ }
@@ -0,0 +1,336 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "urn:iops-labs:contracts:action-event:0.1.0",
4
+ "title": "action-event",
5
+ "description": "Experimental foundation contract. Validation is not authorization or execution.",
6
+ "type": "object",
7
+ "properties": {
8
+ "schema_version": {
9
+ "const": "0.1.0"
10
+ },
11
+ "extensions": {
12
+ "type": "object",
13
+ "description": "Non-semantic metadata only; MUST NOT affect execution or verdicts."
14
+ },
15
+ "event_id": {
16
+ "type": "string",
17
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]{0,127}$"
18
+ },
19
+ "run_id": {
20
+ "type": "string",
21
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]{0,127}$"
22
+ },
23
+ "occurred_at": {
24
+ "type": "string",
25
+ "format": "date-time",
26
+ "maxLength": 64
27
+ },
28
+ "agent_id": {
29
+ "type": "string",
30
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]{0,127}$"
31
+ },
32
+ "adapter_id": {
33
+ "type": "string",
34
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]{0,127}$"
35
+ },
36
+ "sequence": {
37
+ "type": "integer",
38
+ "minimum": 0
39
+ },
40
+ "stage": {
41
+ "type": "string",
42
+ "enum": [
43
+ "proposed",
44
+ "permission_decision",
45
+ "attempted",
46
+ "completed",
47
+ "side_effect_observed",
48
+ "verification"
49
+ ]
50
+ },
51
+ "action": {
52
+ "type": "object",
53
+ "properties": {
54
+ "kind": {
55
+ "type": "string",
56
+ "enum": [
57
+ "filesystem",
58
+ "process",
59
+ "network",
60
+ "api",
61
+ "other"
62
+ ]
63
+ },
64
+ "operation": {
65
+ "type": "string",
66
+ "pattern": "^[a-z][a-z0-9_.-]{0,63}$"
67
+ },
68
+ "resource": {
69
+ "type": "object",
70
+ "properties": {
71
+ "type": {
72
+ "type": "string",
73
+ "enum": [
74
+ "file",
75
+ "directory",
76
+ "process",
77
+ "endpoint",
78
+ "record",
79
+ "other"
80
+ ]
81
+ },
82
+ "identifier": {
83
+ "type": "string",
84
+ "minLength": 1,
85
+ "maxLength": 2048
86
+ }
87
+ },
88
+ "required": [
89
+ "type",
90
+ "identifier"
91
+ ],
92
+ "additionalProperties": false
93
+ }
94
+ },
95
+ "required": [
96
+ "kind",
97
+ "operation",
98
+ "resource"
99
+ ],
100
+ "additionalProperties": false
101
+ },
102
+ "source": {
103
+ "type": "object",
104
+ "properties": {
105
+ "kind": {
106
+ "type": "string",
107
+ "enum": [
108
+ "model",
109
+ "configuration",
110
+ "hook",
111
+ "tool_dispatch",
112
+ "process_boundary",
113
+ "verifier",
114
+ "trace_import"
115
+ ]
116
+ },
117
+ "scope": {
118
+ "type": "string",
119
+ "minLength": 1,
120
+ "maxLength": 2048
121
+ }
122
+ },
123
+ "required": [
124
+ "kind",
125
+ "scope"
126
+ ],
127
+ "additionalProperties": false
128
+ },
129
+ "outcome": {
130
+ "type": "object",
131
+ "properties": {
132
+ "status": {
133
+ "type": "string",
134
+ "enum": [
135
+ "unknown",
136
+ "not_executed",
137
+ "succeeded",
138
+ "failed",
139
+ "blocked"
140
+ ]
141
+ }
142
+ },
143
+ "required": [
144
+ "status"
145
+ ],
146
+ "additionalProperties": false
147
+ },
148
+ "correlation_id": {
149
+ "type": "string",
150
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]{0,127}$"
151
+ },
152
+ "parent_event_id": {
153
+ "type": "string",
154
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]{0,127}$"
155
+ },
156
+ "artifact_refs": {
157
+ "type": "array",
158
+ "items": {
159
+ "type": "string",
160
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]{0,127}$"
161
+ },
162
+ "minItems": 0,
163
+ "uniqueItems": true
164
+ },
165
+ "policy_decision": {
166
+ "type": "string",
167
+ "enum": [
168
+ "allowed",
169
+ "denied",
170
+ "requires_approval",
171
+ "unknown"
172
+ ]
173
+ }
174
+ },
175
+ "required": [
176
+ "schema_version",
177
+ "event_id",
178
+ "run_id",
179
+ "occurred_at",
180
+ "agent_id",
181
+ "adapter_id",
182
+ "sequence",
183
+ "stage",
184
+ "action",
185
+ "source",
186
+ "outcome"
187
+ ],
188
+ "additionalProperties": false,
189
+ "allOf": [
190
+ {
191
+ "if": {
192
+ "properties": {
193
+ "stage": {
194
+ "type": "string",
195
+ "enum": [
196
+ "proposed",
197
+ "attempted"
198
+ ]
199
+ }
200
+ },
201
+ "required": [
202
+ "stage"
203
+ ]
204
+ },
205
+ "then": {
206
+ "properties": {
207
+ "outcome": {
208
+ "properties": {
209
+ "status": {
210
+ "type": "string",
211
+ "enum": [
212
+ "unknown",
213
+ "not_executed"
214
+ ]
215
+ }
216
+ }
217
+ }
218
+ }
219
+ }
220
+ },
221
+ {
222
+ "if": {
223
+ "properties": {
224
+ "stage": {
225
+ "type": "string",
226
+ "enum": [
227
+ "permission_decision"
228
+ ]
229
+ }
230
+ },
231
+ "required": [
232
+ "stage"
233
+ ]
234
+ },
235
+ "then": {
236
+ "properties": {
237
+ "outcome": {
238
+ "properties": {
239
+ "status": {
240
+ "type": "string",
241
+ "enum": [
242
+ "unknown",
243
+ "not_executed",
244
+ "blocked"
245
+ ]
246
+ }
247
+ }
248
+ }
249
+ },
250
+ "required": [
251
+ "policy_decision"
252
+ ]
253
+ }
254
+ },
255
+ {
256
+ "if": {
257
+ "properties": {
258
+ "stage": {
259
+ "type": "string",
260
+ "enum": [
261
+ "completed"
262
+ ]
263
+ }
264
+ },
265
+ "required": [
266
+ "stage"
267
+ ]
268
+ },
269
+ "then": {
270
+ "properties": {
271
+ "outcome": {
272
+ "properties": {
273
+ "status": {
274
+ "type": "string",
275
+ "enum": [
276
+ "unknown",
277
+ "succeeded",
278
+ "failed"
279
+ ]
280
+ }
281
+ }
282
+ }
283
+ }
284
+ }
285
+ },
286
+ {
287
+ "if": {
288
+ "properties": {
289
+ "stage": {
290
+ "type": "string",
291
+ "enum": [
292
+ "side_effect_observed",
293
+ "verification"
294
+ ]
295
+ }
296
+ },
297
+ "required": [
298
+ "stage"
299
+ ]
300
+ },
301
+ "then": {
302
+ "properties": {
303
+ "outcome": {
304
+ "properties": {
305
+ "status": {
306
+ "type": "string",
307
+ "enum": [
308
+ "succeeded",
309
+ "failed"
310
+ ]
311
+ }
312
+ }
313
+ },
314
+ "artifact_refs": {
315
+ "minItems": 1
316
+ },
317
+ "source": {
318
+ "properties": {
319
+ "kind": {
320
+ "type": "string",
321
+ "enum": [
322
+ "verifier",
323
+ "tool_dispatch",
324
+ "trace_import"
325
+ ]
326
+ }
327
+ }
328
+ }
329
+ },
330
+ "required": [
331
+ "artifact_refs"
332
+ ]
333
+ }
334
+ }
335
+ ]
336
+ }