refactor: return complete analysis results inline
This commit is contained in:
@@ -193,7 +193,6 @@ export class HopperApplicationLauncher implements BridgeLauncher {
|
||||
lease?.release(),
|
||||
);
|
||||
const ownership = {
|
||||
schema_version: 1,
|
||||
run_id: session.runId,
|
||||
pid: started.ownership.leaderPid,
|
||||
process_group_id: started.ownership.leaderPid,
|
||||
|
||||
@@ -25,7 +25,7 @@ describe("Hopper provider capabilities", () => {
|
||||
}
|
||||
expect(
|
||||
capabilities.find(({ operation }) => operation === "list_procedures"),
|
||||
).toMatchObject({ pagination: "none" });
|
||||
).toMatchObject({ available: true });
|
||||
expect(
|
||||
capabilities.find(({ operation }) => operation === "set_comment"),
|
||||
).toMatchObject({
|
||||
@@ -36,7 +36,6 @@ describe("Hopper provider capabilities", () => {
|
||||
Reflect.set(capabilities, 0, { ...first, available: false });
|
||||
Reflect.set(first, "available", false);
|
||||
Reflect.set(first.effects, "mutatesArtifact", true);
|
||||
Reflect.set(first.limits, "maxResults", 0);
|
||||
Reflect.set(first.limitations, 0, "forged limitation");
|
||||
|
||||
expect(provider.capabilities()).toEqual(published);
|
||||
|
||||
@@ -60,12 +60,6 @@ const CAPABILITIES: readonly CapabilityDescriptor[] = Object.freeze(
|
||||
operation,
|
||||
available: true,
|
||||
reason: null,
|
||||
pagination:
|
||||
isRecord(contract.inputSchema.properties) &&
|
||||
"offset" in contract.inputSchema.properties
|
||||
? "offset"
|
||||
: "none",
|
||||
exhaustive: false,
|
||||
effects: Object.freeze({
|
||||
mutatesArtifact: MUTATING_OPERATIONS.has(contract.name),
|
||||
launchesProcess: true,
|
||||
@@ -75,11 +69,6 @@ const CAPABILITIES: readonly CapabilityDescriptor[] = Object.freeze(
|
||||
changesPermissions: false,
|
||||
requiresRoot: false,
|
||||
}),
|
||||
limits: Object.freeze({
|
||||
maxResults: null,
|
||||
maxPayloadBytes: contract.name === "read_bytes" ? 4_096 : null,
|
||||
timeoutMs: null,
|
||||
}),
|
||||
limitations: Object.freeze([
|
||||
"Results depend on Hopper's completed static analysis.",
|
||||
]),
|
||||
@@ -87,10 +76,6 @@ const CAPABILITIES: readonly CapabilityDescriptor[] = Object.freeze(
|
||||
}),
|
||||
);
|
||||
|
||||
function isRecord(value: unknown): value is Readonly<Record<string, unknown>> {
|
||||
return typeof value === "object" && value !== null && !Array.isArray(value);
|
||||
}
|
||||
|
||||
/** Concrete analysis provider backed by REA's private Hopper bridge. */
|
||||
export class HopperProvider implements AnalysisProviderCandidate {
|
||||
constructor(
|
||||
|
||||
@@ -45,24 +45,18 @@ describe("Hopper provider discovery", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("advertises the exact bounded byte-read limit", () => {
|
||||
it("advertises byte reads as an available operation", () => {
|
||||
const capabilities = provider(process.execPath).capabilities();
|
||||
expect(
|
||||
capabilities.find(({ operation }) => operation === "read_bytes"),
|
||||
).toMatchObject({
|
||||
available: true,
|
||||
pagination: "none",
|
||||
limits: {
|
||||
maxResults: null,
|
||||
maxPayloadBytes: 4_096,
|
||||
timeoutMs: null,
|
||||
},
|
||||
});
|
||||
expect(
|
||||
capabilities.find(
|
||||
({ operation }) => operation === "address_to_file_offset",
|
||||
),
|
||||
).toMatchObject({ available: true, pagination: "none" });
|
||||
).toMatchObject({ available: true });
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ import {
|
||||
export const LINUX_PRIVATE_DISPLAY_DIAGNOSTIC_PREFIX = "REA_X11_DIAGNOSTIC_V1=";
|
||||
|
||||
const diagnosticContextSchema = z.object({
|
||||
schema_version: z.literal(1),
|
||||
component: z.literal("hopper_private_display"),
|
||||
operation: z.enum(["probe", "launch"]),
|
||||
reason: z
|
||||
|
||||
@@ -267,7 +267,6 @@ const syntheticDiagnostic = (
|
||||
reason: string,
|
||||
failureCode: HopperStartupFailureCode = "private_display_unavailable",
|
||||
): HopperStartupFailureDiagnostic => ({
|
||||
schema_version: 1,
|
||||
component: "hopper_private_display",
|
||||
operation: "probe",
|
||||
status: "error",
|
||||
|
||||
Reference in New Issue
Block a user