fix: iframe embed islands use wrong URL pattern for hero_router #43

Closed
opened 2026-04-16 09:27:06 +00:00 by salmaelsoly · 2 comments
Member

Problem

Several iframe embed islands use the legacy URL pattern /<service>_ui (e.g. /hero_proc_ui) instead of the hero_router convention /<service>/ui/ (e.g. /hero_proc/ui/).

hero_router maps /<service_name>/<socket_type>/ to the corresponding Unix socket at $HERO_SOCKET_DIR/<service_name>/<socket_type>.sock. The _ui suffix pattern does not match any route and returns 404.

Affected islands

Island File Current (broken) Correct
proc archipelagos/embed/proc/src/island.rs:44 /hero_proc_ui /hero_proc/ui/
compute archipelagos/embed/compute/src/island.rs:43 /hero_compute_ui /hero_compute/ui/
embedder archipelagos/embed/embedder/src/island.rs:43 /hero_embedder_ui /hero_embedder/ui/
books archipelagos/embed/books/src/island.rs:28 /hero_books_ui /hero_books/ui/
indexer archipelagos/embed/indexer/src/island.rs:43 /hero_indexer_ui /hero_indexer/ui/
redis archipelagos/embed/redis/src/island.rs:46 /hero_db_ui /hero_db/ui/
auth archipelagos/embed/auth/src/island.rs:43 /hero_auth_ui /hero_auth/ui/
office archipelagos/embed/office/src/island.rs:17 /hero_office /hero_office/ui/
aibroker archipelagos/embed/aibroker/src/island.rs:43 /hero_aibroker /hero_aibroker/ui/
inspector archipelagos/embed/inspector/src/island.rs:43 /hero_router /hero_router/ui/

Fix

Each affected island needs a one-line change in island.rs — replace the format!("{}/hero_<name>_ui", ...) with format!("{}/hero_<name>/ui/", ...).

Also ensure all URLs end with a trailing / to avoid unnecessary 308 redirects from hero_router.

How to verify

# With hero_router running, each URL should return 200:
curl -sL http://127.0.0.1:9988/hero_proc/ui/ -o /dev/null -w "%{http_code}\n"
## Problem Several iframe embed islands use the legacy URL pattern `/<service>_ui` (e.g. `/hero_proc_ui`) instead of the hero_router convention `/<service>/ui/` (e.g. `/hero_proc/ui/`). hero_router maps `/<service_name>/<socket_type>/` to the corresponding Unix socket at `$HERO_SOCKET_DIR/<service_name>/<socket_type>.sock`. The `_ui` suffix pattern does not match any route and returns **404**. ## Affected islands | Island | File | Current (broken) | Correct | |--------|------|-------------------|---------| | proc | `archipelagos/embed/proc/src/island.rs:44` | `/hero_proc_ui` | `/hero_proc/ui/` | | compute | `archipelagos/embed/compute/src/island.rs:43` | `/hero_compute_ui` | `/hero_compute/ui/` | | embedder | `archipelagos/embed/embedder/src/island.rs:43` | `/hero_embedder_ui` | `/hero_embedder/ui/` | | books | `archipelagos/embed/books/src/island.rs:28` | `/hero_books_ui` | `/hero_books/ui/` | | indexer | `archipelagos/embed/indexer/src/island.rs:43` | `/hero_indexer_ui` | `/hero_indexer/ui/` | | redis | `archipelagos/embed/redis/src/island.rs:46` | `/hero_db_ui` | `/hero_db/ui/` | | auth | `archipelagos/embed/auth/src/island.rs:43` | `/hero_auth_ui` | `/hero_auth/ui/` | | office | `archipelagos/embed/office/src/island.rs:17` | `/hero_office` | `/hero_office/ui/` | | aibroker | `archipelagos/embed/aibroker/src/island.rs:43` | `/hero_aibroker` | `/hero_aibroker/ui/` | | inspector | `archipelagos/embed/inspector/src/island.rs:43` | `/hero_router` | `/hero_router/ui/` | ## Fix Each affected island needs a one-line change in `island.rs` — replace the `format!("{}/hero_<name>_ui", ...)` with `format!("{}/hero_<name>/ui/", ...)`. Also ensure all URLs end with a trailing `/` to avoid unnecessary 308 redirects from hero_router. ## How to verify ```bash # With hero_router running, each URL should return 200: curl -sL http://127.0.0.1:9988/hero_proc/ui/ -o /dev/null -w "%{http_code}\n" ```
Author
Member

