Skip to content

Commit e1e7ee5

Browse files
fix(clawsweeper): address review for automerge-openclaw-openclaw-86036 (validation-1)
1 parent e8f9ef8 commit e1e7ee5

14 files changed

Lines changed: 45 additions & 36 deletions

extensions/device-pair/notify.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ async function readNotifyState(api: OpenClawPluginApi): Promise<NotifyStateFile>
108108

109109
const subscribers = subscriberEntries
110110
.map((entry) => entry.value)
111-
.sort((a, b) => a.addedAtMs - b.addedAtMs);
111+
.toSorted((a, b) => a.addedAtMs - b.addedAtMs);
112112
const notifiedRequestIds: Record<string, number> = {};
113113
for (const entry of seenRequestEntries) {
114114
const requestId = normalizeOptionalString(entry.value.requestId);

extensions/memory-core/doctor-contract-api.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import fs from "node:fs/promises";
33
import os from "node:os";
44
import path from "node:path";
5+
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-contracts";
56
import {
67
createPluginStateKeyedStoreForTests,
78
resetPluginStateStoreForTests,
@@ -53,7 +54,7 @@ describe("memory-core doctor dreaming migration", () => {
5354
}
5455

5556
function migrationParams(
56-
config: unknown = {
57+
config: OpenClawConfig = {
5758
agents: {
5859
list: [{ id: "main", workspace: workspaceDir }],
5960
},

extensions/memory-core/doctor-contract-api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ async function fileExists(filePath: string): Promise<boolean> {
5151
}
5252
}
5353

54-
async function readJsonFile(filePath: string): Promise<unknown | null> {
54+
async function readJsonFile(filePath: string): Promise<unknown> {
5555
return JSON.parse(await fs.readFile(filePath, "utf8")) as unknown;
5656
}
5757

extensions/memory-core/src/dreaming-state.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ function openWorkspaceStore<T>(namespace: string): PluginStateKeyedStore<Workspa
8787
});
8888
}
8989

90+
// oxlint-disable-next-line typescript/no-unnecessary-type-parameters -- Workspace state reads are caller-typed by namespace.
9091
export async function readMemoryCoreWorkspaceEntries<T>(params: {
9192
namespace: string;
9293
workspaceDir: string;
@@ -99,6 +100,7 @@ export async function readMemoryCoreWorkspaceEntries<T>(params: {
99100
.map((entry) => ({ key: entry.value.key, value: entry.value.value }));
100101
}
101102

103+
// oxlint-disable-next-line typescript/no-unnecessary-type-parameters -- Workspace state writes preserve caller-specific namespace payloads.
102104
export async function writeMemoryCoreWorkspaceEntries<T>(params: {
103105
namespace: string;
104106
workspaceDir: string;
@@ -126,6 +128,7 @@ export async function writeMemoryCoreWorkspaceEntries<T>(params: {
126128
}
127129
}
128130

131+
// oxlint-disable-next-line typescript/no-unnecessary-type-parameters -- Workspace state writes preserve caller-specific namespace payloads.
129132
export async function writeMemoryCoreWorkspaceEntry<T>(params: {
130133
namespace: string;
131134
workspaceDir: string;

extensions/memory-core/src/short-term-promotion.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2499,7 +2499,6 @@ export async function auditShortTermPromotionArtifacts(params: {
24992499
const storePath = resolveStorePath(workspaceDir);
25002500
const lockPath = resolveLockPath(workspaceDir);
25012501
const issues: ShortTermAuditIssue[] = [];
2502-
let exists = false;
25032502
let entryCount = 0;
25042503
let promotedCount = 0;
25052504
let spacedEntryCount = 0;
@@ -2513,7 +2512,7 @@ export async function auditShortTermPromotionArtifacts(params: {
25132512
namespace: SHORT_TERM_RECALL_NAMESPACE,
25142513
workspaceDir,
25152514
});
2516-
exists = rawEntries.length > 0;
2515+
const exists = rawEntries.length > 0;
25172516
if (exists) {
25182517
const parsed = {
25192518
version: 1,
@@ -2788,9 +2787,7 @@ export const testing = {
27882787
writeMemoryCoreWorkspaceEntries({
27892788
namespace: SHORT_TERM_RECALL_NAMESPACE,
27902789
workspaceDir,
2791-
entries: entries
2792-
? Object.entries(entries).map(([key, value]) => ({ key, value: value as unknown }))
2793-
: [],
2790+
entries: entries ? Object.entries(entries).map(([key, value]) => ({ key, value })) : [],
27942791
}),
27952792
writeMemoryCoreWorkspaceEntry({
27962793
namespace: SHORT_TERM_META_NAMESPACE,
@@ -2812,9 +2809,7 @@ export const testing = {
28122809
writeMemoryCoreWorkspaceEntries({
28132810
namespace: SHORT_TERM_PHASE_SIGNAL_NAMESPACE,
28142811
workspaceDir,
2815-
entries: entries
2816-
? Object.entries(entries).map(([key, value]) => ({ key, value: value as unknown }))
2817-
: [],
2812+
entries: entries ? Object.entries(entries).map(([key, value]) => ({ key, value })) : [],
28182813
}),
28192814
writeMemoryCoreWorkspaceEntry({
28202815
namespace: SHORT_TERM_META_NAMESPACE,

extensions/qa-lab/src/agentic-parity-report.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ describe("qa agentic parity report", () => {
216216

217217
it("counts passing runtime parity scenarios with tool calls in both runtimes", () => {
218218
const metrics = computeQaAgenticParityMetrics({
219-
scenarios: [makeRuntimeParitySummary().scenarios[0]!],
219+
scenarios: [makeRuntimeParitySummary().scenarios[0]],
220220
});
221221

222222
expect(metrics.validToolCallCount).toBe(1);

extensions/qa-lab/src/runtime-tool-fixture.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,10 @@ function stringifyTranscriptToolResult(value: unknown): string {
115115
return String(value);
116116
}
117117
try {
118-
return JSON.stringify(value);
118+
const serialized = JSON.stringify(value);
119+
return typeof serialized === "string" ? serialized : "";
119120
} catch {
120-
return String(value);
121+
return "";
121122
}
122123
}
123124

scripts/e2e/kitchen-sink-rpc-walk.mjs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,9 +289,11 @@ export function runCommand(command, args, options = {}) {
289289
});
290290
}
291291
})
292-
.catch((error) => {
293-
lastResourceSampleError = error;
294-
})
292+
.catch(
293+
/** @param {unknown} error */ (error) => {
294+
lastResourceSampleError = error;
295+
},
296+
)
295297
.finally(() => {
296298
resourceSampleInFlight = null;
297299
});

scripts/e2e/lib/kitchen-sink-plugin/assertions.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@ function scanTextFileLines(file, onLine) {
8080
const text = buffer.subarray(0, bytesRead).toString("utf8");
8181
const lines = text.split(/\r?\n/u);
8282
for (let index = 0; index < lines.length - 1; index += 1) {
83-
if (appendLineText(lines[index], true) === false) {
83+
if (!appendLineText(lines[index], true)) {
8484
return;
8585
}
8686
}
87-
if (appendLineText(lines.at(-1) ?? "", false) === false) {
87+
if (!appendLineText(lines.at(-1) ?? "", false)) {
8888
return;
8989
}
9090
}

scripts/lib/kova-report-gate.mjs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ function numericCount(value) {
66
if (typeof value !== "number") {
77
return undefined;
88
}
9-
const count = Number(value);
10-
return Number.isFinite(count) ? count : undefined;
9+
return Number.isFinite(value) ? value : undefined;
1110
}
1211

1312
const rssMetricIds = ["peakRssMb", "resourcePeakGatewayRssMb"];

0 commit comments

Comments
 (0)