mirror of
https://github.com/morluto/rea
synced 2026-10-25 22:08:11 -04:00
refactor: prune obsolete provider and verification code
Remove unused imports, private inferred types, superseded limit constants and a duplicate MCP assertion. Preserve intentional field omissions while deleting unused local bindings. Validation: typecheck, lint, formatting, unused-code and architecture checks pass. Runtime behavior is unchanged.
This commit is contained in:
@@ -13,8 +13,6 @@ import { promisify } from "node:util";
|
||||
import Ajv from "ajv/dist/2020.js";
|
||||
import addFormats from "ajv-formats";
|
||||
|
||||
import { analysisErrorProjectionSchema } from "../../dist/contracts/errorSchemas.js";
|
||||
|
||||
import { verifyLegacyGhidraReferenceSnapshot } from "./ghidra-reference-snapshot-e2e.mjs";
|
||||
import { verifyGhidraSnapshotLifecycle } from "./real-ghidra-snapshot-lifecycle.mjs";
|
||||
import { verifyGhidraTargetAdmission } from "./real-ghidra-target-admission.mjs";
|
||||
|
||||
@@ -158,7 +158,7 @@ try {
|
||||
observations: {
|
||||
...x.observations,
|
||||
source_files: x.observations.source_files.map(
|
||||
({ name, ...file }) => file,
|
||||
({ name: _name, ...file }) => file,
|
||||
),
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { execFile } from "node:child_process";
|
||||
import { createHash } from "node:crypto";
|
||||
import { mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
|
||||
import { mkdtemp, rm, writeFile } from "node:fs/promises";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
import { promisify } from "node:util";
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { readFile, readdir } from "node:fs/promises";
|
||||
import { join, relative, sep } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
@@ -100,7 +100,9 @@ const verifyRegions = (evidence) => {
|
||||
);
|
||||
assert.equal(gzip.reported_size, oracle.length);
|
||||
assert.equal(gzip.size_basis, "provider_reported_validation_unknown");
|
||||
return result.regions.map(({ provider_id, ...region }) => region);
|
||||
return result.regions.map(
|
||||
({ provider_id: _provider_id, ...region }) => region,
|
||||
);
|
||||
};
|
||||
const verifyFiles = async (evidence) => {
|
||||
const result = firmwareResultSchemas.extract_firmware.parse(
|
||||
|
||||
@@ -80,8 +80,6 @@ export const ADB_PROVIDER_IDENTITY = {
|
||||
version: null,
|
||||
} as const;
|
||||
|
||||
const VERSION_TIMEOUT_MS = 10_000;
|
||||
const VERSION_MAX_OUTPUT_BYTES = 64 * 1024;
|
||||
const DEVICES_TIMEOUT_MS = 20_000;
|
||||
const DEVICES_MAX_OUTPUT_BYTES = 1024 * 1024;
|
||||
const SHELL_TIMEOUT_MS = 30_000;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createHash, randomUUID } from "node:crypto";
|
||||
import { createWriteStream, constants as fsConstants } from "node:fs";
|
||||
import { createWriteStream } from "node:fs";
|
||||
import {
|
||||
access,
|
||||
chmod,
|
||||
|
||||
@@ -3,12 +3,11 @@ import type {
|
||||
AnalysisOperation,
|
||||
AnalysisOperationPort,
|
||||
} from "./AnalysisProvider.js";
|
||||
import { AnalysisOutputError } from "../domain/analysisErrorCore.js";
|
||||
import type { AnalysisError } from "../domain/analysisErrorBase.js";
|
||||
import type { JsonValue } from "../domain/jsonValue.js";
|
||||
import { analysisBookmarkSchema } from "../domain/hopperValues.js";
|
||||
import { resolveAnalysisDocument } from "./AnalysisDocument.js";
|
||||
import { err, ok, type Result } from "../domain/result.js";
|
||||
import { ok, type Result } from "../domain/result.js";
|
||||
|
||||
type Facet =
|
||||
| { readonly state: "available"; readonly value: JsonValue }
|
||||
|
||||
@@ -234,7 +234,7 @@ const readFatSlices = async (
|
||||
): Promise<MachoSlice[]> => {
|
||||
const slices: MachoSlice[] = [];
|
||||
for (const declaration of declarations) {
|
||||
const { index, offset, size: length, cpuType, cpuSubtype } = declaration;
|
||||
const { offset, size: length, cpuType, cpuSubtype } = declaration;
|
||||
const rangeIssue = validateFatSlice(declaration, size, tableEnd);
|
||||
if (rangeIssue !== null)
|
||||
throw new MachoFormatIssue(
|
||||
|
||||
@@ -5,7 +5,6 @@ import {
|
||||
AnalysisAccessDeniedError,
|
||||
AnalysisArtifactChangedError,
|
||||
AnalysisCancelledError,
|
||||
AnalysisCapabilityUnavailableError,
|
||||
AnalysisInputError,
|
||||
AnalysisOutputError,
|
||||
AnalysisResourceConstraintError,
|
||||
|
||||
@@ -2,8 +2,6 @@ import { z } from "zod";
|
||||
import { localPathStringSchema } from "../localPath.js";
|
||||
import { digestSchema } from "../digests.js";
|
||||
|
||||
/** Upper bound for one decoded resource projection in one response. */
|
||||
const MAX_MANIFEST_BYTES = 512 * 1024;
|
||||
const MAX_STRINGS = 2_000;
|
||||
|
||||
/**
|
||||
|
||||
@@ -30,8 +30,6 @@ export const interfaceBuilderAnalysisSchema = z.strictObject({
|
||||
limitations: z.array(z.string()),
|
||||
});
|
||||
|
||||
type InterfaceBuilderAnalysis = z.infer<typeof interfaceBuilderAnalysisSchema>;
|
||||
|
||||
export interface InterfaceBuilderDocumentInput {
|
||||
readonly relativePath: string;
|
||||
readonly archiveSha256: string;
|
||||
|
||||
@@ -38,10 +38,6 @@ export const nativeInvestigationNodeKindSchema = z.enum([
|
||||
"unknown",
|
||||
]);
|
||||
|
||||
type NativeInvestigationNodeKind = z.infer<
|
||||
typeof nativeInvestigationNodeKindSchema
|
||||
>;
|
||||
|
||||
/** One UI, dispatch, or value entity with optional decoded source location. */
|
||||
export const nativeInvestigationNodeSchema = z.strictObject({
|
||||
id: z.string().min(1),
|
||||
@@ -51,7 +47,6 @@ export const nativeInvestigationNodeSchema = z.strictObject({
|
||||
attributes: z.record(z.string(), jsonValueSchema),
|
||||
evidence: z.array(nativeMetadataEvidenceSchema),
|
||||
});
|
||||
type NativeInvestigationNode = z.infer<typeof nativeInvestigationNodeSchema>;
|
||||
|
||||
/** Relationship types preserve UI wiring, native dispatch, and value flow. */
|
||||
export const nativeInvestigationRelationSchema = z.enum([
|
||||
@@ -72,10 +67,6 @@ export const nativeInvestigationRelationSchema = z.enum([
|
||||
"controls",
|
||||
]);
|
||||
|
||||
type NativeInvestigationRelation = z.infer<
|
||||
typeof nativeInvestigationRelationSchema
|
||||
>;
|
||||
|
||||
/** An observed, inferred, or unresolved relationship between entities. */
|
||||
export const nativeInvestigationEdgeSchema = z.discriminatedUnion(
|
||||
"resolution",
|
||||
|
||||
@@ -3,7 +3,6 @@ import {
|
||||
browserAllowedOriginsSchema,
|
||||
browserEndpointSchema,
|
||||
} from "./browserObservation.js";
|
||||
import { browserVersionSchema } from "./browserObservationSchemas.js";
|
||||
import { jsonObjectSchema } from "./jsonValue.js";
|
||||
|
||||
// CDP positions are zero-based and relative to the resource named by url.
|
||||
|
||||
@@ -28,7 +28,6 @@ import {
|
||||
ghidraReleaseCompatibility,
|
||||
ghidraReleaseLine,
|
||||
ghidraVersionDetail,
|
||||
SUPPORTED_GHIDRA_JAVA_MAJOR,
|
||||
SUPPORTED_GHIDRA_VERSION,
|
||||
type GhidraApplicationProperties,
|
||||
type GhidraJavaRequirement,
|
||||
|
||||
@@ -46,7 +46,6 @@ import {
|
||||
CAPABILITIES,
|
||||
windowsP0Capabilities,
|
||||
GHIDRA_PROVIDER_IDENTITY,
|
||||
GHIDRA_OPERATIONS,
|
||||
} from "./GhidraProviderCapabilities.js";
|
||||
import {
|
||||
createGhidraProviderClient,
|
||||
|
||||
@@ -36,7 +36,6 @@ import {
|
||||
AnalysisResourceConstraintError,
|
||||
AnalysisTimeoutError,
|
||||
} from "../domain/analysisErrorCore.js";
|
||||
import { projectAnalysisError } from "../domain/analysisErrorProjection.js";
|
||||
import { BinaryTargetError } from "../domain/configurationErrors.js";
|
||||
import { ProviderAdapterError } from "../domain/providerAdapterError.js";
|
||||
import { ProviderCleanupError } from "../domain/providerCleanupError.js";
|
||||
|
||||
@@ -27,7 +27,6 @@ import { ProviderAdapterError } from "../../domain/providerAdapterError.js";
|
||||
import { ProviderCleanupError } from "../../domain/providerCleanupError.js";
|
||||
import { err, ok, type Result } from "../../domain/result.js";
|
||||
import { runOwnedCommand } from "../../process/OwnedCommand.js";
|
||||
import { OwnedCommandFailure } from "../../process/OwnedCommand.js";
|
||||
import {
|
||||
pwntoolsResourceLimitsSchema,
|
||||
readPwntoolsFailureEvidence,
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import type { EvidenceMcpServer } from "./EvidenceMcpServer.js";
|
||||
import type { FirmwareAnalysisService } from "../application/firmware/FirmwareAnalysisService.js";
|
||||
import { toolContract } from "../contracts/toolContracts.js";
|
||||
import type { FirmwareOperation } from "../domain/firmware/firmwareAnalysis.js";
|
||||
import type { Logger } from "pino";
|
||||
import type { EvidenceWriter } from "../application/investigation/InvestigationRecordPort.js";
|
||||
import type { WithAdmittedAnalysis } from "./analysisAdmission.js";
|
||||
|
||||
@@ -40,10 +40,6 @@ describe("reconstruction obligation ledger MCP parity", () => {
|
||||
summary: { total: 0 },
|
||||
},
|
||||
});
|
||||
expect(result.structuredContent).toHaveProperty(
|
||||
"normalized_result.schema",
|
||||
"ReconstructionObligationLedger",
|
||||
);
|
||||
} finally {
|
||||
await client.close();
|
||||
await server.close();
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { randomUUID } from "node:crypto";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
import { expect, it } from "vitest";
|
||||
|
||||
@@ -525,7 +525,7 @@ it("rejects bytes changed after target admission without launching an engine", a
|
||||
});
|
||||
|
||||
it("retains an uncertain workspace and blocks later launches after cleanup cannot be verified", async () => {
|
||||
const { service, apk, launches, provider } = await setup("cleanup-failure");
|
||||
const { service, apk, launches } = await setup("cleanup-failure");
|
||||
const outcome = await service.execute("inspect_android_package", {
|
||||
path: apk,
|
||||
});
|
||||
|
||||
@@ -1,12 +1,5 @@
|
||||
import { execFile } from "node:child_process";
|
||||
import {
|
||||
access,
|
||||
mkdir,
|
||||
readFile,
|
||||
readdir,
|
||||
rm,
|
||||
writeFile,
|
||||
} from "node:fs/promises";
|
||||
import { access, mkdir, readFile, readdir, writeFile } from "node:fs/promises";
|
||||
import { join, resolve } from "node:path";
|
||||
import { promisify } from "node:util";
|
||||
import { pathToFileURL } from "node:url";
|
||||
|
||||
Reference in New Issue
Block a user