Skip to content

Commit 071f6fb

Browse files
author
wanglu241
committed
test(cli-runner): satisfy oxlint curly + no-promise-executor-return
Wrap single-statement if/for-of bodies in braces and rewrite the sleep helper so its Promise executor is a void block instead of an arrow with an implicit return. No behavior change; demo output and the byte-equivalent slice fingerprints are unchanged.
1 parent 83ee7fa commit 071f6fb

1 file changed

Lines changed: 21 additions & 7 deletions

File tree

scripts/demo-91946-queue.mjs

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ function buildClaudeOwnerKey(input) {
2626
}
2727

2828
function normalizeOptionalLowercaseString(v) {
29-
if (typeof v !== "string") return undefined;
29+
if (typeof v !== "string") {
30+
return undefined;
31+
}
3032
const t = v.trim();
3133
return t ? t.toLowerCase() : undefined;
3234
}
@@ -38,11 +40,17 @@ function resolveCliRunQueueKey(params) {
3840
const isClaudeCliProvider = normalizeOptionalLowercaseString(params.backendId) === "claude-cli";
3941
if (isClaudeCliProvider) {
4042
const sessionId = params.cliSessionId?.trim();
41-
if (sessionId) return `${params.backendId}:session:${sessionId}`;
43+
if (sessionId) {
44+
return `${params.backendId}:session:${sessionId}`;
45+
}
4246
const ownerKey = params.ownerKey?.trim();
43-
if (ownerKey) return `${params.backendId}:owner:${ownerKey}`;
47+
if (ownerKey) {
48+
return `${params.backendId}:owner:${ownerKey}`;
49+
}
4450
const workspaceDir = params.workspaceDir.trim();
45-
if (workspaceDir) return `${params.backendId}:workspace:${workspaceDir}`;
51+
if (workspaceDir) {
52+
return `${params.backendId}:workspace:${workspaceDir}`;
53+
}
4654
}
4755
return params.backendId;
4856
}
@@ -56,7 +64,9 @@ function enqueueKeyedTask({ tails, key, task }) {
5664
);
5765
tails.set(key, tail);
5866
const cleanup = () => {
59-
if (tails.get(key) === tail) tails.delete(key);
67+
if (tails.get(key) === tail) {
68+
tails.delete(key);
69+
}
6070
};
6171
tail.then(cleanup, cleanup);
6272
return current;
@@ -140,13 +150,17 @@ const t0 = performance.now();
140150
const stamp = () => Number((performance.now() - t0).toFixed(2));
141151
const work = (label) => async () => {
142152
events.push({ label, phase: "start", t: stamp() });
143-
await new Promise((r) => setTimeout(r, runMs));
153+
await new Promise((resolve) => {
154+
setTimeout(resolve, runMs);
155+
});
144156
events.push({ label, phase: "end", t: stamp() });
145157
};
146158

147159
console.log("=== PR #91974 live queue concurrency demo ===");
148160
console.log("source-slice fingerprints (sha256, first 16 hex):");
149-
for (const [k, v] of Object.entries(sliceHashes)) console.log(` ${k.padEnd(24)} ${v}`);
161+
for (const [k, v] of Object.entries(sliceHashes)) {
162+
console.log(` ${k.padEnd(24)} ${v}`);
163+
}
150164
console.log("");
151165
console.log("queue-key resolution at PR head:");
152166
console.log(` session A owner-hash ${sessionA_owner}`);

0 commit comments

Comments
 (0)