Skip to content

6.10: display list image items (upload, draw, free) - #189

Draft
atiernan wants to merge 10 commits into
phase6/planfrom
phase6/6.10-image-items
Draft

atiernan wants to merge 10 commits into
phase6/planfrom
phase6/6.10-image-items

Conversation

@atiernan

Copy link
Copy Markdown
Member

Phase 6 item 6.10, in clazel-displaylist (tier 2 crate; the tier is unchanged).

What it adds

  • Tags 7 to 9:
    • upload image: id(4), width(2), height(2), then width × height × 4 bytes of premultiplied RGBA8.
    • draw image: id; the destination x, y, w, h as tag 1 encodes them; the source x/y/w/h as 16-bit fields; and a filter byte, 0 for nearest or 1 for linear. Any other filter byte is not an item.
    • free image: id(4).
  • Validation:
    • Image ids are below 2^16, in their own space.
    • An upload's id is not live, and its sides are 1 to 2^14.
    • Live image bytes stay at most 2^28.
    • A draw names a live image, with its source rectangle inside that image.
    • MAX_LIST_BYTES grows from 2^27 to 2^27 + 2^28.
  • Images are a second table in the retained state (Masks is now {table, images}).
  • theorem_validated_bounds now also covers image bytes, and image_sources_inside.

Commits

The spec and contracts come first, alone, in 8aef016 (rule 3). Verus doesn't pass at that commit. Then come the proofs, the independent transcription, examples and docs, tests, mutations, the Miri sizing and the status row.

Evidence so far (local)

  • Verus, in WSL: 131 verified, 0 errors for the whole crate.
  • Mutations: 130 of 130 killed by a theorem, each with a certificate; none survived. 51 are new, and 11 existing ones were re-anchored for the new spec text. No expect was relabelled.
  • Tests:
    • The conformance tests have a second decoder and validator for tags 7 to 9, random lists (20,000 natively), hostile bytes (100,000 natively) and 110 hand-built cases.
    • All 8 tests pass natively.
    • Clippy is clean, and cargo xtask check passes.
  • Miri sizes, measured natively with the Miri branches forced on: 0.039 s and 0.041 s for the two random suites; the rest are under 0.001 s.
  • cargo xtask verify --changed: it was still running locally when this PR was opened, queued behind other proof jobs. The result goes in a comment.
  • CI: its full verification hasn't run. This isn't done until it's green.

Caveats

  1. The independent transcription's extension was written by the same session that changed the spec, so it isn't blind. Its file header says so.
  2. MAX_LIST_BYTES (384 MiB) is now above clazel-gpu's socket limit LIST_MAX (256 MiB). Lists between the two sizes are refused, never misread. Item 6.12 must settle this with its second-channel decision, along with the GPU_LIMIT comment in crates/clazel/tests/hostile_graphics.rs.
  3. in_range has no stateless bound on how far a draw's source rectangle extends; that is a rule of the walk (image_sources_inside). Guaranteeing that every live image's sides are at most 2^14 would need one more invariant, which isn't added.
  4. The 2^28 image budget and the new list limit haven't been measured.
  5. Until 6.12, clazel-gpu refuses image items: the builder returns Error::Refused and the reference returns None.

🤖 Generated with Claude Code

atiernan and others added 8 commits November 17, 2026 11:49
Upload image, draw image and free image join the spec: their bytes, their
decoding, the image table beside the mask table in the retained state, the
validation rules (ids below 2^16 in their own space, sides 1 to 2^14, live
pixel bytes at most 2^28, a draw naming a live image with its source inside
it) and the list's byte limit growing by 2^28. The contract extends
theorem_validated_bounds to image bytes and source rectangles.

Spec and contracts only (CLAUDE.md rule 3): exec.rs, lemmas.rs, examples.rs
and independent.rs do not yet cover the new items, so Verus does not pass at
this commit; the next commit has the implementation and proofs.

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

The decoder reads tags 7 to 9, the encoder writes them, and the validator keeps
a table of images beside its masks, all proven against the previous commit's
spec: Verus 100 verified, 0 errors with independent.rs set aside (it still has
to learn the new items; the next commits do that, and mutations). Examples
evaluate the new bytes and each new rule both ways on the spec.

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

Tags 7 to 9 in the second form (a fold over maps by id, a reading by position),
and the equivalence with the spec extended: i_read is decode, and i_check is
validate over masks and images, on every list. Verus: 131 verified, 0 errors.
Unlike 5.17a's definitions this extension was not written blind: the session
that extended the spec wrote it, from item 6.10's paragraph, and the file's
header says so.

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

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…them until 6.12

Conformance: a second decoder and validator for tags 7 to 9, random lists,
hand-built cases per rule, the encoder's pixel check, the draw bytes, and a list
past 5.17a's limit that reads as an upload. clazel-gpu refuses a list that holds
an image item, with a comment pointing at 6.12.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
130 mutations (79 of 5.17a's, 11 of them re-anchored for the new spec text, and
51 new, one or more per new rule), all killed by a theorem with a certificate:
130 killed, 0 incidental, 0 survived.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…t near 0.04 s natively (6.10)

With the Miri branches forced on, natively: differential_random_lists 0.039 s,
differential_hostile_bytes 0.041 s, the rest under 0.001 s.

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

Copy link
Copy Markdown
Member Author

Interim result of cargo xtask verify --changed, run from WSL (Ubuntu) on this branch. It had not finished when I wrote this, so this is not a final result.

  • All static checks PASS: no unsafe or lint overrides, listed theorems, clazel-sys audit, tier declarations, spec reviews, pins, generated data, dependency allowlist, and rustfmt.
  • FAIL "select changed crates": git merge-base HEAD origin/main fails with "not a git repository" because the worktree's .git pointer is a Windows path when seen from WSL. This is the known WSL and Windows-linked-worktree environment issue (the same one that breaks "write crate measurements"), not a problem in the change. Because of it, the changed-crate selection did not run, so this is not CHANGED CRATES PASSED.
  • The run was still going (past rustfmt) when I stopped, and has no RESULT line yet.

The proof evidence I do have comes from separate runs: Verus 131 verified, 0 errors, and 130 of 130 mutations killed with certificates (cargo xtask mutate clazel-displaylist); the crate's 8 conformance tests, clippy and cargo xtask check pass natively. CI's full verification has not run and the tier stays 0.

… and changed-crate CI)

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

# Conflicts:
#	crates/clazel-displaylist/README.md
…ri (6.10)

CI took 457 s for 40 random lists and 482 s for 200 hostile byte strings
under Miri, over the 300 s limit for one test. Under Miri they now run 8
and 40, about 95 s each at the rate CI measured. The normal test job is
unchanged.

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

This branch is waiting to be deployed

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