Skip to content

Commit 8a29fae

Browse files
fix(merge): restore the upstream hunks dropped by the main merge
Keep branch clipping/lock-identity logic, restore upstream's empty-file condition, offset assertion, typed safeWriteJson signature and typed test doubles.
1 parent f8ee3e8 commit 8a29fae

5 files changed

Lines changed: 4 additions & 69 deletions

File tree

‎src/core/tools/ReadFileTool.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ export class ReadFileTool extends BaseTool<"read_file"> {
364364
// full-file replacement cannot be built from a clipped line.
365365
output = `IMPORTANT: Some lines exceed ${MAX_LINE_LENGTH} characters and were clipped in this view. The file was read in full, but the clipped lines were not shown in full.
366366
${result.content}`
367-
} else if (result.returnedLines === 0) {
367+
} else if (result.returnedLines === 0 && result.totalLines === 0) {
368368
output = "Note: File is empty"
369369
}
370370

‎src/eslint-suppressions.json‎

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1619,71 +1619,6 @@
16191619
"count": 2
16201620
}
16211621
},
1622-
"utils/__tests__/autoImportSettings.spec.ts": {
1623-
"@typescript-eslint/no-explicit-any": {
1624-
"count": 15
1625-
}
1626-
},
1627-
"utils/__tests__/enhance-prompt.spec.ts": {
1628-
"@typescript-eslint/no-explicit-any": {
1629-
"count": 6
1630-
}
1631-
},
1632-
"utils/__tests__/git.spec.ts": {
1633-
"@typescript-eslint/no-explicit-any": {
1634-
"count": 95
1635-
}
1636-
},
1637-
"utils/__tests__/json-schema.spec.ts": {
1638-
"@typescript-eslint/no-explicit-any": {
1639-
"count": 3
1640-
}
1641-
},
1642-
"utils/__tests__/migrateSettings.spec.ts": {
1643-
"@typescript-eslint/no-explicit-any": {
1644-
"count": 4
1645-
}
1646-
},
1647-
"utils/__tests__/outputChannelLogger.spec.ts": {
1648-
"@typescript-eslint/no-explicit-any": {
1649-
"count": 1
1650-
}
1651-
},
1652-
"utils/__tests__/safeWriteJson.test.ts": {
1653-
"@typescript-eslint/no-explicit-any": {
1654-
"count": 27
1655-
}
1656-
},
1657-
"utils/__tests__/shell.spec.ts": {
1658-
"@typescript-eslint/no-explicit-any": {
1659-
"count": 35
1660-
}
1661-
},
1662-
"utils/__tests__/storage.spec.ts": {
1663-
"@typescript-eslint/no-explicit-any": {
1664-
"count": 25
1665-
}
1666-
},
1667-
"utils/__tests__/tiktoken.spec.ts": {
1668-
"@typescript-eslint/no-explicit-any": {
1669-
"count": 2
1670-
}
1671-
},
1672-
"utils/config.ts": {
1673-
"@typescript-eslint/no-explicit-any": {
1674-
"count": 2
1675-
}
1676-
},
1677-
"utils/export.ts": {
1678-
"@typescript-eslint/no-explicit-any": {
1679-
"count": 2
1680-
}
1681-
},
1682-
"utils/safeWriteJson.ts": {
1683-
"@typescript-eslint/no-explicit-any": {
1684-
"count": 3
1685-
}
1686-
},
16871622
"vitest.setup.ts": {
16881623
"@typescript-eslint/no-explicit-any": {
16891624
"count": 1

‎src/integrations/misc/__tests__/indentation-reader.spec.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ describe("readWithSlice", () => {
315315
const result = readWithSlice(SIMPLE_CODE, 1000, 10)
316316

317317
expect(result.returnedLines).toBe(0)
318-
expect(result.content).toContain("Error")
318+
expect(result.content).toContain("Error: offset 1001 is beyond file end")
319319
// No line was returned, so nothing could have been clipped.
320320
expect(result.hasClippedLines).toBe(false)
321321
})

‎src/utils/__tests__/safeWriteJson.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ describe("safeWriteJson", () => {
316316
await fsPromisesActuals.writeFile!(currentTestFilePath, JSON.stringify(initialData))
317317

318318
// fs.unlink is already vi.fn() — use vi.mocked to avoid double-wrapping via vi.spyOn
319-
vi.mocked(fs.unlink).mockImplementation(async (filePath: any) => {
319+
vi.mocked(fs.unlink).mockImplementation(async (filePath) => {
320320
if (filePath.toString().includes("safeWriteText.bak_")) {
321321
throw new Error("Backup deletion failed")
322322
}

‎src/utils/safeWriteJson.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ async function _lockIdentityKey(absoluteFilePath: string): Promise<string> {
218218
current = path.dirname(current)
219219
}
220220
}
221-
async function safeWriteJson(filePath: string, data: any, options?: SafeWriteJsonOptions): Promise<void> {
221+
async function safeWriteJson(filePath: string, data: unknown, options?: SafeWriteJsonOptions): Promise<void> {
222222
const absoluteFilePath = path.resolve(filePath)
223223
// One release per lock acquired, kept in acquisition order and released in reverse below.
224224
let releaseLocks: Array<() => Promise<void>> = []

0 commit comments

Comments
 (0)