-
Notifications
You must be signed in to change notification settings - Fork 0
fix(kpi): reject malformed JSON-looking compute evidence #481
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,11 +22,15 @@ const latencies = []; | |
| let exchanges = 0; | ||
| let failures = 0; | ||
|
|
||
| for (const line of lines) { | ||
| for (const [index, line] of lines.entries()) { | ||
| let record; | ||
| try { | ||
| record = JSON.parse(line); | ||
| } catch { | ||
| if (/^\s*[\[{]/.test(line)) { | ||
| console.error(`Malformed JSON in KPI log line ${index + 1}.`); | ||
| process.exit(1); | ||
| } | ||
|
Comment on lines
+30
to
+33
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔍 Bracket-prefixed Wrangler diagnostics can fail closed The new guard treats any non-parseable line starting with Was this helpful? React with 👍 or 👎 to provide feedback. |
||
| // Wrangler tail can include non-JSON diagnostic noise; preserve that tolerance. | ||
| continue; | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 Malformed-JSON diagnostic reports wrong line number
filter(Boolean)drops blank lines before the loop, so the iteration index no longer matches the file line. When a blank line precedes a malformed record,Malformed JSON in KPI log line ${index + 1}names the wrong line and sends an operator to the wrong place.Prompt for agents
Was this helpful? React with 👍 or 👎 to provide feedback.