chore(refactor): snapshot test baseline + no-regression gate truoc refactor open-sse

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
decolua
2026-06-13 16:13:40 +07:00
parent 23da7b1fe3
commit 9532ec804e
4 changed files with 58 additions and 0 deletions

3
.gitignore vendored
View File

@@ -72,3 +72,6 @@ ecosystem.config.*
scripts/agSniffer/* scripts/agSniffer/*
gitbooks/* gitbooks/*
gitbook/README.md gitbook/README.md
# Refactor backup reference (do not bundle/lint)
open-sse.old/

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,26 @@
tests/unit/antigravity-mitm.test.js :: Antigravity MITM model handling flags the out-of-box agent/Default model mandatory
tests/unit/claude-header-forwarding.test.js :: proxyAwareFetch — api.anthropic.com routing routes api.anthropic.com to gotScraping (non-streaming) and returns ok response
tests/unit/kiro-model-slots.test.js :: Kiro MITM model slots offers a mappable slot for the agent default model id 'auto'
tests/unit/oauth-cursor-auto-import.test.js :: GET /api/oauth/cursor/auto-import extracts tokens using exact keys
tests/unit/oauth-cursor-auto-import.test.js :: GET /api/oauth/cursor/auto-import falls back to fuzzy key matching on macOS when exact keys are missing
tests/unit/oauth-cursor-auto-import.test.js :: GET /api/oauth/cursor/auto-import linux uses single hardcoded path and original error message
tests/unit/oauth-cursor-auto-import.test.js :: GET /api/oauth/cursor/auto-import returns descriptive error if macOS db file exists but cannot be opened
tests/unit/oauth-cursor-auto-import.test.js :: GET /api/oauth/cursor/auto-import returns login-prompt error when tokens are missing even after fallback
tests/unit/oauth-cursor-auto-import.test.js :: GET /api/oauth/cursor/auto-import returns not-found when no macOS cursor db paths are accessible
tests/unit/oauth-cursor-auto-import.test.js :: GET /api/oauth/cursor/auto-import unsupported platform returns 400
tests/unit/oauth-cursor-auto-import.test.js :: GET /api/oauth/cursor/auto-import unwraps JSON-encoded string values
tests/unit/openai-to-claude.test.js :: openaiToClaudeResponse omits empty Read pages tool argument before emitting Claude input deltas
tests/unit/rtk.test.js :: RTK flag default off, toggle works
tests/unit/rtk.test.js :: compressMessages (disabled) returns null when disabled
tests/unit/rtk.test.js :: compressMessages (enabled) compresses Claude array-form tool_result text parts
tests/unit/rtk.test.js :: compressMessages (enabled) compresses Claude string-form tool_result
tests/unit/rtk.test.js :: compressMessages (enabled) compresses OpenAI tool message (string content)
tests/unit/rtk.test.js :: compressMessages (enabled) handles mix of messages without crashing
tests/unit/rtk.test.js :: compressMessages (enabled) never produces empty content (R14 guard)
tests/unit/rtk.test.js :: compressMessages (enabled) skips below MIN_COMPRESS_SIZE (<500 bytes)
tests/unit/rtk.test.js :: compressMessages (enabled) skips is_error tool_result
tests/unit/rtk.test.js :: compressMessages (enabled) skips when body has no messages
tests/unit/translator-request-normalization.test.js :: request normalization claudeToOpenAIRequest flattens text-only content arrays into string
tests/unit/translator-request-normalization.test.js :: request normalization filterToOpenAIFormat flattens text-only arrays to string
tests/unit/translator-request-normalization.test.js :: request normalization parseSSELine supports provider raw NDJSON stream lines
tests/unit/translator-request-normalization.test.js :: request normalization translateRequest keeps /v1/messages Claude->OpenAI text payloads string-safe

View File

@@ -0,0 +1,28 @@
// Gate: so kết quả test hiện tại với baseline known-fails.
// PASS nếu KHÔNG có test nào pass(baseline) → fail(now). Test mới được phép.
// Usage: node tests/__baseline__/verify-no-regression.mjs <current-results.json>
import { readFileSync } from "fs";
const knownFails = new Set(
readFileSync(new URL("./known-fails.txt", import.meta.url), "utf8")
.split("\n").map(s => s.trim()).filter(Boolean)
);
const resultsPath = process.argv[2];
if (!resultsPath) { console.error("Missing results.json path"); process.exit(2); }
const r = JSON.parse(readFileSync(resultsPath, "utf8"));
const nowFails = r.testResults.flatMap(f =>
f.assertionResults.filter(a => a.status === "failed")
.map(a => f.name.split("/app/")[1] + " :: " + a.fullName)
);
// Regression = fail bây giờ NHƯNG không có trong baseline known-fails
const regressions = nowFails.filter(f => !knownFails.has(f));
if (regressions.length) {
console.error(`\n❌ REGRESSION: ${regressions.length} test pass→fail:\n`);
regressions.forEach(f => console.error(" - " + f));
process.exit(1);
}
console.log(`✅ No regression. (now fails=${nowFails.length}, baseline known=${knownFails.size}, all known)`);