diff --git a/client/tests/test_step_canvas_transport.gd b/client/tests/test_step_canvas_transport.gd index e53a525f6..c1e25b500 100644 --- a/client/tests/test_step_canvas_transport.gd +++ b/client/tests/test_step_canvas_transport.gd @@ -76,9 +76,21 @@ func test_spacing_for_rung_matches_d243_metre_values() -> void: # ============================================================================= -func test_display_ratio_deep_rungs_are_one_to_one() -> void: +## The four deep rungs share ONE display ratio, whatever its current value — +## asserting the relationship rather than the literal, so tuning +## DISPLAY_RATIO_DEEP (pair session 2026-07-26: 1.0 -> 2.0, the cost/looks +## experiment) doesn't require editing a test that isn't about the number. +## The value itself is a presentation tunable (D-255(a)); what must hold is +## that the deep rungs agree with each other and stay a texel-exact integer. +func test_display_ratio_deep_rungs_all_share_the_deep_ratio() -> void: + var deep: float = StepCanvasTransport.DISPLAY_RATIO_DEEP for rung in ["District", "Quarter", "Block", "Chunk"]: - assert_float(StepCanvasTransport.display_ratio_for_rung(rung)).is_equal_approx(1.0, 0.001) + assert_float(StepCanvasTransport.display_ratio_for_rung(rung)).is_equal_approx(deep, 0.001) + assert_float(deep).override_failure_message( + "the deep display ratio must be a whole number of screen px per gridunit —" + + " a fractional ratio reintroduces the sub-pixel blur D-255 texel-exactness prevents" + ).is_equal_approx(floorf(deep), 0.0001) + assert_float(deep).is_greater(0.0) func test_display_ratio_shallow_rungs_use_the_five_x_five_fallback() -> void: @@ -98,10 +110,16 @@ func test_is_orbital_rung_true_only_for_global_and_region() -> void: # ============================================================================= -func test_viewport_fit_extent_at_deep_ratio_matches_viewport_pixels() -> void: - # 1x1 ratio -> extent in gridunits == viewport px, 1:1. - var extent: Vector2i = StepCanvasTransport.viewport_fit_extent(Vector2(800.0, 600.0), "Chunk") - assert_that(extent).is_equal(Vector2i(800, 600)) +## A deep-rung request asks for viewport_px / DISPLAY_RATIO_DEEP gridunits — +## derived from the constant, not the literal, so the ratio stays tunable +## (see the deep-ratio test above). This IS the cost lever: doubling the +## ratio quarters the requested cell count. +func test_viewport_fit_extent_at_deep_ratio_divides_by_the_deep_ratio() -> void: + var deep: float = StepCanvasTransport.DISPLAY_RATIO_DEEP + var viewport := Vector2(800.0, 600.0) + var extent: Vector2i = StepCanvasTransport.viewport_fit_extent(viewport, "Chunk") + var expected := Vector2i(int(ceil(viewport.x / deep)), int(ceil(viewport.y / deep))) + assert_that(extent).is_equal(expected) func test_viewport_fit_extent_at_shallow_ratio_divides_by_the_display_ratio() -> void: diff --git a/client/ui/implant/apps/atlas/step_canvas/step_canvas_transport.gd b/client/ui/implant/apps/atlas/step_canvas/step_canvas_transport.gd index 623d1cc8c..84e9aab8b 100644 --- a/client/ui/implant/apps/atlas/step_canvas/step_canvas_transport.gd +++ b/client/ui/implant/apps/atlas/step_canvas/step_canvas_transport.gd @@ -57,7 +57,17 @@ const RUNG_SPACING_M: Dictionary = { ## client-side, viewport-dependent parameter, kept architecturally separate ## from gridunit spacing") — it never touches a cache key or a wire request, ## only how many screen px one already-fetched gridunit occupies. -const DISPLAY_RATIO_DEEP: float = 1.0 +## PAIR SESSION 2026-07-26 EXPERIMENT (Jeroen): DISPLAY_RATIO_DEEP raised +## 1.0 -> 2.0. One gridunit now occupies a 2x2 screen-px block, so a +## viewport-fit request asks for ~4x FEWER gridunits (a 1920x1080 window: +## ~2.07M cells at 1x1 -> ~518K at 2x2) and the server-side derive cost falls +## with it — the whole point of the experiment. Texel-exact either way (an +## integer ratio, no fractional-pixel blur); the tradeoff is purely visual +## chunkiness. LOOKS ARE THE GATE: revert to 1.0 if Jeroen judges the deep +## rungs too coarse. Non-integer ratios are NOT an option here — they +## reintroduce exactly the fractional-pixel blur D-255's texel-exactness +## exists to prevent. +const DISPLAY_RATIO_DEEP: float = 2.0 const DISPLAY_RATIO_SHALLOW: float = 5.0 ## Global/Region read at the shallow ratio (orbital-scale canvases — extent