Embed static/ assets or fail loud when static dir is missing #51

Open
opened 2026-05-23 20:55:27 +00:00 by coilysiren · 0 comments
Owner

Originally filed by @coilysiren on 2026-05-12T07:20:42Z - https://github.com/coilysiren/repo-recall/issues/84

Problem

src/routes/mod.rs:23-25 reads REPO_RECALL_STATIC and silently falls back to the build-time CARGO_MANIFEST_DIR/static path:

let static_dir = std::env::var("REPO_RECALL_STATIC")
    .ok()
    .unwrap_or_else(|| format!("{}/static", env!("CARGO_MANIFEST_DIR")));

On any host where the binary was not built (kai-server, anyone installing via brew tap), that fallback path does not exist. The service starts cleanly, HTML pages render referencing /static/tailwind.css, and every static asset 404s. The dashboard loads unstyled and the failure mode is silent until a human notices.

This just bit kai-server: the hand-written /etc/systemd/system/repo-recall.service did not set REPO_RECALL_STATIC (separate issue, filed alongside), the binary fell back to the build path, and the dashboard lost its CSS for an unknown stretch of time.

Options

  1. Embed static/ via rust-embed and drop the env var entirely. Most robust: nothing to forget, no path drift between hosts, no install-layout assumption.
  2. Keep the env var but fail loud at startup if <static_dir>/tailwind.css does not exist. Less invasive, still surfaces the misconfiguration at boot instead of silently.

Option 1 is preferred. Option 2 is the minimum bar.

Acceptance

  • A fresh install on a host that never built the binary serves /static/tailwind.css without any env var configuration, OR fails to start with a clear error message naming the missing file.
_Originally filed by @coilysiren on 2026-05-12T07:20:42Z - [https://github.com/coilysiren/repo-recall/issues/84](https://github.com/coilysiren/repo-recall/issues/84)_ ## Problem `src/routes/mod.rs:23-25` reads `REPO_RECALL_STATIC` and silently falls back to the build-time `CARGO_MANIFEST_DIR/static` path: ```rust let static_dir = std::env::var("REPO_RECALL_STATIC") .ok() .unwrap_or_else(|| format!("{}/static", env!("CARGO_MANIFEST_DIR"))); ``` On any host where the binary was not built (kai-server, anyone installing via brew tap), that fallback path does not exist. The service starts cleanly, HTML pages render referencing `/static/tailwind.css`, and every static asset 404s. The dashboard loads unstyled and the failure mode is silent until a human notices. This just bit kai-server: the hand-written `/etc/systemd/system/repo-recall.service` did not set `REPO_RECALL_STATIC` (separate issue, filed alongside), the binary fell back to the build path, and the dashboard lost its CSS for an unknown stretch of time. ## Options 1. Embed `static/` via `rust-embed` and drop the env var entirely. Most robust: nothing to forget, no path drift between hosts, no install-layout assumption. 2. Keep the env var but fail loud at startup if `<static_dir>/tailwind.css` does not exist. Less invasive, still surfaces the misconfiguration at boot instead of silently. Option 1 is preferred. Option 2 is the minimum bar. ## Acceptance - A fresh install on a host that never built the binary serves `/static/tailwind.css` without any env var configuration, OR fails to start with a clear error message naming the missing file.
coilysiren added
P3
and removed
P2
labels 2026-05-31 07:01:12 +00:00
Sign in to join this conversation.
No labels
P0
P1
P2
P3
P4
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
coilyco-flight-deck/repo-recall#51
No description provided.