Skip to content

Fix shape extrusion, style-change re-render, and consolidate proxy teardown - #186

Merged
amorfinv merged 4 commits into
mainfrom
fix/proxy-teardown-and-shape-rendering
Aug 25, 2026
Merged

Fix shape extrusion, style-change re-render, and consolidate proxy teardown#186
amorfinv merged 4 commits into
mainfrom
fix/proxy-teardown-and-shape-rendering

Conversation

@amorfinv

Copy link
Copy Markdown
Collaborator

Summary

Four independent cleanups/fixes, one per commit:

  • Proxy teardown consolidation — the three teardown paths (close, stop_client, _handle_disconnection) each carried a drifting copy of the cached-state clearing. They now all funnel through a single DataManager._reset_cached_state(), so browsers always get the cleared node/traffic picture on disconnect. Dead reconnect() / _ensure_clean_zmq_context() paths removed, unit tests added (tests/test_connection_manager.py).
  • Shared app bootstrapstart_WebATM, script/wsgi.py, and script/wsgi_integrated.py duplicated the create_app + BLUESKY_SERVER_HOST wiring; extracted into create_configured_app() with tests that import both WSGI scripts.
  • Numpy decoding — replaced the hand-rolled five-entry dtype→struct table in make_json_serializable with np.frombuffer on the transmitted dtype string (matching bluesky.network.npcodec), so float16/uint64/string arrays decode instead of falling back to hex. Hex fallback kept for invalid dtypes and truncated buffers.
  • 3D shapes — polygons without altitude data no longer get a fake 1000 m extrusion (they stay flat, like BlueSky renders them); base altitude is clamped into [0, top]; style changes no longer double-render (the 3D renderer defers re-init to the owning ShapeRenderer); duplicated source-recovery logic moved to a shared updateSourceWithRecovery() helper.

🤖 Generated with Claude Code

amorfinv and others added 4 commits August 25, 2026 17:53
The three teardown paths (close, stop_client, _handle_disconnection) each
maintained their own copy of "forget all cached server state" and had
drifted apart. Extract DataManager._reset_cached_state as the single
implementation and route all paths through it, so browsers always receive
the cleared node/traffic picture on disconnect.

Also remove the dead reconnect() and _ensure_clean_zmq_context() code
paths (the app reconnects by building a fresh BlueSkyProxy), and add unit
tests covering the teardown paths.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
start_WebATM, script/wsgi.py, and script/wsgi_integrated.py each
duplicated the create_app + BLUESKY_SERVER_HOST wiring. Extract
create_configured_app() in WebATM.main and use it everywhere, add
allow_unsafe_werkzeug to the python-run fallback of the WSGI scripts,
and fix a stale module name in the app.py docstring. Tests cover the
new bootstrap and import both WSGI scripts.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Replace the hand-rolled struct-format table (which only knew five dtypes
and fell back to hex for everything else, e.g. float16, uint64, string
arrays) with np.frombuffer on the transmitted dtype string, matching
bluesky.network.npcodec. Hex fallback is kept for invalid dtypes and
truncated buffers, with tests for the new and fallback paths.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Polygons without altitude data were extruded to a hard-coded 1000 m; they
now stay flat in the 2D layers, matching how BlueSky treats shapes with
no vertical extent. The new extrusionBounds() helper (with vitest
coverage) also clamps the base into [0, top] so malformed data cannot
produce an inside-out extrusion.

On map style changes, ShapeRenderer.onStyleChange() re-initialized both
renderers and then rendered shapes again on top of the subscription-driven
render, and Shape3DRenderer re-initialized itself independently. The 3D
renderer now just marks its layers as lost and lets the owning
ShapeRenderer rebuild everything once.

The duplicated "recreate source then retry setData" logic moves into a
shared updateSourceWithRecovery() helper in utils/maplibre.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@amorfinv
amorfinv merged commit 336fc1b into main Aug 25, 2026
2 checks passed
@amorfinv
amorfinv deleted the fix/proxy-teardown-and-shape-rendering branch August 25, 2026 15:55
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