8000 feat: open options, query cursors, fact log and log writer (v3) by adityamukho · Pull Request #6 · project-minigraf/minigraf-swift · GitHub
[go: up one dir, main page]

Skip to content

feat: open options, query cursors, fact log and log writer (v3) - #6

Merged
adityamukho merged 1 commit into
v3from
feat/etl-surface
Oct 7, 2026
Merged

adityamukho merged 1 commit into
v3from
feat/etl-surface

Conversation

@adityamukho
Copy link
Copy Markdown
Contributor

The Swift part of project-minigraf/minigraf#462, #465 and #467. It uses the UniFFI shim shared with minigraf-python#6, minigraf-java#9 and minigraf-android#6, and the shape in minigraf's docs/superpowers/specs/2026-10-07-binding-etl-surface-design.md (minigraf PR #468).

What's new

  • MiniGrafDb.openWithOptions(path:options:), query(datalog:) → MiniGrafCursor, factLog(filter:) → MiniGrafFactLog, currentTxCount(), and MiniGrafLogWriter (create, append, appendBatch, advanceTxCount, txCount, finish, close, isOpen).
  • Sources/MinigrafKit/MinigrafKit+Iteration.swift adds cursor.forEachBatch(size:_:), log.forEachRecord(batchSize:_:), MiniGrafError.message and validTimeForever. #462 asked for a Sequence, but a Swift Sequence cannot throw and a batch read can fail, so these take a throwing closure. The release job already copies Sources/MinigrafKit/ with the generated bindings.
  • New swift-test CI job on macOS. It builds the shim, generates the Swift bindings, compiles them with Sources/MinigrafKit and runs Tests/swift/main.swift. Until now CI compiled no Swift at all.

Branching

Targets the new v3 branch, a copy of main. minigraf is a git dependency on the core v3 commit from PR #468. CI now also runs on pushes to v3.

Testing

  • cargo test: 25 shim tests passed.
  • Tests/swift/main.swift covers batches of 1/7/1000 equal to execute(), a cursor fixed at open and after close, API-012, two read-only handles, API-014, the writer refused, STG-042, record values (ref, keyword, forever), filters, API-017, a round trip with identical records and currentTxCount, a hole, API-015 with batch index, API-018, STG-043, and close leaving no file. No Swift toolchain was available locally, so this job's first run is on CI.

🤖 Generated with Claude Code

https://claude.ai/code/session_015GgLEs8YozJjYhwPEYgTUn

Exposes the v3 core's ETL surface with the shim shared by the UniFFI
bindings (minigraf-python#6), following minigraf's
docs/superpowers/specs/2026-10-07-binding-etl-surface-design.md:
open_with_options (project-minigraf/minigraf#465), query cursors
(#462), and the fact log and log writer (#467).

Swift idiom on top: forEachBatch/forEachRecord (a Sequence cannot
throw), MiniGrafError.message and validTimeForever. A new swift-test CI
job compiles the generated bindings with Sources/MinigrafKit and runs
Tests/swift/main.swift on macOS; before it, CI compiled no Swift.

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
@adityamukho
adityamukho merged commit cfbdc69 into v3 Oct 7, 2026
3 checks passed
@adityamukho
adityamukho deleted the feat/etl-surface branch October 7, 2026 06:03
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

0