Skip to content

Commit 90b7cd1

Browse files
dmcppcheckclaude
andcommitted
donate-cpu-server-rest: show "Assert failed" instead of "Crash" for head in the crash report
Only the stack trace of head is uploaded, so the old version is still shown as "Crash". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent c0ecdb9 commit 90b7cd1

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

‎test/tools/donate_cpu_server_rest_test.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,9 @@ def test_crash_report_assertion(client):
149149
assert client.post('/api/v1/results', content=RESULT_CRASH_ASSERTION).status_code == 201
150150
crash = client.get('/api/v1/reports/crash').json()
151151
assert [g['assertions'] for g in crash['stack_traces']] == [[], [ASSERTION]]
152+
assert [(p['package'], p['head_assert']) for p in crash['packages']] == [('aaa', False), ('bbb', True)]
152153
page = client.get('/crash.html').text
154+
assert page.count('>Assert failed<') == 1
153155
assert "Variable::arrayDimensions(const Settings&amp;, bool&amp;): Assertion `x == 1&#39; failed." in page
154156

155157

‎tools/donate-cpu-server-rest.py‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -617,8 +617,10 @@ def crash_report(entries: Dict[str, Dict[str, Any]]) -> Dict[str, Any]:
617617
head_crash, old_crash = head == 'Crash!', old == 'Crash!'
618618
if not head_crash and not old_crash:
619619
continue
620-
rows.append(dict(package_row(package, entry), head_crash=head_crash, old_crash=old_crash))
621620
crash = entry.get('crash')
621+
# only the stack trace of head is uploaded, so it is only known for head if it is an assertion failure
622+
head_assert = head_crash and bool(crash and crash.get('assertions'))
623+
rows.append(dict(package_row(package, entry), head_crash=head_crash, old_crash=old_crash, head_assert=head_assert))
622624
if head_crash and crash:
623625
key = '\n'.join(crash.get('assertions', []) + crash['stack_trace'])
624626
group = stack_traces.get(key)
@@ -1411,7 +1413,11 @@ def html_crash(pkgs: Optional[str] = None):
14111413
data = get_crash()
14121414
if is_pkgs(pkgs):
14131415
return packages_text([r for r in data['packages'] if r['head_crash']])
1414-
rows = [[package_link(r['package']), r['date'], 'Crash' if r['old_crash'] else '', 'Crash' if r['head_crash'] else '']
1416+
def head_text(r: Dict[str, Any]) -> str:
1417+
if r.get('head_assert'):
1418+
return 'Assert failed'
1419+
return 'Crash' if r['head_crash'] else ''
1420+
rows = [[package_link(r['package']), r['date'], 'Crash' if r['old_crash'] else '', head_text(r)]
14151421
for r in data['packages']]
14161422
blocks = []
14171423
for n, g in enumerate(data['stack_traces'], 1):

0 commit comments

Comments
 (0)