From ca9010936a934a49fbc6cf69eb1d7fc2242b6da9 Mon Sep 17 00:00:00 2001 From: morluto <76467478+morluto@users.noreply.github.com> Date: Sat, 10 Oct 2026 04:02:40 +0800 Subject: [PATCH] test(package): share validated native dossier fixtures --- scripts/fixtures/function-dossier.mjs | 35 ++++++++++++++++++++++++++ scripts/lib/verify-package-core.mjs | 29 --------------------- scripts/verify-package-managed.mjs | 3 ++- scripts/verify/managed/config.mjs | 34 ------------------------- scripts/verify/managed/conformance.mjs | 2 +- tests/fixtures/fakeHopper.mjs | 8 ++++++ 6 files changed, 46 insertions(+), 65 deletions(-) create mode 100644 scripts/fixtures/function-dossier.mjs diff --git a/scripts/fixtures/function-dossier.mjs b/scripts/fixtures/function-dossier.mjs new file mode 100644 index 000000000..c1b0cd0f5 --- /dev/null +++ b/scripts/fixtures/function-dossier.mjs @@ -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: [], + }); diff --git a/scripts/lib/verify-package-core.mjs b/scripts/lib/verify-package-core.mjs index 417cc14a1..5371edffc 100644 --- a/scripts/lib/verify-package-core.mjs +++ b/scripts/lib/verify-package-core.mjs @@ -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: [], - }; -}; diff --git a/scripts/verify-package-managed.mjs b/scripts/verify-package-managed.mjs index 16ef56993..4f6c9f3f2 100644 --- a/scripts/verify-package-managed.mjs +++ b/scripts/verify-package-managed.mjs @@ -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"); diff --git a/scripts/verify/managed/config.mjs b/scripts/verify/managed/config.mjs index f22b15d18..8c9906e32 100644 --- a/scripts/verify/managed/config.mjs +++ b/scripts/verify/managed/config.mjs @@ -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: [], - }; -} diff --git a/scripts/verify/managed/conformance.mjs b/scripts/verify/managed/conformance.mjs index 4a0ed5c3b..68d2b090a 100644 --- a/scripts/verify/managed/conformance.mjs +++ b/scripts/verify/managed/conformance.mjs @@ -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, diff --git a/tests/fixtures/fakeHopper.mjs b/tests/fixtures/fakeHopper.mjs index a65073b35..392f609c8 100644 --- a/tests/fixtures/fakeHopper.mjs +++ b/tests/fixtures/fakeHopper.mjs @@ -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":