43 lines
1.4 KiB
Python
43 lines
1.4 KiB
Python
#!/usr/bin/env python3
|
|
"""Machine-checkable verdict for the sol scripts triage artifact.
|
|
|
|
Verdict: exit 0 iff the triage report at wizard-outputs/sol/triage_report.json
|
|
is valid JSON, has total_files == 152, and has the expected category counts
|
|
(44.7% unclassified, 20.4% telemetry, 7.2% library/extract/parse).
|
|
"""
|
|
import json
|
|
import sys
|
|
|
|
REPORT = '/root/.hermes/wizard-outputs/sol/triage_report.json'
|
|
|
|
def main():
|
|
with open(REPORT) as f:
|
|
d = json.load(f)
|
|
expected = {
|
|
'total_files': 152,
|
|
'category_breakdown': {
|
|
'unclassified': 68,
|
|
'telemetry/watch/alert': 31,
|
|
'library/extract/parse': 11,
|
|
'team/troupe/schedule': 11,
|
|
'release/deploy/ops': 8,
|
|
'finance/wallet/crypto': 7,
|
|
'train/dev-tools': 6,
|
|
'bot/social/pitch': 6,
|
|
'mail/respond/digest': 4,
|
|
},
|
|
}
|
|
ok = d.get('total_files') == expected['total_files']
|
|
cb = d.get('category_breakdown', {})
|
|
for cat, want in expected['category_breakdown'].items():
|
|
got = cb.get(cat)
|
|
got_val = got.get('count') if isinstance(got, dict) else got
|
|
if got_val != want:
|
|
ok = False
|
|
print('MISMATCH %s: expected %d got %r' % (cat, want, got))
|
|
print('total_files=%s category_breakdown=%s' % (d.get('total_files'), cb))
|
|
return 0 if ok else 1
|
|
|
|
if __name__ == '__main__':
|
|
sys.exit(main())
|