Skip to content

test(tilemap): close infinite-maps deferred batch — Tiled provider tests, destroy race, misaligned-chunk guard, infinite .tmj demo, hygiene#383

Merged
Exoridus merged 8 commits into
mainfrom
worktree-infinite-maps-slice2
Jul 16, 2026
Merged

test(tilemap): close infinite-maps deferred batch — Tiled provider tests, destroy race, misaligned-chunk guard, infinite .tmj demo, hygiene#383
Exoridus merged 8 commits into
mainfrom
worktree-infinite-maps-slice2

Conversation

@Exoridus

Copy link
Copy Markdown
Owner

Summary

Closes the deferred items accumulated across Infinite Maps Slices 2–4c. Companion to #382 (engine heal fix, already merged).

  • Tiled provider E2E tests: full round trip toTileMap()getChunkSource() → real ChunkStreamergetTileAt, with a distinct-gid fixture asserting negative AND positive coordinates, plus bounded/unbounded contract assertions both directions.
  • ChunkStreamer race tests: destroy-before-in-flight-resolve (no resurrection) and destroy-after-adopt (clean eviction) — open since Slice 2, behavior was already correct, now pinned.
  • Misaligned-chunk guard (packages/exojs-tiled, only src change): an infinite-map chunk whose x/y is not grid-aligned now throws a TiledFormatError naming layer and coords at toTileMap() time, instead of silently corrupting tile indices. TDD, negative-coordinate modulo verified.
  • Infinite .tmj playground demo: hand-authored drift-fields.tmj (14 aligned 16×16 chunks incl. negatives, embedded map-pack tileset) + tiled-infinite-map example streaming both layers, wired into the infinite-maps guide chapter. Smoke + screenshot verified.
  • Hygiene: scripts/**/*.mjs finally lintable (5 never-linted files, mechanical fixes only); select-lanes.test.ts converted to toMatchObject with explicit per-area flags (lane additions no longer break 15 call sites, discrimination retained); sync-example-capabilities gains the missing webWorkers derivation rule.

Verification

Full gates + pnpm test (7721 passed), root build + site build, smoke + screenshot of the new example (coherent island, real tile art). Whole-branch review: cross-task interlocks verified (guard inert against all branch fixtures, capability manifest idempotent under fresh sync).

Exoridus added 8 commits July 16, 2026 18:22
…l. negative coordinates

Extends the Slice-3 infinite-map suite with an end-to-end test that drives
TiledMap.toTileMap() -> getChunkSource() -> a real ChunkStreamer, asserting
resolved tiles at both negative and positive tile coordinates re-sliced from
16x16 on-disk Tiled chunks onto the runtime 32x32 grid. Also strengthens the
existing bounded/unbounded assertions: an infinite layer's width/height are
asserted undefined, and a finite layer's bounded/width/height are asserted
explicitly alongside its already-covered getChunkSource() === undefined.
…unkSource)

Add drift-fields.tmj, a hand-authored infinite Tiled map (two chunked
tile layers, 16x16 on-disk chunks including negative coordinates) and
the tiled-infinite-map example: TiledMap.toTileMap() + getChunkSource()
feed one ChunkStreamer per layer around a free-flying WASD camera, with
no procedural sampler involved. Wire the example into the catalog and
into the "Streaming a Tiled infinite map" guide section.
Extend the Node/config-files/scripts eslint block to glob scripts/**/*.mjs
alongside scripts/**/*.ts, so the 5 .mjs scripts stop crashing the linter
on the first type-aware rule. Add a scoped globals.browser override for
webgpu-probe.mjs, whose page.evaluate() callbacks execute in the browser
page rather than the Node process. Drop one dead assignment in
generate-demo-audio-loops.mjs surfaced by the now-working lint pass.
Whole-object toEqual(areas) assertions required editing every call site
whenever a new lane area was added. Switch them to toMatchObject so each
scenario still pins its known area values explicitly, but a future area
addition doesn't retroactively fail unrelated scenarios. Verified by
temporarily adding a 5th boolean area to selectAreas()'s return value:
all 28 existing tests still passed before reverting the experiment.
sync-example-capabilities.ts listed webWorkers in its ordering array but
had no derivation rule, so worker-based examples were only ever tagged
with the input capabilities they also happened to use. Add a rule: source
matching createWorkerSampledChunkSource( or new Worker( implies
webWorkers. Re-running the sync adds webWorkers to worker-streamed-terrain
only; no other catalog entry changes.
Prettier flagged test/ci/select-lanes.test.ts (unwrapped toMatchObject
call) from the select-lanes lane-addition-proof commit.
@Exoridus
Exoridus enabled auto-merge (squash) July 16, 2026 19:41
@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Bundle Report

Changes will increase total bundle size by 968 bytes (0.0%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
exo-full-iife-Exo-iife 2.61MB 369 bytes (0.01%) ⬆️
exojs-tiled-esm 129.48kB 599 bytes (0.46%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: exojs-tiled-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
TiledMap.js 599 bytes 31.5kB 1.94%

Files in TiledMap.js:

  • ./src/TiledMap.ts → Total Size: 30.9kB
view changes for bundle: exo-full-iife-Exo-iife

Assets Changed:

Asset Name Size Change Total Size Change (%)
exo.full.iife.js 369 bytes 2.61MB 0.01%

Files in exo.full.iife.js:

  • ./packages/exojs-tiled/src/TiledMap.ts → Total Size: 21.16kB

@Exoridus
Exoridus merged commit 0ed5125 into main Jul 16, 2026
17 of 18 checks passed
@Exoridus
Exoridus deleted the worktree-infinite-maps-slice2 branch July 16, 2026 19:50
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