streams: DelimiterStream leaves delimiter bytes in the output when the delimiter spans more than two chunks
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 84/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- deno, typescript
- Área
- backend, stream-processing
Línea de trabajo
Empieza por el método #handle() de DelimiterStream y la rama descrita en el issue donde delimitedChunkEnd < 0 y hay chunks almacenados en búfer. Sigue cómo se recortan los delimitadores parciales que abarcan varios chunks y luego ejecuta las pruebas relevantes de streams con las reproducciones del issue. Se dará por terminado cuando discard y prefix produzcan las salidas esperadas para los delimitadores que abarcan varios chunks, incluido un chunk vacío.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the bug
With a multi-byte delimiter, DelimiterStream (discard and prefix) outputs part of the delimiter as data when a delimiter match starts two or more chunks before the chunk that completes it. An empty chunk in the middle of a two-byte delimiter is enough (["\r", "", "\n"] with "\r\n").
Steps to Reproduce
repro.ts:
import { DelimiterStream } from "jsr:@std/[email protected]/delimiter-stream";
const te = new TextEncoder(), td = new TextDecoder();
const run = async (
chunks: string[],
delim: string,
disposition: "discard" | "prefix" | "suffix" = "discard",
) => {
const out: string[] = [];
for await (
const c of ReadableStream.from(chunks.map((s) => te.encode(s)))
.pipeThrough(new DelimiterStream(te.encode(delim), { disposition }))
) {
out.push(td.decode(c));
}
return out;
};
console.log(await run(["xabcy"], "abc"));
console.log(await run(["xa", "b", "cy"], "abc"));
console.log(await run([..."one<END>two"], "<END>"));
console.log(await run(["\r", "", "\n"], "\r\n"));
console.log(await run(["xa", "b", "cy"], "abc", "prefix"));
deno run repro.ts
Expected behavior
[ "x", "y" ]
[ "x", "y" ]
[ "one", "two" ]
[ "", "" ]
[ "x", "abcy" ]
Actual behavior
[ "x", "y" ]
[ "xa", "y" ]
[ "one<EN", "two" ]
[ "\r", "" ]
[ "xa", "bcy" ]
In #handle(), the delimitedChunkEnd < 0 && bufs.length > 0 branch assumes the partial delimiter lies entirely in the last buffered chunk (last.byteLength + delimitedChunkEnd). When it spans several buffered chunks, that index goes negative and the earlier chunks are not trimmed.
Environment
- OS: Ubuntu Linux x86_64
- deno version: 2.9.8
- std version: @std/streams 1.2.0, also
mainat f834d02 (same output)
Credit: https://ucsbplse.github.io/
- Lenguaje dominante
- TypeScript
- Estrellas
- 3.6k
- Forks
- 713
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de denoland/std
-
`assertEquals` throws on structurally equal `Error` objects due to different stack tracePosiblemente ocupada @powerman2026 la tomó hace 1 día. Abiertobug needs triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
@std/encoding: decodeAscii85 corrupts delimited data ending in "<", decodeVarint32 reads past the end of the bufferPosiblemente ocupada @helmipradita la tomó hace 16 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
@std/yaml: stringify() with condenseFlow wraps already quoted keys in a second pair of quotesPosiblemente ocupada @sebxt la tomó hace 34 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
@std/ini parse silently drops an entire section when the section name repeatsPosiblemente ocupada @Harsh23Kashyap la tomó hace 35 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Los mantenedores suelen responder en 1 día
-
cli: parseArgs() treats an empty flag value passed without "=" as a positional argumentPosiblemente ocupada @helmipradita la tomó hace 23 días. Abiertobug needs triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
denoland/std#7351 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de denoland/std
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
vercel-labs/ui#1066 ·
Los mantenedores suelen responder en 1 día
-
fix(factory-cockpit): display active agent/actor name instead of verbose step name in run card badgeAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
ranxianglei/billion-context#7597 ·
Los mantenedores suelen responder en 1 día
-
documentation target:powerpoint
Dificultad 1/5 Menos de una hora Aptitud para principiantes 76/100
tomast1337/PdfLapas#602 ·
Los mantenedores suelen responder en 1 día
-
kubernetes-ingestor: fetchCRDMapping() runs even when crossplane.enabled is false, logging a 403 ERROR every runPosiblemente ocupada @kc9ddi la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
TeraSky-OSS/backstage-plugins#228 ·