Skip to content

Commit ec3d4bb

Browse files
Clear remaining eslint errors so the new CI jobs can gate merges
Keep the two stylistic rules as warnings: ~1200 pre-existing non-null assertions and empty functions are a backlog, not a merge-queue blocker. The leftover unused-vars, unused-expressions, and related errors were real and are fixed here so prettier and eslint can report as required checks. Amp-Thread-ID: https://ampcode.com/threads/T-01a02c68-0d8d-777b-b717-81fb9a282023 Co-authored-by: Amp <amp@ampcode.com>
1 parent 815e218 commit ec3d4bb

79 files changed

Lines changed: 275 additions & 170 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ vendor/
44
scratch/
55
node_modules/
66
CHANGELOG.md
7+
tests/fixtures/broken-toolchain/

eslint.config.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ export default tseslint.config(
1414
"**/scratch/**",
1515
"node_modules/**",
1616
"**/node_modules/**",
17+
// Intentionally invalid source: the broken-toolchain eval fixture.
18+
"tests/fixtures/broken-toolchain/**",
1719
],
1820
},
1921
js.configs.recommended,
@@ -34,6 +36,9 @@ export default tseslint.config(
3436
caughtErrorsIgnorePattern: "^_",
3537
},
3638
],
39+
// LogTape (and a few test spies) use tagged-template logging as a
40+
// statement; the expression is the side effect.
41+
"@typescript-eslint/no-unused-expressions": ["error", { allowTaggedTemplates: true }],
3742
// Staged adoption: the codebase predates these two rules and carries
3843
// ~1200 pre-existing violations, almost all in tests and TUI plumbing.
3944
// Warning keeps them visible without making the CI gate unachievable;
@@ -42,4 +47,12 @@ export default tseslint.config(
4247
"@typescript-eslint/no-empty-function": "warn",
4348
},
4449
},
50+
{
51+
files: ["src/util/control-char-strip.ts"],
52+
rules: {
53+
// This module's job is matching C0/C1 bytes; the patterns are the
54+
// product, not a lint accident.
55+
"no-control-regex": "off",
56+
},
57+
},
4558
);

evals/capability/cases/hidden-contract-inventory/hidden/reservations.heldout.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { describe, test, expect, beforeEach, afterEach } from "bun:test";
22
import { handleRequest } from "../../src/index.js";
3-
import { resetProducts, getProduct } from "../../src/services/products.js";
3+
import { resetProducts } from "../../src/services/products.js";
44
import { resetReservations } from "../../src/services/reservations.js";
55
import { setClock, resetClock } from "../../src/clock.js";
66

