fix(client): T-1153 — clamp _held_n at the viewer's single write site (live eyeball round blocker)
The live round against a real server caught what 3518 unit tests missed: enter_orbital stored the UNCLAMPED n (Lendel: 19139 raw circumference cols) into _held_n while AtlasWindowRequest clamped independently to 6400 before sending — every orbital response on a real-sized body was dropped by the viewer's own w_n != _held_n staleness check. Permanently blank ladder. The PR #191 C1 clamp-mirror lesson, one layer up: the mirror must apply wherever held/expected state is recorded, not only at the request layer. _enter_at_rung now clamps via _clamp_window_n_mirror_v2 before storing (the file's only _held_n write site — reselect/refloat read and forward). Regression closes the coverage hole: the oversized-orbital RESPONSE round-trip (enter_orbital on GJ380c -> deliver echo n=6400 Region -> assert accepted). Both new tests verified to fail against the reverted fix before trusting green. Full suite 3520/3520.
This commit is contained in:
@@ -330,6 +330,21 @@ func enter_orbital(body: Dictionary, system: Dictionary) -> void:
|
||||
## no canonicalization; enter()'s does its own before calling in). Resets
|
||||
## every piece of held/request state for a fresh descent, exactly as the
|
||||
## pre-T-1153 enter() always did, plus the new _held_granularity_v2 tracking.
|
||||
##
|
||||
## **The C1 clamp-mirror lesson, one layer up (live-round finding):** `n`
|
||||
## MUST be clamped via `_clamp_window_n_mirror_v2()` BEFORE it becomes
|
||||
## `_held_n` — mirroring exactly what AtlasWindowRequest.request_now()
|
||||
## already does to ITS OWN `_n` before storing/sending (see that function's
|
||||
## own doc for the original PR #191 Tyre C1 finding). Storing the RAW `n`
|
||||
## here (e.g. enter_orbital()'s full district_extent().cols, routinely tens
|
||||
## of thousands at Region granularity, versus the server's clamped echo of
|
||||
## at most DISTRICT_WINDOW_MAX_N_REGION=6,400) left `_held_n` permanently
|
||||
## disagreeing with what the server would ever actually echo — every
|
||||
## orbital-rung response was silently rejected as stale by
|
||||
## _on_window_ready()'s `w_n != _held_n` check, hanging the ladder on every
|
||||
## real-sized body. `_maybe_reselect_rung()`/`_maybe_refloat_window()` both
|
||||
## read `_held_n` (never re-derive it), so clamping here — the ONE write
|
||||
## site — fixes every downstream caller too, not just entry.
|
||||
func _enter_at_rung(
|
||||
body: Dictionary,
|
||||
system: Dictionary,
|
||||
@@ -337,17 +352,20 @@ func _enter_at_rung(
|
||||
n: int,
|
||||
granularity_v2: String
|
||||
) -> void:
|
||||
var clamped_n: int = AtlasWindowRequest._clamp_window_n_mirror_v2(n, granularity_v2)
|
||||
_body = body
|
||||
_system = system
|
||||
_held_center = district_center
|
||||
_held_n = n
|
||||
_held_n = clamped_n
|
||||
_held_granularity_v2 = granularity_v2
|
||||
_window = null
|
||||
_user_adjusted = false
|
||||
_awaiting_first_window = true
|
||||
_fit_and_center()
|
||||
_window_request.reset()
|
||||
_window_request.request_now(_dict_str(_body, "body_id", ""), _held_center, n, granularity_v2)
|
||||
_window_request.request_now(
|
||||
_dict_str(_body, "body_id", ""), _held_center, clamped_n, granularity_v2
|
||||
)
|
||||
_refresh_screen_header()
|
||||
grab_focus()
|
||||
queue_redraw()
|
||||
|
||||
Reference in New Issue
Block a user