Files read back from disk are cast to their types instead of validated
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 56/100
- Tipo de issue
- Bug
- Clareza
- Claramente especificada
- Status de atividade
- Ativa
- Stack de tecnologia
- typescript
Direção de pesquisa
Start by reading the listed readers in src/utils/sessions.ts, src/utils/recordingIndex.ts, src/utils/perf.ts, src/utils/logTail.ts, and src/utils/events.ts, then trace how their parsed records are consumed. Run npm run build && npm test to establish the current behavior. Add boundary validation that drops malformed entries and check the event log’s optional typed fields; done means the acceptance criteria hold and the tests pass.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Summary
Files read back from disk are cast to their types instead of validated. These files are documented as readable from caller-written or older-version sources (stem-keyed sidecars, logs "a caller wrote"). A record or line with the wrong shape surfaces later as a TypeError far from the read (for example "s.ocr is not iterable" in search_recording) or as NaN in summaries, instead of being skipped at the boundary the way a torn line is. For sessions.json a single non-object entry makes the whole registry count as corrupt.
Where
src/utils/sessions.ts:207src/utils/recordingIndex.ts:359src/utils/recordingIndex.ts:436src/utils/perf.ts:128src/utils/logTail.ts:96src/utils/events.ts:266
Details
parseDisk is JSON.parse(...) as SessionRecord[] followed by data.map((r) => [r.id, r]). parseIndex checks only version, that segments is an array, and that fingerprint is truthy, yet itemsOf iterates s.ocr of every segment. parsePerfJsonl and the log reader push JSON.parse(row) as PerfSample / as LogLine. Only the event log has a real check (normalizeEvent, added in #437 for caller-written logs), and it validates t, type, x, y but spreads the other fields (durationSec, keys, button, delta) through unchecked.
Impact
These files are documented as readable from caller-written or older-version sources (stem-keyed sidecars, logs "a caller wrote"). A record or line with the wrong shape surfaces later as a TypeError far from the read (for example "s.ocr is not iterable" in search_recording) or as NaN in summaries, instead of being skipped at the boundary the way a torn line is. For sessions.json a single non-object entry makes the whole registry count as corrupt.
How to see it
Put {"version":<INDEX_VERSION>,"fingerprint":{},"segments":[{"start":0,"end":1}]} next to a recording as its index and run search_recording on it.
Suggested fix
Give each reader a small normalize* like normalizeEvent (or a zod schema; zod is already a dependency): drop entries that fail, and in parseDisk filter to objects with a string id and a known status. Check the optional typed fields in normalizeEvent.
Acceptance criteria
- Each step of the plan lands on its own with the tests passing
- No behavior change
Getting started
- Relevant files:
src/utils/sessions.ts,src/utils/recordingIndex.ts,src/utils/perf.ts,src/utils/logTail.ts,src/utils/events.ts - How to run tests:
npm run build && npm test(alsonpm run typecheckandnpm run lint) - Related docs:
CONTRIBUTING.md,AGENTS.md
Filed by repo-audit/full-audit at b8156ef. Severity: low. Effort: M. audit-key: tech-debt|src/utils/sessions.ts|SessionStore.parseDisk
- Linguagem predominante
- TypeScript
- Estrelas
- 1
- Forks
- 4
- Merge médio
- 3d 4h
- PRs com merge (30d)
- 4
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de TMHSDigital/screencast-mcp
-
dependencies effort: small good first issue priority: low
Dificuldade 1/5 1-3 horas Facilidade para iniciantes 88/100
TMHSDigital/screencast-mcp#509 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
TMHSDigital/screencast-mcp#508 ·
Mantenedores costumam responder em até 1 dia
-
dependencies effort: small good first issue priority: low
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
TMHSDigital/screencast-mcp#490 ·
Mantenedores costumam responder em até 1 dia
-
ci effort: small priority: medium
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
TMHSDigital/screencast-mcp#460 ·
Mantenedores costumam responder em até 1 dia
-
effort: medium help wanted priority: low testing
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 38/100
TMHSDigital/screencast-mcp#503 ·
Mantenedores costumam responder em até 1 dia
Todas as issues de TMHSDigital/screencast-mcp
Issues semelhantes
-
from-review tech-debt testing
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
blamechris/chroxy#9520 ·
Mantenedores costumam responder em até 1 dia
-
area:web complexity:S priority:P2 type:chore
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
nahuelcostac/agent-hub#104 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 77/100
snaglet-org/snaglet#78 ·
Mantenedores costumam responder em até 1 dia
-
agent/guide documentation help wanted stage/010-actionable
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 82/100
kubestellar/console-marketplace#1101 ·
Mantenedores costumam responder em até 1 dia
-
Java Edition Tests
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
JSPrismarine/JSPrismarine#4178 · 1 comentário · 1 reação ·
Mantenedores costumam responder em até 1 dia