Implementation Spec for Issue #43

Objective

Fix the iframe embed islands so their iframe src URLs use the hero_router URL convention /<service>/ui/ (with trailing slash) instead of the legacy /<service>_ui pattern that does not map to any hero_router route and returns 404.

Requirements

  • Update the URL string built via format! in each of the 10 affected island.rs files so the iframe requests a URL that hero_router can route to a Unix socket under $HERO_SOCKET_DIR/<service>/ui.sock.
  • All replacement URLs must end with a trailing / to avoid unnecessary 308 redirects from hero_router.
  • No functional/behavioral changes beyond the URL string — all surrounding theme/auth/postMessage wiring stays untouched.
  • Workspace must still build (cargo build) and tests must still pass (cargo test) after the edits.

Files to Modify

  • archipelagos/embed/proc/src/island.rs — fix proc iframe URL (line 46)
  • archipelagos/embed/compute/src/island.rs — fix compute iframe URL (line 45)
  • archipelagos/embed/embedder/src/island.rs — fix embedder iframe URL (line 45)
  • archipelagos/embed/books/src/island.rs — fix books base URL (line 28)
  • archipelagos/embed/indexer/src/island.rs — fix indexer iframe URL (line 45)
  • archipelagos/embed/redis/src/island.rs — fix redis (hero_db) iframe URL (line 48)
  • archipelagos/embed/auth/src/island.rs — fix auth iframe URL (line 45)
  • archipelagos/embed/office/src/island.rs — fix office iframe URL (line 17)
  • archipelagos/embed/aibroker/src/island.rs — fix aibroker iframe URL (line 45)
  • archipelagos/embed/inspector/src/island.rs — fix hero_router iframe URL (line 45)

Implementation Plan

Step 1: Update proc island URL

Files: archipelagos/embed/proc/src/island.rs

  • Replace format!("{}/hero_proc_ui", props.context.api_host) with format!("{}/hero_proc/ui/", props.context.api_host) at line 46
    Dependencies: none

Step 2: Update compute island URL

Files: archipelagos/embed/compute/src/island.rs

  • Replace format!("{}/hero_compute_ui", props.context.api_host) with format!("{}/hero_compute/ui/", props.context.api_host) at line 45
    Dependencies: none

Step 3: Update embedder island URL

Files: archipelagos/embed/embedder/src/island.rs

  • Replace format!("{}/hero_embedder_ui", props.context.api_host) with format!("{}/hero_embedder/ui/", props.context.api_host) at line 45
    Dependencies: none

Step 4: Update books island base URL

Files: archipelagos/embed/books/src/island.rs

  • Replace format!("{}/hero_books_ui", props.context.api_host) with format!("{}/hero_books/ui/", props.context.api_host) at line 28
    Dependencies: none

Step 5: Update indexer island URL

Files: archipelagos/embed/indexer/src/island.rs

  • Replace format!("{}/hero_indexer_ui", props.context.api_host) with format!("{}/hero_indexer/ui/", props.context.api_host) at line 45
    Dependencies: none

Step 6: Update redis (hero_db) island URL

Files: archipelagos/embed/redis/src/island.rs

  • Replace format!("{}/hero_db_ui", props.context.api_host) with format!("{}/hero_db/ui/", props.context.api_host) at line 48
    Dependencies: none

Step 7: Update auth island URL

Files: archipelagos/embed/auth/src/island.rs

  • Replace format!("{}/hero_auth_ui", props.context.api_host) with format!("{}/hero_auth/ui/", props.context.api_host) at line 45
    Dependencies: none

Step 8: Update office island URL

Files: archipelagos/embed/office/src/island.rs

  • Replace format!("{}/hero_office", props.context.api_host) with format!("{}/hero_office/ui/", props.context.api_host) at line 17
    Dependencies: none

Step 9: Update aibroker island URL

Files: archipelagos/embed/aibroker/src/island.rs

  • Replace format!("{}/hero_aibroker", props.context.api_host) with format!("{}/hero_aibroker/ui/", props.context.api_host) at line 45
    Dependencies: none

Step 10: Update inspector island URL

Files: archipelagos/embed/inspector/src/island.rs

  • Replace format!("{}/hero_router", props.context.api_host) with format!("{}/hero_router/ui/", props.context.api_host) at line 45
    Dependencies: none

Step 11: Build verification

