a2aproject / a2aproject/a2a-js

[Bug]: toCoreMessage defaults optional taskId to "" instead of undefined

Abierto Apto para principiantes
#678 1 comentario 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
TypeScript
Estrellas
613
Forks
169
Merge medio
1 d 6 h
PR fusionados (30 d)
21

Descripción

### What happened?

When a v0.3 message does not have a `taskId`, `toCoreMessage` in the compat layer sets it to `""` instead of leaving it as `undefined`:

```
// dist/compat/v0_3/client/index.js, line 996
taskId: compatMsg.taskId ?? "",
```

`taskId` is optional in v0.3, so not every message has one. Setting it to `""` causes problems for consumers that check whether `taskId` is present, because `""` looks like a value but is not a valid task ID. In JavaScript, an optional field that is not set should be `undefined`, not `""`.

### Relevant log output

```shell

```

### Code of Conduct

- [x] I agree to follow this project's Code of Conduct

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

The issue points to the file `dist/compat/v0_3/client/index.js` at line 996. Start by finding the source file for this compat layer, likely in `src/compat/v0_3/client/`. Look for the `toCoreMessage` function and the line setting `taskId`. Understand the v0.3 message schema to confirm `taskId` is optional. Change the default from an empty string to `undefined`. Run any existing tests for the compat layer to ensure the change works and doesn't break anything.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
javascript, typescript
Área
backend-api-design
Tipo de issue
Error
Dificultad
2/5
Tiempo estimado
1-3 horas
Estado de actividad
Activo
Claridad
Bien especificado
Aptitud para principiantes
75/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.