test(package): share validated native dossier fixtures

This commit is contained in:
morluto 2026-10-10 04:02:40 +08:00
parent 5d32e42529
commit ca9010936a
6 changed files with 46 additions and 65 deletions

View File

@ -0,0 +1,35 @@
import { functionDossierSchema } from "../../dist/domain/hopperValues.js";
/** Validated synthetic native observations shared by managed verification lanes. */
export const functionDossier = (name) =>
functionDossierSchema.parse({
procedure: {
address: "0x401000",
name,
classification: {
external: false,
thunk: false,
thunk_target: null,
provenance: "synthetic-provider",
},
body: {
available: false,
reason: "Synthetic provider does not supply function body ranges.",
},
signature: null,
locals: [],
},
pseudocode: "",
assembly: [],
comments: [],
callers: [],
callees: [],
incoming_references: [],
outgoing_references: [],
referenced_strings: [],
referenced_names: [],
basic_blocks: [],
native_api: null,
native_value_flow: null,
limitations: [],
});

View File

@ -69,32 +69,3 @@ export const pathExists = async (path) => {
throw cause;
}
};
/** Synthetic function dossier for managed/native verification fixtures. */
export const functionDossier = (name) => {
return {
procedure: {
address: "0x401000",
name,
classification: {
external: false,
thunk: false,
thunk_target: null,
provenance: "synthetic-provider",
},
signature: null,
locals: [],
},
pseudocode: "",
assembly: [],
comments: [],
callers: [],
callees: [],
incoming_references: [],
outgoing_references: [],
referenced_strings: [],
referenced_names: [],
basic_blocks: [],
limitations: [],
};
};

View File

@ -3,7 +3,8 @@ import { join } from "node:path";
import { createEvidence } from "../dist/domain/evidence.js";
import { buildManagedPeFixture } from "./fixtures/managed/pe.mjs";
import { functionDossier, json, run } from "./lib/verify-package-core.mjs";
import { functionDossier } from "./fixtures/function-dossier.mjs";
import { json, run } from "./lib/verify-package-core.mjs";
const buildManagedFixtures = async (workspace) => {
const managedPath = join(workspace, "managed-fixture.exe");

View File

@ -50,37 +50,3 @@ export const comparisonLimits = {
export const defaultIlBody = Buffer.from([
0x32, 0x02, 0x7b, 0x01, 0x00, 0x00, 0x04, 0x28, 0x01, 0x00, 0x00, 0x0a, 0x2a,
]);
export function functionDossier(name) {
return {
procedure: {
address: "0x401000",
name,
classification: {
external: false,
thunk: false,
thunk_target: null,
provenance: "synthetic-provider",
},
body: {
available: false,
reason: "Synthetic provider does not supply function body ranges.",
},
signature: null,
locals: [],
},
pseudocode: "",
assembly: [],
comments: [],
callers: [],
callees: [],
incoming_references: [],
outgoing_references: [],
referenced_strings: [],
referenced_names: [],
basic_blocks: [],
native_api: null,
native_value_flow: null,
limitations: [],
};
}

View File

@ -13,6 +13,7 @@ import { projectManagedApplicationGraphEvidence } from "../../../dist/applicatio
import { traceApplicationFeatureEvidence } from "../../../dist/application/javascript/JavaScriptApplicationWorkflowService.js";
import { MANAGED_STATIC_PROVIDER } from "../../../dist/application/InvestigationProviders.js";
import { createEvidence } from "../../../dist/domain/evidence.js";
import { functionDossier } from "../../fixtures/function-dossier.mjs";
import {
alternateMvid,
buildNativePeFixture,
@ -21,7 +22,6 @@ import { createManagedConformanceSupport } from "./support.mjs";
import {
comparisonLimits,
defaultIlBody,
functionDossier,
inspectionLimits,
memberLimits,
nativeBoundaryLimits,

View File

@ -87,6 +87,11 @@ const enhancedFixtureResult = (method) => {
procedure: {
address: "0x1000",
name: "fixture",
classification: null,
body: {
available: false,
reason: "The fixture has no function body-extent observation.",
},
signature: null,
locals: [],
},
@ -100,6 +105,9 @@ const enhancedFixtureResult = (method) => {
referenced_strings: [],
referenced_names: [],
basic_blocks: [{ start: "0x1000", end: "0x1001", successors: [] }],
native_api: null,
native_value_flow: null,
limitations: [],
};
}
case "search_strings":