Files: none

  • Run cargo build --workspace at the repo root and confirm it succeeds.
    Dependencies: Steps 1-10

Step 12: Test verification

Files: none

  • Run cargo test --workspace at the repo root and confirm tests pass.
  • Optionally, with hero_router running, curl -sL http://127.0.0.1:9988/<service>/ui/ -o /dev/null -w "%{http_code}\n" should return 200 for each of the 10 services.
    Dependencies: Step 11

Acceptance Criteria

  • All 10 island URLs use the /<service>/ui/ pattern with trailing slash
  • cargo build succeeds for the workspace
  • cargo test passes

Notes

  • The 10 edits are independent (each is a one-line string change in a separate file) and can be performed in parallel.
  • All 10 target lines were verified by reading each file — the line numbers in the issue match the current code exactly.
  • A wider repo grep for the legacy _ui patterns found hits in archipelagos/system/service/src/island.rs and archipelagos/system/services/src/island.rs (plus src/lib.rs). These are doc comments / module-level comments only — the actual iframe URLs in both files already use the correct /hero_proc/ui/ pattern. Updating those stale doc comments is out of scope for this issue; leave them alone to keep the PR minimal and focused.
  • The inspector island embeds hero_router itself — verify manually that hero_router exposes a /hero_router/ui/ route. If hero_router's UI is not under /hero_router/ui/ in the running deployment, that would be a separate routing-registration issue, not a fix to the island code.
  • Books is a special case: the affected line assigns a base_url used by nested views that build URLs like {base_url}/api/.... After the fix, downstream URLs will become <api_host>/hero_books/ui/api/..., which assumes hero_books_server exposes its API under /ui/ — confirm that during smoke testing.
  • No other call sites (dispatchers, registries, manifests, HTML templates) reference these URL patterns — the fix is fully local to the 10 island files.
