Files read back from disk are cast to their types instead of validated
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 56/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- Active
- Stack technique
- typescript
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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
- Langage dominant
- TypeScript
- Étoiles
- 1
- Forks
- 4
- Merge moyen
- 3 j 4 h
- PR mergées (30 j)
- 4
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de TMHSDigital/screencast-mcp
-
dependencies effort: small good first issue priority: low
Difficulté 1/5 1-3 heures Accessibilité débutants 88/100
TMHSDigital/screencast-mcp#509 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
TMHSDigital/screencast-mcp#508 ·
Les mainteneurs répondent en général sous 1 jour
-
dependencies effort: small good first issue priority: low
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
TMHSDigital/screencast-mcp#490 ·
Les mainteneurs répondent en général sous 1 jour
-
ci effort: small priority: medium
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
TMHSDigital/screencast-mcp#460 ·
Les mainteneurs répondent en général sous 1 jour
-
effort: medium help wanted priority: low testing
Difficulté 4/5 3-5 jours Accessibilité débutants 38/100
TMHSDigital/screencast-mcp#503 ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de TMHSDigital/screencast-mcp
Issues similaires
-
from-review tech-debt testing
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
blamechris/chroxy#9520 ·
Les mainteneurs répondent en général sous 1 jour
-
area:web complexity:S priority:P2 type:chore
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100
nahuelcostac/agent-hub#104 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 77/100
snaglet-org/snaglet#78 ·
Les mainteneurs répondent en général sous 1 jour
-
agent/guide documentation help wanted stage/010-actionable
Difficulté 1/5 Moins d'une heure Accessibilité débutants 82/100
kubestellar/console-marketplace#1101 ·
Les mainteneurs répondent en général sous 1 jour
-
Java Edition Tests
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
JSPrismarine/JSPrismarine#4178 · 1 commentaire · 1 réaction ·
Les mainteneurs répondent en général sous 1 jour