Skip to content

Audit src/worker/ comments (#225 Phase 2)#242

Merged
kui merged 1 commit into
masterfrom
claude/issue-225-audit-src-worker
Jul 12, 2026
Merged

Audit src/worker/ comments (#225 Phase 2)#242
kui merged 1 commit into
masterfrom
claude/issue-225-audit-src-worker

Conversation

@kui

@kui kui commented Jul 12, 2026

Copy link
Copy Markdown
Owner

Summary

Phase 2 for #225: audit all of src/worker/ in one sweep (4 files, 111 flagged comments). Drops the 4 corresponding entries from EXCLUDED_PATHS.

Coverage

  • src/worker/lib/map-renderer.ts (83) — largest single-file audit yet. Class field docs, function preambles, and cache-key discussion moved to JSDoc. Design decisions kept as WHY: (compose-before-canvas-resize timing, Path2D batching for GPU cost, canvas coordinate inversion, footprint stroke inset, resetTransform for 1:1 sprite stamps, reversed iteration for z-ordering, radiation full-brightness, footprints inside cached composite). PNG_HEADER_BYTES layout stays as inline JSDoc.
  • src/worker/lib/prefab-filter.ts (18) — PrefabsFilterOutputMessage protocol → JSDoc. Streaming staleness check → INVARIANT:. Detached streamChunks / matched-block-cap / SW-corner offset / partial-input regex compilation → WHY: or JSDoc as fitting.
  • src/worker/map-renderer.ts (9) — glyph fetch memoisation → WHY:. OffscreenCanvas capture rule → INVARIANT:. Message queue and non-awaited update → WHY:.
  • src/worker/prefabs-filter.ts (1) — bumpInputVersion ordering → WHY:.

Style

Single-clause markers using so / because / since causation. JSDoc bodies split into short sentences with period. No ;, , colon-elaboration, or parenthetical elaboration in prose.

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: 30 → 26. src/worker/ fully audited.

Remaining: src/index/ (23 files) and e2e/ + playwright.config.ts (3 files).

Phase 2 for #225. All four worker files, 111 flagged comments.
src/worker/ now fully audited.

Field-level and function-level rationale moved to JSDoc across the
map renderer (allPrefabs, tileIndex cache, composite cache/mirror,
generation counter, drawPrefabFootprints preamble, withAlpha,
anchorOffset, PNG_HEADER_BYTES) and the filter worker
(PrefabsFilterOutputMessage protocol, tryCompileRegex,
matchAndHighlight).

In-body design decisions kept as WHY: / INVARIANT: markers:
- map-renderer: compose-before-canvas-resize timing; Path2D batching
  motivated by a Chrome CrGpuMain trace; canvas y-inversion;
  footprint stroke inset; resetTransform for 1:1 sprite stamps;
  reversed z-ordering iteration; radiation full-brightness;
  footprints inside cached composite; static-lookup reference
  identity in cache key; per-layer bitmap release on close.
- prefab-filter: streaming staleness INVARIANT; detached streamChunks;
  matched-block-cap accounting INVARIANT; SW-corner half-extent shift
  for distance.
- worker/map-renderer: shared glyph fetch memoisation; OffscreenCanvas
  first-message capture INVARIANT; message queue for serialised
  handling; non-awaited update to let throttledInvoker coalesce.
- worker/prefabs-filter: bumpInputVersion ordering rationale.

Style: single-clause sentences using because / so / since for
causation, no ; / — / colon-elaboration per the #235-#236 memo.

EXCLUDED_PATHS shrinks from 30 to 26.
@kui
kui merged commit d8622df into master Jul 12, 2026
2 checks passed
@kui
kui deleted the claude/issue-225-audit-src-worker branch July 12, 2026 06:36
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