feat(dotnet): verify managed native boundaries
Add the verify_managed_native_boundaries workflow for comparing authenticated inspect_managed_native_boundaries Evidence with supplied native export or function Evidence. The workflow verifies only P/Invoke declaration names against observed native symbols, keeps verified, inferred, contradicted, unresolved, and unsupported-native states explicit, and does not translate managed metadata tokens or RVAs into native addresses. Expose schema-identical MCP and CLI surfaces, update managed workflow contracts, product catalog facts, TypeDoc output, README/localized docs, ADR status, package verification, and the REA analysis skill metadata for the 90-tool/50-command inventory. Verification: npx vitest run tests/managedNativeVerification.test.ts --coverage=false; npm run typecheck; npm run docs:generate; npm run check (first run hit a load-sensitive sessionMcp timeout, isolated rerun passed); npx vitest run tests/sessionMcp.test.ts --coverage=false; npm run check; npm run knip; npm run jscpd; npm run scan:todos; npm run verify:managed; CXX=/usr/bin/g++-13 CC=/usr/bin/gcc-13 npm run verify:package.
This commit is contained in:
@@ -2,6 +2,7 @@ import type { McpServer } from "@modelcontextprotocol/server";
|
||||
|
||||
import type { BinarySessionPort } from "../application/BinarySession.js";
|
||||
import { compareManagedMembersEvidence } from "../application/ManagedMemberComparisonService.js";
|
||||
import { verifyManagedNativeBoundariesEvidence } from "../application/ManagedNativeVerificationService.js";
|
||||
import { importManagedReconstructionEvidence } from "../application/ManagedReconstructionService.js";
|
||||
import {
|
||||
planManagedRuntimeCorrelationEvidence,
|
||||
@@ -12,6 +13,10 @@ import {
|
||||
compareManagedMembersInputSchema,
|
||||
managedMemberComparisonResultSchema,
|
||||
} from "../domain/managedMemberComparison.js";
|
||||
import {
|
||||
managedNativeVerificationInputSchema,
|
||||
managedNativeVerificationResultSchema,
|
||||
} from "../domain/managedNativeVerification.js";
|
||||
import { managedReconstructionImportInputSchema } from "../domain/managedReconstruction.js";
|
||||
import { managedRuntimeCorrelationInputSchema } from "../domain/managedRuntimeCorrelation.js";
|
||||
import type { Evidence } from "../domain/evidence.js";
|
||||
@@ -35,6 +40,9 @@ export const registerManagedWorkflowTools = (
|
||||
options: ManagedWorkflowToolRegistration,
|
||||
): void => {
|
||||
const compareContract = contract("compare_managed_members");
|
||||
const nativeVerificationContract = contract(
|
||||
"verify_managed_native_boundaries",
|
||||
);
|
||||
const reconstructionContract = contract("import_managed_reconstruction");
|
||||
const runtimeContract = contract("plan_managed_runtime_correlation");
|
||||
server.registerTool(
|
||||
@@ -91,6 +99,66 @@ export const registerManagedWorkflowTools = (
|
||||
);
|
||||
},
|
||||
);
|
||||
server.registerTool(
|
||||
nativeVerificationContract.name,
|
||||
toolRegistrationOptions(nativeVerificationContract),
|
||||
async (input) => {
|
||||
const parsed = managedNativeVerificationInputSchema.parse(input);
|
||||
const result = await logToolExecution(
|
||||
options.logger,
|
||||
nativeVerificationContract.name,
|
||||
() => Promise.resolve(verifyManagedNativeBoundariesEvidence(parsed)),
|
||||
);
|
||||
if (!result.ok)
|
||||
return toCallToolResult(result, nativeVerificationContract);
|
||||
const recordedSources = recordSources(options.recordEvidence, [
|
||||
parsed.managed_boundaries,
|
||||
...parsed.native_observations,
|
||||
]);
|
||||
if (!recordedSources.ok)
|
||||
return toCallToolResult(recordedSources, nativeVerificationContract);
|
||||
const verification = managedNativeVerificationResultSchema.parse(
|
||||
result.value.normalized_result,
|
||||
);
|
||||
const unknown =
|
||||
verification.summary.unresolved > 0 ||
|
||||
verification.summary.contradicted > 0 ||
|
||||
verification.summary.native_body_unresolved > 0;
|
||||
const output =
|
||||
parsed.unknown_registry_approved === true && unknown
|
||||
? options.recordEvidenceWithUnknown?.(result.value, {
|
||||
approved: true,
|
||||
question:
|
||||
"Which managed/native boundaries remain unresolved or contradicted by the supplied native Evidence?",
|
||||
severity: "medium",
|
||||
domain: "managed-native-verification",
|
||||
supporting_evidence_ids: [result.value.evidence_id],
|
||||
contradicting_evidence_ids: [],
|
||||
required_authority: "shipped-artifact",
|
||||
required_confidence: "observed",
|
||||
required_environment: null,
|
||||
recommended_probes: [
|
||||
{
|
||||
operation: "inspect_managed_native_boundaries",
|
||||
rationale:
|
||||
"Repeat managed boundary inspection with complete ModuleRef, ImplMap, and native implementation pages.",
|
||||
},
|
||||
{
|
||||
operation: "analyze_function",
|
||||
rationale:
|
||||
"Analyze the provider-resolved native function candidate for the declared export.",
|
||||
},
|
||||
],
|
||||
relationships: [],
|
||||
})
|
||||
: options.recordEvidence?.(result.value);
|
||||
if (output !== undefined && !output.ok)
|
||||
return toCallToolResult(output, nativeVerificationContract);
|
||||
return toCallToolResult(result, nativeVerificationContract, {
|
||||
evidenceResourcesAvailable: output !== undefined,
|
||||
});
|
||||
},
|
||||
);
|
||||
server.registerTool(
|
||||
reconstructionContract.name,
|
||||
toolRegistrationOptions(reconstructionContract),
|
||||
|
||||
Reference in New Issue
Block a user