Skip to content

feat(app,adapter-vite,element): 0.42.0-alpha.2 — form/action loop (ADR-0120) - #535

Merged
SisyphusZheng merged 8 commits into
mainfrom
dev
Jul 27, 2026
Merged

feat(app,adapter-vite,element): 0.42.0-alpha.2 — form/action loop (ADR-0120)#535
SisyphusZheng merged 8 commits into
mainfrom
dev

Conversation

@SisyphusZheng

Copy link
Copy Markdown
Member

TP-3 of the 0.42.0 plan. The WC Application Loop's action half:

  • Actions run before loaders on POST (revalidation invariant); fail(4xx, data) returns take the 422 re-render channel with the echo; successful mutations answer 303 (PRG, coerced from 302), never a 200 render; POST without an action is a defined 404.
  • Named actions via formaction='?/name' (export const actions = {...}); unknown names 404.
  • Fetch callers (x-openelement-action) receive the ActionResult discriminated union; the island client entry enhances data-open-enhance forms with zero DOM surgery (failure falls back to the native 422 render unless the page handles open:action-failure).
  • Contract: an action must be safe to re-run after a failed validation.
  • e2e: full loop with javaScriptEnabled: false + enhanced path, 33/33 on Chromium, Firefox and WebKit.
  • Interface snapshot re-baselined for the new unfrozen surface (fail/isActionFailure/ActionResult/ACTION_FETCH_HEADER); stale-prefix test now asserts the boundary invariant.

Release-prepare tier green locally. Publish via publish-existing after merge.

DevBot added 8 commits July 27, 2026 14:10
…med actions/ActionResult (0.42.0-alpha.2)

Server-side form/action loop on the request-time foundation:
- actions run BEFORE loaders on POST (revalidation invariant; previously a
  mutation rendered stale loader data);
- fail(status, data) return channel (4xx-enforced, duck-typed cross-bundle):
  422 re-render with the failure echoed through useActionData;
- successful non-GET actions never answer 200 with a page: 303 PRG back to
  the route (or the action's own Response escape hatch);
- named actions: ?/name selects module.actions[name] (formaction-compatible);
- fetch callers (x-openelement-action header) receive the ActionResult
  discriminated union instead of HTML/redirects — failure/redirect/error;
- POST to a route without an action is a defined 404, not a render;
- real FormData via request.formData() (was parseBody objects);
- element exports ActionResult + ACTION_FETCH_HEADER; app exports fail(),
  isActionFailure, OpenElementActionFailure.

Codegen tests cover ordering, 303/422/named/fetch paths and catch channels
(44/44 entry-renderer, 509 suite green). Client enhancement layer and e2e
follow in the next commits.
…redirects (0.42.0-alpha.2)

- The island client entry now carries the ADR-0120 form enhancement:
  data-open-enhance forms submit via fetch with the ActionResult protocol —
  redirect follows client-side, failure fires a cancelable
  open:action-failure event and otherwise falls back to the native 422
  render. No DOM surgery: unhydrated islands are never touched.
- Redirects thrown from POST actions coerce 302 to 303 (PRG); GET keeps
  the author's status.
- Fixture: /form exercises fail(422) echo, PRG success, named ?/shout
  action; e2e proves the full loop with javaScriptEnabled: false, the
  ActionResult JSON shapes, the named/unknown-action paths and the
  enhanced submit — 33/33 across Chromium, Firefox and WebKit.
…(ADR-0120)

The snapshot gate flagged the alpha.2 additions: element gains the
ActionResult type and ACTION_FETCH_HEADER, app gains fail()/isActionFailure/
OpenElementActionFailure — all new request-time surface authorized by
ADR-0119 (request-time explicitly unfrozen) and specified by ADR-0120. No
frozen 0.41 export changed. Also deno fmt.
…dent prefix

The stale-prefix assertion kept breaking at every version-shape change
(stable→alpha.1, alpha.1→alpha.2): string-prefix relations between stale
claims and the current line are incidental. The real invariant is that
the stale regex with numeric boundaries never matches the current line.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@github-actions

Copy link
Copy Markdown
Contributor

APIError: Insufficient Balance

opencode session  |  github run

@SisyphusZheng
SisyphusZheng merged commit 83e2792 into main Jul 27, 2026
10 checks passed
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