fix(build): unblock release build and settings state updates
Add targeted TypeScript annotations and module declarations to reduce type errors in open-sse services, executors, and shared utilities while temporarily disabling checking in legacy files that still need migration. Reset stale `.next/standalone` output before isolated builds so release artifacts are generated from a clean state. Update the dashboard proxy settings UI to bypass cached settings reads and immediately roll back debug mode when the PATCH request fails, which prevents stale data and inconsistent toggle state.
This commit is contained in:
@@ -421,10 +421,10 @@ async function getLatestCallLog() {
|
||||
return callLogsDb.getCallLogById(rows[0].id);
|
||||
}
|
||||
|
||||
async function getResponsesCallLogCount() {
|
||||
async function getResponsesCallLogs() {
|
||||
const rows = await callLogsDb.getCallLogs({ limit: 200 });
|
||||
if (!Array.isArray(rows) || rows.length === 0) return 0;
|
||||
return rows.filter((row) => row.path === "/v1/responses").length;
|
||||
if (!Array.isArray(rows) || rows.length === 0) return [];
|
||||
return rows.filter((row) => row.path === "/v1/responses");
|
||||
}
|
||||
|
||||
test.beforeEach(async () => {
|
||||
@@ -528,7 +528,7 @@ test("chat pipeline persists Codex responses cache and reasoning tokens to call
|
||||
assert.equal(callLog.tokens.reasoning, 13);
|
||||
});
|
||||
|
||||
test("chat pipeline serves repeated /v1/responses requests as MISS then HIT and logs only once", async () => {
|
||||
test("chat pipeline serves repeated /v1/responses requests as MISS then HIT and logs cache hits separately", async () => {
|
||||
await seedConnection("codex", { apiKey: "sk-codex-cache-seq" });
|
||||
const fetchCalls = [];
|
||||
|
||||
@@ -558,10 +558,11 @@ test("chat pipeline serves repeated /v1/responses requests as MISS then HIT and
|
||||
const requestBody = {
|
||||
model: "codex/gpt-5.3-codex",
|
||||
stream: false,
|
||||
temperature: 0,
|
||||
input: [{ role: "user", content: [{ type: "input_text", text: uniquePrompt }] }],
|
||||
};
|
||||
|
||||
const beforeCount = await getResponsesCallLogCount();
|
||||
const beforeCount = (await getResponsesCallLogs()).length;
|
||||
|
||||
const firstResponse = await handleChat(
|
||||
buildRequest({
|
||||
@@ -599,12 +600,17 @@ test("chat pipeline serves repeated /v1/responses requests as MISS then HIT and
|
||||
assert.equal(fetchCalls.length, 1, "expected upstream to be called only once for MISS");
|
||||
assert.match(fetchCalls[0].url, /\/responses$/);
|
||||
|
||||
const afterCount = await waitFor(async () => {
|
||||
const count = await getResponsesCallLogCount();
|
||||
return count === beforeCount + 1 ? count : null;
|
||||
const callLogs = await waitFor(async () => {
|
||||
const rows = await getResponsesCallLogs();
|
||||
return rows.length === beforeCount + 3 ? rows : null;
|
||||
}, 2000);
|
||||
|
||||
assert.equal(afterCount, beforeCount + 1, "expected exactly one new /v1/responses call log");
|
||||
assert.ok(callLogs, "expected /v1/responses call logs to be recorded");
|
||||
assert.equal(callLogs.length, beforeCount + 3, "expected MISS plus two HIT call logs");
|
||||
|
||||
const newLogs = callLogs.slice(0, 3);
|
||||
assert.equal(newLogs.filter((row) => row.cacheSource === "upstream").length, 1);
|
||||
assert.equal(newLogs.filter((row) => row.cacheSource === "semantic").length, 2);
|
||||
|
||||
const callLog = await waitFor(() => getLatestCallLog());
|
||||
assert.ok(callLog, "expected a call log row to exist");
|
||||
|
||||
@@ -268,25 +268,32 @@ test("syncAllBudgetSchedules advances overdue budgets and records a reset log",
|
||||
const now = Date.UTC(2026, 3, 17, 12, 0, 0);
|
||||
const previousPeriodStart = Date.UTC(2026, 3, 15, 0, 0, 0);
|
||||
const overdueResetAt = Date.UTC(2026, 3, 16, 0, 0, 0);
|
||||
const originalNow = Date.now;
|
||||
|
||||
domainState.saveBudget("key-reset", {
|
||||
dailyLimitUsd: 10,
|
||||
warningThreshold: 0.8,
|
||||
resetInterval: "daily",
|
||||
resetTime: "00:00",
|
||||
budgetResetAt: overdueResetAt,
|
||||
lastBudgetResetAt: previousPeriodStart,
|
||||
});
|
||||
domainState.saveCostEntry("key-reset", 3.5, Date.UTC(2026, 3, 15, 12, 0, 0));
|
||||
try {
|
||||
Date.now = () => now;
|
||||
|
||||
const result = costRules.syncAllBudgetSchedules(now);
|
||||
const synced = costRules.getBudget("key-reset");
|
||||
const logs = domainState.loadBudgetResetLogs("key-reset", 5);
|
||||
domainState.saveBudget("key-reset", {
|
||||
dailyLimitUsd: 10,
|
||||
warningThreshold: 0.8,
|
||||
resetInterval: "daily",
|
||||
resetTime: "00:00",
|
||||
budgetResetAt: overdueResetAt,
|
||||
lastBudgetResetAt: previousPeriodStart,
|
||||
});
|
||||
domainState.saveCostEntry("key-reset", 3.5, Date.UTC(2026, 3, 15, 12, 0, 0));
|
||||
|
||||
assert.equal(result.processed, 1);
|
||||
assert.equal(result.resetCount, 1);
|
||||
assert.equal(synced?.lastBudgetResetAt, Date.UTC(2026, 3, 17, 0, 0, 0));
|
||||
assert.equal(logs.length, 1);
|
||||
assert.equal(logs[0].previousSpend, 3.5);
|
||||
assert.equal(logs[0].resetInterval, "daily");
|
||||
const result = costRules.syncAllBudgetSchedules(now);
|
||||
const synced = costRules.getBudget("key-reset");
|
||||
const logs = domainState.loadBudgetResetLogs("key-reset", 5);
|
||||
|
||||
assert.equal(result.processed, 1);
|
||||
assert.equal(result.resetCount, 1);
|
||||
assert.equal(synced?.lastBudgetResetAt, Date.UTC(2026, 3, 17, 0, 0, 0));
|
||||
assert.equal(logs.length, 1);
|
||||
assert.equal(logs[0].previousSpend, 3.5);
|
||||
assert.equal(logs[0].resetInterval, "daily");
|
||||
} finally {
|
||||
Date.now = originalNow;
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user