Repository navigation
feat: open options, query cursors, fact log and log writer (v3) - #4
Merged
Merged
Conversation
Exposes the v3 core's ETL surface in the C API, following minigraf's docs/superpowers/specs/2026-10-07-binding-etl-surface-design.md: - minigraf_open_with_options with a JSON options object and an error_out for the message (project-minigraf/minigraf#465). - minigraf_query and MiniGrafCursor: vars, next_batch (JSON rows), last_error, free (project-minigraf/minigraf#462). - minigraf_fact_log and MiniGrafFactLog (JSON records with typed values), minigraf_current_tx_count, and MiniGrafLogWriter: create, append, append_batch, advance_tx_count, tx_count, finish, last_error, free (project-minigraf/minigraf#467). cbindgen now maps usize to size_t. A new c-smoke CI job compiles tests/c/etl_smoke.c against the header and the static library with -Werror and runs it. Depends on the unreleased v3 core by git revision; switches to the crates.io release at v3.0.0. CI runs on pushes to v3. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015GgLEs8YozJjYhwPEYgTUn
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The C part of project-minigraf/minigraf#462, #465 and #467. It follows the shape in minigraf's
docs/superpowers/specs/2026-10-07-binding-etl-surface-design.md(minigraf PR #468).What's new
minigraf_open_with_options(path, options_json, char **error_out). Options are a JSON object, so new options never change the ABI, and unknown keys are API-017. With no handle to holdlast_error, an open failure stores its message in*error_out, which the caller frees withminigraf_string_free.minigraf_current_tx_count(db, &out)is added too.minigraf_query,minigraf_cursor_vars,minigraf_cursor_next_batch(c, n)(JSON rows, or NULL at the end or on error),minigraf_cursor_last_error,minigraf_cursor_free.minigraf_fact_log(db, filter_json),_next_batch(a JSON array of records with typed{"type","value"}values),_last_error,_free.minigraf_log_writer_create(path, options_json, &err),_append(record_json),_append_batch(records_json)(a fact-log batch can be passed straight in; a rejected record ends the message with(batch index N)),_advance_tx_count,_tx_count,_finish,_last_error,_free(abandons an unfinished build). Use afterfinishis API-018.cbindgen.tomlsetsusize_is_size_t, so batch sizes aresize_t. The header is regenerated with cbindgen 0.29.2, matching the header-drift job.Branching
Targets the new
v3branch, a copy ofmain.minigrafis a git dependency on the corev3commit from PR #468, and serde derive is added for the JSON shapes. CI now also runs on pushes tov3.Testing
cargo test: 10 passed (3 new). They cover cursor batches of 1/7/1000 equal toexecute(), API-012, read-only open/two readers/API-014/STG-042/API-017 for unknown options and NULLerror_out, record JSON (ref, forever), the tx filter, a round trip with identical records andtx_count, API-018, STG-043, API-015 with batch index, API-017 for a bad UUID, and free leaving no file.c-smokeCI job:tests/c/etl_smoke.cis compiled withgcc -std=c99 -Wall -Wextra -Werroragainstinclude/minigraf.handlibminigraf.a, then run. It passes locally.🤖 Generated with Claude Code
https://claude.ai/code/session_015GgLEs8YozJjYhwPEYgTUn