diff --git a/src/application/ntfs/NtfsJournalService.test.ts b/src/application/ntfs/NtfsJournalService.test.ts index 4288f8b905..78eeeff9c6 100644 --- a/src/application/ntfs/NtfsJournalService.test.ts +++ b/src/application/ntfs/NtfsJournalService.test.ts @@ -101,7 +101,7 @@ it("refuses an oversized acquisition as a fixed ceiling, not host memory", async }, }); // Recovery comes from the fixed-allowance owner, not host-memory advice. - expect(projected.remediation.action).toBe( + expect(projected.remediation.action).toContain( fixedAllowanceRemediation("The NTFS journal file allowance", "input"), ); } finally { diff --git a/src/domain/analysisRefusal.test.ts b/src/domain/analysisRefusal.test.ts index 0f2853090f..5cb89c7122 100644 --- a/src/domain/analysisRefusal.test.ts +++ b/src/domain/analysisRefusal.test.ts @@ -50,6 +50,8 @@ describe("typed refusals", () => { expect(projected.remediation.action).toMatch( /^The GraphQL nesting allowance is a fixed allowance\..*Select a shallower document\.$/u, ); + // The value comes from the ceiling's facts, so a producer need not write it into the name. + expect(projected.remediation.action).toMatch(/\b128 levels\b/u); expect(projected.remediation.action).not.toMatch(/worker memory|doctor/u); expect(projected.details?.refusal).toEqual({ kind: "fixed_ceiling", diff --git a/src/domain/analysisRefusal.ts b/src/domain/analysisRefusal.ts index c9413254ea..f0a62a805a 100644 --- a/src/domain/analysisRefusal.ts +++ b/src/domain/analysisRefusal.ts @@ -102,9 +102,13 @@ export const analysisRefusalRemediation = ( case "fixed_ceiling": { const { ceiling } = refusal; const base = fixedAllowanceRemediation(ceiling.name, ceiling.kind); + const value = + ceiling.limit === undefined || ceiling.unit === undefined + ? "" + : ` The allowance is ${String(ceiling.limit)} ${ceiling.unit}; this release has no runtime override.`; return ceiling.narrowing === undefined - ? base - : `${base} ${ceiling.narrowing}`; + ? `${base}${value}` + : `${base}${value} ${ceiling.narrowing}`; } case "adjustable_budget": return adjustableBudgetRemediation( diff --git a/src/domain/fixedAllowanceRemediation.ts b/src/domain/fixedAllowanceRemediation.ts index f9f75fefd5..aafd0fdefe 100644 --- a/src/domain/fixedAllowanceRemediation.ts +++ b/src/domain/fixedAllowanceRemediation.ts @@ -78,7 +78,4 @@ export const fixedProducerInputAllowance = ( bytes: number, allowance: string, ): { readonly retryable: false; readonly fixedAllowance: FixedAllowance } => - fixedAllowanceOptions( - `${allowance} of ${String(bytes)} bytes (this release has no runtime override)`, - "input", - ); + fixedAllowanceOptions(allowance, "input", { limit: bytes, unit: "bytes" }); diff --git a/src/domain/native/nativeDeadlines.ts b/src/domain/native/nativeDeadlines.ts index d3f6420ef4..57625ccee8 100644 --- a/src/domain/native/nativeDeadlines.ts +++ b/src/domain/native/nativeDeadlines.ts @@ -6,7 +6,8 @@ import { import type { AnalysisControlLimit } from "../analysisSettings.js"; import { - fixedAllowanceRemediation, + fixedAllowanceOptions, + type FixedAllowance, type FixedAllowanceKind, } from "../fixedAllowanceRemediation.js"; @@ -100,12 +101,11 @@ export const nativeDeadlineRecovery = (input: { }; }; -/** Fixed native allowance the agent can see, with the value and no override. */ +/** Fixed native allowance projected as `details.refusal`, with its value and unit. */ export const fixedNativeAllowance = ( allowance: string, kind: FixedAllowanceKind, - valueWithUnits: string, -): { readonly retryable: false; readonly remediationAction: string } => ({ - retryable: false, - remediationAction: `${fixedAllowanceRemediation(allowance, kind)} This release has no runtime override. The allowance is ${valueWithUnits}.`, -}); + limit: number, + unit: string, +): { readonly retryable: false; readonly fixedAllowance: FixedAllowance } => + fixedAllowanceOptions(allowance, kind, { limit, unit }); diff --git a/src/native/NativeCommandAnalysisError.ts b/src/native/NativeCommandAnalysisError.ts index b8a9728143..e8257a5cd1 100644 --- a/src/native/NativeCommandAnalysisError.ts +++ b/src/native/NativeCommandAnalysisError.ts @@ -218,7 +218,8 @@ export const translateNativeCommandFailure = ( ...fixedNativeAllowance( "The native command output capture allowance", "capture", - `${String(NATIVE_COMMAND_OUTPUT_BUDGET_BYTES)} bytes`, + NATIVE_COMMAND_OUTPUT_BUDGET_BYTES, + "bytes", ), }, ), diff --git a/src/native/pe/PeResourcesProvider.test.ts b/src/native/pe/PeResourcesProvider.test.ts index 2d655f40f3..6164ac8bfc 100644 --- a/src/native/pe/PeResourcesProvider.test.ts +++ b/src/native/pe/PeResourcesProvider.test.ts @@ -180,8 +180,12 @@ it("names the fixed PE metadata allowance instead of host memory", async () => { }); const projected = projectAnalysisError(error); expect(projected.retryable).toBe(false); - expect(projected.remediation.action).toContain( - "PE resource metadata allowance", - ); - expect(projected.remediation.action).not.toMatch(/available host memory/u); + expect(projected.details).toMatchObject({ + refusal: { + kind: "fixed_ceiling", + allowance_kind: "parser", + limit: 8 * 1024 * 1024, + unit: "bytes", + }, + }); }); diff --git a/src/native/pe/PeResourcesProvider.ts b/src/native/pe/PeResourcesProvider.ts index 57df29491e..f71a8cffa3 100644 --- a/src/native/pe/PeResourcesProvider.ts +++ b/src/native/pe/PeResourcesProvider.ts @@ -153,7 +153,8 @@ const peResourcesFailurePrimary = ( ? fixedNativeAllowance( "The PE resource metadata allowance", "parser", - `${String(PE_RESOURCE_METADATA_BYTES)} bytes (8 MiB)`, + PE_RESOURCE_METADATA_BYTES, + "bytes", ) : { retryable: false as const, diff --git a/tests/boundary/filesystem/ghidraInstallationProperties.test.ts b/tests/boundary/filesystem/ghidraInstallationProperties.test.ts index 136b0317e2..91194263c3 100644 --- a/tests/boundary/filesystem/ghidraInstallationProperties.test.ts +++ b/tests/boundary/filesystem/ghidraInstallationProperties.test.ts @@ -173,15 +173,15 @@ it("refuses an oversized descriptor before reading file bytes", async () => { expect(projectAnalysisError(failure)).toMatchObject({ code: "resource_constraint", retryable: false, - remediation: { - action: expect.stringContaining( - "Ghidra installation-properties read allowance of 1048576 bytes (this release has no runtime override)", - ), + details: { + refusal: { + kind: "fixed_ceiling", + allowance_kind: "input", + limit: MAX_GHIDRA_INSTALLATION_PROPERTIES_BYTES, + unit: "bytes", + }, }, }); - expect(projectAnalysisError(failure).remediation.action).toContain( - "Increasing an evidence-reply file-size allowance does not admit this input", - ); expect(reads).toBe(0); } finally { await resources.close();