mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
Keeps a real, redacted error message instead of "Error: Error", surfaces Python tracebacks in Sentry as a vetted context, and adds an opt-in SNAPOTTER_SENTRY_DIAGNOSTIC verbose mode plus SNAPOTTER_SENTRY_DSN_OVERRIDE. The default fleet path ships nothing on the never-collect list; raw detail is reachable only via the opt-in flag. Also classifies Redis OOM/READONLY replies as operational and removes a ReDoS in stack-frame extraction.
25 lines
826 B
TypeScript
25 lines
826 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { extractPythonErrorInfo } from "../../../packages/ai/src/bridge.js";
|
|
|
|
describe("extractPythonErrorInfo", () => {
|
|
it("reads the structured envelope from stdout JSON", () => {
|
|
const stdout = JSON.stringify({
|
|
success: false,
|
|
error: "CUDA out of memory for <path>",
|
|
errorInfo: {
|
|
type: "RuntimeError",
|
|
frames: [{ file: "remove_bg.py", line: 88, func: "run" }],
|
|
},
|
|
});
|
|
const info = extractPythonErrorInfo({ stdout, stderr: "" });
|
|
expect(info).toEqual({
|
|
type: "RuntimeError",
|
|
frames: [{ file: "remove_bg.py", line: 88, func: "run" }],
|
|
});
|
|
});
|
|
|
|
it("returns null when there is no envelope (back-compat)", () => {
|
|
expect(extractPythonErrorInfo({ stdout: "boom", stderr: "" })).toBeNull();
|
|
});
|
|
});
|