Skip to content

Audit nim-parser and tts-parser comments (#225 Phase 2) - #239

Merged
kui merged 1 commit into
masterfrom
claude/issue-225-audit-nim-tts-parsers
Jul 11, 2026
Merged

Audit nim-parser and tts-parser comments (#225 Phase 2)#239
kui merged 1 commit into
masterfrom
claude/issue-225-audit-nim-tts-parsers

Conversation

@kui

@kui kui commented Jul 11, 2026

Copy link
Copy Markdown
Owner

Summary

Phase 2 for #225: audit tools/lib/nim-parser.ts (16 comments) and tools/lib/tts-parser.ts (11 comments). Drop both from EXCLUDED_PATHS.

Both files are binary format parsers with near-identical comment shapes, so the treatment is symmetric.

Per-comment disposition

nim-parser.ts

Location Original Decision
Format documentation (8-15) 8-line reverse-engineered layout comment above parseNim Moved to JSDoc on parseNim. Kept the "reverse-engineered guess" caveat since it warns future editors that no upstream spec was consulted. Also fixed typos Its/refered/definisions
try/finally scope (20-22) 3-line rationale for wrapping only I/O Compressed to a single-line INVARIANT: about FD-release on read throw
Validation-after-body-read (38-42) 5-line design rationale Compressed to a two-sentence WHY: (period-split): layout-mirroring intent, then the "malformed files are rare" justification

tts-parser.ts

Location Original Decision
Spec URL (5) Top-of-file // TTS format: https://... Moved into the JSDoc on parseTts where the format is actually parsed
try/finally scope (15-17) Same shape as nim-parser Same single-line INVARIANT:
// Header (21) Section marker inside the try Deleted
// Block data (30) Section marker inside the try Deleted
Validation-after-body-read (41-45) Same shape as nim-parser Same two-sentence WHY:

Style

Markers use single or double sentences with period, no ; / / colon-elaboration.

Test plan

  • deno task ci:lint passes
  • deno task ci:fmt-check passes
  • deno task ci:type-check passes
  • deno task test — 41 tests / 241 steps pass

Progress

EXCLUDED_PATHS: 66 → 64. Remaining tools/lib/ files (5) queued for the next batch (ico.ts, prefab-files.ts, symbol-chars.ts, utils.tsprefab-html.ts already done in #238).

Phase 2 for #225. Two binary-format parsers with near-symmetric
comment shapes; 27 flagged comments total.

Moved to JSDoc on the exported function where the doc belongs:
- nim-parser: 8-line .blocks.nim format table, kept as reverse-
  engineered guess (typos also fixed).
- tts-parser: TTS format spec URL folded into parseTts's JSDoc.

Compressed to single-line INVARIANT: markers:
- Both parsers: "try scope must contain only ByteReader reads so the
  finally releases the FD when reads throw."

Compressed to two-sentence WHY: markers (period-split):
- Both parsers: version/header validated after the body read to keep
  the code sequence mirroring the on-disk layout. Malformed inputs
  are rare because they come from the game's own exporter.

Section markers // Header / // Block data in tts-parser deleted; the
neighbouring reads speak for themselves.

EXCLUDED_PATHS shrinks from 66 to 64.
@kui
kui merged commit 1498c34 into master Jul 11, 2026
2 checks passed
@kui
kui deleted the claude/issue-225-audit-nim-tts-parsers branch July 11, 2026 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant