Files read back from disk are cast to their types instead of validated
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 56/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- typescript
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
- Lingua principale
- TypeScript
- Stelle
- 1
- Fork
- 4
- Merge medio
- 3g 4h
- PR unite (30g)
- 4
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di TMHSDigital/screencast-mcp
-
dependencies effort: small good first issue priority: low
Difficoltà 1/5 1-3 ore Idoneità per principianti 88/100
TMHSDigital/screencast-mcp#509 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
TMHSDigital/screencast-mcp#508 ·
I maintainer di solito rispondono entro 1 giorno
-
dependencies effort: small good first issue priority: low
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
TMHSDigital/screencast-mcp#490 ·
I maintainer di solito rispondono entro 1 giorno
-
ci effort: small priority: medium
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
TMHSDigital/screencast-mcp#460 ·
I maintainer di solito rispondono entro 1 giorno
-
effort: medium help wanted priority: low testing
Difficoltà 4/5 3-5 giorni Idoneità per principianti 38/100
TMHSDigital/screencast-mcp#503 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di TMHSDigital/screencast-mcp
Issue simili
-
from-review tech-debt testing
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
blamechris/chroxy#9520 ·
I maintainer di solito rispondono entro 1 giorno
-
area:web complexity:S priority:P2 type:chore
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
nahuelcostac/agent-hub#104 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
snaglet-org/snaglet#78 ·
I maintainer di solito rispondono entro 1 giorno
-
agent/guide documentation help wanted stage/010-actionable
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100
kubestellar/console-marketplace#1101 ·
I maintainer di solito rispondono entro 1 giorno
-
Java Edition Tests
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
JSPrismarine/JSPrismarine#4178 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno