Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ export class ClearcutLogger {
data.push(
{
gemini_cli_key: EventMetadataKey.GEMINI_CLI_CPU_INFO,
value: cpus[0].model,
value: cpus[0]?.model,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

While using optional chaining (?.) correctly prevents a crash when os.cpus() returns an empty array, the expression cpus[0]?.model can evaluate to undefined. The value property of the EventValue interface is typed as string, so assigning undefined to it can lead to type errors or unexpected behavior downstream. It's safer to provide a fallback value to ensure type safety, similar to other properties in this file.

Suggested change
value: cpus[0]?.model,
value: cpus[0]?.model ?? '',

},
{
gemini_cli_key: EventMetadataKey.GEMINI_CLI_CPU_CORES,
Expand Down