Open
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a client-side Rust/WebAssembly (WASM) implementation of the STAC catalogue traversal logic, and updates the web UI flow to support a “region selection” step at the end of catalogue navigation.
Changes:
- Introduce a new
qubed_wasmcrate (wasm-bindgen) that implements STAC-like responses in the browser. - Add a WASM bootstrapper (
catalogue_wasm.js) and wire it into the browse page, updatingapp.jsto prefer WASM when available. - Restructure the region-selection UI into a step-based flow shown after catalogue traversal completes.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
stac_server/templates/index.html |
Adds WASM status badge, moves region-selection UI into main step flow, loads the WASM bootstrapper module. |
stac_server/static/catalogue_wasm.js |
Loads/initializes the WASM module, fetches arena JSON + language metadata, exposes window.__wasmCatalogue. |
stac_server/static/app.js |
Uses WASM catalogue when available; introduces region-selection step and defers viewer start to the WASM bootstrapper. |
stac_server/main.py |
Adds endpoints to support WASM data/language loading; changes/omits several prior API endpoints. |
qubed_wasm/src/lib.rs |
Implements browser-side STAC traversal and response construction in Rust, exported via wasm-bindgen. |
qubed_wasm/build.sh |
Adds a wasm-pack build script to emit the web bundle into stac_server/static/wasm. |
qubed_wasm/Cargo.toml |
New crate manifest for the WASM package. |
qubed/src/qube.rs |
Adds leaf_dimensions() helper used by the WASM traversal logic. |
qubed/Cargo.toml |
Makes rayon optional for wasm compatibility. |
Cargo.toml |
Adds qubed_wasm to the workspace members. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+24
to
+55
| // 2. Ask the server which data files to load | ||
| const metaResp = await fetch("/api/v2/data_files"); | ||
| if (!metaResp.ok) { | ||
| console.warn("[wasm] /api/v2/data_files returned", metaResp.status, "— falling back to server-side STAC"); | ||
| return; | ||
| } | ||
| const dataFiles = await metaResp.json(); // array of URL strings | ||
| console.log("[wasm] Data files:", dataFiles); | ||
|
|
||
| // 3. Load each data file into the catalogue | ||
| let first = true; | ||
| for (const url of dataFiles) { | ||
| const resp = await fetch(url); | ||
| if (!resp.ok) { | ||
| console.warn(`[wasm] Could not fetch ${url} (${resp.status}) – skipping`); | ||
| continue; | ||
| } | ||
| // The arena JSON endpoint returns a parsed JSON object; wasm expects a string | ||
| const arenaJson = await resp.text(); | ||
| if (first) { | ||
| catalogue.load(arenaJson); | ||
| first = false; | ||
| } else { | ||
| catalogue.append(arenaJson); | ||
| } | ||
| console.log(`[wasm] Loaded ${url}`); | ||
| } | ||
|
|
||
| if (catalogue.is_empty()) { | ||
| console.warn("[wasm] Catalogue empty after loading — falling back to server-side STAC"); | ||
| return; | ||
| } |
Comment on lines
+15
to
+19
| import init, { WasmCatalogue } from "/static/wasm/qubed_wasm.js"; | ||
|
|
||
| async function initWasm() { | ||
| try { | ||
| // 1. Initialise the WASM binary |
Comment on lines
+163
to
167
| # --------------------------------------------------------------------------- | ||
| # Admin endpoint – push new/updated data into the running catalogue | ||
| # --------------------------------------------------------------------------- | ||
|
|
||
| @app.post("/api/v2/polytope/query") |
Comment on lines
+150
to
+152
| data_path = prefix / file_path | ||
| if not data_path.exists(): | ||
| raise HTTPException(status_code=404, detail=f"Data file {file_path} not found") |
| ): | ||
| global qube | ||
| qube.append(PyQube.from_arena_json(json.dumps(body_json))) | ||
| return {"nodes": len(qube)} |
| @@ -410,352 +353,42 @@ async def select( | |||
| return qube.select(request).to_json() | |||
|
|
|||
|
|
|||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Contributor Declaration
By opening this pull request, I affirm the following: