Disallow and suppress unsafe assignment (#19736)

This commit is contained in:
Christian Gunderman
2026-02-20 22:28:55 +00:00
committed by GitHub
parent 3e786a161e
commit 981e9a978e
71 changed files with 149 additions and 22 deletions
@@ -716,6 +716,7 @@ export class ClearcutLogger {
event.function_name === ASK_USER_TOOL_NAME &&
event.metadata['ask_user']
) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const askUser = event.metadata['ask_user'];
const askUserMapping: { [key: string]: EventMetadataKey } = {
question_types: EventMetadataKey.GEMINI_CLI_ASK_USER_QUESTION_TYPES,
@@ -36,11 +36,13 @@ describe('Circular Reference Integration Test', () => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const socketLike: any = {
_httpMessage: {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
agent: proxyAgentLike,
socket: null,
},
};
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
socketLike._httpMessage.socket = socketLike; // Create circular reference
proxyAgentLike.sockets['cloudcode-pa.googleapis.com:443'] = [socketLike];
@@ -49,6 +51,7 @@ describe('Circular Reference Integration Test', () => {
error: new Error('Network error'),
function_args: {
filePath: '/test/file.txt',
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
httpAgent: proxyAgentLike, // This would cause the circular reference
},
};
@@ -39,8 +39,10 @@ describe('Circular Reference Handling', () => {
sockets: {},
agent: null,
};
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
circularObject.agent = circularObject; // Create circular reference
circularObject.sockets['test-host'] = [
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
{ _httpMessage: { agent: circularObject } },
];
@@ -48,6 +50,7 @@ describe('Circular Reference Handling', () => {
const mockRequest: ToolCallRequestInfo = {
callId: 'test-call-id',
name: 'ReadFile',
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
args: circularObject, // This would cause the original error
isClientInitiated: false,
prompt_id: 'test-prompt-id',
+2
View File
@@ -145,12 +145,14 @@ export function logToolCall(config: Config, event: ToolCallEvent): void {
});
if (event.metadata) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const added = event.metadata['model_added_lines'];
if (typeof added === 'number' && added > 0) {
recordLinesChanged(config, added, 'added', {
function_name: event.function_name,
});
}
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const removed = event.metadata['model_removed_lines'];
if (typeof removed === 'number' && removed > 0) {
recordLinesChanged(config, removed, 'removed', {