Files
rea/tests/boundary/sqlite/sqliteDatabaseFailures.test.ts
T
2947a77507 fix(engines): keep format ceilings fixed and recover the EVMole deadline (#6088)
* fix(engines): keep format ceilings fixed and recover the EVMole deadline

Promote the owned EVMole worker wall clock to timeout_ms and name it in
recovery. Fixed CPU, byte, and address-space refusals in this theme say
the adjustable deadline does not raise them.

Refs #5910

Co-authored-by: morluto <morluto@users.noreply.github.com>

* fix(engines): recover the allowance that refused the request

Model capacity recovery follows a structured limit instead of message text,
and the shared header ceiling no longer names Safetensors. Firmware signal
errors keep captured tool output, oversized reports do not suggest an
intermittent rerun, and NativeAOT hydration budget exhaustion explains the
fixed parser allowance on the partial report.

Co-authored-by: morluto <morluto@users.noreply.github.com>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: morluto <morluto@users.noreply.github.com>
2026-10-22 03:06:59 +08:00

107 lines
3.3 KiB
TypeScript

import { expect, it } from "vitest";
import { OwnedCommandFailure } from "../../../src/process/OwnedCommand.js";
import { projectAnalysisError } from "../../../src/domain/analysisErrorProjection.js";
import { sqliteDatabaseFailure } from "../../../src/sqlite/SqliteDatabaseFailures.js";
import { SQLITE_DATABASE_LIMITS } from "../../../src/sqlite/SqliteDatabaseLimits.js";
it.each([null, "owned stop unconfirmed"])(
"preserves a selected worker deadline with cleanup=%s",
(cleanup) => {
const cause = new OwnedCommandFailure(
"timeout",
"Command deadline elapsed.",
{
stdout: { text: "partial-owned-output", bytes: 20, observedBytes: 20 },
stderr: { text: "", bytes: 0, observedBytes: 0 },
exitCode: null,
signal: null,
},
cleanup,
undefined,
["pid:owned-fixture"],
);
const failure = sqliteDatabaseFailure(
cause,
"/selected.db",
"worker",
undefined,
1234,
);
expect(failure.cause).toBe(cause);
const projected = projectAnalysisError(failure);
if (cleanup === null)
expect(projected).toMatchObject({
code: "provider_timeout",
details: { timeout_ms: 1234 },
remediation: { action: expect.stringContaining("--worker-timeout-ms") },
});
else
expect(projected).toMatchObject({
code: "cleanup_incomplete",
retryable: false,
details: {
resources: ["pid:owned-fixture"],
diagnostics: {
previous_error: {
code: "provider_timeout",
details: { timeout_ms: 1234 },
remediation: {
action: expect.stringContaining("worker_timeout_ms"),
},
},
},
},
});
expect(
JSON.stringify(projected).split("partial-owned-output"),
).toHaveLength(2);
if (cleanup !== null) {
expect(failure.cleanupPrimary).toMatchObject({
_tag: "AnalysisTimeoutError",
timeoutMs: 1234,
});
failure.resolveCleanup();
const resolved = projectAnalysisError(failure);
expect(resolved).toMatchObject({
code: "provider_timeout",
details: { timeout_ms: 1234 },
});
expect(
JSON.stringify(resolved).split("partial-owned-output"),
).toHaveLength(2);
}
},
);
it("does not recommend a timer above the supported maximum", () => {
const failure = projectAnalysisError(
sqliteDatabaseFailure(
new OwnedCommandFailure("timeout", "deadline"),
"/selected.db",
"worker",
undefined,
2_147_483_647,
),
);
expect(failure.details).toMatchObject({ timeout_ms: 2_147_483_647 });
expect(failure.remediation.action).toContain("no higher worker deadline");
expect(failure.remediation.action).not.toContain("Increase");
});
it("says diagnostic capture has no runtime override", () => {
const projected = projectAnalysisError(
sqliteDatabaseFailure(
new OwnedCommandFailure("output-limit", "diagnostics exceeded"),
"/selected.db",
"worker",
),
);
expect(projected.remediation.action).toContain(
String(SQLITE_DATABASE_LIMITS.diagnosticBytes),
);
expect(projected.remediation.action).toContain("no runtime override");
expect(projected.remediation.action).toContain(
"worker_timeout_ms does not raise it",
);
});