@giamme/forge 0.12.0 → 0.13.0
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 +77 -0
- package/README.md +1 -1
- package/SKILL.md +31 -12
- package/VERSION +1 -1
- package/docs/add-ons.md +11 -6
- package/docs/artifacts.md +18 -6
- package/docs/commands.md +189 -17
- package/docs/decomposed-runs.md +13 -5
- package/docs/forge-ui.md +34 -4
- package/docs/memory.md +2 -1
- package/docs/models.md +4 -2
- package/docs/reviews.md +81 -19
- package/docs/troubleshooting.md +3 -1
- package/forge +17 -1
- package/package.json +1 -1
- package/references/dataset.md +40 -14
- package/references/decision-models.md +759 -0
- package/references/decompose.md +197 -28
- package/references/harnesses.md +10 -3
- package/references/planning.md +8 -0
- package/references/solo.md +13 -3
- package/references/ui.md +11 -0
- package/scripts/forge-artifact.sh +30 -4
- package/scripts/forge-config.py +238 -29
- package/scripts/forge-contract.py +127 -58
- package/scripts/forge-control.py +40 -9
- package/scripts/forge-decide.py +6 -0
- package/scripts/forge-dispatch.sh +47 -15
- package/scripts/forge-fail-first.py +2 -2
- package/scripts/forge-gate-addressed.sh +40 -0
- package/scripts/forge-gate-message.sh +64 -0
- package/scripts/forge-issues.py +368 -36
- package/scripts/forge-jev-options.sh +269 -42
- package/scripts/forge-lib-attribute.sh +447 -0
- package/scripts/forge-lib-gates.sh +32 -0
- package/scripts/forge-lib-plans.sh +17 -6
- package/scripts/forge-lib-review.sh +24 -19
- package/scripts/forge-lib-task.sh +219 -39
- package/scripts/forge-lib-verify.sh +45 -8
- package/scripts/forge-memory.sh +3 -3
- package/scripts/forge-parallel-options.sh +44 -5
- package/scripts/forge-parallel.sh +503 -304
- package/scripts/forge-plan-check.py +35 -1
- package/scripts/forge-pre-review.py +437 -0
- package/scripts/forge-prompt.py +25 -5
- package/scripts/forge-route.py +2 -2
- package/scripts/forge-runtime.py +55 -1
- package/scripts/forge-schedule.py +70 -9
- package/scripts/forge-shadow.py +2 -2
- package/scripts/forge-solo.sh +41 -10
- package/scripts/forge-submodules.py +389 -0
- package/scripts/forge-sweep.py +542 -0
- package/scripts/forge_dataset/cli.py +12 -6
- package/scripts/forge_dataset/export.py +55 -45
- package/scripts/forge_dataset/forecast.py +4 -1
- package/scripts/forge_dataset/harvest.py +33 -5
- package/scripts/{forge_jev/outcome.py → forge_dataset/states.py} +21 -7
- package/scripts/forge_decide/__init__.py +141 -0
- package/scripts/forge_decide/budget.py +149 -0
- package/scripts/forge_decide/cache.py +66 -0
- package/scripts/forge_decide/cli.py +953 -0
- package/scripts/forge_decide/doctor.py +221 -0
- package/scripts/forge_decide/label_addressed.py +75 -0
- package/scripts/forge_decide/label_attribution.py +62 -0
- package/scripts/forge_decide/label_coverage.py +81 -0
- package/scripts/forge_decide/label_message.py +38 -0
- package/scripts/forge_decide/label_prompt.py +139 -0
- package/scripts/forge_decide/labels.py +328 -0
- package/scripts/forge_decide/metrics.py +125 -0
- package/scripts/forge_decide/migrate.py +226 -0
- package/scripts/forge_decide/providers.py +292 -0
- package/scripts/forge_decide/replay.py +350 -0
- package/scripts/forge_decide/report.py +382 -0
- package/scripts/forge_decide/resolve.py +397 -0
- package/scripts/forge_decide/sites.py +377 -0
- package/scripts/forge_jev/__init__.py +202 -104
- package/scripts/forge_jev/addressed.py +171 -0
- package/scripts/forge_jev/attribution.py +198 -0
- package/scripts/forge_jev/cli.py +460 -382
- package/scripts/forge_jev/client.py +155 -77
- package/scripts/forge_jev/coupling.py +19 -87
- package/scripts/forge_jev/coverage.py +303 -0
- package/scripts/forge_jev/findings.py +219 -0
- package/scripts/forge_jev/gates.py +225 -27
- package/scripts/forge_jev/memory.py +65 -4
- package/scripts/forge_jev/message.py +134 -0
- package/scripts/forge_jev/plan_gates.py +294 -0
- package/scripts/forge_jev/questions.py +173 -313
- package/scripts/forge_jev/verify.py +130 -104
- package/ui/README.md +41 -10
- package/ui/docs/api.md +212 -44
- package/ui/forge_ui/checks.py +331 -0
- package/ui/forge_ui/control.py +60 -11
- package/ui/forge_ui/export.py +8 -3
- package/ui/forge_ui/models.py +1 -0
- package/ui/forge_ui/reader.py +436 -26
- package/ui/forge_ui/server.py +13 -0
- package/ui/forge_ui/static/app.js +15 -8
- package/ui/forge_ui/static/checksview.js +449 -0
- package/ui/forge_ui/static/controls.js +20 -13
- package/ui/forge_ui/static/convo.js +11 -2
- package/ui/forge_ui/static/findingsview.js +6 -4
- package/ui/forge_ui/static/index.html +1 -0
- package/ui/forge_ui/static/panel.js +105 -17
- package/ui/forge_ui/static/runmodel.js +40 -2
- package/ui/forge_ui/static/scene3d.js +2 -15
- package/ui/forge_ui/static/settings.js +336 -41
- package/ui/forge_ui/static/style.css +72 -7
- package/ui/forge_ui/transcripts.py +225 -54
- package/references/jev.md +0 -865
- package/scripts/forge_jev/backtest.py +0 -322
- package/scripts/forge_jev/corpus.py +0 -156
- package/scripts/forge_jev/features.py +0 -24
- package/scripts/forge_jev/predict.py +0 -204
- package/scripts/forge_jev/review.py +0 -73
- package/scripts/forge_jev/routing.py +0 -271
- package/scripts/forge_jev/subset.py +0 -123
package/ui/forge_ui/reader.py
CHANGED
|
@@ -12,7 +12,7 @@ import stat
|
|
|
12
12
|
import time
|
|
13
13
|
import urllib.parse
|
|
14
14
|
|
|
15
|
-
from forge_ui import diffs, executions, findings, fractal, transcripts
|
|
15
|
+
from forge_ui import checks, diffs, executions, findings, fractal, transcripts
|
|
16
16
|
from forge_ui.findings import verdict as _verdict
|
|
17
17
|
|
|
18
18
|
|
|
@@ -545,6 +545,133 @@ def _accepted_fields(reader, name, text):
|
|
|
545
545
|
return attempt, status if status in ('FAIL', 'UNKNOWN') else None
|
|
546
546
|
|
|
547
547
|
|
|
548
|
+
def _log_path(reader, rel):
|
|
549
|
+
"""The regular file `rel` of the run dir as a Path, or None; a path that resolves outside the run is never read."""
|
|
550
|
+
try:
|
|
551
|
+
real = Path(os.path.realpath(reader.path / rel))
|
|
552
|
+
if executions.inside(reader.path, str(real)) and stat.S_ISREG(real.stat().st_mode):
|
|
553
|
+
return real
|
|
554
|
+
if real.exists():
|
|
555
|
+
reader.warn(rel, 'outside the run dir or not a regular file')
|
|
556
|
+
except (OSError, ValueError):
|
|
557
|
+
pass
|
|
558
|
+
return None
|
|
559
|
+
|
|
560
|
+
|
|
561
|
+
_CALL_CAP = 400 # characters of the running command in RunDetail
|
|
562
|
+
|
|
563
|
+
|
|
564
|
+
def _now(reader, owner_dir, execs):
|
|
565
|
+
"""Task.now: where a running task (or solo run) is. The dwarf or reviewer running in it, with the call it is
|
|
566
|
+
making and when its log last moved; else the task execution's own phase."""
|
|
567
|
+
running = [item for item in execs if item['state'] == 'running' and not item['shadow']]
|
|
568
|
+
agent = next((item for item in reversed(running) if item['role'] in ('dwarf', 'qa')), None)
|
|
569
|
+
item = agent or next((item for item in reversed(running) if item['role'] in executions.CONTAINERS), None)
|
|
570
|
+
if item is None:
|
|
571
|
+
return None
|
|
572
|
+
now = dict(role=item['role'], execution=item['id'], attempt=item['attempt'], phase=item['phase'],
|
|
573
|
+
phase_started=item['phase_started'], started=item['started'], last_output_at=None, call=None)
|
|
574
|
+
if agent is not None:
|
|
575
|
+
rel = posixpath.join(owner_dir, agent['role'] + '.log')
|
|
576
|
+
reader.stat(rel) # the page redraws while the agent writes
|
|
577
|
+
log = _log_path(reader, rel)
|
|
578
|
+
state = transcripts.live(log, (agent['model'] or {}).get('harness')) if log is not None else None
|
|
579
|
+
if state is not None:
|
|
580
|
+
call = state['call']
|
|
581
|
+
if call is not None:
|
|
582
|
+
command = call['command']
|
|
583
|
+
call = dict(call, command=command if not command or len(command) <= _CALL_CAP else command[:_CALL_CAP] + '…',
|
|
584
|
+
check=checks.classify(command) if command else None)
|
|
585
|
+
now.update(last_output_at=state['last_output_at'], call=call)
|
|
586
|
+
return now
|
|
587
|
+
|
|
588
|
+
|
|
589
|
+
def _scheduler(reader):
|
|
590
|
+
"""RunDetail.scheduler: whether a scheduler runs this plan now, and, while one does, what holds it: a drain, a
|
|
591
|
+
stop, infrastructure pauses (scheduler-written infra.paused) and the capacity it dispatches up to."""
|
|
592
|
+
pid = (reader.object('scheduler.live') or {}).get('pid') if reader.exists('scheduler.live') else None
|
|
593
|
+
live = False
|
|
594
|
+
if type(pid) is int and pid > 0:
|
|
595
|
+
try:
|
|
596
|
+
os.kill(pid, 0)
|
|
597
|
+
live = True
|
|
598
|
+
except PermissionError:
|
|
599
|
+
live = True
|
|
600
|
+
except (OSError, OverflowError):
|
|
601
|
+
live = False
|
|
602
|
+
result = dict(live=live, drained=False, stopping=None, pauses=[], max_parallel=None)
|
|
603
|
+
if not live:
|
|
604
|
+
return result
|
|
605
|
+
stop = reader.line('stop')
|
|
606
|
+
capacity = reader.number('max_parallel', int)
|
|
607
|
+
result.update(drained=reader.exists('drain'), stopping=stop if stop in ('graceful', 'now') else None,
|
|
608
|
+
max_parallel=capacity if capacity is not None and 1 <= capacity <= 64 else None)
|
|
609
|
+
paused = reader.object('infra.paused') if reader.exists('infra.paused') else None
|
|
610
|
+
for scope in (paused or {}).get('scopes') or []:
|
|
611
|
+
if isinstance(scope, dict):
|
|
612
|
+
result['pauses'].append({key: scope.get(key) for key in
|
|
613
|
+
('scope', 'class', 'harness', 'model', 'tasks', 'cycle', 'until', 'exhausted')})
|
|
614
|
+
return result
|
|
615
|
+
|
|
616
|
+
|
|
617
|
+
_STOPPED = ('FAIL', 'BLOCKED', 'INFRA', 'INTERRUPTED', 'TIMEOUT', 'ERROR', 'CONFLICT', 'NOCHANGES', 'INVALIDATED', 'UNKNOWN')
|
|
618
|
+
|
|
619
|
+
|
|
620
|
+
def _escalation_stop(reader, ident):
|
|
621
|
+
"""The retry policy stopped this task: {attempts, model, split} from escalation.stop and split.suggested."""
|
|
622
|
+
text = reader.text(f'tasks/{ident}/escalation.stop')
|
|
623
|
+
if text is None:
|
|
624
|
+
return None
|
|
625
|
+
cells = (text.splitlines() or [''])[0].split('\t')
|
|
626
|
+
attempts = int(cells[0]) if cells[0].strip().isdigit() else None
|
|
627
|
+
split = (reader.text(f'tasks/{ident}/split.suggested') or '').strip()
|
|
628
|
+
return dict(kind='escalation', attempts=attempts, model=cells[1].strip() if len(cells) > 1 and cells[1].strip() else None,
|
|
629
|
+
split=reader.cap(split, f'tasks/{ident}/split.suggested', 600) or None)
|
|
630
|
+
|
|
631
|
+
|
|
632
|
+
def _waiting(reader, tasks, scheduler):
|
|
633
|
+
"""Task.waiting: why a task that is not running is not, as far as the run dir tells.
|
|
634
|
+
|
|
635
|
+
escalation (the retry policy stopped it, whether or not a scheduler runs); and while one runs: infra (a pause
|
|
636
|
+
holds it), deps (on tasks not merged yet), drained, stopping, overlap (it shares files with a running task),
|
|
637
|
+
slot (the run is at its capacity) or next (nothing holds it: it starts at the scheduler's next turn)."""
|
|
638
|
+
status = {task['id']: task['status'] for task in tasks}
|
|
639
|
+
running = [task for task in tasks if task['status'] == 'RUNNING']
|
|
640
|
+
for task in tasks:
|
|
641
|
+
task['waiting'] = None
|
|
642
|
+
if task['status'] in ('RUNNING', 'MERGED'):
|
|
643
|
+
continue
|
|
644
|
+
stop = _escalation_stop(reader, task['id'])
|
|
645
|
+
if stop is not None:
|
|
646
|
+
task['waiting'] = stop
|
|
647
|
+
continue
|
|
648
|
+
if not scheduler['live'] or task['status'] not in ('PENDING', 'INFRA'):
|
|
649
|
+
continue
|
|
650
|
+
pause = next((p for p in scheduler['pauses'] if p['scope'] == 'all' or task['id'] in (p['tasks'] or [])), None)
|
|
651
|
+
if pause is not None:
|
|
652
|
+
task['waiting'] = dict(pause, kind='infra')
|
|
653
|
+
continue
|
|
654
|
+
if task['status'] != 'PENDING':
|
|
655
|
+
continue
|
|
656
|
+
on = [dep for dep in task['deps'] if status.get(dep) != 'MERGED']
|
|
657
|
+
if on:
|
|
658
|
+
task['waiting'] = dict(kind='deps', on=on, stopped=[dep for dep in on if status.get(dep) in _STOPPED])
|
|
659
|
+
elif scheduler['stopping']:
|
|
660
|
+
task['waiting'] = dict(kind='stopping', mode=scheduler['stopping'])
|
|
661
|
+
elif scheduler['drained']:
|
|
662
|
+
task['waiting'] = dict(kind='drained')
|
|
663
|
+
else:
|
|
664
|
+
mine = [_scope(path) for path in task['files'] if path and path != '-']
|
|
665
|
+
shared = [other['id'] for other in running if _overlap(mine, [_scope(p) for p in other['files'] if p and p != '-'])]
|
|
666
|
+
cap = scheduler['max_parallel']
|
|
667
|
+
if shared:
|
|
668
|
+
task['waiting'] = dict(kind='overlap', on=shared)
|
|
669
|
+
elif cap is not None and len(running) >= cap:
|
|
670
|
+
task['waiting'] = dict(kind='slot', running=len(running), max_parallel=cap)
|
|
671
|
+
else:
|
|
672
|
+
task['waiting'] = dict(kind='next')
|
|
673
|
+
|
|
674
|
+
|
|
548
675
|
def _task_detail(reader, task, run_id, waves, branches):
|
|
549
676
|
"""Fill in a plan task; returns every execution it read (its own and its shadows')."""
|
|
550
677
|
ident = task['id']
|
|
@@ -567,6 +694,8 @@ def _task_detail(reader, task, run_id, waves, branches):
|
|
|
567
694
|
reader, prefix + '/accepted.by', task['accepted_by'])
|
|
568
695
|
for field, filename in [('prompt', 'prompt.md'), ('approach', 'approach.md'), ('retry_findings', 'retry_findings.md')]:
|
|
569
696
|
task[field] = reader.cap(reader.text(prefix + '/' + filename), prefix + '/' + field)
|
|
697
|
+
# the implementer's question for the user, when the task stopped NEEDS_INPUT
|
|
698
|
+
task['needs_input'] = reader.cap(reader.text(prefix + '/needs_input.md'), prefix + '/needs_input')
|
|
570
699
|
task['route'] = []
|
|
571
700
|
for n, line in enumerate((reader.text(prefix + '/route.jsonl') or '').splitlines(), 1):
|
|
572
701
|
if line.strip():
|
|
@@ -575,24 +704,18 @@ def _task_detail(reader, task, run_id, waves, branches):
|
|
|
575
704
|
task['route'].append(obj)
|
|
576
705
|
task['explored'] = reader.exists(prefix + '/route.explored') or any(
|
|
577
706
|
item.get('explored') is True for item in task['route'])
|
|
578
|
-
task['clef'] = {'first_pass': reader.object(prefix + '/clef.first_pass'), 'retry_pass': {}}
|
|
579
|
-
for child in reader.children(prefix):
|
|
580
|
-
if child.name.startswith('clef.retry_pass.'):
|
|
581
|
-
suffix = child.name[len('clef.retry_pass.'):]
|
|
582
|
-
if not re.fullmatch(r'[0-9]+', suffix):
|
|
583
|
-
reader.warn(prefix + '/' + child.name, 'invalid attempt suffix')
|
|
584
|
-
continue
|
|
585
|
-
obj = reader.object(prefix + '/' + child.name)
|
|
586
|
-
if obj is not None:
|
|
587
|
-
task['clef']['retry_pass'][suffix] = obj
|
|
588
707
|
execs = _task_execs(reader, task)
|
|
589
708
|
task['executions'] = execs
|
|
709
|
+
task['now'] = _now(reader, prefix, execs) if task['status'] == 'RUNNING' else None
|
|
590
710
|
merged = reader.stat(prefix + '/merged') if task['status'] == 'MERGED' else None
|
|
591
711
|
task['merged_at'] = float(merged.st_mtime) if merged is not None else None
|
|
592
712
|
task['findings'] = executions.summary_of(qa)
|
|
593
713
|
task['gate'] = _gate(reader, prefix + '/qa.gate')
|
|
594
714
|
task['known_issues'] = _nonempty(reader, prefix + '/known_issues.md')
|
|
595
715
|
task['fail_first'] = _fail_first(reader, prefix + '/failfirst.json')
|
|
716
|
+
task['pre_review'] = _pre_review(reader, prefix + '/prereview.json')
|
|
717
|
+
task['sweep'] = _sweep_task(reader, prefix, task['status'])
|
|
718
|
+
task['swept'] = []
|
|
596
719
|
shadows = _shadows(reader, ident, execs)
|
|
597
720
|
task['shadow'] = [entry for entry, _, _ in shadows]
|
|
598
721
|
# What `forge control show` reads of the task. A change there (a write, or a delete: the dir's mtime) moves `updated`,
|
|
@@ -603,6 +726,73 @@ def _task_detail(reader, task, run_id, waves, branches):
|
|
|
603
726
|
return execs + [item for _, items, _ in shadows for item in items]
|
|
604
727
|
|
|
605
728
|
|
|
729
|
+
# --- the finding sweep (run --sweep): its plan, each fix task's findings and what became of them ------------------
|
|
730
|
+
|
|
731
|
+
_MAX_SWEEP = 200
|
|
732
|
+
_SWEEP_STATES = ('fixed', 'not-fixed', 'unreported')
|
|
733
|
+
|
|
734
|
+
|
|
735
|
+
def _text_or_none(value, size=400):
|
|
736
|
+
return value[:size] if isinstance(value, str) and value else None
|
|
737
|
+
|
|
738
|
+
|
|
739
|
+
def _sweep_task(reader, prefix, status):
|
|
740
|
+
"""A fix task's file and findings: each with what its review said (fixed, not-fixed, or unreported when the
|
|
741
|
+
task merged without a line for it), or None while the task has not merged; None for any other task."""
|
|
742
|
+
obj = reader.object(prefix + '/sweep.json')
|
|
743
|
+
if obj is None or not isinstance(obj.get('findings'), list):
|
|
744
|
+
return None
|
|
745
|
+
said = {}
|
|
746
|
+
if status == 'MERGED':
|
|
747
|
+
for item in list((reader.object(prefix + '/sweep.outcome.json') or {}).get('findings') or []):
|
|
748
|
+
if isinstance(item, dict) and item.get('status') in _SWEEP_STATES and isinstance(item.get('id'), str):
|
|
749
|
+
said[item['id']] = (item['status'], _text_or_none(item.get('note')))
|
|
750
|
+
found = []
|
|
751
|
+
for item in obj['findings'][:_MAX_SWEEP]:
|
|
752
|
+
if not isinstance(item, dict) or not isinstance(item.get('id'), str):
|
|
753
|
+
continue
|
|
754
|
+
state, note = said.get(item['id'], ('unreported' if status == 'MERGED' else None, None))
|
|
755
|
+
found.append(dict(id=item['id'], severity=_text_or_none(item.get('severity'), 8),
|
|
756
|
+
confidence=_text_or_none(item.get('confidence'), 16), task=_text_or_none(item.get('task'), 200),
|
|
757
|
+
location=_text_or_none(item.get('location')),
|
|
758
|
+
summary=_text_or_none((item.get('text') or '').split('\n')[0] if isinstance(item.get('text'), str) else None),
|
|
759
|
+
status=state, note=note))
|
|
760
|
+
return dict(file=_text_or_none(obj.get('file')), findings=found)
|
|
761
|
+
|
|
762
|
+
|
|
763
|
+
def _sweep(reader, tasks):
|
|
764
|
+
"""RunDetail.sweep: the run's finding sweep, from sweep/plan.json and its fix tasks; None when it was never
|
|
765
|
+
swept. Also fills each source task's `swept`: its findings a fix task took, and what became of them."""
|
|
766
|
+
by_id = {task['id']: task for task in tasks}
|
|
767
|
+
fix = [task for task in tasks if task.get('sweep')]
|
|
768
|
+
for task in fix:
|
|
769
|
+
for item in task['sweep']['findings']:
|
|
770
|
+
source = by_id.get(item['task'])
|
|
771
|
+
if source is not None and len(source['swept']) < _MAX_SWEEP:
|
|
772
|
+
source['swept'].append(dict(item, by=task['id']))
|
|
773
|
+
obj = reader.object('sweep/plan.json')
|
|
774
|
+
if obj is None:
|
|
775
|
+
return None
|
|
776
|
+
found = [item for task in fix for item in task['sweep']['findings']]
|
|
777
|
+
dropped = []
|
|
778
|
+
for item in list(obj.get('dropped') or [])[:_MAX_SWEEP]:
|
|
779
|
+
if not isinstance(item, dict):
|
|
780
|
+
continue
|
|
781
|
+
line = item.get('line') if isinstance(item.get('line'), int) and not isinstance(item.get('line'), bool) else None
|
|
782
|
+
where = _text_or_none(item.get('file'))
|
|
783
|
+
detail = item.get('detail') if isinstance(item.get('detail'), dict) else {}
|
|
784
|
+
dropped.append(dict(task=_text_or_none(item.get('task'), 200), severity=_text_or_none(item.get('severity'), 8),
|
|
785
|
+
location=f'{where}:{line}' if where and line else where,
|
|
786
|
+
summary=_text_or_none((item.get('text') or '').split('\n')[0] if isinstance(item.get('text'), str) else None),
|
|
787
|
+
reason=_text_or_none(item.get('reason'), 40),
|
|
788
|
+
merged_since=[x for x in list(detail.get('merged_since') or []) if isinstance(x, str)][:20]))
|
|
789
|
+
at = obj.get('at')
|
|
790
|
+
return dict(at=float(at) if isinstance(at, (int, float)) and not isinstance(at, bool) else None,
|
|
791
|
+
severity=_text_or_none(obj.get('severity'), 8), plausible=obj.get('plausible') is True,
|
|
792
|
+
tasks=[task['id'] for task in fix], findings=len(found),
|
|
793
|
+
fixed=sum(1 for item in found if item['status'] == 'fixed'), dropped=dropped)
|
|
794
|
+
|
|
795
|
+
|
|
606
796
|
# The control files (CONTRACT.md) nothing else here reads. `forge control` appends control.log and writes the task's
|
|
607
797
|
# files without touching the run dir, so they are stat'd for `updated` only.
|
|
608
798
|
# Read only for their mtimes, so the run's `updated` stamp moves when a control changes.
|
|
@@ -615,6 +805,35 @@ _TASK_CONTROLS = ('qa_threshold', 'retry_budget', 'retries.used', 'escalation.pi
|
|
|
615
805
|
_FAIL_FIRST_RESULTS = ('proven', 'passes_without_change', 'inconclusive', 'error')
|
|
616
806
|
|
|
617
807
|
|
|
808
|
+
_PRE_REVIEW_STATUSES = ('passed', 'flaky', 'pre-existing', 'failed', 'skipped', 'error')
|
|
809
|
+
|
|
810
|
+
|
|
811
|
+
def _pre_review(reader, name):
|
|
812
|
+
"""prereview.json (forge-pre-review.py, opt-in #85): the tests the attempt affects, run before its review."""
|
|
813
|
+
obj = reader.object(name)
|
|
814
|
+
if obj is None:
|
|
815
|
+
return None
|
|
816
|
+
if obj.get('status') not in _PRE_REVIEW_STATUSES:
|
|
817
|
+
reader.warn(name, 'unknown pre-review status')
|
|
818
|
+
return None
|
|
819
|
+
|
|
820
|
+
def paths(key):
|
|
821
|
+
value = obj.get(key)
|
|
822
|
+
return [p for p in value if isinstance(p, str)] if isinstance(value, list) else []
|
|
823
|
+
|
|
824
|
+
tail = None
|
|
825
|
+
for run in reversed(obj.get('runs') if isinstance(obj.get('runs'), list) else []):
|
|
826
|
+
if isinstance(run, dict) and type(run.get('rc')) is int and run['rc'] != 0 and isinstance(run.get('tail'), str):
|
|
827
|
+
tail = run['tail'][-2000:]
|
|
828
|
+
break
|
|
829
|
+
seconds = obj.get('seconds')
|
|
830
|
+
return dict(status=obj['status'], reason=obj.get('reason') if isinstance(obj.get('reason'), str) else None,
|
|
831
|
+
command=obj.get('command') if isinstance(obj.get('command'), str) else None,
|
|
832
|
+
selected=paths('selected'), failing=paths('failing'), preexisting=paths('preexisting'),
|
|
833
|
+
flaky=paths('flaky'), seconds=seconds if isinstance(seconds, (int, float)) and not isinstance(seconds, bool) else None,
|
|
834
|
+
tail=tail)
|
|
835
|
+
|
|
836
|
+
|
|
618
837
|
def _fail_first(reader, name):
|
|
619
838
|
"""failfirst.json (forge-fail-first.py, opt-in): did each new test fail without the change?"""
|
|
620
839
|
obj = reader.object(name)
|
|
@@ -1036,6 +1255,21 @@ def _timeline(pool, runs, verifications):
|
|
|
1036
1255
|
runs=runs, verifications=verifications)
|
|
1037
1256
|
|
|
1038
1257
|
|
|
1258
|
+
# scripts/forge-contract.py DEFAULT_THRESHOLD: what a run with no qa_threshold file blocks on.
|
|
1259
|
+
_DEFAULT_THRESHOLD = 'P2'
|
|
1260
|
+
|
|
1261
|
+
|
|
1262
|
+
def _threshold(reader):
|
|
1263
|
+
"""(effective level, 'set' | 'default') from the qa_threshold file; `none` in a file means P3.
|
|
1264
|
+
Anything else that is not P0..P3 is ignored, as the gate and forge-control.py ignore it."""
|
|
1265
|
+
value = (reader.line('qa_threshold') or '').replace(' ', '').upper()
|
|
1266
|
+
if value == 'NONE':
|
|
1267
|
+
return 'P3', 'set'
|
|
1268
|
+
if value in ('P0', 'P1', 'P2', 'P3'):
|
|
1269
|
+
return value, 'set'
|
|
1270
|
+
return _DEFAULT_THRESHOLD, 'default'
|
|
1271
|
+
|
|
1272
|
+
|
|
1039
1273
|
_SOLO_SETTINGS = ('explore', 'shadow_rate', 'shadow_qa', 'timeout', 'max_parallel', 'qa_threshold',
|
|
1040
1274
|
'escalate_after', 'verify_retries', 'final_qa')
|
|
1041
1275
|
|
|
@@ -1045,7 +1279,9 @@ def _solo_detail(reader, source):
|
|
|
1045
1279
|
status = next(iter(result['counts']))
|
|
1046
1280
|
result['request'] = reader.cap(reader.text('request.md'), 'request')
|
|
1047
1281
|
result['settings'] = dict.fromkeys(_SOLO_SETTINGS)
|
|
1282
|
+
result['settings']['qa_threshold'], result['settings']['qa_threshold_source'] = _threshold(reader)
|
|
1048
1283
|
result['verification'] = None
|
|
1284
|
+
result['attribution'] = _attribution(reader)
|
|
1049
1285
|
result['waves'] = [['solo']]
|
|
1050
1286
|
attempts = _history(reader, 'attempts.tsv')
|
|
1051
1287
|
qa = reader.text('qa.last')
|
|
@@ -1055,15 +1291,17 @@ def _solo_detail(reader, source):
|
|
|
1055
1291
|
branch=None, attempt=max((item['attempt'] for item in attempts), default=None),
|
|
1056
1292
|
attempts=attempts, escalations=[], verdict=_verdict(qa), accepted_by=None,
|
|
1057
1293
|
accepted=False, accepted_attempt=None, accepted_over=None,
|
|
1058
|
-
explored=False, route=[],
|
|
1294
|
+
explored=False, route=[], shadow=[],
|
|
1059
1295
|
prompt=reader.cap(reader.text('prompt.md'), 'tasks/solo/prompt'), approach=None,
|
|
1060
|
-
retry_findings=None, qa_tail=reader.cap(qa, 'tasks/solo/qa_tail', 4000, True),
|
|
1296
|
+
retry_findings=None, needs_input=None, qa_tail=reader.cap(qa, 'tasks/solo/qa_tail', 4000, True),
|
|
1061
1297
|
dwarf_tail=reader.cap(reader.text('dwarf.last'), 'tasks/solo/dwarf_tail', 4000, True),
|
|
1062
1298
|
executions=execs, merged_at=None, findings=executions.summary_of(qa),
|
|
1063
1299
|
gate=_gate(reader, 'qa.gate'), known_issues=_nonempty(reader, 'known_issues.md'),
|
|
1064
|
-
fail_first=_fail_first(reader, 'failfirst.json')
|
|
1300
|
+
fail_first=_fail_first(reader, 'failfirst.json'), pre_review=None,
|
|
1301
|
+
now=_now(reader, '', execs) if status == 'RUNNING' else None, waiting=None, sweep=None, swept=[])
|
|
1065
1302
|
result.update(timeline=_timeline(execs, [], []), integration=None, final_review=None, final_reviews=[],
|
|
1066
|
-
deferrals=[], findings_available=findings.available(), fractal=fractal.summary(reader)
|
|
1303
|
+
deferrals=[], findings_available=findings.available(), fractal=fractal.summary(reader),
|
|
1304
|
+
scheduler=None, sweep=None)
|
|
1067
1305
|
result.update(tasks=[task], warnings=reader.warnings, truncated=reader.truncated, updated=reader.updated)
|
|
1068
1306
|
return result
|
|
1069
1307
|
|
|
@@ -1083,15 +1321,48 @@ def _waves(reader):
|
|
|
1083
1321
|
return waves, wave_map
|
|
1084
1322
|
|
|
1085
1323
|
|
|
1324
|
+
# --- attribution: the result of `forge-parallel.sh attribute` ------------------------------------
|
|
1325
|
+
|
|
1326
|
+
_ATTRIBUTION_KEYS = ('culprit', 'base_fails', 'inconclusive', 'verification_runs', 'gate')
|
|
1327
|
+
|
|
1328
|
+
|
|
1329
|
+
def _is_text_or_null(value):
|
|
1330
|
+
return value is None or isinstance(value, str)
|
|
1331
|
+
|
|
1332
|
+
|
|
1333
|
+
def _attribution(reader):
|
|
1334
|
+
"""RunDetail.attribution from attribution.json, or null when there is none or any field is missing or of the
|
|
1335
|
+
wrong type (warned): a half-valid file is not evidence for a culprit."""
|
|
1336
|
+
name = 'attribution.json'
|
|
1337
|
+
obj = reader.object(name)
|
|
1338
|
+
if obj is None:
|
|
1339
|
+
return None
|
|
1340
|
+
gate = obj.get('gate')
|
|
1341
|
+
outcome = gate.get('outcome') if isinstance(gate, dict) else None
|
|
1342
|
+
runs = obj.get('verification_runs')
|
|
1343
|
+
if not (all(key in obj for key in _ATTRIBUTION_KEYS)
|
|
1344
|
+
and _is_text_or_null(obj['culprit']) and _is_text_or_null(obj['inconclusive'])
|
|
1345
|
+
and isinstance(obj['base_fails'], bool)
|
|
1346
|
+
and isinstance(runs, int) and not isinstance(runs, bool)
|
|
1347
|
+
and (gate is None or isinstance(gate, dict)) and _is_text_or_null(outcome)):
|
|
1348
|
+
reader.warn(name, 'not an attribution')
|
|
1349
|
+
return None
|
|
1350
|
+
return dict(culprit=_text_or_none(obj['culprit'], 200), base_fails=obj['base_fails'],
|
|
1351
|
+
inconclusive=_text_or_none(obj['inconclusive'], 400), verification_runs=runs,
|
|
1352
|
+
gate_outcome=_text_or_none(outcome, 40))
|
|
1353
|
+
|
|
1354
|
+
|
|
1086
1355
|
def detail(path, source='plan') -> dict:
|
|
1087
1356
|
reader = _Read(path)
|
|
1088
1357
|
if _kind(reader.path) == 'solo':
|
|
1089
1358
|
return _solo_detail(reader, source)
|
|
1090
1359
|
result, tasks = _summary(reader, source)
|
|
1091
1360
|
result['request'] = reader.cap(reader.text('request.md'), 'request')
|
|
1361
|
+
threshold = _threshold(reader)
|
|
1092
1362
|
result['settings'] = dict(explore=reader.number('explore'), shadow_rate=reader.number('shadow_rate'),
|
|
1093
1363
|
shadow_qa=_list(reader.text('shadow_qa') or ''), timeout=reader.number('timeout', int),
|
|
1094
|
-
max_parallel=reader.number('max_parallel', int),
|
|
1364
|
+
max_parallel=reader.number('max_parallel', int),
|
|
1365
|
+
qa_threshold=threshold[0], qa_threshold_source=threshold[1],
|
|
1095
1366
|
escalate_after=reader.number('escalate_after', int),
|
|
1096
1367
|
verify_retries=reader.number('verify_retries', int), final_qa=reader.line('final_qa'))
|
|
1097
1368
|
waves, wave_map = _waves(reader)
|
|
@@ -1102,9 +1373,13 @@ def detail(path, source='plan') -> dict:
|
|
|
1102
1373
|
pool += _task_detail(reader, task, result['run_id'], wave_map, branches)
|
|
1103
1374
|
for name in _RUN_CONTROLS:
|
|
1104
1375
|
reader.stat(name)
|
|
1376
|
+
result['scheduler'] = _scheduler(reader)
|
|
1377
|
+
_waiting(reader, tasks, result['scheduler'])
|
|
1378
|
+
result['sweep'] = _sweep(reader, tasks)
|
|
1105
1379
|
run_execs = _run_execs(reader)
|
|
1106
1380
|
result['verification'] = _verification(reader, result['verification_status'],
|
|
1107
1381
|
[item for item in run_execs if item['role'] == 'verification'])
|
|
1382
|
+
result['attribution'] = _attribution(reader)
|
|
1108
1383
|
items, integrations = executions.review_dirs(reader)
|
|
1109
1384
|
published = _published(reader)
|
|
1110
1385
|
reviews = []
|
|
@@ -1264,16 +1539,7 @@ def execution_transcript(path, name, source='plan'):
|
|
|
1264
1539
|
item, owner, owner_dir = found
|
|
1265
1540
|
role, running = item['role'], item['state'] == 'running'
|
|
1266
1541
|
# A finished execution's log is its copy; the owner dir's is the one being written, or the next one's.
|
|
1267
|
-
|
|
1268
|
-
log = None
|
|
1269
|
-
try:
|
|
1270
|
-
real = Path(os.path.realpath(reader.path / rel))
|
|
1271
|
-
if executions.inside(reader.path, str(real)) and stat.S_ISREG(real.stat().st_mode):
|
|
1272
|
-
log = real
|
|
1273
|
-
elif real.exists():
|
|
1274
|
-
reader.warn(rel, 'outside the run dir or not a regular file')
|
|
1275
|
-
except (OSError, ValueError):
|
|
1276
|
-
pass
|
|
1542
|
+
log = _agent_log(reader, item, owner_dir)
|
|
1277
1543
|
resolved = executions.resolved_of(reader, f'{item.rel}/{role}.resolved')
|
|
1278
1544
|
if resolved is None and running:
|
|
1279
1545
|
resolved = executions.parse_resolved(reader.text(posixpath.join(owner_dir, role + '.resolved'))) or None
|
|
@@ -1285,6 +1551,141 @@ def execution_transcript(path, name, source='plan'):
|
|
|
1285
1551
|
return result
|
|
1286
1552
|
|
|
1287
1553
|
|
|
1554
|
+
def _agent_log(reader, item, owner_dir):
|
|
1555
|
+
"""The log of a dwarf or reviewer execution: its copy once it ended, the one being written while it runs."""
|
|
1556
|
+
role = item['role']
|
|
1557
|
+
return _log_path(reader, posixpath.join(owner_dir, role + '.log') if item['state'] == 'running' else f'{item.rel}/{role}.log')
|
|
1558
|
+
|
|
1559
|
+
|
|
1560
|
+
def _checks_of(reader, item, owner_dir):
|
|
1561
|
+
"""checks.analyze() of one dwarf or reviewer execution, with what it is and, while it runs, when its log moved."""
|
|
1562
|
+
log = _agent_log(reader, item, owner_dir)
|
|
1563
|
+
model = item['model'] or {}
|
|
1564
|
+
running = item['state'] == 'running'
|
|
1565
|
+
result = transcripts.transcript(log, model.get('harness'), running)
|
|
1566
|
+
found = checks.analyze(result['events'])
|
|
1567
|
+
moved = None
|
|
1568
|
+
if running and log is not None:
|
|
1569
|
+
try:
|
|
1570
|
+
moved = log.stat().st_mtime
|
|
1571
|
+
except OSError:
|
|
1572
|
+
pass
|
|
1573
|
+
found.update(execution=item['id'], role=item['role'], state=item['state'], attempt=item['attempt'],
|
|
1574
|
+
spec=model.get('spec'), harness=model.get('harness'), source=result['source'],
|
|
1575
|
+
truncated=result['truncated'], last_output_at=moved)
|
|
1576
|
+
return found
|
|
1577
|
+
|
|
1578
|
+
|
|
1579
|
+
def _brief_dir(kind, owner):
|
|
1580
|
+
"""Where the brief of an execution's owner is, or None for a final review or a shadow."""
|
|
1581
|
+
if owner['kind'] == 'task':
|
|
1582
|
+
return '' if owner['id'] == 'solo' and kind == 'solo' else f"tasks/{owner['id']}"
|
|
1583
|
+
return None
|
|
1584
|
+
|
|
1585
|
+
|
|
1586
|
+
def execution_checks(path, name, source='plan'):
|
|
1587
|
+
"""ExecutionChecks: the checks a dwarf or reviewer ran, the call it makes now, the environment problems it met
|
|
1588
|
+
and, for a task's execution, its brief's acceptance-criteria commands against them. None for another role."""
|
|
1589
|
+
reader = _Read(path)
|
|
1590
|
+
found = _execution(reader, name)
|
|
1591
|
+
if found is None or found[0]['role'] not in ('dwarf', 'qa'):
|
|
1592
|
+
return None
|
|
1593
|
+
item, owner, owner_dir = found
|
|
1594
|
+
result = _checks_of(reader, item, owner_dir)
|
|
1595
|
+
brief = _brief_dir(_kind(reader.path), owner)
|
|
1596
|
+
wanted = checks.criteria(reader.text(posixpath.join(brief, 'prompt.md'))) if brief is not None else []
|
|
1597
|
+
result.update(run=run_key(reader.path), owner=owner,
|
|
1598
|
+
criteria=checks.coverage(wanted, [(c['command'], dict(index=c['index'])) for c in result['checks']]),
|
|
1599
|
+
warnings=reader.warnings)
|
|
1600
|
+
return result
|
|
1601
|
+
|
|
1602
|
+
|
|
1603
|
+
def _owners(reader):
|
|
1604
|
+
"""(task id, owner dir, executions) of each task of the run (the one `solo` of a solo run), or None."""
|
|
1605
|
+
kind = _kind(reader.path)
|
|
1606
|
+
if kind == 'solo':
|
|
1607
|
+
return [('solo', '', _solo_execs(reader, _solo_status(reader), _history(reader, 'attempts.tsv')))]
|
|
1608
|
+
if kind != 'plan':
|
|
1609
|
+
return None
|
|
1610
|
+
out = []
|
|
1611
|
+
for task in _tasks(reader):
|
|
1612
|
+
task['attempts'], task['attempt'] = _attempt_state(reader, f"tasks/{task['id']}")
|
|
1613
|
+
out.append((task['id'], f"tasks/{task['id']}", _task_execs(reader, task)))
|
|
1614
|
+
return out
|
|
1615
|
+
|
|
1616
|
+
|
|
1617
|
+
def task_checks(path, task_id, source='plan'):
|
|
1618
|
+
"""TaskChecks: attempt by attempt, the checks each dwarf and reviewer ran, and which of the commands the task's
|
|
1619
|
+
acceptance criteria name ran, ran another way, or did not run."""
|
|
1620
|
+
reader = _Read(path)
|
|
1621
|
+
owners = _owners(reader)
|
|
1622
|
+
owner = next((item for item in owners or [] if item[0] == task_id), None)
|
|
1623
|
+
if owner is None:
|
|
1624
|
+
return None
|
|
1625
|
+
_, owner_dir, execs = owner
|
|
1626
|
+
wanted = checks.criteria(reader.text(posixpath.join(owner_dir, 'prompt.md')))
|
|
1627
|
+
by_attempt = {}
|
|
1628
|
+
for item in execs:
|
|
1629
|
+
if item['role'] in ('dwarf', 'qa') and not item['shadow']:
|
|
1630
|
+
by_attempt.setdefault(item['attempt'], []).append(_checks_of(reader, item, owner_dir))
|
|
1631
|
+
attempts = []
|
|
1632
|
+
for attempt in sorted(by_attempt, key=lambda value: (value is None, value or 0)):
|
|
1633
|
+
runs = by_attempt[attempt]
|
|
1634
|
+
ran = [(c['command'], dict(execution=r['execution'], role=r['role'], index=c['index'])) for r in runs for c in r['checks']]
|
|
1635
|
+
attempts.append(dict(attempt=attempt, running=any(r['state'] == 'running' for r in runs), executions=runs,
|
|
1636
|
+
criteria=checks.coverage(wanted, ran)))
|
|
1637
|
+
return dict(run=run_key(reader.path), task=task_id, criteria=wanted, attempts=attempts,
|
|
1638
|
+
truncated=reader.truncated, warnings=reader.warnings)
|
|
1639
|
+
|
|
1640
|
+
|
|
1641
|
+
_ENVIRONMENT_HITS = 50 # a problem's hits answered (its tasks are all named)
|
|
1642
|
+
_ENV_CACHE = executions._SigCache(4096)
|
|
1643
|
+
|
|
1644
|
+
|
|
1645
|
+
def _environment_of(reader, item, owner_dir):
|
|
1646
|
+
"""The environment problems one execution's failed commands met, cached while its log is unchanged."""
|
|
1647
|
+
log = _agent_log(reader, item, owner_dir)
|
|
1648
|
+
if log is None:
|
|
1649
|
+
return []
|
|
1650
|
+
try:
|
|
1651
|
+
info = log.stat()
|
|
1652
|
+
except OSError:
|
|
1653
|
+
return []
|
|
1654
|
+
clock = log.with_name(log.stem + '.clock')
|
|
1655
|
+
sig = (executions._signature(info), item['state'], transcripts._signature(clock))
|
|
1656
|
+
hit = _ENV_CACHE.get(('environment', str(log)), sig)
|
|
1657
|
+
if hit is None:
|
|
1658
|
+
result = transcripts.transcript(log, (item['model'] or {}).get('harness'), item['state'] == 'running')
|
|
1659
|
+
hit = checks.analyze(result['events'])['environment']
|
|
1660
|
+
_ENV_CACHE.put(('environment', str(log)), sig, hit)
|
|
1661
|
+
return hit
|
|
1662
|
+
|
|
1663
|
+
|
|
1664
|
+
def run_environment(path, source='plan'):
|
|
1665
|
+
"""RunEnvironment: each environment problem the run's dwarfs and reviewers met (Docker, a sandbox's EPERM, a
|
|
1666
|
+
port in use, …), with the tasks it hit and where: the commands that failed on it."""
|
|
1667
|
+
reader = _Read(path)
|
|
1668
|
+
owners = _owners(reader)
|
|
1669
|
+
if owners is None:
|
|
1670
|
+
return None
|
|
1671
|
+
found = {}
|
|
1672
|
+
for task_id, owner_dir, execs in owners:
|
|
1673
|
+
for item in execs:
|
|
1674
|
+
if item['role'] not in ('dwarf', 'qa'):
|
|
1675
|
+
continue
|
|
1676
|
+
for hit in _environment_of(reader, item, owner_dir):
|
|
1677
|
+
entry = found.setdefault(hit['problem'], dict(problem=hit['problem'], label=checks.LABELS[hit['problem']],
|
|
1678
|
+
tasks=[], count=0, hits=[]))
|
|
1679
|
+
entry['count'] += 1
|
|
1680
|
+
if task_id not in entry['tasks']:
|
|
1681
|
+
entry['tasks'].append(task_id)
|
|
1682
|
+
if len(entry['hits']) < _ENVIRONMENT_HITS:
|
|
1683
|
+
entry['hits'].append(dict(task=task_id, attempt=item['attempt'], role=item['role'], execution=item['id'],
|
|
1684
|
+
index=hit['index'], command=hit['command'], line=hit['line']))
|
|
1685
|
+
problems = [found[key] for key, _, _ in checks.ENVIRONMENT if key in found]
|
|
1686
|
+
return dict(run=run_key(reader.path), problems=problems, warnings=reader.warnings)
|
|
1687
|
+
|
|
1688
|
+
|
|
1288
1689
|
def final_review_detail(path, name, source='plan'):
|
|
1289
1690
|
"""FinalReviewDetail of final-review-<e>-<p> or integrate-<e>-<p>, or None."""
|
|
1290
1691
|
reader = _Read(path)
|
|
@@ -1892,6 +2293,15 @@ class Catalog:
|
|
|
1892
2293
|
def transcript(self, key, name):
|
|
1893
2294
|
return self._find(key, execution_transcript, name)
|
|
1894
2295
|
|
|
2296
|
+
def execution_checks(self, key, name):
|
|
2297
|
+
return self._find(key, execution_checks, name)
|
|
2298
|
+
|
|
2299
|
+
def task_checks(self, key, task_id):
|
|
2300
|
+
return self._find(key, task_checks, task_id)
|
|
2301
|
+
|
|
2302
|
+
def environment(self, key):
|
|
2303
|
+
return self._find(key, run_environment)
|
|
2304
|
+
|
|
1895
2305
|
def final_review_diff(self, key, name):
|
|
1896
2306
|
return self._find(key, final_review_diff, name)
|
|
1897
2307
|
|
package/ui/forge_ui/server.py
CHANGED
|
@@ -41,6 +41,9 @@ _REVIEW_PATH = re.compile(r'/api/runs/([0-9a-f]{12})/final-reviews/((?:final-rev
|
|
|
41
41
|
_TASK_DIFF_PATH = re.compile(_TASK_PATH.pattern + r'/diff(?:/(current|prev|committed|existing))?')
|
|
42
42
|
_EXEC_DIFF_PATH = re.compile(_EXEC_PATH.pattern + '/diff')
|
|
43
43
|
_TRANSCRIPT_PATH = re.compile(_EXEC_PATH.pattern + '/transcript')
|
|
44
|
+
_EXEC_CHECKS_PATH = re.compile(_EXEC_PATH.pattern + '/checks')
|
|
45
|
+
_TASK_CHECKS_PATH = re.compile(_TASK_PATH.pattern + '/checks')
|
|
46
|
+
_ENVIRONMENT_PATH = re.compile(r'/api/runs/([0-9a-f]{12})/environment')
|
|
44
47
|
_REVIEW_DIFF_PATH = re.compile(_REVIEW_PATH.pattern + '/diff')
|
|
45
48
|
_FILES_PATH = re.compile(r'/api/runs/([0-9a-f]{12})/files')
|
|
46
49
|
_FINDINGS_PATH = re.compile(r'/api/runs/([0-9a-f]{12})/findings')
|
|
@@ -144,6 +147,16 @@ def api_get(catalog, path):
|
|
|
144
147
|
match = _TRANSCRIPT_PATH.fullmatch(path)
|
|
145
148
|
if match:
|
|
146
149
|
return catalog.transcript(*match.groups())
|
|
150
|
+
match = _EXEC_CHECKS_PATH.fullmatch(path)
|
|
151
|
+
if match:
|
|
152
|
+
return catalog.execution_checks(*match.groups())
|
|
153
|
+
match = _TASK_CHECKS_PATH.fullmatch(path)
|
|
154
|
+
if match:
|
|
155
|
+
task_id = _task_id(match.group(2))
|
|
156
|
+
return None if task_id is None else catalog.task_checks(match.group(1), task_id)
|
|
157
|
+
match = _ENVIRONMENT_PATH.fullmatch(path)
|
|
158
|
+
if match:
|
|
159
|
+
return catalog.environment(match.group(1))
|
|
147
160
|
match = _FILES_PATH.fullmatch(path)
|
|
148
161
|
if match:
|
|
149
162
|
return catalog.files(match.group(1))
|