@giamme/forge 0.16.0 → 0.17.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 +19 -0
- package/VERSION +1 -1
- package/docs/dataset.md +8 -0
- package/docs/reviews.md +15 -1
- package/package.json +1 -1
- package/references/dataset.md +124 -5
- package/references/decision-models.md +15 -2
- package/references/decompose.md +46 -10
- package/references/planning.md +3 -2
- package/scripts/forge-contract.py +52 -1
- package/scripts/forge-issues.py +4 -3
- package/scripts/forge-ledger.py +3 -1
- package/scripts/forge-lib-adopt.sh +7 -1
- package/scripts/forge-metrics.sh +22 -0
- package/scripts/forge-parallel.sh +3 -1
- package/scripts/forge-plan-check.py +25 -2
- package/scripts/forge-planner.py +20 -6
- package/scripts/forge-shadow.py +28 -9
- package/scripts/forge-sweep.py +25 -10
- package/scripts/forge_dataset/cli.py +83 -0
- package/scripts/forge_dataset/facts.py +278 -0
- package/scripts/forge_dataset/harvest.py +16 -3
- package/scripts/forge_dataset/outcomes.py +206 -58
- package/scripts/forge_dataset/pairs.py +174 -0
- package/scripts/forge_dataset/risk.py +108 -0
- package/scripts/forge_dataset/tiers.py +427 -0
- package/scripts/forge_decide/cli.py +23 -2
- package/scripts/forge_decide/labels.py +30 -6
- package/scripts/forge_decide/replay.py +10 -4
- package/ui/docs/api.md +12 -3
- package/ui/forge_ui/export.py +9 -2
- package/ui/forge_ui/findings.py +4 -2
- package/ui/forge_ui/reader.py +71 -4
- package/ui/forge_ui/server.py +8 -0
- package/ui/forge_ui/static/app.js +6 -1
- package/ui/forge_ui/static/diffview.js +7 -3
- package/ui/forge_ui/static/panel.js +43 -2
- package/ui/forge_ui/static/style.css +1 -0
package/ui/forge_ui/export.py
CHANGED
|
@@ -40,8 +40,9 @@ _TEXT_KEYS = frozenset(('prompt', 'last', 'request', 'log_tail', 'dwarf_tail', '
|
|
|
40
40
|
'dwarf_input', 'error', 'last_line', 'message', 'excerpt', 'tail', 'lines', 'call', 'split',
|
|
41
41
|
'needs_input', 'detail'))
|
|
42
42
|
# keys that are private text only under one parent: a person's --reason on each decision (`reason` elsewhere is
|
|
43
|
-
# a short machine word, such as a sweep's dropped-finding reason, and stays)
|
|
44
|
-
_TEXT_KEYS_UNDER = {'decisions': frozenset(('reason',))
|
|
43
|
+
# a short machine word, such as a sweep's dropped-finding reason, and stays); the --reason of each adoption too
|
|
44
|
+
_TEXT_KEYS_UNDER = {'decisions': frozenset(('reason',)), 'adoptions': frozenset(('reason',)),
|
|
45
|
+
'adoption': frozenset(('reason',))}
|
|
45
46
|
|
|
46
47
|
|
|
47
48
|
def _enc(value):
|
|
@@ -172,6 +173,10 @@ def build(catalog, key, texts=False, paths=False, now=None):
|
|
|
172
173
|
reviews = [r.get('name') for r in (run.get('final_reviews') or []) if isinstance(r, dict) and r.get('name')]
|
|
173
174
|
for name in reviews:
|
|
174
175
|
snap.add(f'{base}/final-reviews/{_enc(name)}')
|
|
176
|
+
adopted = [a['review'] for a in (run.get('adoptions') or []) if isinstance(a, dict) and isinstance(a.get('review'), str)
|
|
177
|
+
and re.fullmatch(r'adopt-[0-9]+-[0-9]+', a['review'])]
|
|
178
|
+
for name in adopted:
|
|
179
|
+
snap.add(f'{base}/adoptions/{_enc(name)}')
|
|
175
180
|
snap.add(f'{base}/files')
|
|
176
181
|
snap.add(f'{base}/findings')
|
|
177
182
|
fractal = run.get('fractal') or {}
|
|
@@ -193,6 +198,8 @@ def build(catalog, key, texts=False, paths=False, now=None):
|
|
|
193
198
|
snap.add(url, cap=DIFF_CAP)
|
|
194
199
|
for name in reviews:
|
|
195
200
|
snap.add(f'{base}/final-reviews/{_enc(name)}/diff', cap=DIFF_CAP)
|
|
201
|
+
for name in adopted:
|
|
202
|
+
snap.add(f'{base}/adoptions/{_enc(name)}/diff', cap=DIFF_CAP)
|
|
196
203
|
# what each dwarf and reviewer said and ran: its conversation is all text, and so are the commands it ran
|
|
197
204
|
for name in names:
|
|
198
205
|
if name.startswith(('dwarf-', 'qa-')):
|
package/ui/forge_ui/findings.py
CHANGED
|
@@ -104,14 +104,16 @@ def listing(text, limit=200):
|
|
|
104
104
|
return None
|
|
105
105
|
result = []
|
|
106
106
|
for status, severity, line, block in found[:limit]:
|
|
107
|
-
first = block.split('\n', 1)[0]
|
|
107
|
+
first, facts = block.split('\n', 1)[0], None
|
|
108
108
|
try:
|
|
109
109
|
match = module._LOCATION.search(first)
|
|
110
|
+
# #119: the facts suffix is shown apart, never as part of the summary
|
|
111
|
+
first, facts = module.split_facts(first)[0], module.facts(block)
|
|
110
112
|
except Exception:
|
|
111
113
|
match = None
|
|
112
114
|
result.append(dict(severity=None if severity is None else 'P%d' % severity, status=status,
|
|
113
115
|
location=match.group(0) if match else None, line=line,
|
|
114
|
-
summary=first.strip()[:_SUMMARY_MAX],
|
|
116
|
+
summary=first.strip()[:_SUMMARY_MAX], facts=facts,
|
|
115
117
|
text=block if len(block) <= _TEXT_MAX else block[:_TEXT_MAX] + '…'))
|
|
116
118
|
return result
|
|
117
119
|
|
package/ui/forge_ui/reader.py
CHANGED
|
@@ -777,8 +777,13 @@ def _grant(choice):
|
|
|
777
777
|
return 0
|
|
778
778
|
|
|
779
779
|
|
|
780
|
+
_ADOPT_NAME = re.compile(r'adopt-[0-9]+-[0-9]+')
|
|
781
|
+
|
|
782
|
+
|
|
780
783
|
def _adoptions(reader):
|
|
781
|
-
"""One row per range `adopt` brought in (adoptions.tsv: epoch, base, tip, verdict, approved, spec, review, reason).
|
|
784
|
+
"""One row per range `adopt` brought in (adoptions.tsv: epoch, base, tip, verdict, approved, spec, review, reason).
|
|
785
|
+
`findings` summarizes its review's reply and `diff` says the range's diff is there to open (#131); both are
|
|
786
|
+
None or False when `review` does not name an adopt-<epoch>-<pid> dir of the run."""
|
|
782
787
|
result = []
|
|
783
788
|
for label, row in reader.rows('adoptions.tsv', 8):
|
|
784
789
|
try:
|
|
@@ -788,8 +793,11 @@ def _adoptions(reader):
|
|
|
788
793
|
except (ValueError, OverflowError):
|
|
789
794
|
reader.warn(label, 'invalid epoch')
|
|
790
795
|
continue
|
|
796
|
+
name = row[6] if _ADOPT_NAME.fullmatch(row[6] or '') and reader.exists(row[6]) else None
|
|
791
797
|
result.append(dict(at=at, base=row[1], tip=row[2], verdict=row[3], approved=row[4] == '1', spec=_nullable(row[5]),
|
|
792
|
-
review=_nullable(row[6]), reason=_nullable('\t'.join(row[7:]))
|
|
798
|
+
review=_nullable(row[6]), reason=_nullable('\t'.join(row[7:])),
|
|
799
|
+
findings=executions.qa_result(reader, name + '/qa.last')[1] if name else None,
|
|
800
|
+
diff=bool(name) and reader.exists(name + '/range.diff')))
|
|
793
801
|
return result
|
|
794
802
|
|
|
795
803
|
|
|
@@ -1914,6 +1922,59 @@ def final_review_detail(path, name, source='plan'):
|
|
|
1914
1922
|
return result
|
|
1915
1923
|
|
|
1916
1924
|
|
|
1925
|
+
def _adoption(reader, name):
|
|
1926
|
+
"""The adoptions.tsv row of adopt-<epoch>-<pid> `name`, or None."""
|
|
1927
|
+
if _kind(reader.path) != 'plan' or not _ADOPT_NAME.fullmatch(name or ''):
|
|
1928
|
+
return None
|
|
1929
|
+
return next((row for row in _adoptions(reader) if row['review'] == name), None) if reader.exists(name) else None
|
|
1930
|
+
|
|
1931
|
+
|
|
1932
|
+
def adoption_detail(path, name, source='plan'):
|
|
1933
|
+
"""AdoptionDetail of a range `adopt` brought in (#131): its row, what its reviewer read and said, the findings
|
|
1934
|
+
and what was kept; None when the run adopted nothing under that name."""
|
|
1935
|
+
reader = _Read(path)
|
|
1936
|
+
row = _adoption(reader, name)
|
|
1937
|
+
if row is None:
|
|
1938
|
+
return None
|
|
1939
|
+
qa_last = reader.text(name + '/qa.last')
|
|
1940
|
+
execs = executions.scan(reader, name + '/attempts', False, ('qa',))
|
|
1941
|
+
run = execs[-1] if execs else None
|
|
1942
|
+
threshold = reader.word(name + '/qa_threshold')
|
|
1943
|
+
return dict(name=name, adoption=row, verdict=reader.word(name + '/verdict') or row['verdict'],
|
|
1944
|
+
threshold=None if threshold in (None, 'none') else threshold, gate=_gate(reader, name + '/qa.gate'),
|
|
1945
|
+
started=run['started'] if run else None, ended=run['ended'] if run else None,
|
|
1946
|
+
duration_s=run['duration_s'] if run else None,
|
|
1947
|
+
qa_input=reader.excerpt(name + '/qa.input', 40000, 20000, 'qa_input'),
|
|
1948
|
+
qa_last=reader.clip(qa_last, 20000, 8000, 'qa_last'),
|
|
1949
|
+
known_issues=reader.excerpt(name + '/known_issues.md', 20000, 8000, 'known_issues'),
|
|
1950
|
+
findings=findings.listing(qa_last), tests=findings.tests(qa_last), diff=row['diff'],
|
|
1951
|
+
truncated=reader.truncated, warnings=reader.warnings)
|
|
1952
|
+
|
|
1953
|
+
|
|
1954
|
+
def adoption_diff(path, name, source='plan'):
|
|
1955
|
+
"""DiffDetail of an adopted range: its range.diff, else the ```diff fence of its review's prompt, with the
|
|
1956
|
+
review's findings pinned; None when the run adopted nothing under that name."""
|
|
1957
|
+
reader = _Read(path)
|
|
1958
|
+
row = _adoption(reader, name)
|
|
1959
|
+
if row is None:
|
|
1960
|
+
return None
|
|
1961
|
+
loaded = rel = None
|
|
1962
|
+
for rel, fence in ((name + '/range.diff', False), (name + '/qa.input', True)):
|
|
1963
|
+
if os.path.lexists(reader.path / rel):
|
|
1964
|
+
loaded = diffs.load(reader, rel, fence)
|
|
1965
|
+
if loaded is not None:
|
|
1966
|
+
break
|
|
1967
|
+
key = run_key(reader.path)
|
|
1968
|
+
info = _regular(reader, name + '/range.diff')
|
|
1969
|
+
sources = [dict(id=name, label='range.diff' if info else 'reviewed diff', kind='adoption', verdict=row['verdict'],
|
|
1970
|
+
bytes=info.st_size if info else None, url=_url(key, 'adoptions', name, 'diff'))]
|
|
1971
|
+
origin = dict(kind='adoption', id=name, which='reviewed', execution=None, attempt=None,
|
|
1972
|
+
file=rel if loaded is not None else None)
|
|
1973
|
+
review = _diff_review('adoption', None, None, row['spec'], row['verdict'], name + '/qa.last', [])
|
|
1974
|
+
# adopt leaves the diff out of the prompt, and range.diff out of the dir, past the inline limit
|
|
1975
|
+
return _diff_detail(reader, key, origin, sources, loaded, _NOT_INLINED, [review])
|
|
1976
|
+
|
|
1977
|
+
|
|
1917
1978
|
# --- diffs: what a task changed and what each review read, its findings pinned -------------
|
|
1918
1979
|
|
|
1919
1980
|
_PLAN_DIFFS = (('current', 'changes.diff'), ('prev', 'changes.prev.diff'), ('committed', 'committed.diff'))
|
|
@@ -2044,7 +2105,7 @@ def _diff_detail(reader, key, origin, sources, loaded, reason, reviews):
|
|
|
2044
2105
|
for index, item in enumerate(findings.listing(text) or []):
|
|
2045
2106
|
found.append(dict(id=_finding_id(review, index), review={key: review[key] for key in ('kind', 'execution', 'attempt', 'spec')},
|
|
2046
2107
|
severity=item['severity'], status=item['status'], location=item['location'],
|
|
2047
|
-
summary=item['summary'], text=item['text']))
|
|
2108
|
+
summary=item['summary'], facts=item['facts'], text=item['text']))
|
|
2048
2109
|
return dict(run=key, source=origin, sources=sources, available=loaded is not None,
|
|
2049
2110
|
reason=None if loaded is not None else reason, bytes=loaded['bytes'] if loaded else None,
|
|
2050
2111
|
truncated=bool(loaded and loaded['truncated']), files=files, findings=diffs.pin(found, files),
|
|
@@ -2164,7 +2225,7 @@ def _finding_id(review, index):
|
|
|
2164
2225
|
def _findings_of(reader, review):
|
|
2165
2226
|
listed = findings.listing(reader.text(review['last'])) if review['last'] else None
|
|
2166
2227
|
return [dict(id=_finding_id(review, index), severity=item['severity'], status=item['status'],
|
|
2167
|
-
location=item['location'], summary=item['summary'])
|
|
2228
|
+
location=item['location'], summary=item['summary'], facts=item['facts'])
|
|
2168
2229
|
for index, item in enumerate(listed or [])]
|
|
2169
2230
|
|
|
2170
2231
|
|
|
@@ -2549,6 +2610,12 @@ class Catalog:
|
|
|
2549
2610
|
def final_review_diff(self, key, name):
|
|
2550
2611
|
return self._find(key, final_review_diff, name)
|
|
2551
2612
|
|
|
2613
|
+
def adoption(self, key, name):
|
|
2614
|
+
return self._find(key, adoption_detail, name)
|
|
2615
|
+
|
|
2616
|
+
def adoption_diff(self, key, name):
|
|
2617
|
+
return self._find(key, adoption_diff, name)
|
|
2618
|
+
|
|
2552
2619
|
def files(self, key):
|
|
2553
2620
|
return self._find(key, files_detail)
|
|
2554
2621
|
|
package/ui/forge_ui/server.py
CHANGED
|
@@ -45,6 +45,8 @@ _EXEC_CHECKS_PATH = re.compile(_EXEC_PATH.pattern + '/checks')
|
|
|
45
45
|
_TASK_CHECKS_PATH = re.compile(_TASK_PATH.pattern + '/checks')
|
|
46
46
|
_ENVIRONMENT_PATH = re.compile(r'/api/runs/([0-9a-f]{12})/environment')
|
|
47
47
|
_REVIEW_DIFF_PATH = re.compile(_REVIEW_PATH.pattern + '/diff')
|
|
48
|
+
_ADOPTION_PATH = re.compile(r'/api/runs/([0-9a-f]{12})/adoptions/(adopt-[0-9]+-[0-9]+)')
|
|
49
|
+
_ADOPTION_DIFF_PATH = re.compile(_ADOPTION_PATH.pattern + '/diff')
|
|
48
50
|
_FILES_PATH = re.compile(r'/api/runs/([0-9a-f]{12})/files')
|
|
49
51
|
_FINDINGS_PATH = re.compile(r'/api/runs/([0-9a-f]{12})/findings')
|
|
50
52
|
_EXPORT_PATH = re.compile(r'/api/runs/([0-9a-f]{12})/export')
|
|
@@ -144,6 +146,12 @@ def api_get(catalog, path):
|
|
|
144
146
|
match = _REVIEW_DIFF_PATH.fullmatch(path)
|
|
145
147
|
if match:
|
|
146
148
|
return catalog.final_review_diff(*match.groups())
|
|
149
|
+
match = _ADOPTION_PATH.fullmatch(path)
|
|
150
|
+
if match:
|
|
151
|
+
return catalog.adoption(*match.groups())
|
|
152
|
+
match = _ADOPTION_DIFF_PATH.fullmatch(path)
|
|
153
|
+
if match:
|
|
154
|
+
return catalog.adoption_diff(*match.groups())
|
|
147
155
|
match = _TRANSCRIPT_PATH.fullmatch(path)
|
|
148
156
|
if match:
|
|
149
157
|
return catalog.transcript(*match.groups())
|
|
@@ -51,16 +51,19 @@ window.ForgeApp = (() => {
|
|
|
51
51
|
if (sel.kind === 'task') return `${base}/tasks/${e(sel.id)}`;
|
|
52
52
|
if (sel.kind === 'execution') return sel.task ? `${base}/tasks/${e(sel.task)}/executions/${e(sel.exec)}` : `${base}/executions/${e(sel.exec)}`;
|
|
53
53
|
if (sel.kind === 'final') return `${base}/final-review${sel.name ? '/' + e(sel.name) : ''}`;
|
|
54
|
+
if (sel.kind === 'adoption') return `${base}/adoptions/${e(sel.name)}`;
|
|
54
55
|
if (sel.kind === 'verification') return `${base}/verification`;
|
|
55
56
|
if (sel.kind === 'integration') return `${base}/integration`;
|
|
56
57
|
if (sel.kind === 'fractal') return `${base}/tasks/${e(sel.task)}/fractal/${e(sel.node)}`;
|
|
57
58
|
return base;
|
|
58
59
|
}
|
|
59
|
-
// a diff: {kind: 'task', task, source, file} | {kind: 'final', name, file} | {kind: '
|
|
60
|
+
// a diff: {kind: 'task', task, source, file} | {kind: 'final', name, file} | {kind: 'adoption', name, file}
|
|
61
|
+
// | {kind: 'fractal', task, node, file},
|
|
60
62
|
// opened at a file, or at one finding (its id from /findings)
|
|
61
63
|
function diffHash(key, spec) {
|
|
62
64
|
const e = encodeURIComponent, base = '#/runs/' + e(key), file = spec.finding ? '/finding/' + e(spec.finding) : spec.file ? '/file/' + e(spec.file) : '';
|
|
63
65
|
if (spec.kind === 'final') return `${base}/final-review/${e(spec.name)}/diff${file}`;
|
|
66
|
+
if (spec.kind === 'adoption') return `${base}/adoptions/${e(spec.name)}/diff${file}`;
|
|
64
67
|
if (spec.kind === 'fractal') return `${base}/tasks/${e(spec.task)}/fractal/${e(spec.node)}/diff${file}`;
|
|
65
68
|
return `${base}/tasks/${e(spec.task)}/diff${spec.source && spec.source !== 'current' ? '/' + e(spec.source) : ''}${file}`;
|
|
66
69
|
}
|
|
@@ -87,6 +90,7 @@ window.ForgeApp = (() => {
|
|
|
87
90
|
if ((r = rest.match(/^\/tasks\/([^/]+)\/diff(?:\/(?!file\/|finding\/)([^/]+))?(?:\/finding\/([^/]+))?(?:\/file\/(.+?))?\/?$/))) return { key: d(m[1]), sel: { kind: 'task', id: d(r[1]) }, diff: { kind: 'task', task: d(r[1]), source: r[2] ? d(r[2]) : 'current', finding: r[3] ? d(r[3]) : null, file: r[4] ? d(r[4]) : null } };
|
|
88
91
|
if ((r = rest.match(/^\/tasks\/([^/]+)\/fractal\/([^/]+)\/diff(?:\/file\/(.+?))?\/?$/))) return { key: d(m[1]), sel: { kind: 'task', id: d(r[1]) }, diff: { kind: 'fractal', task: d(r[1]), node: d(r[2]), file: r[3] ? d(r[3]) : null } };
|
|
89
92
|
if ((r = rest.match(/^\/final-review\/([^/]+)\/diff(?:\/finding\/([^/]+))?(?:\/file\/(.+?))?\/?$/))) return { key: d(m[1]), sel: { kind: 'final', name: d(r[1]) }, diff: { kind: 'final', name: d(r[1]), finding: r[2] ? d(r[2]) : null, file: r[3] ? d(r[3]) : null } };
|
|
93
|
+
if ((r = rest.match(/^\/adoptions\/([^/]+)\/diff(?:\/finding\/([^/]+))?(?:\/file\/(.+?))?\/?$/))) return { key: d(m[1]), sel: { kind: 'adoption', name: d(r[1]) }, diff: { kind: 'adoption', name: d(r[1]), finding: r[2] ? d(r[2]) : null, file: r[3] ? d(r[3]) : null } };
|
|
90
94
|
if ((r = rest.match(/^\/(?:tasks\/([^/]+)\/)?executions\/([^/]+)\/conversation(?:\/event\/(\d{1,7}))?\/?$/))) {
|
|
91
95
|
const s = r[1] ? { kind: 'execution', task: d(r[1]), id: d(r[1]), exec: d(r[2]) } : { kind: 'execution', task: null, exec: d(r[2]) };
|
|
92
96
|
const run = s.task && state.cache.get(d(m[1]))?.data, t = run && list(run.tasks).find(x => x.id === s.task);
|
|
@@ -101,6 +105,7 @@ window.ForgeApp = (() => {
|
|
|
101
105
|
else if ((r = rest.match(/^\/tasks\/([^/]+)\/?$/))) sel = { kind: 'task', id: d(r[1]) };
|
|
102
106
|
else if ((r = rest.match(/^\/executions\/([^/]+)\/?$/))) sel = { kind: 'execution', task: null, exec: d(r[1]) };
|
|
103
107
|
else if ((r = rest.match(/^\/final-review(?:\/([^/]+))?\/?$/))) sel = { kind: 'final', name: r[1] ? d(r[1]) : null };
|
|
108
|
+
else if ((r = rest.match(/^\/adoptions\/([^/]+)\/?$/))) sel = { kind: 'adoption', name: d(r[1]) };
|
|
104
109
|
else if (/^\/verification\/?$/.test(rest)) sel = { kind: 'verification' };
|
|
105
110
|
else if (/^\/integration\/?$/.test(rest)) sel = { kind: 'integration' };
|
|
106
111
|
else if ((r = rest.match(/^\/tasks\/([^/]+)\/fractal\/([^/]+)\/?$/))) sel = { kind: 'fractal', task: d(r[1]), node: d(r[2]) };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* forge-ui diff viewer: a task's diff (current, previous, committed, or exactly what one reviewer read), a final
|
|
2
|
-
review's combined diff or a Fractal node's candidate, with each review finding shown under the line it points
|
|
2
|
+
review's combined diff, an adopted range or a Fractal node's candidate, with each review finding shown under the line it points
|
|
3
3
|
at. Defines window.ForgeDiff.render(host, ctx). All API values enter the DOM as text.
|
|
4
|
-
ctx = { run, spec: {kind: 'task'|'final'|'fractal', task, source, file, name, node, finding}, fetchJSON(path),
|
|
4
|
+
ctx = { run, spec: {kind: 'task'|'final'|'adoption'|'fractal', task, source, file, name, node, finding}, fetchJSON(path),
|
|
5
5
|
rerender(), href(spec) → hash, closeHref }. */
|
|
6
6
|
window.ForgeDiff = (() => {
|
|
7
7
|
'use strict';
|
|
@@ -23,6 +23,7 @@ window.ForgeDiff = (() => {
|
|
|
23
23
|
function urlFor(run, spec) {
|
|
24
24
|
const base = `/api/runs/${enc(run.key)}`;
|
|
25
25
|
if (spec.kind === 'final') return `${base}/final-reviews/${enc(spec.name)}/diff`;
|
|
26
|
+
if (spec.kind === 'adoption') return `${base}/adoptions/${enc(spec.name)}/diff`;
|
|
26
27
|
if (spec.kind === 'fractal') return `${base}/tasks/${enc(spec.task)}/fractal/nodes/${enc(spec.node)}/diff`;
|
|
27
28
|
const src = spec.source || 'current';
|
|
28
29
|
if (TASK_FILES.has(src)) return `${base}/tasks/${enc(spec.task)}/diff${src === 'current' ? '' : '/' + src}`;
|
|
@@ -54,6 +55,9 @@ window.ForgeDiff = (() => {
|
|
|
54
55
|
const r = f.review || {};
|
|
55
56
|
head.append(el('span', `${r.kind || 'review'}${r.attempt != null ? ' · attempt ' + r.attempt : ''}${r.spec ? ' · ' + r.spec : ''}`, 'muted'));
|
|
56
57
|
if (where) head.append(el('span', where, 'mono muted'));
|
|
58
|
+
// #119: the reviewer's own reach, origin and evidence, recorded in shadow (they decide nothing)
|
|
59
|
+
const facts = Object.entries(f.facts || {}).filter(([, v]) => v).map(([k, v]) => `${k} ${v}`);
|
|
60
|
+
if (facts.length) { const t = el('span', facts.join(' · '), 'muted diff-finding-facts'); t.title = "The reviewer's own facts about this finding; they do not change what blocks"; head.append(t); }
|
|
57
61
|
box.append(head, el('p', said(f)));
|
|
58
62
|
const more = String(f.text || '').trim();
|
|
59
63
|
if (more && more !== String(f.summary || '').trim()) { const d = el('details'); d.dataset.keep = `finding-${f.id ?? where ?? said(f)}`; d.append(el('summary', 'Details'), el('pre', more)); box.append(d); }
|
|
@@ -128,7 +132,7 @@ window.ForgeDiff = (() => {
|
|
|
128
132
|
host.replaceChildren();
|
|
129
133
|
const D = entry.data;
|
|
130
134
|
const top = el('div', undefined, 'diff-top');
|
|
131
|
-
const what = spec.kind === 'final' ? 'Final review' : spec.kind === 'fractal' ? `${spec.task} · Fractal node ${spec.node}` : spec.task === 'solo' && run.kind === 'solo' ? 'Solo run' : `Task ${spec.task}`;
|
|
135
|
+
const what = spec.kind === 'final' ? 'Final review' : spec.kind === 'adoption' ? `Adopted range · ${spec.name}` : spec.kind === 'fractal' ? `${spec.task} · Fractal node ${spec.node}` : spec.task === 'solo' && run.kind === 'solo' ? 'Solo run' : `Task ${spec.task}`;
|
|
132
136
|
const title = el('h2'); title.append(el('span', 'Diff · ', 'muted'), document.createTextNode(what)); top.append(title);
|
|
133
137
|
const close = el('a', undefined, 'diff-close button'); close.href = ctx.closeHref;
|
|
134
138
|
if (window.ForgeIcons) close.append(window.ForgeIcons.icon('close'));
|
|
@@ -679,7 +679,8 @@ window.ForgePanel = (() => {
|
|
|
679
679
|
}
|
|
680
680
|
|
|
681
681
|
// Commits made outside forge that `adopt` brought in, each reviewed alone: a person's work, so no task row claims them.
|
|
682
|
-
|
|
682
|
+
// Each opens its review, its findings and the range's diff (#131).
|
|
683
|
+
function adoptionsList(host, run, ctx) {
|
|
683
684
|
const rows = list(run.adoptions);
|
|
684
685
|
if (!rows.length) return;
|
|
685
686
|
const s = section(host, `Adopted commits (${rows.length})`);
|
|
@@ -689,18 +690,57 @@ window.ForgePanel = (() => {
|
|
|
689
690
|
li.append(el('code', `${String(a.base).slice(0, 12)}..${String(a.tip).slice(0, 12)}`, 'mono'), document.createTextNode(' '),
|
|
690
691
|
chip(a.verdict, failed ? 'fail' : 'pass'));
|
|
691
692
|
if (a.approved) li.append(el('span', 'approved over the review', 'tag'));
|
|
693
|
+
if (a.findings && a.findings.worst) li.append(document.createTextNode(' '), sevChip(`${a.findings.worst}×${a.findings[a.findings.worst]}`, a.findings.worst));
|
|
692
694
|
if (a.reason) li.append(el('p', a.reason, 'muted'));
|
|
695
|
+
if (ctx && a.findings !== undefined && (a.findings !== null || a.diff)) {
|
|
696
|
+
const links = el('p', undefined, 'adoption-links'), sel = { kind: 'adoption', name: a.review };
|
|
697
|
+
links.append(link('Its review and findings →', ctx.hash(sel), () => ctx.onSelect(sel)));
|
|
698
|
+
const d = a.diff && diffLink(ctx, 'The range, findings pinned →', { kind: 'adoption', name: a.review });
|
|
699
|
+
if (d) links.append(document.createTextNode(' '), d);
|
|
700
|
+
li.append(links);
|
|
701
|
+
}
|
|
693
702
|
ul.append(li);
|
|
694
703
|
}
|
|
695
704
|
s.append(ul);
|
|
696
705
|
}
|
|
697
706
|
|
|
707
|
+
function adoptionView(host, ctx, sel) {
|
|
708
|
+
const run = ctx.run, a = list(run.adoptions).find(x => x.review === sel.name);
|
|
709
|
+
const head = el('div', undefined, 'insp-head');
|
|
710
|
+
head.append(el('h2', 'Adopted range'), el('div', 'finish · made outside forge, reviewed alone', 'insp-kind'));
|
|
711
|
+
host.append(head);
|
|
712
|
+
const back = { kind: 'final' };
|
|
713
|
+
if (!a) { muted(host, `This run adopted nothing under ${sel.name}.`); host.append(link('← Final review', ctx.hash(back), () => ctx.onSelect(back))); return; }
|
|
714
|
+
const chips = el('div', undefined, 'chips');
|
|
715
|
+
chips.append(chip(a.verdict, String(a.verdict).toUpperCase() === 'PASS' ? 'pass' : 'fail'));
|
|
716
|
+
if (a.approved) chips.append(el('span', 'approved over the review', 'tag'));
|
|
717
|
+
head.append(chips);
|
|
718
|
+
if (a.reason) host.append(el('p', a.reason));
|
|
719
|
+
fields(host, [['Reviewer', plate(a.spec)], ['Range', `${String(a.base).slice(0, 12)}..${String(a.tip).slice(0, 12)}`, true], ['Adopted', time(a.at)]]);
|
|
720
|
+
const d0 = a.diff && diffLink(ctx, 'The range, findings pinned →', { kind: 'adoption', name: a.review });
|
|
721
|
+
if (d0) host.append(d0);
|
|
722
|
+
const fs = section(host, 'Findings');
|
|
723
|
+
findingCounts(fs, a.findings);
|
|
724
|
+
const entry = lazy(ctx, `/api/runs/${encodeURIComponent(run.key)}/adoptions/${encodeURIComponent(a.review)}`, 'adoption:' + a.review);
|
|
725
|
+
if (!loading(fs, entry, 'the review')) {
|
|
726
|
+
const d = entry.data;
|
|
727
|
+
gateLine(fs, d.gate);
|
|
728
|
+
testsLine(fs, d.tests);
|
|
729
|
+
findingsList(fs, d.findings, `adoption-${a.review}`);
|
|
730
|
+
const ps = section(host, 'Report and prompt');
|
|
731
|
+
if (d.known_issues) details(ps, a.approved ? 'Findings kept (known_issues.md)' : 'Known issues', d.known_issues, `adoption-${a.review}-known`);
|
|
732
|
+
details(ps, 'Reviewer report (qa.last)', d.qa_last, `adoption-${a.review}-last`);
|
|
733
|
+
details(ps, 'Prompt (qa.input)', d.qa_input, `adoption-${a.review}-input`);
|
|
734
|
+
}
|
|
735
|
+
host.append(el('p'), link('← Final review', ctx.hash(back), () => ctx.onSelect(back)));
|
|
736
|
+
}
|
|
737
|
+
|
|
698
738
|
function finalView(host, ctx, sel) {
|
|
699
739
|
const run = ctx.run, reviews = list(run.final_reviews);
|
|
700
740
|
const head = el('div', undefined, 'insp-head');
|
|
701
741
|
head.append(el('h2', 'Final review'), el('div', 'finish · whole-run review', 'insp-kind'));
|
|
702
742
|
host.append(head);
|
|
703
|
-
adoptionsList(host, run);
|
|
743
|
+
adoptionsList(host, run, ctx);
|
|
704
744
|
const pick = sel.name ? reviews.find(r => r.name === sel.name) : reviews[0];
|
|
705
745
|
if (!pick) {
|
|
706
746
|
head.append(chip(run.settings && run.settings.final_qa ? 'pending' : 'not requested', 'none'));
|
|
@@ -812,6 +852,7 @@ window.ForgePanel = (() => {
|
|
|
812
852
|
}
|
|
813
853
|
if (sel.kind === 'execution') return execView(host, ctx, task, sel);
|
|
814
854
|
if (sel.kind === 'final') return finalView(host, ctx, sel);
|
|
855
|
+
if (sel.kind === 'adoption') return adoptionView(host, ctx, sel);
|
|
815
856
|
if (sel.kind === 'verification') return verificationView(host, ctx);
|
|
816
857
|
if (sel.kind === 'integration') return integrationView(host, ctx);
|
|
817
858
|
if (sel.kind === 'fractal') return fractalNodeView(host, ctx, sel);
|
|
@@ -1526,6 +1526,7 @@ dialog.set-guide::backdrop { background: light-dark(rgb(17 22 19 / .35), rgb(0 0
|
|
|
1526
1526
|
/* Commits adopted from outside a run */
|
|
1527
1527
|
.adoptions { display: grid; gap: var(--s-2); margin: 0; padding: 0; list-style: none; font-size: var(--t-sm); }
|
|
1528
1528
|
.adoptions p { margin: var(--s-1) 0 0; text-wrap: pretty; }
|
|
1529
|
+
.adoption-links { display: flex; flex-wrap: wrap; gap: var(--s-3); }
|
|
1529
1530
|
|
|
1530
1531
|
/* A held redraw that has lasted (#115) */
|
|
1531
1532
|
.live-held { position: fixed; right: var(--s-4); bottom: var(--s-4); z-index: 30; display: flex; align-items: center; gap: var(--s-2); padding: var(--s-2) var(--s-3); border: 1px solid var(--rule); border-radius: var(--r-key); background: var(--module); color: var(--ink); box-shadow: var(--ply-2); font-size: var(--t-sm); }
|