Files
SnapOtter/tests/unit/api/redis-preflight.test.ts
T
SnapOtterandGitHub ae6a4c8b7c fix: error-only Sentry telemetry, storm-proof capture, and crash fixes (#476)
Removes Sentry tracing entirely (BullMQ idle polling burned 4.8M transactions in 2 days at the baked 0.1 rate), decouples PostHog sampling, and replaces the type-only error scrub with a vetted-field sanitizer plus SafeError/ToolInputError contracts. One classified capture path with per-signature throttles and a per-process ceiling makes storms impossible (NODE-1E was 4,541 events from one 30s loop). Browser errors move to a dedicated web Sentry project with their own source maps. Adds the SNAPOTTER_TELEMETRY runtime kill switch and silences test fleets.

Crash fixes: remote 204/304 SSRF process kill (NODE-20), conversion-preset boot crash loop (NODE-21), Redis version preflight + unhandled subscribe rejection (NODE-1T), Sign PDF on plain-http origins (NODE-1K/1M), wavesurfer/pdf.js teardown rejections (NODE-1P/1N), bundle-import ZlibError to 400 (NODE-1Z), chart-maker input errors declassified (NODE-1H/1J), asset requests skip the session DB lookup (NODE-1D).
2026-07-10 21:41:49 +08:00

22 lines
1.0 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { checkRedisInfoCompatible } from "../../../apps/api/src/jobs/connection.js";
describe("checkRedisInfoCompatible", () => {
it("accepts 6.2, 7.x, 8.x", () => {
expect(checkRedisInfoCompatible("# Server\r\nredis_version:8.0.1\r\n")).toBeNull();
expect(checkRedisInfoCompatible("redis_version:6.2.14")).toBeNull();
expect(checkRedisInfoCompatible("redis_version:7.4.0")).toBeNull();
});
it("rejects < 6.2 with a SafeError carrying the version in code", () => {
const err = checkRedisInfoCompatible("redis_version:6.0.16");
expect(err?.message).toBe("Redis 6.2 or newer is required. Point REDIS_URL at Redis 8.");
expect(err?.code).toBe("redis-6.0");
const old = checkRedisInfoCompatible("redis_version:5.0.7");
expect(old?.code).toBe("redis-5.0");
});
it("tolerates unparseable INFO (managed Redis)", () => {
expect(checkRedisInfoCompatible("garbage")).toBeNull();
expect(checkRedisInfoCompatible("")).toBeNull();
});
});