## Implementation Spec for Issue #43 ### Objective Fix the iframe embed islands so their iframe `src` URLs use the hero_router URL convention `/<service>/ui/` (with trailing slash) instead of the legacy `/<service>_ui` pattern that does not map to any hero_router route and returns 404. ### Requirements - Update the URL string built via `format!` in each of the 10 affected `island.rs` files so the iframe requests a URL that hero_router can route to a Unix socket under `$HERO_SOCKET_DIR/<service>/ui.sock`. - All replacement URLs must end with a trailing `/` to avoid unnecessary 308 redirects from hero_router. - No functional/behavioral changes beyond the URL string — all surrounding theme/auth/postMessage wiring stays untouched. - Workspace must still build (`cargo build`) and tests must still pass (`cargo test`) after the edits. ### Files to Modify - `archipelagos/embed/proc/src/island.rs` — fix proc iframe URL (line 46) - `archipelagos/embed/compute/src/island.rs` — fix compute iframe URL (line 45) - `archipelagos/embed/embedder/src/island.rs` — fix embedder iframe URL (line 45) - `archipelagos/embed/books/src/island.rs` — fix books base URL (line 28) - `archipelagos/embed/indexer/src/island.rs` — fix indexer iframe URL (line 45) - `archipelagos/embed/redis/src/island.rs` — fix redis (hero_db) iframe URL (line 48) - `archipelagos/embed/auth/src/island.rs` — fix auth iframe URL (line 45) - `archipelagos/embed/office/src/island.rs` — fix office iframe URL (line 17) - `archipelagos/embed/aibroker/src/island.rs` — fix aibroker iframe URL (line 45) - `archipelagos/embed/inspector/src/island.rs` — fix hero_router iframe URL (line 45) ### Implementation Plan #### Step 1: Update proc island URL Files: `archipelagos/embed/proc/src/island.rs` - Replace `format!("{}/hero_proc_ui", props.context.api_host)` with `format!("{}/hero_proc/ui/", props.context.api_host)` at line 46 Dependencies: none #### Step 2: Update compute island URL Files: `archipelagos/embed/compute/src/island.rs` - Replace `format!("{}/hero_compute_ui", props.context.api_host)` with `format!("{}/hero_compute/ui/", props.context.api_host)` at line 45 Dependencies: none #### Step 3: Update embedder island URL Files: `archipelagos/embed/embedder/src/island.rs` - Replace `format!("{}/hero_embedder_ui", props.context.api_host)` with `format!("{}/hero_embedder/ui/", props.context.api_host)` at line 45 Dependencies: none #### Step 4: Update books island base URL Files: `archipelagos/embed/books/src/island.rs` - Replace `format!("{}/hero_books_ui", props.context.api_host)` with `format!("{}/hero_books/ui/", props.context.api_host)` at line 28 Dependencies: none #### Step 5: Update indexer island URL Files: `archipelagos/embed/indexer/src/island.rs` - Replace `format!("{}/hero_indexer_ui", props.context.api_host)` with `format!("{}/hero_indexer/ui/", props.context.api_host)` at line 45 Dependencies: none #### Step 6: Update redis (hero_db) island URL Files: `archipelagos/embed/redis/src/island.rs` - Replace `format!("{}/hero_db_ui", props.context.api_host)` with `format!("{}/hero_db/ui/", props.context.api_host)` at line 48 Dependencies: none #### Step 7: Update auth island URL Files: `archipelagos/embed/auth/src/island.rs` - Replace `format!("{}/hero_auth_ui", props.context.api_host)` with `format!("{}/hero_auth/ui/", props.context.api_host)` at line 45 Dependencies: none #### Step 8: Update office island URL Files: `archipelagos/embed/office/src/island.rs` - Replace `format!("{}/hero_office", props.context.api_host)` with `format!("{}/hero_office/ui/", props.context.api_host)` at line 17 Dependencies: none #### Step 9: Update aibroker island URL Files: `archipelagos/embed/aibroker/src/island.rs` - Replace `format!("{}/hero_aibroker", props.context.api_host)` with `format!("{}/hero_aibroker/ui/", props.context.api_host)` at line 45 Dependencies: none #### Step 10: Update inspector island URL Files: `archipelagos/embed/inspector/src/island.rs` - Replace `format!("{}/hero_router", props.context.api_host)` with `format!("{}/hero_router/ui/", props.context.api_host)` at line 45 Dependencies: none #### Step 11: Build verification Files: none - Run `cargo build --workspace` at the repo root and confirm it succeeds. Dependencies: Steps 1-10 #### Step 12: Test verification Files: none - Run `cargo test --workspace` at the repo root and confirm tests pass. - Optionally, with hero_router running, `curl -sL http://127.0.0.1:9988/<service>/ui/ -o /dev/null -w "%{http_code}\n"` should return 200 for each of the 10 services. Dependencies: Step 11 ### Acceptance Criteria - [ ] All 10 island URLs use the `/<service>/ui/` pattern with trailing slash - [ ] cargo build succeeds for the workspace - [ ] cargo test passes ### Notes - The 10 edits are independent (each is a one-line string change in a separate file) and can be performed in parallel. - All 10 target lines were verified by reading each file — the line numbers in the issue match the current code exactly. - A wider repo grep for the legacy `_ui` patterns found hits in `archipelagos/system/service/src/island.rs` and `archipelagos/system/services/src/island.rs` (plus `src/lib.rs`). These are doc comments / module-level comments only — the actual iframe URLs in both files already use the correct `/hero_proc/ui/` pattern. Updating those stale doc comments is out of scope for this issue; leave them alone to keep the PR minimal and focused. - The `inspector` island embeds `hero_router` itself — verify manually that hero_router exposes a `/hero_router/ui/` route. If hero_router's UI is not under `/hero_router/ui/` in the running deployment, that would be a separate routing-registration issue, not a fix to the island code. - Books is a special case: the affected line assigns a `base_url` used by nested views that build URLs like `{base_url}/api/...`. After the fix, downstream URLs will become `<api_host>/hero_books/ui/api/...`, which assumes hero_books_server exposes its API under `/ui/` — confirm that during smoke testing. - No other call sites (dispatchers, registries, manifests, HTML templates) reference these URL patterns — the fix is fully local to the 10 island files.
Author
Member

Pull request opened (WIP): #67

This PR implements the URL-pattern fix discussed in this issue. It is marked work-in-progress while we complete a follow-up linkage change so the 9 unlinked embed islands (proc, compute, embedder, indexer, redis, auth, aibroker, inspector, office) are actually rendered by the showcase server.

Pull request opened (WIP): https://forge.ourworld.tf/lhumina_code/hero_archipelagos/pulls/67 This PR implements the URL-pattern fix discussed in this issue. It is marked work-in-progress while we complete a follow-up linkage change so the 9 unlinked embed islands (proc, compute, embedder, indexer, redis, auth, aibroker, inspector, office) are actually rendered by the showcase server.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lhumina_code/hero_archipelagos#43
No description provided.