Audit src/worker/ comments (#225 Phase 2)#242
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Phase 2 for #225: audit all of
src/worker/in one sweep (4 files, 111 flagged comments). Drops the 4 corresponding entries fromEXCLUDED_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 asWHY:(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/sincecausation. JSDoc bodies split into short sentences with period. No;,—, colon-elaboration, or parenthetical elaboration in prose.Test plan
deno task ci:lintpassesdeno task ci:fmt-checkpassesdeno task ci:type-checkpassesdeno task test— 41 tests / 241 steps passProgress
EXCLUDED_PATHS: 30 → 26.src/worker/fully audited.Remaining:
src/index/(23 files) ande2e/+playwright.config.ts(3 files).