Skip to content

score zu-c for misuse - #619

Merged
tamnd merged 1 commit into
mainfrom
c-misuse
Aug 22, 2026
Merged

tamnd merged 1 commit into
mainfrom
c-misuse

Conversation

@tamnd

@tamnd tamnd commented Aug 22, 2026

Copy link
Copy Markdown
Owner

tamnd/zu-c#7 landed a C test harness and a fifteen case misuse suite. zu-c goes from 22 to 39 of the 90 its tier asks for.

The item asks for the misuse and lifecycle suite of dx/15 section 4: deliberately wrong programs, and for each one no crash, no leak, and a clear message. What made it more than a file of new cases is that zu-c had no C tests at all. The repository whose reason for existing is the C ABI was testing that ABI entirely through the header-only C++ wrapper, which means every promise the wrapper keeps on a caller's behalf was a promise the suite had never asked the ABI to keep. A destructor does not run twice. A zu::Connection has no null state to pass. A Result cannot outlive its Connection by accident, because the wrapper arranged that it cannot.

Most of the misuse item lives in exactly that gap, so the work was a C harness first and then the suite.

Two things came out of writing it, both filed rather than absorbed:

The progress watcher may call zu_conn_rows_read and the header says it may not. zu_query, zu_prepare and zu_begin from in there all answer ZU_MISUSE_CONCURRENT as promised, but zu_conn_rows_read answers ZU_OK while the header names zu_conn_interrupt as the only call meant to cross threads. The behaviour is right and the sentence is wrong, since a watcher reporting a rate has no other way to the row count. That is #618, and all five statuses are asserted in the suite so that resolving it either way is a failing test rather than a surprise.

A bad path answers ZU_CORRUPT or ZU_IO, not the ZU_ERROR I reported on #614. A file that is there and is not a database is corrupt; a path with nothing at it, or one that is a directory, is io. That is the distinction a user needs and the engine already draws it well. The correction is on #614.

The overview was regenerated with cargo run -q -p xtask -- clients. One line moved.

tamnd/zu-c#7 put a C test harness and a fifteen case misuse suite in
the repository that had, until now, no C tests at all. The row goes 22
to 39 of the 90 it owes.

Worth saying why that was the shape of the work rather than a file of
new cases. The wrapper is header-only, so a C++ test reaches the ABI
through it, and every promise the wrapper keeps for a caller is one the
suite had never asked the ABI to keep. Most of the misuse item is in
that gap: a destructor does not run twice, a zu::Connection has no null
state to pass, a Result cannot outlive its Connection by accident.

Two findings out of it, both filed: the progress watcher may call
zu_conn_rows_read though the header says only zu_conn_interrupt crosses
threads, which is #618, and a bad path answers ZU_CORRUPT or ZU_IO
rather than the ZU_ERROR I had reported on #614.
@tamnd
tamnd merged commit da7eed3 into main Aug 22, 2026
36 of 40 checks passed
@tamnd
tamnd deleted the c-misuse branch August 22, 2026 15:41
@tamnd tamnd mentioned this pull request Aug 22, 2026
22 tasks
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