Files read back from disk are cast to their types instead of validated
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 56/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- typescript
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- TypeScript
- Star
- 1
- Fork
- 4
- Merge trung bình
- 3 ngày 4 giờ
- Pull request đã merge (30 ngày)
- 4
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của TMHSDigital/screencast-mcp
-
dependencies effort: small good first issue priority: low
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 88/100
TMHSDigital/screencast-mcp#509 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
TMHSDigital/screencast-mcp#508 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
dependencies effort: small good first issue priority: low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
TMHSDigital/screencast-mcp#490 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
ci effort: small priority: medium
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
TMHSDigital/screencast-mcp#460 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
effort: medium help wanted priority: low testing
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 38/100
TMHSDigital/screencast-mcp#503 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của TMHSDigital/screencast-mcp
Issue tương tự
-
from-review tech-debt testing
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
blamechris/chroxy#9520 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:web complexity:S priority:P2 type:chore
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
nahuelcostac/agent-hub#104 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
snaglet-org/snaglet#78 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
agent/guide documentation help wanted stage/010-actionable
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
kubestellar/console-marketplace#1101 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Java Edition Tests
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
JSPrismarine/JSPrismarine#4178 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày