feat(metadata)!: give NTFS, Maven report and NuGet budgets typed per-call controls (#14629)

* feat(metadata)!: give NTFS, Maven report and NuGet budgets typed per-call controls

inspect_ntfs_journal refused acquisitions above a fixed 64 MiB allowance;
it now takes max_file_bytes (default 64 MiB) and re-admits a retained
acquisition under the call's budget, so lowering it cannot reuse a larger
cached read. inspect_maven_gradle_metadata refused at six fixed report
allowances; they are now report_limits fields (CLI --report-limits JSON)
with today's values as defaults. Maven max_file_bytes and NuGet
max_file_bytes, max_entries and max_nuspec_bytes refusals now report
details.limit from the same bounds objects the schemas use.

The Ghidra installation-properties read allowance is registered as a
protocol bound: it reads the provider's own short installation
descriptor, not analysis input.

BREAKING CHANGE: NTFS and Maven report refusals report details.limit
instead of a fixed_ceiling refusal, and parseMavenGradleMetadata and the
inspect_ntfs_journal input contract gain the new controls.

* fix(metadata): keep omitted NTFS budgets omitted and type host and maximum recovery

inspect_ntfs_journal recorded the default max_file_bytes as if the caller
had chosen it; the field is now optional and resolved for execution only,
so Evidence keeps omission. A host allocation failure while holding an
admitted acquisition is reported as measured memory exhaustion instead
of generic I/O. A Maven report refusal whose need exceeds the control's
maximum no longer suggests raising it. A public CLI/MCP test covers
report_limits refusal and recovery for a POM.
This commit is contained in:
morluto authored and GitHub committed 2026-11-25 21:55:28 -05:00
1 parent 49e2eca4f9
commit 4f66985978
22 files changed
+544 -230

No files matched your search

+21 -9
View File
@@ -771,18 +771,16 @@ it.each([
source: repeatedVariantModule(),
maximum: 4_194_304,
required: 5_000_000,
recovery: "character allowance for variant names",
},
{
boundary: "variants",
source: `{"formatVersion":"1.1","variants":[${Array(4_097).fill("{}").join(",")}]}`,
maximum: 4_096,
required: 4_097,
recovery: "4096-variant allowance",
},
])(
"reports the measured $boundary fixed allowance",
async ({ boundary, source, maximum, required, recovery }) => {
] as const)(
"reports the measured $boundary allowance as its report_limits control",
async ({ boundary, source, maximum, required }) => {
const root = await createTestTempDirectory("rea-gradle-report-");
const path = join(root, "demo.module");
await writeFile(path, source);
@@ -792,17 +790,31 @@ it.each([
path,
max_file_bytes: 1024 * 1024,
});
if (result.ok)
throw new Error(`Expected a fixed allowance for ${boundary}`);
if (result.ok) throw new Error(`Expected a report limit for ${boundary}`);
expect(projectAnalysisError(result.error)).toMatchObject({
code: "resource_constraint",
retryable: false,
details: {
reported_limits: { boundary, maximum, required },
refusal: { kind: "fixed_ceiling", allowance_kind: "report" },
limit: {
control_kind: "parameter",
parameter: `report_limits.${boundary}`,
effective_value: maximum,
default_value: maximum,
applies_at: "next_call",
},
},
remediation: {
action: expect.stringContaining(`report_limits.${boundary}`),
},
remediation: { action: expect.stringContaining(recovery) },
});
// The same document is reported once the caller raises the control.
const raised = await provider.inspect({
path,
max_file_bytes: 1024 * 1024,
report_limits: { [boundary]: required },
});
if (!raised.ok) throw raised.error;
} finally {
await provider.close();
}