python2rust 0.1.0__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.
- python2rust/__init__.py +8 -0
- python2rust/__main__.py +5 -0
- python2rust/_core.py +44 -0
- python2rust/agent/__init__.py +0 -0
- python2rust/agent/agents.py +333 -0
- python2rust/agent/apply.py +516 -0
- python2rust/agent/finish.py +295 -0
- python2rust/agent/fixers.py +229 -0
- python2rust/agent/loop.py +441 -0
- python2rust/agent/patches.py +1165 -0
- python2rust/agent/port.py +579 -0
- python2rust/agent/prompts/judge_v2.md +96 -0
- python2rust/agent/review.py +34 -0
- python2rust/agent/rustlex.py +232 -0
- python2rust/cli/__init__.py +0 -0
- python2rust/cli/doctor.py +62 -0
- python2rust/cli/inputs.py +105 -0
- python2rust/cli/main.py +1162 -0
- python2rust/cli/ops.py +642 -0
- python2rust/cli/workflow.py +178 -0
- python2rust/core/__init__.py +38 -0
- python2rust/core/config.py +263 -0
- python2rust/core/constructs.py +124 -0
- python2rust/core/diagnostics.py +280 -0
- python2rust/core/emit/__init__.py +5 -0
- python2rust/core/emit/crates.py +51 -0
- python2rust/core/emit/render.py +561 -0
- python2rust/core/emit/schema.py +168 -0
- python2rust/core/emit/translate.py +304 -0
- python2rust/core/frontend/__init__.py +1 -0
- python2rust/core/frontend/module.py +896 -0
- python2rust/core/frontend/names.py +129 -0
- python2rust/core/frontend/project.py +277 -0
- python2rust/core/frontend/project_imports.py +173 -0
- python2rust/core/frontend/symbols.py +132 -0
- python2rust/core/frontend/walrus.py +59 -0
- python2rust/core/ir/__init__.py +1 -0
- python2rust/core/ir/nodes.py +675 -0
- python2rust/core/ir/rtypes.py +122 -0
- python2rust/core/ir/types.py +326 -0
- python2rust/core/lower/__init__.py +1 -0
- python2rust/core/lower/calls.py +1125 -0
- python2rust/core/lower/context.py +223 -0
- python2rust/core/lower/exceptions.py +317 -0
- python2rust/core/lower/exprs.py +845 -0
- python2rust/core/lower/fstrings.py +141 -0
- python2rust/core/lower/funcs.py +276 -0
- python2rust/core/lower/lowerer.py +366 -0
- python2rust/core/lower/modelcalls.py +195 -0
- python2rust/core/lower/models.py +645 -0
- python2rust/core/lower/stmts.py +722 -0
- python2rust/core/lower/testing.py +601 -0
- python2rust/core/lower/validation.py +253 -0
- python2rust/core/passes/__init__.py +1 -0
- python2rust/core/passes/aliasing.py +311 -0
- python2rust/core/passes/analysis.py +207 -0
- python2rust/core/passes/devirt.py +329 -0
- python2rust/core/passes/ownership.py +259 -0
- python2rust/core/passes/raises.py +275 -0
- python2rust/core/rt_lib.rs +2071 -0
- python2rust/data/README.md +81 -0
- python2rust/data/py2many_builtins.toml +4744 -0
- python2rust/errors.py +28 -0
- python2rust/py.typed +0 -0
- python2rust/report/__init__.py +0 -0
- python2rust/report/constructs.py +31 -0
- python2rust/report/contract.py +688 -0
- python2rust/report/corpus.py +323 -0
- python2rust/report/explain.py +168 -0
- python2rust/report/schemas.py +914 -0
- python2rust/server/__init__.py +0 -0
- python2rust/server/mcp_server.py +289 -0
- python2rust/server/mcp_workflow.py +100 -0
- python2rust/skill/SKILL.md +214 -0
- python2rust/verify/__init__.py +0 -0
- python2rust/verify/check.py +1135 -0
- python2rust/verify/equiv/__init__.py +1264 -0
- python2rust/verify/equiv/compare.py +455 -0
- python2rust/verify/equiv/harness.py +505 -0
- python2rust/verify/equiv/judge.py +358 -0
- python2rust/verify/equiv/procs.py +255 -0
- python2rust/verify/equiv/runner.py +248 -0
- python2rust/verify/equiv/types.py +543 -0
- python2rust/verify/keystore.py +76 -0
- python2rust/verify/ladder.py +396 -0
- python2rust/verify/sandbox.py +370 -0
- python2rust/verify/testrun.py +280 -0
- python2rust/workflow/__init__.py +0 -0
- python2rust/workflow/brief.py +312 -0
- python2rust/workflow/interview.py +366 -0
- python2rust/workflow/layout.py +103 -0
- python2rust/workflow/planner.py +409 -0
- python2rust/workflow/project.py +134 -0
- python2rust/workflow/schemas.py +265 -0
- python2rust/workflow/state.py +392 -0
- python2rust/workflow/staticscan.py +209 -0
- python2rust-0.1.0.dist-info/METADATA +395 -0
- python2rust-0.1.0.dist-info/RECORD +102 -0
- python2rust-0.1.0.dist-info/WHEEL +4 -0
- python2rust-0.1.0.dist-info/entry_points.txt +4 -0
- python2rust-0.1.0.dist-info/licenses/LICENSE +21 -0
- python2rust-0.1.0.dist-info/licenses/NOTICE +65 -0
|
@@ -0,0 +1,914 @@
|
|
|
1
|
+
"""JSON Schemas (draft 2020-12) of every JSON document the CLI and the MCP server produce."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
_DRAFT = "https://json-schema.org/draft/2020-12/schema"
|
|
8
|
+
_STR_OR_NULL = {"type": ["string", "null"]}
|
|
9
|
+
_INT = {"type": "integer"}
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def _obj(props: dict[str, Any], required: list[str] | None = None) -> dict[str, Any]:
|
|
13
|
+
return {
|
|
14
|
+
"type": "object",
|
|
15
|
+
"properties": props,
|
|
16
|
+
"required": list(props) if required is None else required,
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
_NULL_INT = {"type": ["integer", "null"]}
|
|
21
|
+
# functions_check_clean is the headline: Rust output, no todo!(), passes cargo check; null when
|
|
22
|
+
# the ladder did not reach (or could not run) `check`. "no TODO" alone is functions_no_todo.
|
|
23
|
+
_VERIFY_TOTALS: dict[str, Any] = {
|
|
24
|
+
"functions_translated": _NULL_INT,
|
|
25
|
+
"functions_check_pass": _NULL_INT,
|
|
26
|
+
"functions_check_clean": _NULL_INT,
|
|
27
|
+
"functions_check_clean_pct": {"type": ["number", "null"]},
|
|
28
|
+
"functions_unverified": _NULL_INT,
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
_DEFS: dict[str, Any] = {
|
|
32
|
+
"diagnostic": _obj(
|
|
33
|
+
{
|
|
34
|
+
"code": {"type": "string", "pattern": "^PY2RS[0-9]{3}$"},
|
|
35
|
+
"severity": {"enum": ["error", "warning", "info"]},
|
|
36
|
+
"message": {"type": "string"},
|
|
37
|
+
"file": {"type": "string"},
|
|
38
|
+
"line": _INT,
|
|
39
|
+
"col": _INT,
|
|
40
|
+
"construct": _STR_OR_NULL,
|
|
41
|
+
"hint": _STR_OR_NULL,
|
|
42
|
+
}
|
|
43
|
+
),
|
|
44
|
+
"todo": _obj(
|
|
45
|
+
{
|
|
46
|
+
"id": {"type": "string"},
|
|
47
|
+
"code": {"type": "string"},
|
|
48
|
+
"file": {"type": "string"},
|
|
49
|
+
"line": _INT,
|
|
50
|
+
"python_snippet": {"type": "string"},
|
|
51
|
+
"rust_context": {"type": "string"},
|
|
52
|
+
"rust_line": _INT,
|
|
53
|
+
"kind": {"type": "string"},
|
|
54
|
+
"needs_review": {"type": "boolean"},
|
|
55
|
+
"review_reason": _STR_OR_NULL,
|
|
56
|
+
"rust_file": {
|
|
57
|
+
**_STR_OR_NULL,
|
|
58
|
+
"description": "Rust file to edit, null when not written.",
|
|
59
|
+
},
|
|
60
|
+
"hint": _STR_OR_NULL,
|
|
61
|
+
"instruction": {"type": "string", "description": "The exact instruction for an agent."},
|
|
62
|
+
"state": {
|
|
63
|
+
"enum": ["open", "patched"],
|
|
64
|
+
"description": "patched: a stored patch is applied.",
|
|
65
|
+
},
|
|
66
|
+
}
|
|
67
|
+
),
|
|
68
|
+
"drift_entry": _obj(
|
|
69
|
+
{
|
|
70
|
+
"code": {"type": "string", "pattern": "^PY2RS[0-9]{3}$"},
|
|
71
|
+
"file": {"type": "string"},
|
|
72
|
+
"line": _INT,
|
|
73
|
+
"message": {"type": "string"},
|
|
74
|
+
"construct": _STR_OR_NULL,
|
|
75
|
+
}
|
|
76
|
+
),
|
|
77
|
+
"source_map_entry": _obj(
|
|
78
|
+
{
|
|
79
|
+
"rust_line": _INT,
|
|
80
|
+
"py_file": {"type": "string"},
|
|
81
|
+
"py_line": _INT,
|
|
82
|
+
"py_end_line": _INT,
|
|
83
|
+
"item": {"type": "string"},
|
|
84
|
+
}
|
|
85
|
+
),
|
|
86
|
+
"stats": _obj(
|
|
87
|
+
{
|
|
88
|
+
k: _INT
|
|
89
|
+
for k in (
|
|
90
|
+
"functions_total",
|
|
91
|
+
"functions_clean",
|
|
92
|
+
"models_total",
|
|
93
|
+
"models_clean",
|
|
94
|
+
"todo_count",
|
|
95
|
+
)
|
|
96
|
+
}
|
|
97
|
+
),
|
|
98
|
+
"file_result": _obj(
|
|
99
|
+
{
|
|
100
|
+
"file": {"type": "string"},
|
|
101
|
+
"status": {"enum": ["clean", "not_clean", "todo", "error", "internal_error"]},
|
|
102
|
+
"rust_path": _STR_OR_NULL,
|
|
103
|
+
"rust": {**_STR_OR_NULL, "description": "Inline Rust, present unless -o wrote it."},
|
|
104
|
+
"stats": {"$ref": "#/$defs/stats"},
|
|
105
|
+
"diagnostics": {"type": "array", "items": {"$ref": "#/$defs/diagnostic"}},
|
|
106
|
+
"todos": {"type": "array", "items": {"$ref": "#/$defs/todo"}},
|
|
107
|
+
"patches": {"type": "array", "items": {"$ref": "#/$defs/patch_report"}},
|
|
108
|
+
"drift": {
|
|
109
|
+
"type": "array",
|
|
110
|
+
"items": {"$ref": "#/$defs/drift_entry"},
|
|
111
|
+
"description": "Drift ledger: where the Rust may behave differently from the Python.",
|
|
112
|
+
},
|
|
113
|
+
"notes": {"type": "array", "items": {"type": "string"}},
|
|
114
|
+
"required_crates": {
|
|
115
|
+
"type": "object",
|
|
116
|
+
"description": "Crates (version, features) the generated Rust uses.",
|
|
117
|
+
"additionalProperties": _obj(
|
|
118
|
+
{
|
|
119
|
+
"version": {"type": "string"},
|
|
120
|
+
"features": {"type": "array", "items": {"type": "string"}},
|
|
121
|
+
}
|
|
122
|
+
),
|
|
123
|
+
},
|
|
124
|
+
"required_features": {"type": "array", "items": {"type": "string"}},
|
|
125
|
+
"not_clean": {
|
|
126
|
+
"type": "array",
|
|
127
|
+
"items": {"type": "string"},
|
|
128
|
+
"description": "Rust items the core counts not clean: a TODO, drift or unenforced behaviour, also transitively.",
|
|
129
|
+
},
|
|
130
|
+
"tests": {
|
|
131
|
+
"type": "array",
|
|
132
|
+
"description": "Python tests found and translated (or dropped, with the reason).",
|
|
133
|
+
"items": _obj(
|
|
134
|
+
{
|
|
135
|
+
"py_id": {"type": "string"},
|
|
136
|
+
"py_file": {"type": "string"},
|
|
137
|
+
"py_line": _INT,
|
|
138
|
+
"rust_name": {"type": "string"},
|
|
139
|
+
"status": {"enum": ["translated", "partial", "dropped"]},
|
|
140
|
+
"reason": _STR_OR_NULL,
|
|
141
|
+
"label": _STR_OR_NULL,
|
|
142
|
+
}
|
|
143
|
+
),
|
|
144
|
+
},
|
|
145
|
+
"error": _STR_OR_NULL,
|
|
146
|
+
}
|
|
147
|
+
),
|
|
148
|
+
"patch_report": _obj(
|
|
149
|
+
{
|
|
150
|
+
"todo_id": {"type": "string"},
|
|
151
|
+
"status": {
|
|
152
|
+
"enum": [
|
|
153
|
+
"applied",
|
|
154
|
+
"failed",
|
|
155
|
+
"stale",
|
|
156
|
+
"orphaned",
|
|
157
|
+
"not-applied-unverified",
|
|
158
|
+
"rejected-by-gate",
|
|
159
|
+
"tampered",
|
|
160
|
+
]
|
|
161
|
+
},
|
|
162
|
+
"detail": _STR_OR_NULL,
|
|
163
|
+
}
|
|
164
|
+
),
|
|
165
|
+
"summary": _obj(
|
|
166
|
+
{
|
|
167
|
+
"files": _INT,
|
|
168
|
+
"files_clean": _INT,
|
|
169
|
+
"files_with_todos": _INT,
|
|
170
|
+
"files_not_clean": _INT,
|
|
171
|
+
"files_failed": _INT,
|
|
172
|
+
"functions_total": _INT,
|
|
173
|
+
"functions_no_todo": _INT,
|
|
174
|
+
"models_total": _INT,
|
|
175
|
+
"models_no_todo": _INT,
|
|
176
|
+
"todo_count": _INT,
|
|
177
|
+
"todos_patched": _INT,
|
|
178
|
+
"needs_review_count": _INT,
|
|
179
|
+
"error_count": _INT,
|
|
180
|
+
"warning_count": _INT,
|
|
181
|
+
"drift_count": {**_INT, "description": "Entries in the drift ledger."},
|
|
182
|
+
"not_clean_count": {
|
|
183
|
+
**_INT,
|
|
184
|
+
"description": "Items the core counts not clean (see file_result.not_clean).",
|
|
185
|
+
},
|
|
186
|
+
"drift_by_code": {"type": "object", "additionalProperties": _INT},
|
|
187
|
+
}
|
|
188
|
+
),
|
|
189
|
+
"check_error": _obj(
|
|
190
|
+
{
|
|
191
|
+
"file": _STR_OR_NULL,
|
|
192
|
+
"rust_file": _STR_OR_NULL,
|
|
193
|
+
"rust_line": {"type": ["integer", "null"]},
|
|
194
|
+
"rust_col": {"type": ["integer", "null"]},
|
|
195
|
+
"code": _STR_OR_NULL,
|
|
196
|
+
"category": {"type": "string"},
|
|
197
|
+
"message": {"type": "string"},
|
|
198
|
+
"python_line": {"type": ["integer", "null"]},
|
|
199
|
+
"level": {"enum": ["error", "warning"]},
|
|
200
|
+
"mapped_by": {
|
|
201
|
+
"enum": ["source_map", "approximate", None],
|
|
202
|
+
"description": "source_map is exact; approximate is a heuristic (no source map).",
|
|
203
|
+
},
|
|
204
|
+
"item": _STR_OR_NULL,
|
|
205
|
+
"todo_id": _STR_OR_NULL,
|
|
206
|
+
}
|
|
207
|
+
),
|
|
208
|
+
"contract_side": {
|
|
209
|
+
"type": "object",
|
|
210
|
+
"properties": {
|
|
211
|
+
"source": {"enum": ["file", "crate", "command"]},
|
|
212
|
+
"path": {"type": "string"},
|
|
213
|
+
"openapi": _STR_OR_NULL,
|
|
214
|
+
"paths": _INT,
|
|
215
|
+
"operations": _INT,
|
|
216
|
+
},
|
|
217
|
+
"required": ["source", "path", "openapi", "paths", "operations"],
|
|
218
|
+
},
|
|
219
|
+
"contract_finding": _obj(
|
|
220
|
+
{
|
|
221
|
+
"code": {"type": "string", "pattern": "^PY2RS-C[0-9]{3}$"},
|
|
222
|
+
"severity": {"enum": ["error", "warning"]},
|
|
223
|
+
"operation": {
|
|
224
|
+
**_STR_OR_NULL,
|
|
225
|
+
"description": "`METHOD /path`, null for path-level findings.",
|
|
226
|
+
},
|
|
227
|
+
"message": {"type": "string"},
|
|
228
|
+
"python": {**_STR_OR_NULL, "description": "JSON pointer into the Python document."},
|
|
229
|
+
"rust": {**_STR_OR_NULL, "description": "JSON pointer into the Rust document."},
|
|
230
|
+
}
|
|
231
|
+
),
|
|
232
|
+
"port_task": _obj(
|
|
233
|
+
{
|
|
234
|
+
"schema_version": {"const": 1},
|
|
235
|
+
"kind": {"const": "function-body"},
|
|
236
|
+
"task_id": {"type": "string"},
|
|
237
|
+
"tier": {"type": "string"},
|
|
238
|
+
"file": {"type": "string"},
|
|
239
|
+
"function": {"type": "string"},
|
|
240
|
+
"python": _obj(
|
|
241
|
+
{"file": {"type": "string"}, "line": _INT, "snippet": {"type": "string"}}
|
|
242
|
+
),
|
|
243
|
+
"rust": _obj({"line": _INT, "function": {"type": "string"}}),
|
|
244
|
+
"errors": {
|
|
245
|
+
"type": "array",
|
|
246
|
+
"items": _obj(
|
|
247
|
+
{
|
|
248
|
+
"code": _STR_OR_NULL,
|
|
249
|
+
"message": {"type": "string"},
|
|
250
|
+
"rust_line": {"type": ["integer", "null"]},
|
|
251
|
+
"python_line": {"type": ["integer", "null"]},
|
|
252
|
+
}
|
|
253
|
+
),
|
|
254
|
+
},
|
|
255
|
+
"open_todos": _INT,
|
|
256
|
+
"signatures": {"type": "array", "items": {"type": "string"}},
|
|
257
|
+
"previous_attempts": {"type": "array", "items": {"type": "object"}},
|
|
258
|
+
"instruction": {"type": "string"},
|
|
259
|
+
}
|
|
260
|
+
),
|
|
261
|
+
"port_task_full": {
|
|
262
|
+
"type": "object",
|
|
263
|
+
"allOf": [{"$ref": "#/$defs/port_task"}],
|
|
264
|
+
"properties": {"system": {"type": "string"}, "user": {"type": "string"}},
|
|
265
|
+
},
|
|
266
|
+
"rung": _obj(
|
|
267
|
+
{
|
|
268
|
+
"status": {"enum": ["pass", "fail", "skipped", "unverified"]},
|
|
269
|
+
"errors": _INT,
|
|
270
|
+
"detail": _STR_OR_NULL,
|
|
271
|
+
},
|
|
272
|
+
["status", "errors", "detail"],
|
|
273
|
+
),
|
|
274
|
+
"function_verdict": _obj(
|
|
275
|
+
{
|
|
276
|
+
"function": {"type": "string"},
|
|
277
|
+
"kind": {"enum": ["function", "module"]},
|
|
278
|
+
"py_line": {"type": ["integer", "null"]},
|
|
279
|
+
"has_item": {"type": "boolean"},
|
|
280
|
+
"has_todo": {"type": "boolean"},
|
|
281
|
+
"rungs": {
|
|
282
|
+
"type": "object",
|
|
283
|
+
"additionalProperties": {
|
|
284
|
+
"enum": ["pass", "fail", "skipped", "unverified", "judged"]
|
|
285
|
+
},
|
|
286
|
+
},
|
|
287
|
+
"highest_rung": {"enum": ["parse", "fmt", "check", "clippy", "test", "equiv", None]},
|
|
288
|
+
"check_clean": {
|
|
289
|
+
"type": "boolean",
|
|
290
|
+
"description": "Rust output exists, no todo!() left, and cargo check passes.",
|
|
291
|
+
},
|
|
292
|
+
"messages": {"type": "array", "items": {"type": "string"}},
|
|
293
|
+
}
|
|
294
|
+
),
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
# Project mode (a directory translated as a whole): where the file sits in the crate. Optional.
|
|
299
|
+
_DEFS["file_result"]["properties"]["module"] = {
|
|
300
|
+
"type": "object",
|
|
301
|
+
"description": "Present when the file was translated as part of a project.",
|
|
302
|
+
"properties": {
|
|
303
|
+
"name": {"type": "string", "description": "dotted Python module name"},
|
|
304
|
+
"rust_module": {"type": "string", "description": "e.g. crate::shop::pricing"},
|
|
305
|
+
"crate_path": {"type": "string", "description": "file below the crate's src/"},
|
|
306
|
+
"depends_on": {"type": "array", "items": {"type": "string"}},
|
|
307
|
+
"in_cycle": {"type": "boolean"},
|
|
308
|
+
},
|
|
309
|
+
"required": ["name", "rust_module", "crate_path", "depends_on", "in_cycle"],
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
def _head(command: str, props: dict[str, Any]) -> dict[str, Any]:
|
|
314
|
+
base = {
|
|
315
|
+
"schema_version": {"const": 1},
|
|
316
|
+
"command": {"const": command},
|
|
317
|
+
"version": {"type": "string"},
|
|
318
|
+
}
|
|
319
|
+
return {
|
|
320
|
+
"$schema": _DRAFT,
|
|
321
|
+
"title": f"python2rust {command} --json",
|
|
322
|
+
**_obj({**base, **props}),
|
|
323
|
+
"$defs": _DEFS,
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
_TRANSLATE_PROPS = {
|
|
328
|
+
"ok": {"type": "boolean"},
|
|
329
|
+
"summary": {"$ref": "#/$defs/summary"},
|
|
330
|
+
"files": {"type": "array", "items": {"$ref": "#/$defs/file_result"}},
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
# one translated Rust test of the `apply` test rung: its Rust path and Python test id (null when
|
|
334
|
+
# the translation does not know it), plus `message` (failed) or `why` (skipped-todo)
|
|
335
|
+
_APPLY_TESTS = {
|
|
336
|
+
"type": "array",
|
|
337
|
+
"items": {
|
|
338
|
+
"type": "object",
|
|
339
|
+
"properties": {
|
|
340
|
+
"test": {"type": "string"},
|
|
341
|
+
"py_id": _STR_OR_NULL,
|
|
342
|
+
"file": _STR_OR_NULL,
|
|
343
|
+
"message": {"type": "string"},
|
|
344
|
+
"why": {"type": "string"},
|
|
345
|
+
},
|
|
346
|
+
"required": ["test", "py_id"],
|
|
347
|
+
},
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
SCHEMAS: dict[str, dict[str, Any]] = {
|
|
351
|
+
"translate": _head("translate", _TRANSLATE_PROPS),
|
|
352
|
+
"todos": _head(
|
|
353
|
+
"todos",
|
|
354
|
+
{
|
|
355
|
+
"ok": {"type": "boolean"},
|
|
356
|
+
"count": _INT,
|
|
357
|
+
"todos": {"type": "array", "items": {"$ref": "#/$defs/todo"}},
|
|
358
|
+
"failed_files": {
|
|
359
|
+
"type": "array",
|
|
360
|
+
"items": _obj(
|
|
361
|
+
{
|
|
362
|
+
"file": {"type": "string"},
|
|
363
|
+
"status": {"type": "string"},
|
|
364
|
+
"error": _STR_OR_NULL,
|
|
365
|
+
}
|
|
366
|
+
),
|
|
367
|
+
},
|
|
368
|
+
},
|
|
369
|
+
),
|
|
370
|
+
"coverage": _head(
|
|
371
|
+
"coverage",
|
|
372
|
+
{
|
|
373
|
+
"ok": {"type": "boolean"},
|
|
374
|
+
"level": {"enum": ["parse", "fmt", "check", "clippy", "test", "equiv", None]},
|
|
375
|
+
"totals": {
|
|
376
|
+
**_DEFS["summary"],
|
|
377
|
+
"properties": {**_DEFS["summary"]["properties"], **_VERIFY_TOTALS},
|
|
378
|
+
"required": [*_DEFS["summary"]["required"], *_VERIFY_TOTALS],
|
|
379
|
+
},
|
|
380
|
+
"todos_by_construct": {"type": "object", "additionalProperties": _INT},
|
|
381
|
+
"todos_by_code": {"type": "object", "additionalProperties": _INT},
|
|
382
|
+
"diagnostics_by_code": {"type": "object", "additionalProperties": _INT},
|
|
383
|
+
"files": {
|
|
384
|
+
"type": "array",
|
|
385
|
+
"items": {
|
|
386
|
+
**_obj(
|
|
387
|
+
{
|
|
388
|
+
"file": {"type": "string"},
|
|
389
|
+
"status": {"type": "string"},
|
|
390
|
+
"diagnostics": _INT,
|
|
391
|
+
}
|
|
392
|
+
),
|
|
393
|
+
"additionalProperties": _INT,
|
|
394
|
+
},
|
|
395
|
+
},
|
|
396
|
+
"markdown": {"type": "string"},
|
|
397
|
+
},
|
|
398
|
+
),
|
|
399
|
+
"check": _head(
|
|
400
|
+
"check",
|
|
401
|
+
{
|
|
402
|
+
"ok": {"type": "boolean"},
|
|
403
|
+
"translation": {
|
|
404
|
+
"oneOf": [
|
|
405
|
+
{"type": "null"},
|
|
406
|
+
_obj(
|
|
407
|
+
{
|
|
408
|
+
"summary": {"$ref": "#/$defs/summary"},
|
|
409
|
+
"files": {"type": "array", "items": {"$ref": "#/$defs/file_result"}},
|
|
410
|
+
}
|
|
411
|
+
),
|
|
412
|
+
]
|
|
413
|
+
},
|
|
414
|
+
"cargo": _obj(
|
|
415
|
+
{
|
|
416
|
+
"available": {"type": "boolean"},
|
|
417
|
+
"version": _STR_OR_NULL,
|
|
418
|
+
"status": {"enum": ["ok", "errors", "skipped", "failed"]},
|
|
419
|
+
"reason": _STR_OR_NULL,
|
|
420
|
+
"offline": {"type": "boolean"},
|
|
421
|
+
"errors": _INT,
|
|
422
|
+
"warnings": _INT,
|
|
423
|
+
"errors_by_category": {"type": "object", "additionalProperties": _INT},
|
|
424
|
+
"diagnostics": {"type": "array", "items": {"$ref": "#/$defs/check_error"}},
|
|
425
|
+
"scratch_dir": _STR_OR_NULL,
|
|
426
|
+
"dependencies": {"enum": ["custom", "default", "none"]},
|
|
427
|
+
"notes": {"type": "array", "items": {"type": "string"}},
|
|
428
|
+
}
|
|
429
|
+
),
|
|
430
|
+
},
|
|
431
|
+
),
|
|
432
|
+
"explain": _head(
|
|
433
|
+
"explain",
|
|
434
|
+
{
|
|
435
|
+
"code": {"type": "string"},
|
|
436
|
+
"summary": {"type": "string"},
|
|
437
|
+
"documented": {"type": "boolean"},
|
|
438
|
+
"why": {"type": "string"},
|
|
439
|
+
"fix": {"type": "string"},
|
|
440
|
+
"example": {
|
|
441
|
+
"oneOf": [
|
|
442
|
+
{"type": "null"},
|
|
443
|
+
_obj(
|
|
444
|
+
{
|
|
445
|
+
"python": {"type": "string"},
|
|
446
|
+
"rust_before": {"type": "string"},
|
|
447
|
+
"rust_after": {"type": "string"},
|
|
448
|
+
}
|
|
449
|
+
),
|
|
450
|
+
]
|
|
451
|
+
},
|
|
452
|
+
},
|
|
453
|
+
),
|
|
454
|
+
"constructs": _head(
|
|
455
|
+
"constructs",
|
|
456
|
+
{
|
|
457
|
+
"constructs": {
|
|
458
|
+
"type": "array",
|
|
459
|
+
"items": _obj(
|
|
460
|
+
{
|
|
461
|
+
"id": {"type": "string"},
|
|
462
|
+
"name": {"type": "string"},
|
|
463
|
+
"status": {
|
|
464
|
+
"enum": ["supported", "partial", "todo"],
|
|
465
|
+
"description": "partial: a subset; todo: always an explicit TODO.",
|
|
466
|
+
},
|
|
467
|
+
"phase": {"type": "string"},
|
|
468
|
+
"codes": {
|
|
469
|
+
"type": "array",
|
|
470
|
+
"items": {"type": "string"},
|
|
471
|
+
"description": "The PY2RS codes this construct can produce.",
|
|
472
|
+
},
|
|
473
|
+
}
|
|
474
|
+
),
|
|
475
|
+
},
|
|
476
|
+
},
|
|
477
|
+
),
|
|
478
|
+
"verify": _head(
|
|
479
|
+
"verify",
|
|
480
|
+
{
|
|
481
|
+
"ok": {"type": "boolean"},
|
|
482
|
+
"level": {"enum": ["parse", "fmt", "check", "clippy", "test", "equiv"]},
|
|
483
|
+
"rungs": {"type": "array", "items": {"type": "string"}},
|
|
484
|
+
"tools": {
|
|
485
|
+
"type": "object",
|
|
486
|
+
"properties": {
|
|
487
|
+
"rustfmt": {"type": "boolean"},
|
|
488
|
+
"cargo": {"type": "boolean"},
|
|
489
|
+
"clippy": {"type": ["boolean", "null"]},
|
|
490
|
+
},
|
|
491
|
+
},
|
|
492
|
+
"summary": {
|
|
493
|
+
**_DEFS["summary"],
|
|
494
|
+
"properties": {
|
|
495
|
+
**_DEFS["summary"]["properties"],
|
|
496
|
+
**_VERIFY_TOTALS,
|
|
497
|
+
"functions_with_rust": _INT,
|
|
498
|
+
"failing_functions": _INT,
|
|
499
|
+
"highest_rung_counts": {"type": "object", "additionalProperties": _INT},
|
|
500
|
+
},
|
|
501
|
+
"required": [
|
|
502
|
+
*_DEFS["summary"]["required"],
|
|
503
|
+
*_VERIFY_TOTALS,
|
|
504
|
+
"functions_with_rust",
|
|
505
|
+
"failing_functions",
|
|
506
|
+
"highest_rung_counts",
|
|
507
|
+
],
|
|
508
|
+
},
|
|
509
|
+
"files": {
|
|
510
|
+
"type": "array",
|
|
511
|
+
"items": _obj(
|
|
512
|
+
{
|
|
513
|
+
"file": {"type": "string"},
|
|
514
|
+
"translation_status": {"type": "string"},
|
|
515
|
+
"rungs": {
|
|
516
|
+
"type": "object",
|
|
517
|
+
"additionalProperties": {"$ref": "#/$defs/rung"},
|
|
518
|
+
},
|
|
519
|
+
"functions": {
|
|
520
|
+
"type": "array",
|
|
521
|
+
"items": {"$ref": "#/$defs/function_verdict"},
|
|
522
|
+
},
|
|
523
|
+
}
|
|
524
|
+
),
|
|
525
|
+
},
|
|
526
|
+
},
|
|
527
|
+
),
|
|
528
|
+
"apply": _head(
|
|
529
|
+
"apply",
|
|
530
|
+
{
|
|
531
|
+
"ok": {"type": "boolean"},
|
|
532
|
+
"todo_id": {"type": "string"},
|
|
533
|
+
"status": {"enum": ["accepted", "rejected", "failed", "unverified"]},
|
|
534
|
+
"file": _STR_OR_NULL,
|
|
535
|
+
"function": _STR_OR_NULL,
|
|
536
|
+
"gate": _obj(
|
|
537
|
+
{
|
|
538
|
+
"passed": {"type": ["boolean", "null"]},
|
|
539
|
+
"violations": {
|
|
540
|
+
"type": "array",
|
|
541
|
+
"items": _obj(
|
|
542
|
+
{
|
|
543
|
+
"token": {"type": "string"},
|
|
544
|
+
"line": _INT,
|
|
545
|
+
"message": {"type": "string"},
|
|
546
|
+
}
|
|
547
|
+
),
|
|
548
|
+
},
|
|
549
|
+
"allowed": {"type": "array", "items": {"type": "string"}},
|
|
550
|
+
"warnings": {
|
|
551
|
+
"type": "array",
|
|
552
|
+
"items": _obj(
|
|
553
|
+
{
|
|
554
|
+
"token": {"type": "string"},
|
|
555
|
+
"line": _INT,
|
|
556
|
+
"message": {"type": "string"},
|
|
557
|
+
}
|
|
558
|
+
),
|
|
559
|
+
},
|
|
560
|
+
},
|
|
561
|
+
["passed", "violations", "allowed"],
|
|
562
|
+
),
|
|
563
|
+
"verification": {
|
|
564
|
+
"oneOf": [
|
|
565
|
+
{"type": "null"},
|
|
566
|
+
_obj(
|
|
567
|
+
{
|
|
568
|
+
"level": {"const": "check"},
|
|
569
|
+
"rungs": {"type": "object"},
|
|
570
|
+
"fmt_advisory": {"type": ["string", "null"]},
|
|
571
|
+
"test_rung": {
|
|
572
|
+
"enum": ["none", "pass", "fail", "unverified"],
|
|
573
|
+
"description": "translated #[test]s of the module: none = it has none",
|
|
574
|
+
},
|
|
575
|
+
"tests": _obj(
|
|
576
|
+
{
|
|
577
|
+
"scope": {"type": "array", "items": {"type": "string"}},
|
|
578
|
+
"passed": _APPLY_TESTS,
|
|
579
|
+
"failed": _APPLY_TESTS,
|
|
580
|
+
"skipped_todo": _APPLY_TESTS,
|
|
581
|
+
"out_of_scope": _INT,
|
|
582
|
+
},
|
|
583
|
+
),
|
|
584
|
+
"errors": {"type": "array", "items": {"type": "string"}},
|
|
585
|
+
"tools": {"type": "object"},
|
|
586
|
+
},
|
|
587
|
+
# test_rung is absent when `check` already failed: no tests were run
|
|
588
|
+
["level", "rungs", "fmt_advisory", "errors", "tools"],
|
|
589
|
+
),
|
|
590
|
+
]
|
|
591
|
+
},
|
|
592
|
+
"patch_path": _STR_OR_NULL,
|
|
593
|
+
"reason": _STR_OR_NULL,
|
|
594
|
+
},
|
|
595
|
+
),
|
|
596
|
+
"eval": _head(
|
|
597
|
+
"eval",
|
|
598
|
+
{
|
|
599
|
+
"ok": {"type": "boolean"},
|
|
600
|
+
"level": {"type": "string"},
|
|
601
|
+
"corpus": {"type": "string"},
|
|
602
|
+
"metrics": {
|
|
603
|
+
"type": "object",
|
|
604
|
+
"properties": {
|
|
605
|
+
"files": _INT,
|
|
606
|
+
"python_lines": _INT,
|
|
607
|
+
"functions_total": _INT,
|
|
608
|
+
"functions_translated": _INT,
|
|
609
|
+
"functions_check_clean": _NULL_INT,
|
|
610
|
+
"functions_check_clean_pct": {"type": ["number", "null"]},
|
|
611
|
+
"files_fully_clean": _NULL_INT,
|
|
612
|
+
"files_with_parsing_rust": _INT,
|
|
613
|
+
"todos_open": _INT,
|
|
614
|
+
"todos_per_100_lines": {"type": "number"},
|
|
615
|
+
"todos_per_100_lines_by_code": {
|
|
616
|
+
"type": "object",
|
|
617
|
+
"additionalProperties": {"type": "number"},
|
|
618
|
+
},
|
|
619
|
+
"todos_per_100_lines_by_kind": {
|
|
620
|
+
"type": "object",
|
|
621
|
+
"additionalProperties": {"type": "number"},
|
|
622
|
+
},
|
|
623
|
+
"needs_review": _INT,
|
|
624
|
+
},
|
|
625
|
+
"required": [
|
|
626
|
+
"files",
|
|
627
|
+
"python_lines",
|
|
628
|
+
"functions_total",
|
|
629
|
+
"functions_translated",
|
|
630
|
+
"functions_check_clean",
|
|
631
|
+
"functions_check_clean_pct",
|
|
632
|
+
"files_fully_clean",
|
|
633
|
+
"todos_open",
|
|
634
|
+
"todos_per_100_lines",
|
|
635
|
+
"todos_per_100_lines_by_code",
|
|
636
|
+
],
|
|
637
|
+
},
|
|
638
|
+
"expectations_failed": {"type": "array", "items": {"type": "string"}},
|
|
639
|
+
"baseline": {"type": ["object", "null"]},
|
|
640
|
+
"files": {"type": "array", "items": {"type": "object"}},
|
|
641
|
+
"markdown": {"type": "string"},
|
|
642
|
+
},
|
|
643
|
+
),
|
|
644
|
+
"contract": _head(
|
|
645
|
+
"contract",
|
|
646
|
+
{
|
|
647
|
+
"ok": {"type": "boolean"},
|
|
648
|
+
"python": {"$ref": "#/$defs/contract_side"},
|
|
649
|
+
"rust": {"$ref": "#/$defs/contract_side"},
|
|
650
|
+
"normalisation": {"type": "array", "items": {"type": "string"}},
|
|
651
|
+
"summary": _obj(
|
|
652
|
+
{
|
|
653
|
+
"findings": _INT,
|
|
654
|
+
"errors": _INT,
|
|
655
|
+
"warnings": _INT,
|
|
656
|
+
"operations_compared": _INT,
|
|
657
|
+
"operations_identical": _INT,
|
|
658
|
+
"by_code": {"type": "object", "additionalProperties": _INT},
|
|
659
|
+
}
|
|
660
|
+
),
|
|
661
|
+
"findings": {"type": "array", "items": {"$ref": "#/$defs/contract_finding"}},
|
|
662
|
+
"markdown": {"type": "string"},
|
|
663
|
+
},
|
|
664
|
+
),
|
|
665
|
+
"port": _head(
|
|
666
|
+
"port",
|
|
667
|
+
{
|
|
668
|
+
"ok": {"type": "boolean"},
|
|
669
|
+
"status": {"enum": ["converged", "exhausted", "budget", "no_progress", "dry_run"]},
|
|
670
|
+
"crate": {"type": "string"},
|
|
671
|
+
"agent": _STR_OR_NULL,
|
|
672
|
+
"dry_run": {"type": "boolean"},
|
|
673
|
+
"sends_data": {
|
|
674
|
+
"type": "boolean",
|
|
675
|
+
"description": "True only when an agent backend was chosen.",
|
|
676
|
+
},
|
|
677
|
+
"budget_hit": {"enum": ["iterations", "tokens", "seconds", None]},
|
|
678
|
+
"overlay": {"type": "object"},
|
|
679
|
+
"cache": _obj({"hits": _INT, "misses": _INT}),
|
|
680
|
+
"rounds": {
|
|
681
|
+
"type": "array",
|
|
682
|
+
"items": _obj(
|
|
683
|
+
{
|
|
684
|
+
"round": _INT,
|
|
685
|
+
"errors_before": _INT,
|
|
686
|
+
"errors_after": _INT,
|
|
687
|
+
"failing_before": _INT,
|
|
688
|
+
"failing_after": _INT,
|
|
689
|
+
"tasks": _INT,
|
|
690
|
+
"fixed": {"type": "object", "additionalProperties": _INT},
|
|
691
|
+
"rejected": _INT,
|
|
692
|
+
"gate_rejected": _INT,
|
|
693
|
+
"invalid": _INT,
|
|
694
|
+
"gate_warnings": _INT,
|
|
695
|
+
"tokens": _INT,
|
|
696
|
+
}
|
|
697
|
+
),
|
|
698
|
+
},
|
|
699
|
+
"totals": _obj(
|
|
700
|
+
{
|
|
701
|
+
"files": _INT,
|
|
702
|
+
"files_untranslatable": _INT,
|
|
703
|
+
"functions_failing": _INT,
|
|
704
|
+
"todos_left": _INT,
|
|
705
|
+
"compile_errors": _INT,
|
|
706
|
+
"fixed_by_tier": {"type": "object", "additionalProperties": _INT},
|
|
707
|
+
"cargo_checks": _INT,
|
|
708
|
+
"tokens": _INT,
|
|
709
|
+
"seconds": {"type": "number"},
|
|
710
|
+
}
|
|
711
|
+
),
|
|
712
|
+
"review_queue": {"type": "array", "items": {"type": "object"}},
|
|
713
|
+
"tasks": {"type": "array", "items": {"$ref": "#/$defs/port_task_full"}},
|
|
714
|
+
"unverified_patches": {
|
|
715
|
+
"type": "array",
|
|
716
|
+
"description": "Model fixes to submit through the apply pipeline.",
|
|
717
|
+
"items": _obj(
|
|
718
|
+
{key: {"type": "string"} for key in ("id", "file", "function", "patch_path")}
|
|
719
|
+
),
|
|
720
|
+
},
|
|
721
|
+
"notes": {"type": "array", "items": {"type": "string"}},
|
|
722
|
+
},
|
|
723
|
+
),
|
|
724
|
+
"port-task": {
|
|
725
|
+
"$schema": _DRAFT,
|
|
726
|
+
"title": "what a `cmd` agent receives on stdin (one JSON object)",
|
|
727
|
+
"$defs": _DEFS,
|
|
728
|
+
**_obj(
|
|
729
|
+
{
|
|
730
|
+
"schema_version": {"const": 1},
|
|
731
|
+
"kind": {"const": "function-body"},
|
|
732
|
+
"task": {"$ref": "#/$defs/port_task"},
|
|
733
|
+
"system": {"type": "string"},
|
|
734
|
+
"user": {"type": "string"},
|
|
735
|
+
"prompt": {
|
|
736
|
+
"type": "string",
|
|
737
|
+
"description": "system + user as plain text, for chat CLIs",
|
|
738
|
+
},
|
|
739
|
+
}
|
|
740
|
+
),
|
|
741
|
+
},
|
|
742
|
+
"port-patch": {
|
|
743
|
+
"$schema": _DRAFT,
|
|
744
|
+
"title": "what a `cmd` agent prints on stdout (one JSON object; a fenced block is tolerated)",
|
|
745
|
+
**_obj(
|
|
746
|
+
{
|
|
747
|
+
"replacement": {
|
|
748
|
+
"type": "string",
|
|
749
|
+
"description": "the function BODY: the text between the outer braces",
|
|
750
|
+
},
|
|
751
|
+
"tokens": {"type": "integer"},
|
|
752
|
+
"notes": {"type": "string"},
|
|
753
|
+
},
|
|
754
|
+
["replacement"],
|
|
755
|
+
),
|
|
756
|
+
},
|
|
757
|
+
"doctor": _head(
|
|
758
|
+
"doctor",
|
|
759
|
+
{
|
|
760
|
+
"ok": {"type": "boolean"},
|
|
761
|
+
"checks": {
|
|
762
|
+
"type": "array",
|
|
763
|
+
"items": _obj(
|
|
764
|
+
{
|
|
765
|
+
"name": {"type": "string"},
|
|
766
|
+
"status": {"enum": ["ok", "warn", "fail"]},
|
|
767
|
+
"detail": {"type": "string"},
|
|
768
|
+
"required": {"type": "boolean"},
|
|
769
|
+
}
|
|
770
|
+
),
|
|
771
|
+
},
|
|
772
|
+
},
|
|
773
|
+
),
|
|
774
|
+
"skill": _head("skill", {"name": {"type": "string"}, "text": {"type": "string"}}),
|
|
775
|
+
"schema": _head(
|
|
776
|
+
"schema",
|
|
777
|
+
{
|
|
778
|
+
"schemas": {"type": "array", "items": {"type": "string"}},
|
|
779
|
+
"exit_codes": {
|
|
780
|
+
"type": "object",
|
|
781
|
+
"description": "The exit code table shared by every command.",
|
|
782
|
+
"additionalProperties": {"type": "string"},
|
|
783
|
+
},
|
|
784
|
+
},
|
|
785
|
+
),
|
|
786
|
+
"error": {
|
|
787
|
+
"$schema": _DRAFT,
|
|
788
|
+
"title": "python2rust error document (any command, exit 2, 3 or 4)",
|
|
789
|
+
**_obj(
|
|
790
|
+
{
|
|
791
|
+
"schema_version": {"const": 1},
|
|
792
|
+
"ok": {"const": False},
|
|
793
|
+
"error": {
|
|
794
|
+
**_obj(
|
|
795
|
+
{
|
|
796
|
+
"kind": {
|
|
797
|
+
"enum": ["usage", "internal", "missing_dependency", "missing_core"]
|
|
798
|
+
},
|
|
799
|
+
"message": {"type": "string"},
|
|
800
|
+
}
|
|
801
|
+
),
|
|
802
|
+
"additionalProperties": True,
|
|
803
|
+
},
|
|
804
|
+
}
|
|
805
|
+
),
|
|
806
|
+
},
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
|
|
810
|
+
# --- the equiv rung: fields that only exist from `verify --level equiv` (all optional) ----------
|
|
811
|
+
|
|
812
|
+
_EQUIV = {
|
|
813
|
+
"enum": ["passed", "passed-judged", "failed", "needs-judgement", "not-applicable"],
|
|
814
|
+
"description": "passed = same output by rules; passed-judged = only a judge says so (never "
|
|
815
|
+
"counted as passed); needs-judgement = presentation-level differences nobody ruled on.",
|
|
816
|
+
}
|
|
817
|
+
_EQUIV_FIELDS: dict[str, Any] = {
|
|
818
|
+
"equiv": _EQUIV,
|
|
819
|
+
"equiv_reason": _STR_OR_NULL,
|
|
820
|
+
"equiv_inputs": _INT,
|
|
821
|
+
"equiv_counterexample": {
|
|
822
|
+
"type": ["object", "null"],
|
|
823
|
+
"description": "{args, python, rust, diff, shrunk}: the (shrunk) input that differs.",
|
|
824
|
+
},
|
|
825
|
+
"equiv_skipped": {
|
|
826
|
+
"type": "object",
|
|
827
|
+
"additionalProperties": _INT,
|
|
828
|
+
"description": "inputs not compared, by reason (e.g. the Python timed out)",
|
|
829
|
+
},
|
|
830
|
+
"equiv_drift": {
|
|
831
|
+
"type": "array",
|
|
832
|
+
"items": {"type": "object"},
|
|
833
|
+
"description": "ints outside i64 (or inputs Rust cannot take): reported, not silently equal.",
|
|
834
|
+
},
|
|
835
|
+
}
|
|
836
|
+
_DEFS["function_verdict"]["properties"].update(_EQUIV_FIELDS)
|
|
837
|
+
_DEFS["model_verdict"] = {
|
|
838
|
+
"type": "object",
|
|
839
|
+
"properties": {"model": {"type": "string"}, **_EQUIV_FIELDS},
|
|
840
|
+
"required": ["model", "equiv"],
|
|
841
|
+
}
|
|
842
|
+
_V = SCHEMAS["verify"]["properties"]
|
|
843
|
+
_V["files"]["items"]["properties"]["models"] = {
|
|
844
|
+
"type": "array",
|
|
845
|
+
"items": {"$ref": "#/$defs/model_verdict"},
|
|
846
|
+
}
|
|
847
|
+
_V["summary"]["properties"].update(
|
|
848
|
+
{
|
|
849
|
+
k: _NULL_INT
|
|
850
|
+
for k in (
|
|
851
|
+
"equivalent_by_rules",
|
|
852
|
+
"functionally_equivalent",
|
|
853
|
+
"functions_equiv_applicable",
|
|
854
|
+
"functions_equiv_failed",
|
|
855
|
+
"functions_equiv_needs_judgement",
|
|
856
|
+
"functions_equiv_not_applicable",
|
|
857
|
+
"equiv_drift_findings",
|
|
858
|
+
"models_equiv_passed",
|
|
859
|
+
"models_equiv_total",
|
|
860
|
+
)
|
|
861
|
+
}
|
|
862
|
+
)
|
|
863
|
+
_V["equiv"] = {"type": "object", "description": "settings and judge accounting of the equiv rung"}
|
|
864
|
+
_V["judged"] = {
|
|
865
|
+
"type": "array",
|
|
866
|
+
"items": {"type": "object"},
|
|
867
|
+
"description": "judged passes with the judge's reasons, for human review",
|
|
868
|
+
}
|
|
869
|
+
_V["spot_check"] = _obj(
|
|
870
|
+
{
|
|
871
|
+
"requested": _INT,
|
|
872
|
+
"sampled": _INT,
|
|
873
|
+
"disagreements": _INT,
|
|
874
|
+
"estimated_false_pass_rate": {"type": ["number", "null"]},
|
|
875
|
+
"reason": _STR_OR_NULL,
|
|
876
|
+
}
|
|
877
|
+
)
|
|
878
|
+
_A = SCHEMAS["apply"]
|
|
879
|
+
_A["properties"]["equiv"] = {
|
|
880
|
+
"type": "object",
|
|
881
|
+
"properties": {
|
|
882
|
+
# not-run: the comparison was needed but not asked for (--run-python); opted-out: --no-equiv
|
|
883
|
+
"status": {"enum": ["not-run", "opted-out", *_EQUIV["enum"]]},
|
|
884
|
+
"decision": {"enum": ["accepted", "failed", "unverified"]},
|
|
885
|
+
"reason": _STR_OR_NULL,
|
|
886
|
+
"needs_review": {"type": "boolean"},
|
|
887
|
+
"judged_accepted_by": {
|
|
888
|
+
"enum": ["accept-judged", "ack-review", None],
|
|
889
|
+
"description": "who vouched for an accepted passed-judged result: accept-judged "
|
|
890
|
+
"(--accept-judged or accept_judged in the TOML), ack-review (needs_review TODO "
|
|
891
|
+
"acknowledged)",
|
|
892
|
+
},
|
|
893
|
+
"accept_judged": {
|
|
894
|
+
"type": "boolean",
|
|
895
|
+
"description": "judged passes were allowed to count (--accept-judged or the TOML key)",
|
|
896
|
+
},
|
|
897
|
+
"inputs": _INT,
|
|
898
|
+
"counterexample": {"type": ["object", "null"]},
|
|
899
|
+
"drift": {"type": "array"},
|
|
900
|
+
"judged": {"type": "array"},
|
|
901
|
+
},
|
|
902
|
+
"required": ["status"],
|
|
903
|
+
}
|
|
904
|
+
_A["properties"]["verified_level"] = {
|
|
905
|
+
"type": ["string", "null"],
|
|
906
|
+
"description": "what an accepted fix was verified by, e.g. 'check+tests+equivalence' or "
|
|
907
|
+
"'check+tests, not equivalence' (--no-equiv); null when not accepted",
|
|
908
|
+
}
|
|
909
|
+
_A["required"].append("equiv")
|
|
910
|
+
|
|
911
|
+
# --- the agent-first workflow: init, plan, next, done, status -------------------------------------
|
|
912
|
+
from python2rust.workflow import schemas as workflow_schemas # noqa: E402
|
|
913
|
+
|
|
914
|
+
SCHEMAS.update(workflow_schemas.build(_head, _obj))
|