Painters built without fingerprints share one band plan cache key #94

Open
opened 2026-10-13 02:28:06 +00:00 by ImBenji · 0 comments
Owner

From the engineering review on 2026-10-13.

The scene band cache key (lib/rendering/canvas_painter.dart:1230) is built from fingerprints, and several painters pass none: png.dart, svg.dart, pdf.dart, lib/agent/view_capture.dart, and the line preview swatches in lib/widgets/lines_panel_v2.dart, lib/widgets/draw_panel.dart and the professional properties panel. They all land on the same key, so the second one can reuse the first's bands, whose indices point into a different list. The punchout cache in lines_v2.dart:486 has the same shape.

Scenario: two such painters paint back to back with no live canvas paint in between, for example a preview swatch then an export, or two agent captures in one frame.

Evidence: test/review_probes/render_static_cache_alias_probe.dart (local, untracked), three cases: a different set of ops is drawn, one of three boxes is drawn in the wrong order, and a stale plan against a shorter list gives an empty draw list (a blank export). Whether the app actually reaches this sequence is unverified, since any live repaint replaces the slot. test/composite_order_test.dart already clears the cache in setUp for this reason.

Fix sketch: when skipTileCache is set, build bands locally and never read or write the statics; same for the punchout cache. Also guard _paintCore against an empty metroLines (canvas_painter.dart:2030 throws Bad state: No element).

From the engineering review on 2026-10-13. The scene band cache key (`lib/rendering/canvas_painter.dart:1230`) is built from fingerprints, and several painters pass none: `png.dart`, `svg.dart`, `pdf.dart`, `lib/agent/view_capture.dart`, and the line preview swatches in `lib/widgets/lines_panel_v2.dart`, `lib/widgets/draw_panel.dart` and the professional properties panel. They all land on the same key, so the second one can reuse the first's bands, whose indices point into a different list. The punchout cache in `lines_v2.dart:486` has the same shape. **Scenario:** two such painters paint back to back with no live canvas paint in between, for example a preview swatch then an export, or two agent captures in one frame. **Evidence:** `test/review_probes/render_static_cache_alias_probe.dart` (local, untracked), three cases: a different set of ops is drawn, one of three boxes is drawn in the wrong order, and a stale plan against a shorter list gives an empty draw list (a blank export). Whether the app actually reaches this sequence is unverified, since any live repaint replaces the slot. `test/composite_order_test.dart` already clears the cache in `setUp` for this reason. **Fix sketch:** when `skipTileCache` is set, build bands locally and never read or write the statics; same for the punchout cache. Also guard `_paintCore` against an empty `metroLines` (`canvas_painter.dart:2030` throws `Bad state: No element`).
ImBenji added the bugarea:rendering labels 2026-10-13 02:28:06 +00:00
ImBenji added this to the Arcs & Angles project 2026-10-13 02:28:06 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: IMBENJI.NET/Metro-Map-Maker#94