Skip to content

fix(ecs): preserve atlas and image resources across lifecycle transitions - #387

Merged
xiaoiver merged 1 commit into
masterfrom
codex/ecs-resource-lifecycle-coverage
Oct 9, 2026
Merged

xiaoiver merged 1 commit into
masterfrom
codex/ecs-resource-lifecycle-coverage

Conversation

@xiaoiver

@xiaoiver xiaoiver commented Oct 9, 2026

Copy link
Copy Markdown
Owner

Failed glyph-atlas rebuilds destroyed the old texture and published incomplete cache data. Late image decodes could overwrite newer bitmaps, and empty batches could reuse the wrong renderer combination: for example, a retired shadow/fill rectangle batch could be reused for fill/dashed-stroke rendering merely because both contained two drawcalls.

This change keeps atlas map/packing/texture updates together until upload succeeds, releases failed uploads, and makes teardown idempotent. It also fixes multiline origins, the default glyph scale, and bitmap kerning placement. Image decoding now preserves explicit replacements, closes obsolete results, retries synchronous adapter failures, and ignores disabled fill layers when resolving raster options. Batch reuse checks each renderer constructor, and removed/cleared UI drawcalls no longer reappear when restoring the frame queue.

Adds 68 behavioral unit tests and independent coverage gates for GlyphManager, image URL raster caching, and BatchManager. Atlas tests exercise real packing with controlled raster/GPU inputs; image tests use native Cairo pixels and explicitly completed decode promises; batch tests use actual drawcall classes and validation, with GPU/graph boundaries substituted. Existing browser regressions separately verify rendered output. All ECS source files remain included in coverage.

Coverage Before After
ECS lines 65.23% 65.99%
ECS branches 51.57% 52.62%
GlyphManager lines 89.39% 100%
Image URL raster cache lines 65.07% 97.70%
BatchManager lines 74.05% 98.76%

Validation:

  • Full ECS suite with coverage: 202 suites / 1273 tests passed, all coverage gates passed, about 9m25s in Node 20 with native canvas/headless-gl and Xvfb.
  • 12 existing Chromium regressions passed: glyph ink, atlas reuse during resize, atlas refresh after font/content edits, migrated image fills, blend modes, clipping, WebGL1 fallback, and translucent paint layers.
  • Browser TypeScript project, a targeted TypeScript project for the new unit tests, full repository ESLint, new test/config/changeset formatting, and git diff --check passed.

Baseline is merged master 8d4ffbba (PR #386). Metrics are from local full-package reports; Coveralls updates after merge and CI. docs/ecs-test-coverage.md records counts, gates, reproduction commands, and the next text/icon/effect property-synchronization priorities. Includes an ECS patch changeset; no package publication.

@xiaoiver
xiaoiver merged commit 2a57479 into master Oct 9, 2026
14 of 15 checks passed
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