Skip to content

fix: isolate request state and complete HTMX todo CRUD - #15

Merged
WilliamRagstad merged 3 commits into
mainfrom
codex/runtime-isolation-todo-20261025
Oct 26, 2026
Merged

WilliamRagstad merged 3 commits into
mainfrom
codex/runtime-isolation-todo-20261025

Conversation

@WilliamRagstad

@WilliamRagstad WilliamRagstad commented Oct 25, 2026 •

Copy link
Copy Markdown
Member

The todo example defines CRUD logic directly in inline endpoint blocks and uses HTMX for all client/server interaction. PUT now uses put /todos/(id: String) form(title: String, completed: Boolean): the edit form submits named fields in an application/x-www-form-urlencoded body to /todos/{id}. It no longer rewrites PUT values into URL segments. Unchecked completion binds as false. POST retains its existing URL-based creation route.

The form declaration follows the parser's documented syntax, and HTMX submission follows its official form-parameter documentation. HTTP tasks collect bounded bodies asynchronously before dispatch, including chunked uploads, so slow uploads do not block the JavaScript actor. Declared String and Boolean/Bool fields become request-local bindings before pre-handlers and inline endpoint execution. Malformed, duplicate, missing, or conflicting inputs return 400; unsupported media types return 415. Bodies are capped at 64 KiB and ten seconds (413/408). JSON, multipart uploads, models, and other form field types remain unsupported and are documented.

global contains shared todo state and three reusable rendering/escaping helpers. Endpoint return values become responses or post-handler out; locals never become persistent globals. HTMX swaps escaped HTML fragments and application validation messages. Module globals remain intentional shared state, and JavaScript execution remains serialized. Refs #4.

Validation:

  • cargo fmt --check, cargo build --locked --offline, and cargo test --locked --offline: 15 tests passed.
  • HTTP coverage includes CRUD, title escaping, URL-encoded UTF-8/plus/percent decoding, unchecked booleans, rejected fields/media/oversized bodies, POST/PATCH form handling, pre-handler binding, concurrent form isolation, and chunked uploads while another route responds.
  • Existing inline execution, routing, reload, and concurrency assertions pass.
  • Chromium with pinned HTMX 2.0.8 verifies load/create/edit/complete/uncomplete/validation/delete; PUT requests have form bodies at /todos/1, including omission of the unchecked checkbox. Clean shutdown verified.

The example README includes the PUT declaration and curl body examples; docs/runtime.md describes supported request behavior and runtime limitations.

@WilliamRagstad
WilliamRagstad deleted the branch codex/html-reload-20261025 October 25, 2026 22:15
@WilliamRagstad WilliamRagstad changed the title fix: isolate request bindings and complete the todo CRUD example fix: isolate request state and complete HTMX todo CRUD Oct 26, 2026
@WilliamRagstad
WilliamRagstad changed the base branch from codex/html-reload-20261025 to main October 26, 2026 07:48
@WilliamRagstad
WilliamRagstad force-pushed the codex/runtime-isolation-todo-20261025 branch from baffecf to 46f01fb Compare October 26, 2026 07:48
@WilliamRagstad
WilliamRagstad marked this pull request as ready for review October 26, 2026 08:12
@WilliamRagstad
WilliamRagstad merged commit 88cc381 into main Oct 26, 2026
1 check passed
@WilliamRagstad
WilliamRagstad deleted the codex/runtime-isolation-todo-20261025 branch October 26, 2026 08:12
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