Skip to content

Bundle 2: registry facades and zero-unsafe UATs for libcurl, sqlite3, sdl, raylib - #3662

Merged
ehartford merged 8 commits into
mainfrom
bundle2-facades
Nov 27, 2026
Merged

ehartford merged 8 commits into
mainfrom
bundle2-facades

Conversation

@ehartford

Copy link
Copy Markdown
Contributor

Closes #3143
Closes #3111
Closes #3146
Closes #3157
Closes #3159

Summary

Bundled registry facades and supporting compiler foundations verified under a single seed-driven battery:

Compiler Foundations

  1. CiFacts / CiFacadeDraft full contract forwarding (828cd77ae): Carry c facts NAME error E:, top-level domain/preserves domain/handle/message (D216), rich pointer-resource clauses (from f(out param N), abandon, ok, message, borrows, independent, thread, requires domain), fn contract clauses (rename, preserves, callbacks none, present cases, valid on failed, null status, consumes ... destroyed_by, callback ... userdata/argv, user_data, returns borrow ...), and buffered variadic case tables from registry facts.with into drafted contracts.
  2. D246 borrow-only child resources & of <Resource> disambiguation (4b82caeb9): Delegated under D237 — allow borrow-only child resources (e.g., libcurl's Part wraps *mut curl_mimepart) with returns borrow R from param N rendering only Borrowed<R>[Origin] and its lend methods; narrow ambiguous multi-resource C representations (*mut CURL vs *mut CURLSH, both *mut c_void) using of <Resource>.
  3. Per-slot callback pairs & Option/Result payload extraction (300ce6160): Track callback/userdata pairs per slot in ForeignPairState so multiple callback pairs on one resource (WRITEFUNCTION/WRITEDATA + HEADERFUNCTION/HEADERDATA) retain independent types and origins without clobbering one another; initialize FOREIGN_PAIR_CREATE when extracting a resource from a non-resource container (let Some(h) = Easy.new()).

Registry Facades & Zero-Unsafe UATs

  • c.sdl (#3157, 105b4a945): registry/c/sdl/facts.with (Window, Renderer, Surface, Texture, message Event wraps SDL_Event, rendering & window methods); removed inline contract from uat/sdl.uat and expanded uat/fixtures/sdl_main.with with Event.poll() loop (pass: 11 steps).
  • c.sqlite3 (#3146, 7475c99cb): registry/c/sqlite3/facts.with (Database, Statement, Context, Value, open/open_v2, prepare, exec/exec_with, create_function_v2, bindings, columns, errmsg); removed inline contract from uat/sqlite3.uat and expanded uat/fixtures/sqlite3_main.with with transactions, bound statements, UDF, and error messages (pass: 7 steps).
  • c.libcurl (#3143, #3111, 177019e9b): registry/c/libcurl/facts.with (Easy, HeaderList, Mime, borrow-only Part, setopt variadic cases including WRITEFUNCTION/HEADERFUNCTION/HTTPHEADER/MIMEPOST, getinfo fills cases, version_info); removed inline contract from uat/libcurl.uat and expanded uat/fixtures/libcurl_main.with (pass: 7 steps).
  • c.raylib (#3159, f7ea113ee): Expanded registry/c/raylib/facts.with (LoadTextureFromImage, FontData, ShaderData, AudioStreamData) and uat/fixtures/raylib_spiral_main.with (texture upload/draw/unload, default font DrawTextEx, IsKeyDown, audio stream lifecycle, explicit unload order; pass: 10 steps).

Verification

  • Targeted tests (behav_d246_borrow_only_resource, err_3114, foreign_pair_*, all callback-pair compile-error tests): PASS
  • Targeted UATs (sdl, sqlite3, libcurl, raylib_spiral): ALL PASS
  • Seed-driven battery (WITH=$PWD/src/main with run tools/battery.with): running now; verdict will be posted before marking ready.

@ehartford

Copy link
Copy Markdown
Contributor Author

Seed-driven battery verdict (WITH=$PWD/src/main, commit 42e958547):

out/battery/battery.log: rc=0 green
battery rc=0 wall=857s
behavior-tests: 2349/2349 ok
native-compile-error-tests: 2208/2208 ok
internals-tests: 144/144 ok
EMIT-C SMOKE OK (54 cases)
uat: 16 scenarios: 15 pass, 1 skip (raylib_spiral_windows, Windows-only)

Marking ready and merging.

@ehartford
ehartford marked this pull request as ready for review November 27, 2026 21:05
@ehartford
ehartford merged commit a059721 into main Nov 27, 2026
1 check passed
@ehartford
ehartford deleted the bundle2-facades branch November 27, 2026 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment