Skip to content

Audit src/lib/, src/types/, src/prefabs/main.ts (#225 Phase 2)#241

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

Audit src/lib/, src/types/, src/prefabs/main.ts (#225 Phase 2)#241
kui merged 1 commit into
masterfrom
claude/issue-225-audit-src-lib-bundle

Conversation

@kui

@kui kui commented Jul 12, 2026

Copy link
Copy Markdown
Owner

Summary

Phase 2 for #225: audit all of src/lib/, src/prefabs/main.ts, and src/types/7dtdmap.ts in one sweep (18 files, 121 flagged comments). Drops the corresponding 18 entries from EXCLUDED_PATHS.

Highlights

Declaration-level rationale moved to JSDoc, in-body rationale kept as single-clause markers, code-restating comments deleted.

Types & data shape (src/types/7dtdmap.ts, 18 comments)

All interface / field docs moved to JSDoc so they show on hover for consumers.

Data / lookup libraries

  • prefab-tooltip.ts (19) — CURSOR_OFFSET, TooltipHint, PrefabTooltip, PrefabTooltipController preambles → JSDoc; three in-body WHY: (popover top-layer contract, global Shift tracking, anchor evaluation ordering).
  • prefab-hit-index.ts (12) — EXCLUDED_NAME_FRAGMENTS and PrefabHitIndex preambles → JSDoc; rotation-swap rationale → WHY:.
  • labels.ts (10) — PRIMARY_SUBTAG_LANGUAGES and resolveChinese preambles → JSDoc.
  • footprint-color.ts (8) — TileIndex, buildTileIndex, footprintColorRgb preambles → JSDoc; lattice-origin derivation → WHY:.
  • utils.ts (8) — fetchCompleteBlob, escapeHtml preambles → JSDoc; content-encoding length-check rationale → WHY:.
  • prefabs.ts (5) — loadPrefabsXml (DOMParser rationale) and decorationToPrefab preambles → JSDoc; malformed-position fail-fast → WHY:.
  • prefab-added-versions.ts (5) — Version-comparison preamble → JSDoc on latestAddedVersion.
  • storage.ts (4) — pipeTo close-once contract → INVARIANT:; NotFoundError idempotency → WHY:.
  • throttled-invoker.ts (2) — Pending-flag coalescing → INVARIANT:.

UI helpers

  • url-state.ts (7) — UrlState preamble → JSDoc; two-event dispatch rationales → WHY:.
  • dom-utils.ts (4) — Rotation-swap → WHY:; three in-body section labels deleted.
  • prefab-link-tooltip.ts (4) — CURSOR_OFFSET and installPrefabLinkTooltip preambles → JSDoc.
  • prefabs-filter-controls.ts (4) — bindPrefabsFilterControls preamble → JSDoc.
  • glyph-sprite.ts (4) — buildGlyphSprite preamble → JSDoc; scale rationale → WHY:.
  • label-handler.ts (4) — Synchronous initial-language commit → WHY:.
  • oneshot-worker.ts (2) — preventDefault rationale → WHY:.
  • prefabs/main.ts (1)// init deleted (self-invoking async IIFE is idiomatic).

Style

All new markers are single-clause sentences using because / so / since for causation. No ;, , or elaboration parentheticals in prose. JSDoc bodies use period-split for genuinely separate ideas.

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: 48 → 30. All of src/lib/, src/types/, and src/prefabs/ audited.

Phase 2 for #225. Eighteen files, 121 flagged comments.

Declaration-level rationale moved to JSDoc across the types module
(all Prefab / HighlightedPrefab / mesh / district / glyph shapes),
data lookup libraries (prefab-tooltip, prefab-hit-index, labels,
footprint-color, utils, prefabs, prefab-added-versions), and UI
helpers (url-state, prefab-link-tooltip, prefabs-filter-controls,
glyph-sprite).

In-body rationale kept as single-clause WHY: / INVARIANT: markers:
- prefab-tooltip: popover top-layer contract, global Shift tracking.
- prefab-hit-index: rotation-swap of world-aligned width and depth.
- footprint-color: lattice-origin derivation from any tile.
- utils: content-encoding length-check condition.
- prefabs: malformed-position fail-fast.
- storage: pipeTo close-once INVARIANT; NotFoundError idempotency.
- throttled-invoker: pending-flag coalescing INVARIANT.
- url-state: input+change dual dispatch rationales.
- dom-utils, glyph-sprite: rotation-swap and scale rationale.
- label-handler: synchronous initial-language commit.
- oneshot-worker: preventDefault suppresses double-logging.

Deleted where variable names or idiom already convey the intent:
- dom-utils "in-game scale" / "center offset" section labels.
- prefabs/main.ts "// init" above the IIFE.

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

EXCLUDED_PATHS shrinks from 48 to 30.
@kui
kui merged commit 13a59b2 into master Jul 12, 2026
2 checks passed
@kui
kui deleted the claude/issue-225-audit-src-lib-bundle branch July 12, 2026 06:24
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