Files
reverse-engineering-anything/src/domain/resourceConstraintReattribution.test.ts
T
Cursor Agent 5ba464527b fix(limits): reject invalid runtime seeds and keep the value an operation used
A malformed migrated launch seed stays on the config and the operation view reports configuration_invalid unless a snapshot override is active. Kuna, regex, GDB, and Rizin keep the deadline or heap accepted when the work started, and reattributed resource errors copy the structured limit.
2026-11-11 20:16:24 +08:00

46 lines
1.3 KiB
TypeScript

import { expect, it } from "vitest";
import { analysisSettingLimit } from "./analysisSettingDefinitions.js";
import {
AnalysisResourceConstraintError,
reattributedResourceConstraint,
} from "./analysisErrorCore.js";
import { projectAnalysisError } from "./analysisErrorProjection.js";
it("keeps the structured limit when a resource refusal is reattributed", () => {
const limit = analysisSettingLimit(
"bridge.max_request_bytes",
8192,
"runtime",
);
const original = new AnalysisResourceConstraintError(
"cutter_command",
"transport",
"Cutter status exceeded the request ceiling.",
{ max_request_bytes: 8192 },
{
remediationAction: "Raise bridge.max_request_bytes.",
retryable: false,
limit,
},
);
const discovery = reattributedResourceConstraint(
"list_cutter_sessions",
original,
);
expect(discovery.operation).toBe("list_cutter_sessions");
expect(discovery.limit).toEqual(original.limit);
expect(discovery.recovery).toEqual(original.recovery);
expect(discovery.reportedLimits).toEqual(original.reportedLimits);
const projected = projectAnalysisError(discovery);
expect(projected).toMatchObject({
code: "resource_constraint",
details: {
limit: {
setting: "bridge.max_request_bytes",
effective_value: 8192,
source: "runtime",
},
},
});
});