feat(native): make function matching allowance configurable (#7159)

Allow native matching representation budgets to be selected at runtime or launch while retaining the 96 MiB default and main shared-provenance accounting. Preserve actionable configuration recovery through the setting owner and verify complete CLI/MCP matches for 20k/50k synthetic inventories and real stripped LLVM 14/15 inventories.

Fixes #6406.

Based on #7112 by Kaoru0822; original authorship and co-author credit retained.

Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
authored and GitHub committed 2026-10-26 02:22:32 +08:00
1 parent a174892e3e
commit b8ce3c74cd
27 files changed
+1511 -27

No files matched your search

@@ -18,9 +18,15 @@ import { err, ok, type Result } from "../../domain/result.js";
import type { EvidenceLookup } from "../EvidenceInputResolver.js";
import { resolveNativeMatchingSources } from "./NativeMatchingSources.js";
import type { ExecutionOptions } from "../AnalysisProvider.js";
import type { NativeMatchingAllowance } from "../../config/nativeMatchingAllowance.js";
import { FUNCTION_COMPARISON_PROVIDER } from "../../domain/comparisonEvidenceIdentity.js";
const OPERATION = "match_native_functions";
/** Effective admission budget, separate from caller-authored Evidence parameters. */
export interface NativeFunctionMatchingOptions extends ExecutionOptions {
readonly representationAllowance?: NativeMatchingAllowance;
}
export interface NativeFunctionMatchingResult {
readonly evidence: Evidence;
readonly sources: readonly Evidence[];
@@ -30,10 +36,14 @@ export interface NativeFunctionMatchingResult {
/** Pair existing observations through one source/analysis admission. */
export const matchNativeFunctions = async (
rawInput: unknown,
options?: ExecutionOptions,
options?: NativeFunctionMatchingOptions,
lookup?: EvidenceLookup,
): Promise<Result<NativeFunctionMatchingResult, AnalysisError>> => {
const admission = new NativeMatchingAdmission(OPERATION, options?.signal);
const admission = new NativeMatchingAdmission(
OPERATION,
options?.signal,
options?.representationAllowance,
);
try {
await setImmediate();
await admission.checkpoint();
@@ -171,10 +181,14 @@ export const matchNativeFunctionsFromBundles = async (
input: MatchNativeFunctionsInput,
paths: readonly string[],
resources: ArtifactResourceScope,
options?: ExecutionOptions,
options?: NativeFunctionMatchingOptions,
): Promise<Result<NativeFunctionMatchingResult, AnalysisError>> => {
try {
const admission = new NativeMatchingAdmission(OPERATION, options?.signal);
const admission = new NativeMatchingAdmission(
OPERATION,
options?.signal,
options?.representationAllowance,
);
await admission.admit(input);
const loaded = await loadNativeMatchingBundleSources({
input,