aboutsummaryrefslogtreecommitdiff
path: root/scripts/newos4-feedback-collect.py
diff options
context:
space:
mode:
authorAgando <roduccomm@gmail.com>2026-10-26 14:45:36 +0100
committerAgando <roduccomm@gmail.com>2026-10-26 14:45:36 +0100
commit4179025e04093eecedb11d1d5355e994d755c14f (patch)
tree169ba969650d952bee0148d1b447a9e481ce25c5 /scripts/newos4-feedback-collect.py
parent3b66ce05034108c1903fcdb286ffb49b0951826c (diff)
feat(newos4): filter network-class auto reports at ingest — count, don't file
The debug supervisor files an auto report for any failed fetch, so a flaky phone connection or a retired endpoint became a review card. One cluster held 14 407 + 1 031 occurrences and produced 3 of the 19 cards in the queue; 10 of 21 items reviewed on 2026-10-26 were noise for this reason. api/debug/report.php: an auto report whose *every* error is network-class (fetch failed / failed to fetch / network error / load failed / aborted / signal is aborted / ERR_INTERNET_*) now increments data/debug/network_failures.json (per day, per source path, top 40 kept) and returns 202 {filtered:"network"}. No RPT file, no card. Never filtered: any report with auto=false (user content), and any auto report carrying a stack/TypeError, i.e. a real defect. Verified on a throwaway tree and live through nginx: auto network poll.php -> 202 filtered, no file auto network /ollama/ -> 202 filtered, no file auto TypeError + stack -> 201 filed (RPT-20261026-134455-95f10612) user report w/ "fetch" -> 201 filed (RPT-20261026-134455-ab0f2cd4) Live: counter total=1 by_source {'/spaces/newos4/api/chat/poll.php': 1}, reports stayed at 19. The dashboard now shows the counter instead of silence: "🌐 1 network failure counted at ingest today, not filed as cards — /spaces/newos4/api/chat/poll.php ×1"
Diffstat (limited to 'scripts/newos4-feedback-collect.py')
-rwxr-xr-xscripts/newos4-feedback-collect.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/scripts/newos4-feedback-collect.py b/scripts/newos4-feedback-collect.py
index e73238c..226a74c 100755
--- a/scripts/newos4-feedback-collect.py
+++ b/scripts/newos4-feedback-collect.py
@@ -16,6 +16,7 @@ TRIAGE = os.path.join(ROOT, 'admin/docs/newos4-triage-latest.json')
STEER = os.path.join(ROOT, 'spaces/newos4/data/maintenance/steering.json')
DECISIONS = os.path.join(ROOT, 'spaces/newos4/data/feedback/decisions.jsonl')
APPLIED = os.path.join(ROOT, 'spaces/newos4/data/feedback/applied.json') # ledger written by the applier
+NETFAIL = os.path.join(ROOT, 'spaces/newos4/data/debug/network_failures.json') # ingest-filter counter
def load(path, default):
@@ -131,7 +132,12 @@ def main():
plans = plans_needing_decision(dec)
reports = reports_needing_decision(dec)
awaiting = [x for x in plans + reports if not x.get('decision')]
+ net = load(NETFAIL, {}) or {}
+ net_top = sorted(((net.get('by_source') or {}) if isinstance(net.get('by_source'), dict) else {}).items(),
+ key=lambda kv: -int(kv[1]))[:3]
doc = {
+ 'network_failures': {'day': net.get('day'), 'total': int(net.get('total') or 0),
+ 'top': [[str(k), int(v)] for k, v in net_top]},
'generated_at': datetime.now(timezone.utc).isoformat(timespec='seconds'),
'counts': {
'plans_review': len(plans), 'reports_total': len(reports),