Fix safeFetch metrics double-counting failed requests #15
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Created from local project scan after reviewing existing issues #1-#13.
Current status: pis/utils/fetch.mjs records a failed metric before throwing on non-2xx responses, then records another failed metric in the catch block for the same request. HTML responses after a 200 are also counted once as OK and then again as failed. This can inflate /api/metrics failure/request counts and make source reliability look worse or inconsistent.
Code references:
Acceptance criteria:
In Bearbeitung durch Codex auf Branch codex/issue-15-fetch-metrics. Scope: safeFetch Metrics-Doppelzaehlung: pro Attempt genau ein Metric Record, HTTP/HTML Fehler korrekt als failed, Regressionstests. Runner-only: keine lokalen npm/node Laeufe.
PR geoeffnet: #33\n\nStatus: mergeable. Scope: safeFetch/safeFetchText zaehlen pro Attempt genau einen Metric Record; HTTP- und HTML/JSON-Shape-Fehler behalten Status/Bytes/Error ohne Doppelzaehlung. Regressionen fuer HTTP failure, HTML response und Retry-Accounting ergaenzt. Runner-only: keine lokalen npm/node Tests.