Skip to content

Phase 6 item 6.14: form encodings and the submission algorithm (Verus, in part) - #174

Draft
atiernan wants to merge 8 commits into
phase6/6.13-form-datafrom
phase6/6.14-submission
Draft

atiernan wants to merge 8 commits into
phase6/6.13-form-datafrom
phase6/6.14-submission

Conversation

@atiernan

Copy link
Copy Markdown
Member

What was built

Phase 6 item 6.14, in clazel-forms (tier stays 0, target 2): the form encodings and HTML's form submission algorithm, src/submit/. Rule 3 order: a65f686c is spec + contracts alone (a small spec tweak, 9517d479, rewrote two helpers as recursion; the unencodable-code-point literal was later spelled as explicit code points).

  • Spec (HTML at 0793d3d8, URL/Encoding at the commits clazel-url/clazel-encoding pin; modelling choices at the top of spec.rs): URL §5.2 serializer (UTF-8 via clazel-percent; single-byte encoders, an unencodable code point is %26%23N%3B), "convert to name-value pairs", text/plain, multipart/form-data (boundary a parameter), "picking an encoding", and the submission algorithm to a plain Outcome (URL record, GET/POST, body + content type, this tab/new tab, no-referrer). Refused and listed: dialog, mailto:, javascript:, schemes outside the table, encodings with no encoder (multi-byte legacy, x-user-defined), a bad boundary.
  • Proven (Verus, WSL): every public function of src/submit/exec/ equals its spec function, submit_exec for every well-formed arena. Lemmas: serializer output is ASCII; scalar strings stay scalar.
  • Section numbers fixed in phase-6.md (4.10.22.3, .8, .9; URL §5.2) and the status row.
  • Mutations: 21 new (41 in all).
  • Tests: hand cases, WPT tables, differential against form_urlencoded.

What was checked

  • cargo verus verify in crates/clazel-forms (WSL, own target dir): 256 verified, 0 errors.
  • clazel-encoding (WSL, after cleaning it): 365 verified, 0 errors. I changed that tier-2 crate: run_encoder_handler in single_byte/encode.rs is now pub (no proof or contract change), so the serializer can read the encoder's error per code point.
  • cargo xtask mutate clazel-forms (WSL): 41 mutations: 17 killed by a theorem, 24 killed incidentally, 0 survived, PASS.
  • cargo test -p clazel-forms: all pass. clazel-conformance: lines: WPT urlencoded-parser (serialize then parse) 35/35; urlencoded2, text-plain, multipart-formdata 20/20 each (11 File calls each skipped); differential vs form_urlencoded 1.2.2, 5000/5000.
  • cargo clippy -p clazel-forms -p clazel-encoding -p xtask --all-targets, cargo fmt, cargo xtask check, cargo xtask testdata: clean/pass.

Not checked or not done

  • Full cargo xtask verify --changed and CI have not run; no Miri; the tier stays 0 (rule 7).
  • No independent.rs; 14 of the new mutations are killed-incidentally (single-byte table, label table, byte-string literals and the document-dependent steps are out of reach of compute_only).
  • Validation, events, dialog, history handling are the caller's (6.15, 6.16). The action URL's own query is parsed in UTF-8 whatever the document encoding (listed). Boundary absence from the body is not checked.

Decisions to look at

  • Named targets and _blank mean a new tab; _self/_parent/_top/empty mean this tab (as phase-6.md says).
  • Unlisted URL schemes (file:, blob:, about:) are refused, not guessed.
  • WPT files are copied under tests/data/wpt-form-encodings/ (converter in xtask/src/testdata/wpt_form_encodings.rs); the older conformance_forms.rs still include_str!s from crates/clazel/tests/wpt-phase6/ (limitation noted in the README).
  • Cargo.lock gains form_urlencoded for this crate (row already in docs/DEPENDENCIES.md).

🤖 Generated with Claude Code

atiernan and others added 6 commits November 16, 2026 05:25
…ssion algorithm (item 6.14)

URL's application/x-www-form-urlencoded serializer, HTML's conversion to
name-value pairs, text/plain, multipart/form-data, picking an encoding, and
the form submission algorithm's steps to a navigation request. Contracts
only; no executable code yet (rule 3).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… recursive definitions (item 6.14)

Same meaning as the quantified form; recursion matches how every other
helper in the spec is written and what the implementation loops over.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… the spec (item 6.14)

Every public function of src/submit/exec equals its spec function:
serializer (UTF-8 and single-byte), pairs, text/plain, multipart,
picking an encoding, attribute states, targets, and submit_exec. Lemmas:
the serializer's output is ASCII, scalar strings stay scalar. Spec: the
unencodable-code-point literals are explicit code points. clazel-encoding:
run_encoder_handler is public (no proof change).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… (item 6.14)

Worked examples evaluated by Verus; 21 mutations of the new spec; the
xtask converter and vendored WPT files for the urlencoded, text/plain and
multipart tests; hand-made submission tests; a differential test of the
serializer against form_urlencoded.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… 6.14)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… (item 6.14)

Miri took 1854 s for all 5000 cases and CI fails any test over 300 s.
120 cases take about 45 s at the measured 0.37 s each; the full 5000
still run in the normal test job (docs/VERIFICATION.md, Miri).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rate Miri and changed-crate CI)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch is waiting to be deployed

1 waiting deployment
full-verification — a446fb35 Waiting Nov 19, 2026 by atiernan via Approve the proofs #587
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