Skip to content

feat(phase-14): htmx shareable web client — server-rendered optimizer UI#20

Merged
harsh-pandhe merged 1 commit into
mainfrom
feat/phase-14-htmx
May 20, 2026
Merged

feat(phase-14): htmx shareable web client — server-rendered optimizer UI#20
harsh-pandhe merged 1 commit into
mainfrom
feat/phase-14-htmx

Conversation

@harsh-pandhe
Copy link
Copy Markdown
Owner

Summary

Phase 14 adds a minimal, dependency-free server-rendered web client that drives the optimizer through plain HTML + htmx attributes. The point is shareable result links: every run lands at /htmx/run/{rid} and that URL can be sent to anyone with network access to the API.

Routes

Registered in create_app, unauthenticated by design — synthetic terrain only, no DEM upload, no project leakage:

Route Method What
/ GET Landing page — length, seed, system, generations form
/htmx/run POST Run synthetic optimize, return HTML fragment with metrics + permalink
/htmx/run/{rid} GET Shareable read-only view of a stored run

Implementation

Single ~200-line module (src/ropeway/server/htmx.py):

  • No template engine — inline HTML strings with a small CSS block
  • htmx attributes for the form post + result swap (hx-post, hx-target, hx-swap, hx-indicator)
  • Runs stored in process memory; the link is valid for the lifetime of the server

The authenticated FastAPI surface (/auth, /projects, /optimize/dem) is untouched.

Test plan

  • tests/test_server_htmx.py — 5 new tests: landing form, run returns metrics + permalink, unknown system 400, share link returns stored run, unknown rid 404
  • Full suite 157 → 162 passing, zero regressions
  • Existing test_server_api.py / test_server_phase95.py all green — the existing API surface is unchanged

Phase 14 adds a minimal, dependency-free server-rendered web client
that drives the optimizer through plain HTML + htmx attributes. The
point is shareable result links: every run lands at /htmx/run/{rid}
and that URL can be sent to anyone with network access to the API.

Routes (registered in create_app, unauthenticated by design — synthetic
terrain only, no DEM upload, no project leakage):
  GET  /                  landing page (length, seed, system, generations)
  POST /htmx/run          run synthetic optimize, return HTML fragment
                          with metrics + a permanent run link
  GET  /htmx/run/{rid}    shareable read-only view of a stored run

The implementation is a single ~200 line module (src/ropeway/server/htmx.py)
with no template engine — inline HTML strings with a small CSS block,
htmx attributes for the form post + result swap. Runs are stored in
process memory; the link is valid for the lifetime of the server.

The authenticated FastAPI surface (/auth, /projects, /optimize/dem) is
untouched.

Tests: 5 new in tests/test_server_htmx.py (landing form, run returns
metrics + permalink, unknown system 400, share link returns stored run,
unknown rid 404). Suite 157 → 162.
@harsh-pandhe harsh-pandhe merged commit db78458 into main May 20, 2026
2 checks passed
@harsh-pandhe harsh-pandhe deleted the feat/phase-14-htmx branch May 20, 2026 06:29
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