75 lines
2.4 KiB
Python
75 lines
2.4 KiB
Python
#!/usr/bin/env python3
|
|
"""Generate a real triage classification artifact from the 2026-09-26 inbox seed.
|
|
|
|
Classifies each seed entry deterministically by summary prefix:
|
|
- archive_fix : 'Archive fix: magazine-XXXX ...' publication corrections
|
|
- push_branch : 'Turd app: approve pushing branch ...' branch/PR requests
|
|
- trial : 'Trial by Timmy ...' or 'Q9: hand unreleased audio ...'
|
|
- decided_approved : already-decided approved items (in 'decided')
|
|
Writes wizard-work/sol/triage-seed-2026-09.json
|
|
"""
|
|
import json
|
|
import os
|
|
|
|
BASE = '/root/troupe-standup'
|
|
SEED = os.path.join(BASE, 'inbox', 'seed-2026-09-26.json')
|
|
OUT = os.path.join(BASE, 'wizard-work', 'sol', 'triage-seed-2026-09.json')
|
|
|
|
ALLOWED = {'archive_fix', 'push_branch', 'trial', 'decided_approved'}
|
|
|
|
|
|
def classify(item):
|
|
s = (item.get('summary') or '').lower()
|
|
if item.get('decision') == 'approved':
|
|
return 'decided_approved'
|
|
if s.startswith('archive fix'):
|
|
return 'archive_fix'
|
|
if s.startswith('turd app: approve'):
|
|
return 'push_branch'
|
|
if s.startswith('trial by timmy') or s.startswith('q9: hand unreleased audio'):
|
|
return 'trial'
|
|
return 'unclassified'
|
|
|
|
|
|
def main():
|
|
d = json.load(open(SEED))
|
|
items = []
|
|
for it in d.get('decided', []):
|
|
items.append({
|
|
'id': it.get('id'),
|
|
'bucket': classify(it),
|
|
'kind': 'decided',
|
|
'summary': it.get('summary'),
|
|
'reason': 'already-decided approved item',
|
|
})
|
|
for it in d.get('pending', []):
|
|
b = classify(it)
|
|
if b not in ALLOWED:
|
|
raise SystemExit('unclassified id=%s: %s' % (it.get('id'), it.get('summary')))
|
|
items.append({
|
|
'id': it.get('id'),
|
|
'bucket': b,
|
|
'kind': 'pending',
|
|
'summary': it.get('summary'),
|
|
'reason': 'summary prefix matched %s' % b,
|
|
})
|
|
|
|
buckets = {}
|
|
for it in items:
|
|
buckets[it['bucket']] = buckets.get(it['bucket'], 0) + 1
|
|
|
|
art = {
|
|
'seed': os.path.basename(SEED),
|
|
'source': os.path.join('inbox', 'seed-2026-09-26.json'),
|
|
'buckets': buckets,
|
|
'item_count': len(items),
|
|
'items': items,
|
|
}
|
|
os.makedirs(os.path.dirname(OUT), exist_ok=True)
|
|
json.dump(art, open(OUT, 'w'), indent=2)
|
|
print(json.dumps({'buckets': buckets, 'item_count': len(items)}))
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|