Skip to content

Modeled C §66: UAT and examples rewritten to the facade surface; zlib/bzip2/libcurl facades; user-programs-safe - #1625

Merged
ehartford merged 2 commits into
modeled-c-stage11from
modeled-c-uat-rewrite
Sep 24, 2026
Merged

ehartford merged 2 commits into
modeled-c-stage11from
modeled-c-uat-rewrite

Conversation

@ehartford

Copy link
Copy Markdown
Contributor

Ruling §66's last step, now that the SQLite facade (#1619) is on main: the user programs are rewritten to the facade surface. Stacks on #1618 (branch modeled-c-stage12b): the sqlite3 fixture spells the callback-less exec with None and compiles once that lands.

sqlite3 (done)

  • build/release_uat_fixtures/sqlite3_main.w: 11 unsafe → 0. Database.open / db.exec / db.prepare / stmt.step / stmt.column_int; the statement is finalized before the connection closes on every path. Same output (sqlite3 UAT passed), verified on stage1 with the interim callback spelling (a closure + i32 userdata) — the None spelling waits for Modeled C: a callback contract cannot mark the callback optional; sqlite3_exec with no callback ("If the callback is NULL, no callback is invoked") needs a no-op fn (ruling §44) #1618.
  • build/release_uat.w: the C-package UAT writes lib/facades/sqlite3.w into the fresh project as src/facades/sqlite3.w (§16.2b.1: the facade is the project's own until the package ships it), so use facades.sqlite3 resolves in the project itself and not through the parent-lib/ walk into this repository. build.w: the facade is an input of :release-sqlite3-uat.
  • docs: with_for_ai.md §16, with-migration-guide.md, with-idiomatic-guide.md (the hand-rolled impl Drop wrapper → the facade clauses), with-release-runbook.md.

zlib / bzip2 / libcurl: stopped at zlib (§65)

No facade written. The one-shot zlib surface (compress/uncompress) and bzip2's BZ2_bzBuffToBuff* take caller-owned buffers with a length parameter, and the facade language has no clause that pairs a pointer with its length. Evidence in #1621: a plain fn compress / lend checks clean and turns the raw-pointer call safe with no bounds contract — the partial model §16.2b.3 forbids — while the program still spells every &raw mut … as *mut Bytef. Those three fixtures keep their unsafe (8 + 5 + 6 = 19 uses; the count was 28 with sqlite3's 11), so :user-programs-safe stays red on them until #1621 lands.

Gaps filed

Not touched (listed)

examples/ has no c_import program (examples/nebula/README.md mentions raw sqlite3 calls in prose only); docs/completed/* are archived designs and keep their historical spellings; no homepage sources are in the repo.

Verification

  • stage1 (with build :dev): the rewritten fixture logic runs and prints sqlite3 UAT passed; the four repros above are pinned in their issues.
  • :user-programs-safe / :release-sqlite3-uat: posted below once the release binary is built.
    No :fixpoint/:test/audits on this branch (folded into the coordinator's stack battery).

@ehartford

Copy link
Copy Markdown
Contributor Author

Verification with the release binary of f7b90b9 (with build full, all targets green):

Eric Hartford added 2 commits September 24, 2026 13:32
…> 0 (ruling §66); the C-package UAT writes the facade into the project as src/facades/<lib>.w

The fixture is what an application developer writes over `with get c.sqlite3`:
Database.open / db.exec / db.prepare / stmt.step / stmt.column_int, the
statement finalized before the connection closes, on every path. The exec
call is spelled with #1618's `None` (no row callback); it compiles once
that lands (the interim unit-userdata spelling traps the compiler, #1622).
The runner copies lib/facades/sqlite3.w beside the program so the fresh
project resolves `use facades.sqlite3` itself, never through the
parent-lib/ walk into this repository. Ceremony left on the surface is
filed: #1624 (prepare's -1/null, exec's errmsg slot).
…diomatic guide and the release runbook track the facade surface (ruling §66)

A spec change updates the example in the same change: the raw
sqlite3_open/&raw mut db spellings and the hand-rolled Drop wrapper give
way to Database.open and the facade clauses that generate it.
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