Skip to content

Phase 6 item 6.13: clazel-forms, the form data set and form owner (Verus, in part) - #173

Draft
atiernan wants to merge 8 commits into
phase6/6.7-giffrom
phase6/6.13-form-data
Draft

atiernan wants to merge 8 commits into
phase6/6.7-giffrom
phase6/6.13-form-data

Conversation

@atiernan

Copy link
Copy Markdown
Member

What was built

New crate clazel-forms (tier 0, target tier 2, per 6.0(b)). HTML's form owner and "constructing the entry list" over a clazel-dom arena, with the control state (value, checkedness, selectedness, dirty flags, image click coordinates) in a side table keyed by node id.

Commit order follows CLAUDE.md rule 3: 162dd461 is spec.rs + contract.rs only; the code and proofs follow.

  • Spec (HTML Standard commit 0793d3d8544eee95a862e6637130a8106c3d11ca, 2026-11-14, step numbers in comments, modelling choices at the top of src/spec.rs): form owner and "reset the form owner"; entry list steps 1 to 5.11 for input (every state), button, select (single and multiple, list of options, option disabled), textarea (newline normalization, hard wrapping), disabled including the fieldset/legend rule, datalist ancestors, the submitter, image coordinates, _charset_, dirname (ltr), value sanitization.
  • Proven in Verus (run in WSL): every public function of src/exec/ equals its spec function for every well-formed arena; no panic or overflow. Tree order and the list of options are explicit-stack walks. Lemmas: every node of a tree order has the form's root as its root (so "connected" is "root is the document"), and every entry has a non-empty name.
  • Mutations: 20; 10 killed with certificates (string algorithms), 10 killed incidentally (entry-list steps; a certificate needs a concrete Document).
  • Tests: 20 hand-made cases through the tree builder; WPT form-submission-0: all 32 pages need script, so the markup and data tables of three pages are read from the vendored files and run (19 of 19 checks; clazel-conformance: line).

What was checked (exact commands and results)

  • Verus (WSL, own target dir, cargo verus verify -- -A missing_docs in crates/clazel-forms): 162 verified, 0 errors.
  • cargo xtask mutate clazel-forms (WSL): 20 mutations: 10 killed by a theorem, 10 killed incidentally, 0 survived, PASS.
  • cargo test -p clazel-forms: 20 + 1 tests pass; clazel-conformance: suite="WPT form-submission-0 (script-free markup and tables)" pass=19 xfail=0 fail=0 total=19.
  • cargo clippy -p clazel-forms --all-targets: no warnings. cargo fmt, cargo xtask check: pass.

What was NOT checked or done

  • Full cargo xtask verify --changed and CI have not run; the tier stays 0 (rule 7).
  • Not written: independent.rs (the independent transcription) and certificates for the document-dependent mutations; both are required for tier 2. No Miri run, no Kani.
  • Gaps listed in the spec header and README: an option's text without a value attribute is the table's (HTML-aware text content not transcribed); the selectedness setting algorithm and radio groups are the caller's; no File entries; email read as one address; the hard-wrapping algorithm is one fixed implementation-defined choice.
  • Per-control ancestor walks cost controls times depth on a very deep tree (README); a carried-flags version is left to 6.20 if needed.

Decisions a human should look at

  • The form owner is the arena's form_owner as the parser set it (a Some means the parser inserted flag is set), else "reset the form owner" run on the final tree; this is a modelling choice (spec header).
  • I corrected 6.13's section numbers in docs/phases/phase-6.md (the † ones were §4.10.17.3 and §4.10.21.4; the real ones are §4.10.18.3 and §4.10.22.4). 6.14's † numbers are also off by one subsection (e.g. multipart is §4.10.22.8, plain text §4.10.22.9, URL-encoded §4.10.22.7, the submission algorithm §4.10.22.3); I left them for that item.
  • clazel-treebuilder is a dev-dependency (ours, pinned =0.0.0); no third-party packages added.
  • The test reads WPT pages with include_str! from crates/clazel/tests/wpt-phase6/ (6.1's vendoring), not a copy.

🤖 Generated with Claude Code

atiernan and others added 7 commits November 16, 2026 04:36
New crate, tier 0 with target tier 2 (phase-6.md 6.0(b)). Only the part
people review: spec.rs transcribes HTML §4.10.18.3 "reset the form owner" and
"form owner", §4.10.22.4 "constructing the entry list" (steps 1 to 5.11),
disabled (with the fieldset rule), the list of options and option disabled,
the textarea wrapping transformation, value sanitization, the dirname entry
and the image button's coordinates, over a clazel-dom arena with the control
state in a side table. HTML pinned at 0793d3d8544e. contract.rs states what
the executable functions will be proven to meet. No executable code yet.

The spec typechecks and its termination proofs verify under Verus (22
verified, 0 errors). Modelling choices are listed at the top of spec.rs.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…unctions, proven (item 6.13)

Each is proven equal to the spec function it names, under Verus (77
verified, 0 errors): newline stripping and normalization, whitespace
stripping, ASCII case-insensitive and exact keyword matches, the textarea
wrapping line breaks, decimal, the cols character width (non-negative integer
parsing, cut off at usize::MAX), attribute lookup, the input type, element
classes, the walks up the ancestors (root, nearest form, datalist, disabled
fieldset, option's ancestors, first legend child) and the tree order walk as
a stack machine whose state is the spec's tree order still to come.

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

The form owner and the controls of a form (the form attribute resolved by
the root's tree order and a once-per-form lookup, the parser's association
otherwise), the values of text, textarea (newline normalization, hard
wrapping), button, checkbox, radio, hidden and image fields, a select's list
of options as an explicit-stack walk, option disabled and value, and the
whole of step 5's body for one field are proven equal to the spec (152
verified, 0 errors under Verus). Lemmas prove every node of a tree order has
the form's root as its root, so "connected" is "the root is the document".

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

Twenty hand-made cases of the algorithm's steps and the form owner, run
through the proven executable functions, and the Verus proofs kept after the
clippy fixes (158 verified, 0 errors).

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

All 32 pages of form-submission-0 need script, so the test reads the markup
and the data tables of three of them (constructing-form-data-set.html,
url-encoded.html, submit-entity-body.html) and runs the script-free part:
the form the page builds, the element it clicks, the entry list compared
with what the page asserts. 19 of 19 pass; the rest of those pages' checks
(FormData, events, files, frames) need script and are not counted.

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

lemma_entry_names (field_entries, entries_of): every entry has a non-empty
name, proven for the spec. examples.rs evaluates the string algorithms on
small inputs. mutations.json: ten certified mutations of the string
algorithms and ten of the entry list's steps recorded as killed
incidentally (no spec lemma is false; the exec proofs break).

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

The mutation run passes: 20 mutations, 10 killed by a theorem, 10 killed
incidentally. docs/phases/phase-6.md: 6.13's row, and the item's section
numbers corrected against the HTML text (§4.10.18.3 and §4.10.22.4).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…i 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 — df65dc14 Waiting Nov 20, 2026 by atiernan via Approve the proofs #586
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