Frozen state: store edits to earlier array elements as changes, not whole arrays

Abierto
#5,320 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
52/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
typescript
Área
backend

Línea de trabajo

Start by reading the diffState implementation and the state operation readers and writers; the issue names no file or test paths. Compare how array prefix appends and whole-array set operations are encoded, then check existing tests for frozen state diffs. Done means earlier element edits can be stored with tail appends or truncations, with a compatible rollout that ships readers before writers.

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

Descripción

Follow-up from review of #5214 / #5215.

Frozen state is stored as a change from the version it was made from (diffState). Arrays are diffed as append only when the old array is a prefix of the new one. Any other change, such as editing an earlier element and then appending, pop(), or splice(), writes the whole array as one set.

Agent loops hit this often: they fill in a tool result on the last assistant message, then append the next one. Measured on a 200-message history, editing the last message and appending one produced 6,566 B of ops, against 6,536 B for the whole value, so no saving at all.

Possible approaches:

  • per-index set ops for changed elements (by identity, which is cheap for frozen values), plus append for the tail;
  • a truncate op for pop() / splice() at the end;
  • falling back to set only when the index ops outgrow the array.

The stored format would need a new op kind, so readers must ship before writers use it.

🤖 Generated with Claude Code

Lenguaje dominante
TypeScript
Estrellas
2.5k
Forks
401
Merge medio
1 d 21 h
PR fusionados (30 d)
201

Preparar el entorno

  • Sin Dockerfile ni archivo de Docker Compose
  • Tiene una plantilla de pull request
  • Sin guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de vercel/workflow

Todos los issues de vercel/workflow

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.