robert-github-agent 0.1.0b1__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.
- robert_agent/__init__.py +1 -0
- robert_agent/acceptance.py +394 -0
- robert_agent/acceptance_suite.py +287 -0
- robert_agent/audit_result.py +501 -0
- robert_agent/authorize.py +117 -0
- robert_agent/board.py +538 -0
- robert_agent/chat_status.py +338 -0
- robert_agent/cli/__init__.py +1 -0
- robert_agent/cli/exit_codes.py +5 -0
- robert_agent/cli/main.py +535 -0
- robert_agent/cli/output.py +20 -0
- robert_agent/common.py +6 -0
- robert_agent/controlled_e2e_acceptance.py +394 -0
- robert_agent/daemon.py +607 -0
- robert_agent/daemon_state.py +319 -0
- robert_agent/diagnostics.py +119 -0
- robert_agent/discover.py +775 -0
- robert_agent/dispatch.py +217 -0
- robert_agent/doctor.py +94 -0
- robert_agent/github_api.py +12 -0
- robert_agent/init_config.py +126 -0
- robert_agent/integrations/__init__.py +1 -0
- robert_agent/integrations/openclaw.py +285 -0
- robert_agent/live_discovery_acceptance.py +70 -0
- robert_agent/live_worker_acceptance.py +363 -0
- robert_agent/live_worktree_acceptance.py +344 -0
- robert_agent/loop_engine.py +285 -0
- robert_agent/memory_curator.py +105 -0
- robert_agent/migrate.py +157 -0
- robert_agent/notify.py +74 -0
- robert_agent/paths.py +16 -0
- robert_agent/production_write_canary.py +254 -0
- robert_agent/project_memory.py +503 -0
- robert_agent/publish.py +743 -0
- robert_agent/publish_dedupe_acceptance.py +270 -0
- robert_agent/redaction.py +41 -0
- robert_agent/render_prompt.py +544 -0
- robert_agent/resource_files.py +8 -0
- robert_agent/resources/__init__.py +1 -0
- robert_agent/resources/acceptance-matrix.md +120 -0
- robert_agent/resources/classifier.md +19 -0
- robert_agent/resources/command-matrix.md +38 -0
- robert_agent/resources/config.example.yml +20 -0
- robert_agent/resources/db/migrations/001_legacy_dd_to_robert.sql +14 -0
- robert_agent/resources/db/schema.sql +479 -0
- robert_agent/resources/failure-modes.md +36 -0
- robert_agent/resources/fixtures/actor-permission.json +1 -0
- robert_agent/resources/fixtures/discovery.json +1 -0
- robert_agent/resources/fixtures/redaction.json +1 -0
- robert_agent/resources/fixtures/review-followup.json +1 -0
- robert_agent/resources/fixtures/worker-results.json +1 -0
- robert_agent/resources/fixtures/workstreams.json +1 -0
- robert_agent/resources/github-events.md +77 -0
- robert_agent/resources/kanban-control.md +165 -0
- robert_agent/resources/redaction.md +29 -0
- robert_agent/resources/result-contract.md +56 -0
- robert_agent/resources/routes.yml +82 -0
- robert_agent/resources/schemas/config.schema.json +123 -0
- robert_agent/resources/schemas/event.schema.json +18 -0
- robert_agent/resources/schemas/result.schema.json +99 -0
- robert_agent/resources/schemas/route.schema.json +23 -0
- robert_agent/resources/schemas/snapshot.schema.json +17 -0
- robert_agent/resources/schemas/task.schema.json +15 -0
- robert_agent/resources/trust-model.md +16 -0
- robert_agent/resources/worker-prompt.md +121 -0
- robert_agent/resources/worker-protocol.md +47 -0
- robert_agent/resources/workflow.yml +50 -0
- robert_agent/resources/workstream-model.md +17 -0
- robert_agent/route.py +232 -0
- robert_agent/route_config.py +64 -0
- robert_agent/run_once.py +5375 -0
- robert_agent/runtime_knowledge.py +392 -0
- robert_agent/service.py +161 -0
- robert_agent/skills.py +28 -0
- robert_agent/status.py +1051 -0
- robert_agent/storage.py +376 -0
- robert_agent/summarize.py +100 -0
- robert_agent/supervise.py +72 -0
- robert_agent/usage.py +192 -0
- robert_agent/validate_config.py +616 -0
- robert_agent/wakeup.py +261 -0
- robert_agent/web.py +2893 -0
- robert_agent/web_assets/board.css +255 -0
- robert_agent/web_assets/board.html +165 -0
- robert_agent/web_assets/board.js +660 -0
- robert_agent/web_assets/github-shell.css +122 -0
- robert_agent/web_assets/index.html +103 -0
- robert_agent/web_assets/operations.css +168 -0
- robert_agent/web_assets/workbench.css +131 -0
- robert_agent/web_assets/workbench.js +581 -0
- robert_agent/work_items.py +1016 -0
- robert_agent/workbench.py +701 -0
- robert_agent/worker/__init__.py +1 -0
- robert_agent/worker/heartbeat.py +190 -0
- robert_agent/worker/result.py +321 -0
- robert_agent/worker/snapshot.py +98 -0
- robert_agent/worker_adapters/__init__.py +138 -0
- robert_agent/worker_adapters/cbc.py +68 -0
- robert_agent/worker_adapters/codex.py +56 -0
- robert_agent/worker_adapters/command.py +33 -0
- robert_agent/worker_adapters/tcodex.py +56 -0
- robert_agent/worker_heartbeat.py +6 -0
- robert_agent/worker_result.py +6 -0
- robert_agent/worker_snapshot.py +6 -0
- robert_agent/workstream.py +55 -0
- robert_agent/worktree.py +297 -0
- robert_github_agent-0.1.0b1.dist-info/METADATA +217 -0
- robert_github_agent-0.1.0b1.dist-info/RECORD +111 -0
- robert_github_agent-0.1.0b1.dist-info/WHEEL +4 -0
- robert_github_agent-0.1.0b1.dist-info/entry_points.txt +2 -0
- robert_github_agent-0.1.0b1.dist-info/licenses/LICENSE +201 -0
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
import argparse
|
|
3
|
+
from contextlib import closing
|
|
4
|
+
import json
|
|
5
|
+
import os
|
|
6
|
+
import sqlite3
|
|
7
|
+
import tempfile
|
|
8
|
+
import time
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
|
|
11
|
+
from robert_agent.common import emit
|
|
12
|
+
from robert_agent import live_worktree_acceptance
|
|
13
|
+
from robert_agent import run_once
|
|
14
|
+
from robert_agent import validate_config
|
|
15
|
+
from robert_agent.resource_files import resource
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
PACKAGE_ROOT = Path(__file__).resolve().parent
|
|
19
|
+
WORKER_RESULT_SCRIPT = PACKAGE_ROOT / "worker_result.py"
|
|
20
|
+
DEFAULT_WORKFLOW = resource("workflow.yml")
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def _workspace_dir(workspace_dir):
|
|
24
|
+
if workspace_dir:
|
|
25
|
+
path = Path(workspace_dir).expanduser().resolve()
|
|
26
|
+
path.mkdir(parents=True, exist_ok=True)
|
|
27
|
+
return path
|
|
28
|
+
return Path(tempfile.mkdtemp(prefix="dd-controlled-e2e-")).resolve()
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def _write_json(path, payload):
|
|
32
|
+
path.parent.mkdir(parents=True, exist_ok=True)
|
|
33
|
+
path.write_text(json.dumps(payload, ensure_ascii=False, indent=2, sort_keys=True), encoding="utf-8")
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def _mock_new_pr_worker(workspace_dir):
|
|
37
|
+
worker = workspace_dir / "mock-new-pr-worker.py"
|
|
38
|
+
worker.write_text(
|
|
39
|
+
f"""#!/usr/bin/env python3
|
|
40
|
+
import json
|
|
41
|
+
import sys
|
|
42
|
+
|
|
43
|
+
sys.path.insert(0, {str(WORKER_RESULT_SCRIPT.parent.parent)!r})
|
|
44
|
+
from robert_agent.worker import result
|
|
45
|
+
|
|
46
|
+
prompt = sys.stdin.read()
|
|
47
|
+
fields = {{}}
|
|
48
|
+
for line in prompt.splitlines():
|
|
49
|
+
if ": " in line:
|
|
50
|
+
key, value = line.split(": ", 1)
|
|
51
|
+
fields[key] = value
|
|
52
|
+
fingerprints = json.loads(fields["event_fingerprints"])
|
|
53
|
+
workstream_id = fields["workstream_id"]
|
|
54
|
+
issue_number = workstream_id.rsplit("#", 1)[-1]
|
|
55
|
+
repo = workstream_id[len("github:"):].split("#", 1)[0]
|
|
56
|
+
body = (
|
|
57
|
+
"<!-- robert-workstream\\n"
|
|
58
|
+
"origin_workstream_id: {{}}\\n"
|
|
59
|
+
"source_issue: {{}}\\n"
|
|
60
|
+
"task_id: {{}}\\n"
|
|
61
|
+
"created_by: robert\\n"
|
|
62
|
+
"-->\\nControlled acceptance PR"
|
|
63
|
+
).format(workstream_id, issue_number, fields["task_id"])
|
|
64
|
+
payload = {{
|
|
65
|
+
"task_id": fields["task_id"],
|
|
66
|
+
"attempt_id": fields["attempt_id"],
|
|
67
|
+
"output_type": "new_pr",
|
|
68
|
+
"planned_github_actions": [
|
|
69
|
+
{{
|
|
70
|
+
"type": "push_existing_pr",
|
|
71
|
+
"worktree_path": fields["worktree_path"],
|
|
72
|
+
"branch": fields["branch_name"],
|
|
73
|
+
}},
|
|
74
|
+
{{
|
|
75
|
+
"type": "open_pr",
|
|
76
|
+
"repo": repo,
|
|
77
|
+
"head": fields["branch_name"],
|
|
78
|
+
"base": fields["target_base_branch"],
|
|
79
|
+
"title": "Controlled acceptance PR",
|
|
80
|
+
"body": body,
|
|
81
|
+
}}
|
|
82
|
+
],
|
|
83
|
+
"consumed_event_fingerprints": fingerprints,
|
|
84
|
+
"verification": [
|
|
85
|
+
{{
|
|
86
|
+
"command": "controlled-e2e-worker",
|
|
87
|
+
"status": "passed",
|
|
88
|
+
"purpose": "record controlled e2e worker acceptance result",
|
|
89
|
+
"required": True,
|
|
90
|
+
"exit_code": 0,
|
|
91
|
+
}}
|
|
92
|
+
],
|
|
93
|
+
"handoff": "controlled e2e ready",
|
|
94
|
+
"used_skills": [],
|
|
95
|
+
}}
|
|
96
|
+
record = result.record_result(fields["db_path"], payload)
|
|
97
|
+
print(json.dumps(record, sort_keys=True))
|
|
98
|
+
raise SystemExit(0 if record["ok"] else 1)
|
|
99
|
+
""",
|
|
100
|
+
encoding="utf-8",
|
|
101
|
+
)
|
|
102
|
+
os.chmod(worker, 0o755)
|
|
103
|
+
return worker
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
def _config(source_config_path, workspace_dir, checkout, worker):
|
|
107
|
+
source_config = validate_config.validate_config(source_config_path, skip_external=True)
|
|
108
|
+
if not source_config["ok"]:
|
|
109
|
+
return source_config
|
|
110
|
+
repo = source_config["repos"][0]
|
|
111
|
+
config = {
|
|
112
|
+
"data_dir": str(workspace_dir / "data"),
|
|
113
|
+
"database": "dd.sqlite3",
|
|
114
|
+
"worker_command": str(worker),
|
|
115
|
+
"max_concurrency": 1,
|
|
116
|
+
"worker_startup_grace_seconds": 1,
|
|
117
|
+
"stale_after_minutes": source_config.get("stale_after_minutes", 20),
|
|
118
|
+
"hard_timeout_minutes": source_config.get("hard_timeout_minutes", 90),
|
|
119
|
+
"lease_ttl_minutes": source_config.get("lease_ttl_minutes", 9),
|
|
120
|
+
"repos": [
|
|
121
|
+
{
|
|
122
|
+
"full_name": repo["full_name"],
|
|
123
|
+
"github_account": repo["github_account"],
|
|
124
|
+
"trusted_actors": repo["trusted_actors"],
|
|
125
|
+
"default_base_branch": "main",
|
|
126
|
+
"repo_root": str(checkout["repo_root"]),
|
|
127
|
+
"worktree_root": str(checkout["worktree_root"]),
|
|
128
|
+
}
|
|
129
|
+
],
|
|
130
|
+
}
|
|
131
|
+
config_path = workspace_dir / "config.json"
|
|
132
|
+
_write_json(config_path, config)
|
|
133
|
+
return {
|
|
134
|
+
"ok": True,
|
|
135
|
+
"status": "prepared",
|
|
136
|
+
"config_path": config_path,
|
|
137
|
+
"db_path": workspace_dir / "data" / "dd.sqlite3",
|
|
138
|
+
"repo": config["repos"][0],
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
def _fixture(config, workspace_dir):
|
|
143
|
+
repo = config["repo"]
|
|
144
|
+
fixture_path = workspace_dir / "fixture.json"
|
|
145
|
+
_write_json(
|
|
146
|
+
fixture_path,
|
|
147
|
+
{
|
|
148
|
+
"events": [
|
|
149
|
+
{
|
|
150
|
+
"id": "controlled-e2e-comment",
|
|
151
|
+
"number": 77,
|
|
152
|
+
"source_type": "issue",
|
|
153
|
+
"event_type": "comment",
|
|
154
|
+
"actor_login": repo["trusted_actors"][0],
|
|
155
|
+
"author_association": "OWNER",
|
|
156
|
+
"title": "Fix controlled e2e acceptance",
|
|
157
|
+
"body": f"@{repo['github_account']} please fix this controlled e2e bug",
|
|
158
|
+
"intent": "bug_fix",
|
|
159
|
+
"url": f"https://github.com/{repo['full_name']}/issues/77",
|
|
160
|
+
}
|
|
161
|
+
]
|
|
162
|
+
},
|
|
163
|
+
)
|
|
164
|
+
return fixture_path
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
def _wait_for_result(db_path, timeout_seconds, poll_interval_seconds):
|
|
168
|
+
deadline = time.monotonic() + timeout_seconds
|
|
169
|
+
while time.monotonic() <= deadline:
|
|
170
|
+
with closing(sqlite3.connect(db_path)) as conn:
|
|
171
|
+
row = conn.execute(
|
|
172
|
+
"""
|
|
173
|
+
SELECT result_id, output_type
|
|
174
|
+
FROM worker_results
|
|
175
|
+
ORDER BY created_at DESC
|
|
176
|
+
LIMIT 1
|
|
177
|
+
"""
|
|
178
|
+
).fetchone()
|
|
179
|
+
if row:
|
|
180
|
+
return {"result_id": row[0], "output_type": row[1]}
|
|
181
|
+
time.sleep(poll_interval_seconds)
|
|
182
|
+
return {}
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
class _PublishRunner:
|
|
186
|
+
def __init__(self):
|
|
187
|
+
self.calls = []
|
|
188
|
+
|
|
189
|
+
def __call__(self, command, **kwargs):
|
|
190
|
+
self.calls.append({"command": list(command), "kwargs": dict(kwargs)})
|
|
191
|
+
|
|
192
|
+
class Completed:
|
|
193
|
+
returncode = 0
|
|
194
|
+
stderr = ""
|
|
195
|
+
|
|
196
|
+
def __init__(self, stdout):
|
|
197
|
+
self.stdout = stdout
|
|
198
|
+
|
|
199
|
+
if command[:3] == ["gh", "pr", "list"]:
|
|
200
|
+
return Completed("[]")
|
|
201
|
+
if command[:3] == ["gh", "pr", "create"]:
|
|
202
|
+
repo = command[command.index("--repo") + 1] if "--repo" in command else "example/repo"
|
|
203
|
+
return Completed(f"https://github.com/{repo}/pull/42\n")
|
|
204
|
+
return Completed("[]")
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
def _evidence(db_path, repo_full_name):
|
|
208
|
+
issue_workstream_id = f"github:{repo_full_name}#77"
|
|
209
|
+
pr_workstream_id = f"github:{repo_full_name}!42"
|
|
210
|
+
with closing(sqlite3.connect(db_path)) as conn:
|
|
211
|
+
task = conn.execute(
|
|
212
|
+
"""
|
|
213
|
+
SELECT t.task_id, t.lifecycle, t.route_id, a.worktree_path, a.branch_name
|
|
214
|
+
FROM tasks t
|
|
215
|
+
JOIN attempts a ON a.task_id = t.task_id
|
|
216
|
+
ORDER BY t.created_at DESC
|
|
217
|
+
LIMIT 1
|
|
218
|
+
"""
|
|
219
|
+
).fetchone()
|
|
220
|
+
action_rows = conn.execute(
|
|
221
|
+
"""
|
|
222
|
+
SELECT action_type, audit_status, publish_status, target_url
|
|
223
|
+
FROM github_actions
|
|
224
|
+
ORDER BY created_at, action_id
|
|
225
|
+
"""
|
|
226
|
+
).fetchall()
|
|
227
|
+
issue_stream = conn.execute(
|
|
228
|
+
"""
|
|
229
|
+
SELECT lifecycle
|
|
230
|
+
FROM workstreams
|
|
231
|
+
WHERE workstream_id = ?
|
|
232
|
+
"""
|
|
233
|
+
,
|
|
234
|
+
(issue_workstream_id,),
|
|
235
|
+
).fetchone()
|
|
236
|
+
pr_stream = conn.execute(
|
|
237
|
+
"""
|
|
238
|
+
SELECT lifecycle
|
|
239
|
+
FROM workstreams
|
|
240
|
+
WHERE workstream_id = ?
|
|
241
|
+
"""
|
|
242
|
+
,
|
|
243
|
+
(pr_workstream_id,),
|
|
244
|
+
).fetchone()
|
|
245
|
+
result = conn.execute(
|
|
246
|
+
"""
|
|
247
|
+
SELECT result_id, output_type, metadata_json
|
|
248
|
+
FROM worker_results
|
|
249
|
+
ORDER BY created_at DESC
|
|
250
|
+
LIMIT 1
|
|
251
|
+
"""
|
|
252
|
+
).fetchone()
|
|
253
|
+
return {
|
|
254
|
+
"task_id": task[0] if task else "",
|
|
255
|
+
"task_lifecycle": task[1] if task else "",
|
|
256
|
+
"route_id": task[2] if task else "",
|
|
257
|
+
"worktree_path": task[3] if task else "",
|
|
258
|
+
"branch_name": task[4] if task else "",
|
|
259
|
+
"github_actions": [
|
|
260
|
+
(row[0], row[1], row[2]) for row in action_rows
|
|
261
|
+
],
|
|
262
|
+
"published_pr_url": next(
|
|
263
|
+
(row[3] for row in action_rows if row[0] == "open_pr" and row[3]),
|
|
264
|
+
"",
|
|
265
|
+
),
|
|
266
|
+
"issue_workstream_lifecycle": issue_stream[0] if issue_stream else "",
|
|
267
|
+
"derived_pr_workstream_lifecycle": pr_stream[0] if pr_stream else "",
|
|
268
|
+
"worker_result": {
|
|
269
|
+
"result_id": result[0] if result else "",
|
|
270
|
+
"output_type": result[1] if result else "",
|
|
271
|
+
"metadata": json.loads(result[2] or "{}") if result else {},
|
|
272
|
+
},
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
def controlled_e2e_acceptance(
|
|
277
|
+
config_path,
|
|
278
|
+
workspace_dir=None,
|
|
279
|
+
timeout_seconds=30,
|
|
280
|
+
poll_interval_seconds=0.2,
|
|
281
|
+
workflow_path=DEFAULT_WORKFLOW,
|
|
282
|
+
):
|
|
283
|
+
workspace = _workspace_dir(workspace_dir)
|
|
284
|
+
checkout = live_worktree_acceptance._controlled_checkout(workspace)
|
|
285
|
+
worker = _mock_new_pr_worker(workspace)
|
|
286
|
+
config = _config(config_path, workspace, checkout, worker)
|
|
287
|
+
if not config["ok"]:
|
|
288
|
+
return config
|
|
289
|
+
fixture = _fixture(config, workspace)
|
|
290
|
+
first_run = run_once.run_once(
|
|
291
|
+
config["config_path"],
|
|
292
|
+
workflow_path=workflow_path,
|
|
293
|
+
fixture_path=fixture,
|
|
294
|
+
dry_run=False,
|
|
295
|
+
skip_external=True,
|
|
296
|
+
)
|
|
297
|
+
if not first_run["ok"]:
|
|
298
|
+
return {
|
|
299
|
+
"ok": False,
|
|
300
|
+
"status": first_run.get("status", "failed_first_run"),
|
|
301
|
+
"safe_error": first_run.get("safe_error", "controlled e2e first run failed"),
|
|
302
|
+
"workspace_dir": str(workspace),
|
|
303
|
+
"config_path": str(config["config_path"]),
|
|
304
|
+
"fixture_path": str(fixture),
|
|
305
|
+
"db_path": str(config["db_path"]),
|
|
306
|
+
"first_run": first_run,
|
|
307
|
+
}
|
|
308
|
+
worker_result = _wait_for_result(config["db_path"], timeout_seconds, poll_interval_seconds)
|
|
309
|
+
if not worker_result:
|
|
310
|
+
return {
|
|
311
|
+
"ok": False,
|
|
312
|
+
"status": "worker_result_timeout",
|
|
313
|
+
"safe_error": "controlled e2e worker did not record a result",
|
|
314
|
+
"workspace_dir": str(workspace),
|
|
315
|
+
"config_path": str(config["config_path"]),
|
|
316
|
+
"fixture_path": str(fixture),
|
|
317
|
+
"db_path": str(config["db_path"]),
|
|
318
|
+
"first_run": first_run,
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
runner = _PublishRunner()
|
|
322
|
+
original_publish_ready_actions = run_once.publish.publish_ready_actions
|
|
323
|
+
|
|
324
|
+
def fake_publish_ready_actions(db_path, dry_run=False, repo_id=None):
|
|
325
|
+
return original_publish_ready_actions(
|
|
326
|
+
db_path,
|
|
327
|
+
dry_run=dry_run,
|
|
328
|
+
run_command=runner,
|
|
329
|
+
repo_id=repo_id,
|
|
330
|
+
)
|
|
331
|
+
|
|
332
|
+
try:
|
|
333
|
+
run_once.publish.publish_ready_actions = fake_publish_ready_actions
|
|
334
|
+
second_run = run_once.run_once(
|
|
335
|
+
config["config_path"],
|
|
336
|
+
workflow_path=workflow_path,
|
|
337
|
+
dry_run=False,
|
|
338
|
+
skip_external=True,
|
|
339
|
+
)
|
|
340
|
+
finally:
|
|
341
|
+
run_once.publish.publish_ready_actions = original_publish_ready_actions
|
|
342
|
+
repo_full_name = config["repo"]["full_name"]
|
|
343
|
+
evidence = _evidence(config["db_path"], repo_full_name)
|
|
344
|
+
ok = (
|
|
345
|
+
second_run.get("ok")
|
|
346
|
+
and evidence["route_id"] == "new-pr"
|
|
347
|
+
and evidence["task_lifecycle"] == "completed"
|
|
348
|
+
and evidence["issue_workstream_lifecycle"] == "completed"
|
|
349
|
+
and evidence["derived_pr_workstream_lifecycle"] == "completed"
|
|
350
|
+
and evidence["github_actions"] == [
|
|
351
|
+
("push_existing_pr", "accepted", "published"),
|
|
352
|
+
("open_pr", "accepted", "published"),
|
|
353
|
+
]
|
|
354
|
+
and evidence["published_pr_url"] == f"https://github.com/{repo_full_name}/pull/42"
|
|
355
|
+
)
|
|
356
|
+
return {
|
|
357
|
+
"ok": bool(ok),
|
|
358
|
+
"status": "completed" if ok else "failed_e2e_verification",
|
|
359
|
+
"workspace_dir": str(workspace),
|
|
360
|
+
"config_path": str(config["config_path"]),
|
|
361
|
+
"fixture_path": str(fixture),
|
|
362
|
+
"db_path": str(config["db_path"]),
|
|
363
|
+
"first_run": first_run,
|
|
364
|
+
"second_run": second_run,
|
|
365
|
+
"publish_result": second_run.get("publish_result", {}),
|
|
366
|
+
"publish_calls": runner.calls,
|
|
367
|
+
**evidence,
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
def main(argv=None):
|
|
372
|
+
parser = argparse.ArgumentParser()
|
|
373
|
+
parser.add_argument("--config", required=True)
|
|
374
|
+
parser.add_argument("--workspace-dir")
|
|
375
|
+
parser.add_argument("--workflow", default=str(DEFAULT_WORKFLOW))
|
|
376
|
+
parser.add_argument("--timeout-seconds", type=float, default=30)
|
|
377
|
+
parser.add_argument("--poll-interval-seconds", type=float, default=0.2)
|
|
378
|
+
args = parser.parse_args(argv)
|
|
379
|
+
result = controlled_e2e_acceptance(
|
|
380
|
+
args.config,
|
|
381
|
+
workspace_dir=args.workspace_dir,
|
|
382
|
+
workflow_path=Path(args.workflow),
|
|
383
|
+
timeout_seconds=args.timeout_seconds,
|
|
384
|
+
poll_interval_seconds=args.poll_interval_seconds,
|
|
385
|
+
)
|
|
386
|
+
if result.get("ok"):
|
|
387
|
+
return emit(result, 0)
|
|
388
|
+
if result.get("status") == "failed_config":
|
|
389
|
+
return emit(result, 3)
|
|
390
|
+
return emit(result, 2)
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
if __name__ == "__main__":
|
|
394
|
+
raise SystemExit(main())
|