chore: consolidate model utils and drive-by cleanups (#476)

Signed-off-by: Thibault Sottiaux <tibo@openai.com>
This commit is contained in:
Thibault Sottiaux
2025-04-21 12:33:57 -04:00
committed by GitHub
parent dc276999a9
commit 3c4f1fea9b
21 changed files with 196 additions and 205 deletions

View File

@@ -50,7 +50,7 @@ vi.mock("openai", () => {
// The AgentLoop pulls these helpers in order to decide whether a command can
// be autoapproved. None of that matters for this test, so we stub the module
// with minimal noop implementations.
// with minimal no-op implementations.
vi.mock("../src/approvals.js", () => {
return {
__esModule: true,

View File

@@ -79,7 +79,7 @@ describe("canAutoApprove()", () => {
test("true command is considered safe", () => {
expect(check(["true"])).toEqual({
type: "auto-approve",
reason: "Noop (true)",
reason: "No-op (true)",
group: "Utility",
runInSandbox: false,
});

View File

@@ -26,7 +26,7 @@ vi.mock("fs", async () => {
memfs[path] = data;
},
mkdirSync: () => {
// noop in inmemory store
// no-op in inmemory store
},
rmSync: (path: string) => {
// recursively delete any key under this prefix

View File

@@ -44,7 +44,7 @@ describe("model-utils offline resilience", () => {
"../src/utils/model-utils.js"
);
const supported = await isModelSupportedForResponses("o4-mini");
const supported = await isModelSupportedForResponses("openai", "o4-mini");
expect(supported).toBe(true);
});
@@ -63,8 +63,11 @@ describe("model-utils offline resilience", () => {
"../src/utils/model-utils.js"
);
// Should resolve true despite the network failure
const supported = await isModelSupportedForResponses("some-model");
// Should resolve true despite the network failure.
const supported = await isModelSupportedForResponses(
"openai",
"some-model",
);
expect(supported).toBe(true);
});
});

View File

@@ -57,7 +57,7 @@ async function type(
await flush();
}
/** Build a set of noop callbacks so <TerminalChatInput> renders with minimal
/** Build a set of no-op callbacks so <TerminalChatInput> renders with minimal
* scaffolding.
*/
function stubProps(): any {

View File

@@ -127,7 +127,7 @@ describe("TextBuffer basic editing parity with Rust suite", () => {
expect(buf.getCursor()).toEqual([0, 2]); // after 'b'
});
it("is a noop at the very beginning of the buffer", () => {
it("is a no-op at the very beginning of the buffer", () => {
const buf = new TextBuffer("ab");
buf.backspace(); // caret starts at (0,0)

View File

@@ -26,7 +26,7 @@ vi.mock("../src/components/select-input/select-input.js", () => {
// Ink's <TextInput> toggles rawmode which calls .ref() / .unref() on stdin.
// The test environment's mock streams don't implement those methods, so we
// polyfill them to noops on the prototype *before* the component tree mounts.
// polyfill them to no-ops on the prototype *before* the component tree mounts.
import { EventEmitter } from "node:events";
if (!(EventEmitter.prototype as any).ref) {
(EventEmitter.prototype as any).ref = () => {};