@giamme/forge 0.11.1 → 0.12.1
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.
- package/CHANGELOG.md +56 -0
- package/SKILL.md +7 -3
- package/VERSION +1 -1
- package/docs/artifacts.md +50 -11
- package/docs/commands.md +56 -8
- package/docs/decomposed-runs.md +43 -2
- package/docs/forge-ui.md +55 -8
- package/docs/reviews.md +64 -6
- package/package.json +1 -1
- package/references/dataset.md +4 -2
- package/references/decompose.md +191 -17
- package/references/harnesses.md +13 -1
- package/references/ui.md +25 -4
- package/scripts/forge-contract.py +37 -7
- package/scripts/forge-control.py +268 -25
- package/scripts/forge-dispatch.sh +90 -3
- package/scripts/forge-guard.py +156 -15
- package/scripts/forge-issues.py +47 -3
- package/scripts/forge-lib-plans.sh +9 -3
- package/scripts/forge-lib-review.sh +24 -5
- package/scripts/forge-lib-task.sh +53 -5
- package/scripts/forge-lib-verify.sh +137 -6
- package/scripts/forge-parallel-options.sh +85 -0
- package/scripts/forge-parallel.sh +262 -31
- package/scripts/forge-ripwire.py +1 -1
- package/scripts/forge-route.py +157 -5
- package/scripts/forge-runtime.py +49 -1
- package/scripts/forge-schedule.py +735 -53
- package/scripts/forge-solo.sh +3 -1
- package/scripts/forge-sweep.py +542 -0
- package/scripts/forge-verify.py +878 -0
- package/scripts/forge_dataset/forecast.py +33 -5
- package/scripts/forge_dataset/harvest.py +10 -4
- package/scripts/forge_verify_reports.py +225 -0
- package/ui/README.md +58 -12
- package/ui/docs/api.md +277 -28
- package/ui/forge_ui/checks.py +331 -0
- package/ui/forge_ui/control.py +12 -2
- package/ui/forge_ui/export.py +25 -8
- package/ui/forge_ui/reader.py +657 -24
- package/ui/forge_ui/server.py +29 -0
- package/ui/forge_ui/static/app.js +15 -7
- package/ui/forge_ui/static/checksview.js +449 -0
- package/ui/forge_ui/static/controls.js +217 -33
- package/ui/forge_ui/static/convo.js +11 -2
- package/ui/forge_ui/static/findingsview.js +6 -4
- package/ui/forge_ui/static/gantt.js +14 -9
- package/ui/forge_ui/static/index.html +2 -0
- package/ui/forge_ui/static/panel.js +44 -1
- package/ui/forge_ui/static/runmodel.js +109 -12
- package/ui/forge_ui/static/scene3d.js +9 -5
- package/ui/forge_ui/static/style.css +113 -0
- package/ui/forge_ui/static/verifyview.js +324 -0
- package/ui/forge_ui/transcripts.py +225 -54
|
@@ -243,13 +243,25 @@ def _pct(v):
|
|
|
243
243
|
return '%.0f%%' % (v * 100)
|
|
244
244
|
|
|
245
245
|
|
|
246
|
-
def
|
|
246
|
+
def _names(rows: list, most: int = 8) -> str:
|
|
247
|
+
names = [r['task'] for r in rows]
|
|
248
|
+
return ', '.join(names[:most]) + (', ...' if len(names) > most else '')
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
def lines(fc: dict, brief: bool = False) -> list:
|
|
252
|
+
"""The forecast as text. brief (the block `run` prints) gives tasks without enough history
|
|
253
|
+
one line together instead of one row each, and no table at all when no task has enough."""
|
|
254
|
+
thin = [r for r in fc['tasks'] if not r['enough']]
|
|
255
|
+
if brief and len(thin) == len(fc['tasks']):
|
|
256
|
+
return ['no forecast yet: none of the %d task(s) has %d past tasks at its tier and model '
|
|
257
|
+
'(forge dataset forecast %s shows each count)' % (len(thin), MIN_HISTORY, fc['plan'])]
|
|
247
258
|
out = ['forecast from %d past task(s) at the same tier and model (advisory; routing never reads it)'
|
|
248
259
|
% fc['history_tasks']]
|
|
249
260
|
for r in fc['tasks']:
|
|
250
261
|
where = '%s %s' % (r['tier'] or '?', r['spec'] or '?')
|
|
251
262
|
if not r['enough']:
|
|
252
|
-
|
|
263
|
+
if not brief:
|
|
264
|
+
out.append(' %-14s %-22s %s' % (r['task'], where, r['note']))
|
|
253
265
|
continue
|
|
254
266
|
fp = r['first_pass']
|
|
255
267
|
t, s = r['tokens'], r['time_s']
|
|
@@ -257,6 +269,9 @@ def lines(fc: dict) -> list:
|
|
|
257
269
|
r['task'], where, _pct(fp['rate']), _pct(fp['ci'][0]), _pct(fp['ci'][1]), fp['k'], fp['n'],
|
|
258
270
|
_tokens(t['median']), _tokens(t['p90']), _time(s['median']), _time(s['p90']),
|
|
259
271
|
' <- likely to need a retry' if r['flag'] else ''))
|
|
272
|
+
if brief and thin:
|
|
273
|
+
out.append(' %d task(s) without enough history yet (under %d past tasks): %s'
|
|
274
|
+
% (len(thin), MIN_HISTORY, _names(thin)))
|
|
260
275
|
if fc['merged']:
|
|
261
276
|
out.append(' %d task(s) already merged, not forecast' % len(fc['merged']))
|
|
262
277
|
tot = fc['total']
|
|
@@ -275,12 +290,17 @@ def lines(fc: dict) -> list:
|
|
|
275
290
|
return out
|
|
276
291
|
|
|
277
292
|
|
|
293
|
+
def _tmp(plan: Path) -> Path:
|
|
294
|
+
"""Where save() writes forecast.json before moving it into place."""
|
|
295
|
+
return plan / ('.forecast.json.%d' % os.getpid())
|
|
296
|
+
|
|
297
|
+
|
|
278
298
|
def save(plan: Path, fc: dict) -> None:
|
|
279
299
|
"""Keep what was predicted, so it can be checked against what happened. Fail-open."""
|
|
280
300
|
body = {k: v for k, v in fc.items() if k != 'at'}
|
|
281
301
|
digest = hashlib.sha256(json.dumps(body, sort_keys=True).encode()).hexdigest()[:16]
|
|
302
|
+
tmp = _tmp(plan)
|
|
282
303
|
try:
|
|
283
|
-
tmp = plan / ('.forecast.json.%d' % os.getpid())
|
|
284
304
|
tmp.write_text(json.dumps(fc, indent=2, sort_keys=True) + '\n')
|
|
285
305
|
tmp.replace(plan / 'forecast.json')
|
|
286
306
|
except OSError:
|
|
@@ -302,7 +322,7 @@ def advise(plan: Path, shown: list) -> None:
|
|
|
302
322
|
return
|
|
303
323
|
if not fc or not fc['tasks']:
|
|
304
324
|
return
|
|
305
|
-
for line in lines(fc):
|
|
325
|
+
for line in lines(fc, brief=True):
|
|
306
326
|
print(line)
|
|
307
327
|
sys.stdout.flush()
|
|
308
328
|
shown.append(True)
|
|
@@ -317,7 +337,10 @@ def budget() -> float:
|
|
|
317
337
|
value = float(os.environ.get('FORGE_FORECAST_BUDGET_S') or BUDGET_S)
|
|
318
338
|
except ValueError:
|
|
319
339
|
return BUDGET_S
|
|
320
|
-
|
|
340
|
+
if not value > 0:
|
|
341
|
+
return BUDGET_S
|
|
342
|
+
# Thread.join refuses a timeout past TIMEOUT_MAX (inf, 1e10, ...): that budget means no limit.
|
|
343
|
+
return min(value, threading.TIMEOUT_MAX)
|
|
321
344
|
|
|
322
345
|
|
|
323
346
|
def main(args) -> int:
|
|
@@ -336,6 +359,11 @@ def main(args) -> int:
|
|
|
336
359
|
if not shown:
|
|
337
360
|
print('forecast skipped: reading the history took over %gs' % budget())
|
|
338
361
|
sys.stdout.flush()
|
|
362
|
+
# os._exit stops save() wherever it is, so a half-written temp file would stay in the plan.
|
|
363
|
+
try:
|
|
364
|
+
_tmp(plan).unlink()
|
|
365
|
+
except OSError:
|
|
366
|
+
pass
|
|
339
367
|
os._exit(0)
|
|
340
368
|
return 0
|
|
341
369
|
if not (plan / 'tasks.tsv').is_file():
|
|
@@ -43,7 +43,7 @@ WATCHED = (
|
|
|
43
43
|
'verification.status', 'verification.exit', 'verification.command', 'verification.log',
|
|
44
44
|
'verification.retry.log', 'verification.flaky', 'verification.coverage.txt',
|
|
45
45
|
'verification.jev.json', 'verification.runs.tsv', 'verification.commit', 'verification.fingerprint',
|
|
46
|
-
'results.tsv',
|
|
46
|
+
'verification.lanes.json', 'results.tsv',
|
|
47
47
|
)
|
|
48
48
|
|
|
49
49
|
_VERDICT = re.compile(r'^FORGE_VERDICT: (PASS|FAIL)([ \t]+(—|–|-)( .*)?)?[ \t]*$')
|
|
@@ -544,8 +544,11 @@ def verification_events(attempt: Path, out: Path, rc, prov: dict, src: str = 'li
|
|
|
544
544
|
repo = first_line(plan / 'repo')
|
|
545
545
|
command = first_line(out / 'verification.command') if made('verification.command') else None
|
|
546
546
|
jev = read_json(out / 'verification.jev.json') if made('verification.jev.json') else None
|
|
547
|
+
lanes = made('verification.lanes.json')
|
|
547
548
|
if not command:
|
|
548
549
|
source = None
|
|
550
|
+
elif lanes:
|
|
551
|
+
source = 'lanes:plan' if (plan / 'verify.d').is_dir() else 'lanes:repo'
|
|
549
552
|
elif (plan / 'verify_cmd').exists():
|
|
550
553
|
source = 'flag'
|
|
551
554
|
elif jev and jev.get('discovered'):
|
|
@@ -559,9 +562,12 @@ def verification_events(attempt: Path, out: Path, rc, prov: dict, src: str = 'li
|
|
|
559
562
|
for line in (text(out / 'verification.runs.tsv') or '').splitlines():
|
|
560
563
|
cells = line.split('\t')
|
|
561
564
|
if len(cells) >= 5 and cells[0].isdigit():
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
+
run = dict(n=int(cells[0]), kind=cells[1], exit=as_int(cells[2]),
|
|
566
|
+
tree_changed=cells[3] == '1', duration_s=as_int(cells[4]),
|
|
567
|
+
log=cells[5] if len(cells) > 5 else None)
|
|
568
|
+
if len(cells) >= 8: # a lane's run: n kind exit tree_changed duration_s log lane started
|
|
569
|
+
run['lane'] = cells[6] or None
|
|
570
|
+
runs.append(run)
|
|
565
571
|
elif command and made('verification.log'):
|
|
566
572
|
runs.append(dict(n=1, kind='initial', exit=as_int(first_line(out / 'verification.exit')),
|
|
567
573
|
tree_changed=None, duration_s=None, log='verification.log'))
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
"""Test reports for forge-verify.py: JUnit XML and TAP 12-14. Stdlib only, offline.
|
|
2
|
+
|
|
3
|
+
``scan(directory, since)`` reads every ``*.xml`` and ``*.tap`` under a lane's report
|
|
4
|
+
directory that was written at or after ``since`` (an epoch float: the start of that run),
|
|
5
|
+
recursively and without following symlinks, and returns the lane's ``tests``:
|
|
6
|
+
|
|
7
|
+
{"pass", "fail", "skip", "error",
|
|
8
|
+
"failing": [{"name", "suite", "file", "message", "excerpt", "known", "log_line"}],
|
|
9
|
+
"reports": [<paths relative to the directory>], "notes": [...], "truncated": bool}
|
|
10
|
+
|
|
11
|
+
plus what a baseline verdict needs and the display does not keep: every failing name (not
|
|
12
|
+
only the first 200) and whether the evidence is complete. A report that cannot be used
|
|
13
|
+
(too big, unreadable, not parseable, a DOCTYPE or ENTITY declaration) is skipped with a
|
|
14
|
+
note and makes the evidence incomplete; nothing here raises on a hostile file.
|
|
15
|
+
"""
|
|
16
|
+
from __future__ import annotations
|
|
17
|
+
|
|
18
|
+
import os
|
|
19
|
+
import re
|
|
20
|
+
import stat
|
|
21
|
+
import xml.etree.ElementTree as ET
|
|
22
|
+
|
|
23
|
+
FILE_MAX = 32 << 20
|
|
24
|
+
FAILING_MAX = 200
|
|
25
|
+
MESSAGE_MAX = 500
|
|
26
|
+
EXCERPT_MAX = 2000
|
|
27
|
+
LOG_SEARCH_MAX = 64 << 20
|
|
28
|
+
|
|
29
|
+
ANSI = re.compile(r'\x1b\[[0-?]*[ -/]*[@-~]|\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)|\x1b[@-Z\\-_]')
|
|
30
|
+
# Refused before parsing: no external entities, no entity expansion bombs.
|
|
31
|
+
DECLARATIONS = re.compile(rb'<!\s*(?:DOCTYPE|ENTITY)', re.I)
|
|
32
|
+
TAP_LINE = re.compile(r'(not\s+)?ok\b\s*(\d+)?\s*(?:-\s*)?(.*)$')
|
|
33
|
+
TAP_PLAN = re.compile(r'1\.\.(\d+)\b')
|
|
34
|
+
TAP_BAIL = re.compile(r'Bail out!\s*(.*)$')
|
|
35
|
+
TAP_DIRECTIVE = re.compile(r'\s*(?<!\\)#\s*(SKIP|TODO)\b', re.I)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def clean(text: str | None, cap: int) -> str:
|
|
39
|
+
return ANSI.sub('', text or '').strip()[:cap]
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def first_line(text: str | None) -> str:
|
|
43
|
+
for line in (text or '').splitlines():
|
|
44
|
+
if line.strip():
|
|
45
|
+
return line.strip()
|
|
46
|
+
return ''
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def junit_cases(data: bytes) -> list[dict]:
|
|
50
|
+
"""[{name, suite, outcome, message, excerpt}] from a JUnit XML document; ValueError when unusable."""
|
|
51
|
+
# The declaration check reads bytes, so only an ASCII-compatible encoding is let through:
|
|
52
|
+
# UTF-16 or UTF-32 (a byte-order mark, or NUL bytes) could hide a DOCTYPE from it.
|
|
53
|
+
if data[:2] in (b'\xff\xfe', b'\xfe\xff') or b'\x00' in data:
|
|
54
|
+
raise ValueError('only UTF-8 reports are read')
|
|
55
|
+
if DECLARATIONS.search(data):
|
|
56
|
+
raise ValueError('DOCTYPE or ENTITY declarations are refused')
|
|
57
|
+
try:
|
|
58
|
+
root = ET.fromstring(data)
|
|
59
|
+
except ET.ParseError as error:
|
|
60
|
+
raise ValueError('not well-formed XML (%s)' % error)
|
|
61
|
+
if root.tag not in ('testsuite', 'testsuites'):
|
|
62
|
+
raise ValueError('no testsuite or testsuites element')
|
|
63
|
+
parents = {child: parent for parent in root.iter() for child in parent}
|
|
64
|
+
cases = []
|
|
65
|
+
for case in root.iter('testcase'):
|
|
66
|
+
name, classname = case.get('name') or '?', case.get('classname')
|
|
67
|
+
suite = parents.get(case)
|
|
68
|
+
problem = case.find('failure')
|
|
69
|
+
outcome = 'fail'
|
|
70
|
+
if problem is None:
|
|
71
|
+
problem, outcome = case.find('error'), 'error'
|
|
72
|
+
if problem is None:
|
|
73
|
+
outcome = 'skip' if case.find('skipped') is not None else 'pass'
|
|
74
|
+
entry = {'name': '%s.%s' % (classname, name) if classname else name,
|
|
75
|
+
'suite': suite.get('name') if suite is not None and suite.tag == 'testsuite' else None,
|
|
76
|
+
'outcome': outcome, 'message': '', 'excerpt': ''}
|
|
77
|
+
if problem is not None:
|
|
78
|
+
text = problem.text or ''
|
|
79
|
+
entry['message'] = problem.get('message') or first_line(text)
|
|
80
|
+
parts = [text] + [(case.findtext(tag) or '') for tag in ('system-out', 'system-err')]
|
|
81
|
+
entry['excerpt'] = '\n'.join(p.strip('\n') for p in parts if p.strip())
|
|
82
|
+
cases.append(entry)
|
|
83
|
+
return cases
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def tap_cases(data: bytes) -> tuple[list[dict], str | None]:
|
|
87
|
+
"""Top-level test points of a TAP stream, each with its YAML diagnostic block if any, and
|
|
88
|
+
why the stream is incomplete (a `Bail out!`, no plan, or fewer or more points than its
|
|
89
|
+
plan), else None. An incomplete stream's points still count, but cannot prove a baseline."""
|
|
90
|
+
try:
|
|
91
|
+
text = data.decode('utf-8')
|
|
92
|
+
except UnicodeDecodeError:
|
|
93
|
+
raise ValueError('not UTF-8 text')
|
|
94
|
+
cases: list[dict] = []
|
|
95
|
+
block: list[str] | None = None
|
|
96
|
+
planned = bail = None
|
|
97
|
+
for line in text.splitlines():
|
|
98
|
+
if block is not None:
|
|
99
|
+
if line.strip() == '...':
|
|
100
|
+
if cases:
|
|
101
|
+
diag = '\n'.join(block)
|
|
102
|
+
cases[-1]['excerpt'] = diag
|
|
103
|
+
found = re.search(r'^\s*message:\s*(.*)$', diag, re.M)
|
|
104
|
+
if found:
|
|
105
|
+
cases[-1]['message'] = found.group(1).strip().strip('\'"')
|
|
106
|
+
block = None
|
|
107
|
+
else:
|
|
108
|
+
block.append(line)
|
|
109
|
+
continue
|
|
110
|
+
if line.strip() == '---' and line.startswith(' ') and cases:
|
|
111
|
+
block = []
|
|
112
|
+
continue
|
|
113
|
+
stop = TAP_BAIL.match(line)
|
|
114
|
+
if stop:
|
|
115
|
+
bail = stop.group(1).strip() or 'no reason given'
|
|
116
|
+
break
|
|
117
|
+
plan = TAP_PLAN.match(line)
|
|
118
|
+
if plan and planned is None:
|
|
119
|
+
planned = int(plan.group(1))
|
|
120
|
+
continue
|
|
121
|
+
match = TAP_LINE.match(line) # top level only: subtests are indented
|
|
122
|
+
if not match:
|
|
123
|
+
continue
|
|
124
|
+
description = match.group(3)
|
|
125
|
+
directive = TAP_DIRECTIVE.search(description)
|
|
126
|
+
name = description[:directive.start()].strip() if directive else description.strip()
|
|
127
|
+
if directive:
|
|
128
|
+
outcome = 'skip'
|
|
129
|
+
else:
|
|
130
|
+
outcome = 'fail' if match.group(1) else 'pass'
|
|
131
|
+
cases.append({'name': name or 'test %s' % (match.group(2) or len(cases) + 1), 'suite': None,
|
|
132
|
+
'outcome': outcome, 'message': '', 'excerpt': ''})
|
|
133
|
+
if not cases:
|
|
134
|
+
raise ValueError('no TAP test points')
|
|
135
|
+
if bail is not None:
|
|
136
|
+
return cases, 'it bailed out (%s)' % clean(bail, MESSAGE_MAX)
|
|
137
|
+
if planned is None:
|
|
138
|
+
return cases, 'it has no plan line (1..N)'
|
|
139
|
+
if planned != len(cases):
|
|
140
|
+
return cases, 'its plan says %d tests and it has %d' % (planned, len(cases))
|
|
141
|
+
return cases, None
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
def scan(directory: str, since: float) -> tuple[dict, list[str], bool]:
|
|
145
|
+
"""(tests, every failing name, whether the evidence is complete) for one lane run."""
|
|
146
|
+
tests = {'pass': 0, 'fail': 0, 'skip': 0, 'error': 0, 'failing': [], 'reports': [],
|
|
147
|
+
'notes': [], 'truncated': False}
|
|
148
|
+
names: list[str] = []
|
|
149
|
+
complete = True
|
|
150
|
+
found = []
|
|
151
|
+
for top, dirs, files in os.walk(directory, followlinks=False):
|
|
152
|
+
dirs.sort()
|
|
153
|
+
for name in sorted(files):
|
|
154
|
+
if name.endswith(('.xml', '.tap')):
|
|
155
|
+
found.append(os.path.join(top, name))
|
|
156
|
+
for path in found:
|
|
157
|
+
rel = os.path.relpath(path, directory)
|
|
158
|
+
try:
|
|
159
|
+
info = os.lstat(path)
|
|
160
|
+
except OSError:
|
|
161
|
+
continue
|
|
162
|
+
if not stat.S_ISREG(info.st_mode) or info.st_mtime < since:
|
|
163
|
+
continue # a symlink, or a report an earlier run left
|
|
164
|
+
try:
|
|
165
|
+
if info.st_size > FILE_MAX:
|
|
166
|
+
raise ValueError('larger than %d MB' % (FILE_MAX >> 20))
|
|
167
|
+
with open(path, 'rb') as handle:
|
|
168
|
+
data = handle.read(FILE_MAX + 1)
|
|
169
|
+
if len(data) > FILE_MAX:
|
|
170
|
+
raise ValueError('larger than %d MB' % (FILE_MAX >> 20))
|
|
171
|
+
cases, problem = (junit_cases(data), None) if rel.endswith('.xml') else tap_cases(data)
|
|
172
|
+
except (OSError, ValueError, RecursionError) as error:
|
|
173
|
+
tests['notes'].append('%s skipped: %s' % (rel, error))
|
|
174
|
+
complete = False
|
|
175
|
+
continue
|
|
176
|
+
tests['reports'].append(rel)
|
|
177
|
+
if problem:
|
|
178
|
+
tests['notes'].append('%s is incomplete: %s' % (rel, problem))
|
|
179
|
+
complete = False
|
|
180
|
+
for case in cases:
|
|
181
|
+
tests[case['outcome']] += 1
|
|
182
|
+
if case['outcome'] not in ('fail', 'error'):
|
|
183
|
+
continue
|
|
184
|
+
names.append(case['name'])
|
|
185
|
+
if len(tests['failing']) >= FAILING_MAX:
|
|
186
|
+
tests['truncated'] = True
|
|
187
|
+
continue
|
|
188
|
+
tests['failing'].append({'name': clean(case['name'], MESSAGE_MAX), 'suite': case['suite'],
|
|
189
|
+
'file': rel, 'message': clean(case['message'], MESSAGE_MAX),
|
|
190
|
+
'excerpt': clean(case['excerpt'], EXCERPT_MAX),
|
|
191
|
+
'known': False, 'log_line': None})
|
|
192
|
+
return tests, names, complete
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
def log_lines(log: str, names: list[str]) -> dict:
|
|
196
|
+
"""{name: 1-based number of the first log line containing it}, within the first 64 MB."""
|
|
197
|
+
wanted = sorted({n for n in names if n}, key=len, reverse=True)
|
|
198
|
+
if not wanted:
|
|
199
|
+
return {}
|
|
200
|
+
pattern = re.compile('|'.join(re.escape(n) for n in wanted))
|
|
201
|
+
found: dict = {}
|
|
202
|
+
read = 0
|
|
203
|
+
try:
|
|
204
|
+
with open(log, 'rb') as handle:
|
|
205
|
+
for number, raw in enumerate(handle, 1):
|
|
206
|
+
read += len(raw)
|
|
207
|
+
if read > LOG_SEARCH_MAX:
|
|
208
|
+
break
|
|
209
|
+
line = raw.decode('utf-8', 'replace')
|
|
210
|
+
if not pattern.search(line): # one search per line; most lines name no test
|
|
211
|
+
continue
|
|
212
|
+
for name in wanted:
|
|
213
|
+
if name not in found and name in line:
|
|
214
|
+
found[name] = number
|
|
215
|
+
if len(found) == len(wanted):
|
|
216
|
+
break
|
|
217
|
+
except OSError:
|
|
218
|
+
pass
|
|
219
|
+
return found
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
def load_baseline(path: str) -> set:
|
|
223
|
+
"""Known failing test names: one per line, blank lines and # comments ignored."""
|
|
224
|
+
with open(path, encoding='utf-8', errors='replace') as handle:
|
|
225
|
+
return {line.strip() for line in handle if line.strip() and not line.strip().startswith('#')}
|
package/ui/README.md
CHANGED
|
@@ -12,9 +12,19 @@ blocks on a plate, with cables between them and lamps that light up as things ha
|
|
|
12
12
|
dependency cables, and ends in a *finish* line of three nodes: integration, verification
|
|
13
13
|
and the whole-run **final review**. *Execution* lays the same work out on wall-clock time:
|
|
14
14
|
one block per attempt, in the lane it really ran in, with its dwarf and review inside, the
|
|
15
|
-
attempts that have not started projected by forge-schedule's own rules,
|
|
16
|
-
many slots were busy against `--max-parallel
|
|
17
|
-
from its wave to where it ran.
|
|
15
|
+
attempts that have not started projected by forge-schedule's own rules, a strip of how
|
|
16
|
+
many slots were busy against `--max-parallel`, and the verification's lanes and reruns on
|
|
17
|
+
rows of their own. Switching between the two moves each task from its wave to where it ran.
|
|
18
|
+
- **Verification as it happens:** the step each lane is in, its last line, the failing tests
|
|
19
|
+
first (new or known, from the lanes' test reports) with a link into the log at each one, and
|
|
20
|
+
every lane's output a click away.
|
|
21
|
+
- **Where each task is, and what it checked:** the command a running dwarf or reviewer is
|
|
22
|
+
running and for how long, flagged when its log has been quiet for five minutes; why a task
|
|
23
|
+
that is not running waits (its dependencies, shared files, a full run, a drain, an
|
|
24
|
+
infrastructure pause with its countdown, the retry policy); each attempt's tests, type checks,
|
|
25
|
+
lints and builds with their exits, times and counts, against the commands its acceptance
|
|
26
|
+
criteria name; and one banner for an environment problem (Docker, a sandbox's EPERM, a port in
|
|
27
|
+
use) that several tasks met.
|
|
18
28
|
- **Click to open.** A task opens to show its attempts, each with its dwarf, its reviewer and
|
|
19
29
|
any shadow reviews, linked; an escalation is a labelled cable between attempts. The
|
|
20
30
|
inspector beside the stage shows what launched each step and what came of it: the exact
|
|
@@ -169,15 +179,47 @@ keep one meaning everywhere (amber running, green merged or passed, red failed,
|
|
|
169
179
|
a lamp: their severity is a shape (P0 spike, P1 diamond, P2 cone, P3 pin).
|
|
170
180
|
- **Tables:** the task table and the leaderboard's tables sort by any column (click its header:
|
|
171
181
|
ascending, descending, off), reorder by dragging a header (or Alt+← → on it), and show or hide
|
|
172
|
-
columns from *Columns*, which also resets them. Each table remembers its columns.
|
|
182
|
+
columns from *Columns*, which also resets them. Each table remembers its columns. The task
|
|
183
|
+
table's *Now* column says what each running task runs (and for how long), or why one waits.
|
|
173
184
|
|
|
174
185
|
<img src="docs/media/run.png" width="49%" alt="Planned waves: a run's tasks on a 3D plate with dependency cables, finding marks and the finish nodes, between the runs list and the run's inspector."> <img src="docs/media/execution.png" width="49%" alt="Execution: one block per attempt on wall-clock time, failed attempts in red, with the timeline and critical path in the inspector.">
|
|
175
|
-
- **Inspector:** for the run, its timeline, critical path, peak concurrency
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
186
|
+
- **Inspector:** for the run, its timeline, critical path, peak concurrency, what its scheduler
|
|
187
|
+
is doing (dispatching, drained or stopping, how many tasks wait and on what, each pause with its
|
|
188
|
+
countdown) and finish line, with what the finding sweep fixed and left; for a task, *Now* (below), its models and routing, escalations,
|
|
189
|
+
timings (busy, model time, overhead, queue wait after its dependencies merged), attempts and
|
|
190
|
+
their executions with the checks each ran, review findings with the gate decision, what the
|
|
191
|
+
finding sweep did with its findings (or, for a fix task, each finding it took and whether its
|
|
192
|
+
review found it fixed), Clef predictions against outcomes, and its prompts; for one execution, its model, phases, tokens,
|
|
193
|
+
checks, exact prompt and final message; for the final review, its verdict, findings, report,
|
|
194
|
+
prompt and history.
|
|
195
|
+
- **Now and checks:** a running task's *Now* names the agent at work and its attempt, the phase
|
|
196
|
+
and for how long, the command it is running (its first line, and whether it is a test, type
|
|
197
|
+
check, lint or build) and for how long, when its log last moved, and *quiet N min* once that is
|
|
198
|
+
over five minutes; it links to the conversation. A task that is not running says why: the
|
|
199
|
+
tasks it waits on (a stopped one marked), the running task it shares files with, no free slot,
|
|
200
|
+
a drain or stop, an infrastructure pause with its countdown, or the retry policy's stop with
|
|
201
|
+
the split it suggests. Under each attempt's dwarf and reviewer are the checks they ran, from
|
|
202
|
+
their logs: a lamp, the kind, the command (opening the conversation at it), its exit, time and
|
|
203
|
+
counts (passed, failed, skipped; or errors and warnings), and a failed one's last lines; then
|
|
204
|
+
the environment problems its failed commands met, and which of the commands the brief's
|
|
205
|
+
`## Acceptance criteria` names ran, ran another way, or never ran. A codex or grok log carries
|
|
206
|
+
no times, so the times come from the clock forge keeps beside each log (runs from before it
|
|
207
|
+
show none). The run header's *Environment* banner lists a problem (Docker down or out of
|
|
208
|
+
address pools, a missing container, a port in use, the sandbox's EPERM, a refused local
|
|
209
|
+
service, no network, a full disk, a missing command) that the failed commands of more than one
|
|
210
|
+
task met, with those tasks and, folded, each command and the line that showed it.
|
|
211
|
+
- **Verification (its finish node):** while it runs, how long it has run, the step a lane
|
|
212
|
+
announced (`::forge step name=… state=start`) and for how long, the last line it printed, a
|
|
213
|
+
warning after five minutes with no output, and the live output of the lane that printed last
|
|
214
|
+
(choose a lane to follow it instead). Once it failed, the failing tests come first, grouped by
|
|
215
|
+
lane and marked *new* or *known* (from the lane's JUnit or TAP reports and its baseline), each
|
|
216
|
+
with its message, an excerpt and *open in log* at its line; a lane without reports shows the
|
|
217
|
+
end of its log, and the step it ended in is named. A table lists every lane with its state
|
|
218
|
+
(flaky and known marked), time, runs and test counts; a lane's name opens its output. A
|
|
219
|
+
changed checkout is called out. A single verify command shows the newest of its logs live.
|
|
220
|
+
In *Execution*, the verification gets rows after the tasks: one per lane, with a bar per run
|
|
221
|
+
and reruns marked, or a single command's runs back to back (dashed: only their durations are
|
|
222
|
+
recorded). The finish node counts the lanes and reruns and lights one lamp per lane.
|
|
181
223
|
- **Files (the run toolbar's third mode):** a heatmap of files (grouped and collapsible by
|
|
182
224
|
directory) against tasks (grouped by wave): planned files outlined, touched files filled by how
|
|
183
225
|
many attempts changed them, drift hatched, merge conflicts ringed, and a dot where another task
|
|
@@ -208,7 +250,7 @@ keep one meaning everywhere (amber running, green merged or passed, red failed,
|
|
|
208
250
|
from a finding's mark on the stage (`/finding/<id>` scrolls to that finding and focuses it).
|
|
209
251
|
|
|
210
252
|
<img src="docs/media/diff.png" width="760" alt="The diff a reviewer read, with a P1 finding under the line that compares token digests and a P2 finding under the revoke function.">
|
|
211
|
-
- **Conversations (`…/tasks/<id>/executions/<dwarf-or-qa>/conversation`, `…/executions/<id>/conversation`):**
|
|
253
|
+
- **Conversations (`…/tasks/<id>/executions/<dwarf-or-qa>/conversation[/event/<n>]`, `…/executions/<id>/conversation`):**
|
|
212
254
|
what one dwarf or reviewer said and did, read from its agent CLI's `<role>.log`, in the diff's
|
|
213
255
|
place: its messages, its thinking folded, each command with its exit and output, each edit with
|
|
214
256
|
its patch and a link to the file in the diff its review read, other tool calls, and the final
|
|
@@ -217,7 +259,8 @@ keep one meaning everywhere (amber running, green merged or passed, red failed,
|
|
|
217
259
|
*Follow* keeps the newest event in view. codex, grok, claude, openclaude and opencode logs are
|
|
218
260
|
read event by event; when a claude run logged only its final answer, the conversation comes from
|
|
219
261
|
Claude's own session file for that run, if it is still on this machine; any other log is shown
|
|
220
|
-
as it is. Open it from an attempt's dwarf or reviewer in the inspector
|
|
262
|
+
as it is. Open it from an attempt's dwarf or reviewer in the inspector, or at one command from a
|
|
263
|
+
check or an environment problem (`/event/<n>` opens it there and stops following the end).
|
|
221
264
|
|
|
222
265
|
<img src="docs/media/conversation.png" width="760" alt="A dwarf's conversation: its thinking, the files it wrote, a test run that failed with exit 1 and the run that passed after the fix.">
|
|
223
266
|
- **Fractal child tasks:** when a run used Fractal, a task's inspector shows the tree it was split
|
|
@@ -307,6 +350,9 @@ turns all of it off: no token is issued, every change is a 405, and the controls
|
|
|
307
350
|
- `forge_ui/static/diffview.js`: the diff viewer, with findings pinned to their lines.
|
|
308
351
|
- `forge_ui/static/convo.js`, `forge_ui/transcripts.py`: an execution's conversation, and the
|
|
309
352
|
reader of each agent CLI's log format behind it.
|
|
353
|
+
- `forge_ui/static/checksview.js`, `forge_ui/checks.py`: where each task stands and the checks its
|
|
354
|
+
agents ran (the Now column and section, each attempt's checks, the environment banner), and
|
|
355
|
+
the reading of checks, counts, acceptance criteria and environment problems from a transcript.
|
|
310
356
|
- `forge_ui/static/files.js`: the files heatmap (`matrix()` is pure and node-tested).
|
|
311
357
|
- `forge_ui/export.py`: a run as one HTML file (the page's scripts and styles inlined, the API
|
|
312
358
|
responses it reads, the 3D stage's modules as one module text, a hash-based policy).
|