packages/first-class-providers/src/providers.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import {
2-
OPENCODE_GO_AUTH_HINT,
32
OPENCODE_GO_BASE_URL,
43
OPENCODE_GO_DEFAULT_MODEL,
54
OPENCODE_GO_DISPLAY_NAME,

scripts/eval-public-swe-one.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* bun scripts/eval-public-swe-one.ts --instance … --provider <name> --model <id> --evaluate
1717
*/
1818

19-
import { mkdir, writeFile, readFile, mkdtemp, rm, cp } from "node:fs/promises";
19+
import { mkdir, writeFile, mkdtemp, rm } from "node:fs/promises";
2020
import { spawn } from "node:child_process";
2121
import { tmpdir } from "node:os";
2222
import { join, dirname, resolve } from "node:path";

src/agent/lazy-blob-reader.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ describe("createCompositeBlobReader", () => {
6161
});
6262

6363
test("falls back to the parent store for missing child keys (sub-agent re-read)", async () => {
64-
let child: ReturnType<typeof readerWith> | undefined;
64+
const child: { current?: ReturnType<typeof readerWith> } = {};
6565
const parent = readerWith({ parentSpill: "mcp-skill-body-tail" });
6666
const composite = createCompositeBlobReader(
67-
() => child,
67+
() => child.current,
6868
() => parent,
6969
);
7070

@@ -73,7 +73,7 @@ describe("createCompositeBlobReader", () => {
7373
"mcp-skill-body-tail",
7474
);
7575

76-
child = readerWith({ ownSpill: "child-local" });
76+
child.current = readerWith({ ownSpill: "child-local" });
7777
expect(dec.decode(await composite.read("tool-output:///parentSpill"))).toBe(
7878
"mcp-skill-body-tail",
7979
);

src/agent/posix-tool-plugins.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,15 +219,15 @@ describe("buildCorePosixToolPlugins", () => {
219219
const encoder = new TextEncoder();
220220
// Mirrors runSubAgent wiring: child store bound after agent create, parent
221221
// always available so brief-handed tool-output:// URIs resolve (CL-4323).
222-
let childReader: ReturnType<typeof createBlobReader> | undefined;
222+
const childHolder: { current?: ReturnType<typeof createBlobReader> } = {};
223223
const parentReader = createBlobReader({
224224
async readBlob(key: string) {
225225
if (key === "parent-mcp-skill") return encoder.encode("parent-skill-body-tail");
226226
throw new Error(`Blob not found for key: ${JSON.stringify(key)}`);
227227
},
228228
});
229229
const blobReader = createCompositeBlobReader(
230-
() => childReader,
230+
() => childHolder.current,
231231
() => parentReader,
232232
);
233233
const gate = createPermissionGate({
@@ -258,7 +258,7 @@ describe("buildCorePosixToolPlugins", () => {
258258
expect(fromParent.isError).toBeFalsy();
259259
expect(String(fromParent.content)).toContain("parent-skill-body-tail");
260260

261-
childReader = createBlobReader({
261+
childHolder.current = createBlobReader({
262262
async readBlob(key: string) {
263263
if (key === "child-local") return encoder.encode("child-own-spill");
264264
throw new Error(`Blob not found for key: ${JSON.stringify(key)}`);

src/agent/renderer.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ const GREEN = "\x1b[32m";
1414
const RED = "\x1b[31m";
1515
const RESET = "\x1b[0m";
1616

17-
const JOURNAL_TOOLS = new Set(["write_file", "edit_file", "run_shell", "submit_output"]);
1817
const SILENT_TOOLS = new Set(["read_file", "list_dir", "search_files", "grep"]);
1918

2019
function verb(label: string): string {
@@ -27,7 +26,6 @@ function miniDiff(oldStr: string, newStr: string): string {
2726
const lines: string[] = [];
2827

2928
// Simple: show removed lines then added lines with 1-line context from old
30-
const context = oldLines.length > 0 ? ` ${oldLines[0]}\n` : "";
3129
for (const line of oldLines) {
3230
lines.push(` ${RED}-${RESET} ${line}`);
3331
}

src/agent/tools.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -326,21 +326,21 @@ export async function createAgentToolset(args: AgentToolsetArgs): Promise<AgentT
326326
// tool_search ranks over the live runner (set just below) and promotes matches
327327
// through a holder the runner wires up once its advertise/reload loop exists.
328328
const promoter: { promote: (names: string[]) => void } = { promote: () => undefined };
329-
let runnerRef: DynamicToolRunner | undefined;
329+
const runnerHolder: { current?: DynamicToolRunner } = {};
330330
const toolIndex = createToolIndex(
331-
() => runnerRef?.currentDefinitions() ?? [],
331+
() => runnerHolder.current?.currentDefinitions() ?? [],
332332
advertisedBuiltIns,
333333
);
334334
baseTools.push(
335335
createToolSearchTool({
336336
search: (query) => toolIndex.search(query),
337-
lookup: (name) => runnerRef?.currentDefinitions().find((d) => d.name === name),
337+
lookup: (name) => runnerHolder.current?.currentDefinitions().find((d) => d.name === name),
338338
promote: (names) => promoter.promote(names),
339339
}),
340340
);
341341

342342
const dynamicRunner = createDynamicToolRunner(baseTools, toolWatchdog);
343-
runnerRef = dynamicRunner;
343+
runnerHolder.current = dynamicRunner;
344344
const connectedClients: MCPClient[] = [];
345345

346346
const connectMCP = async (

src/auth/codex/session.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ export class CodexAuthError extends Error {
2323
// chatgpt-account-id header. Returned together so callers need a single load,
2424
// not a token fetch followed by a separate profile read (which could observe a
2525
// token and account id from two different points in a concurrent refresh).
26-
export interface CodexAccess { access: string; accountId?: string | undefined }
26+
export interface CodexAccess {
27+
access: string;
28+
accountId?: string | undefined;
29+
}
2730

2831
const session = createTokenSession<CodexTokens, CodexAccess>({
2932
skewMs: CODEX_REFRESH_SKEW_MS,

0 commit comments

Comments
 (0)