mcl-graph: CozoDB on SQLite only — no RocksDB, no import, no way back #2

Manually merged
terra merged 9 commits from pallas/19-off-rocksdb into main 2026-11-23 04:34:21 +00:00
Member

Purpose (work): mcl-graph leaves RocksDB for good — the store is CozoDB on its SQLite engine in graph.sqlite and nothing else — so the RocksDB images can be deleted once every service is ported (macula-io/macula-ci-images#19 step 1b, design §2 as amended on 2026-11-23).

DECIDED 2026-11-23 (Raf): "we don't use rocksDB anymore", then "Port them off, then delete (Recommended)", and "Yes, build it (Recommended)" for this package; then "Drop the migration (Recommended)", after his question "is there even a 'before the switch'? AFAIK, mcl-graph has never really been used". The design's mcl-graph section is amended on macula-io/macula-ci-images#19 (comment 1003) and in DESIGN_2026-11-23_off-rocksdb.md, with the Supervisor's evidence: /bulk0/mcl-graph/data holds one 2109-byte sst of the two relation definitions (10 entries, 2026-10-06) and empty WALs since. There is no graph data.

What changes — the removal, from the ported tip 5113d67

  • Gone: mcl_graph_migrate (R3, the one-time import) with mcl_graph_migrate_tests, and mcl_graph_reverse_export (R4, the way back) with mcl_graph_reverse_export_tests, and mcl_graph_store_migration_tests. There is nothing to import and nothing to go back to. A boot on a data directory with no graph.sqlite gets a fresh store and its schema, whatever else sits beside it; the old RocksDB directory is never opened.
  • Gone: the dual-engine build. Cargo.toml asks cozo for storage-sqlite, so cozorocks — and with it RocksDB, lz4 and zstd — leaves cozo's dependency graph. Cargo.lock is regenerated: 212 lines out, and the three remaining insertions are the dependency lists re-sorted.
  • mcl_graph_nif: open/1 replaces open/2; backup/2, restore/2 and sync_path/1 go with the import that used them, and open/1 is the whole surface. The stub, the Rust crate, the moduledoc and the NIF's own comments say one engine, one file, created on the first open.
  • mcl_graph_store: init ensures the data directory and opens graph.sqlite in it; CozoDB creates the file. schema_statements/0 is removed — only the deleted tests used it.
  • The docs and the comments follow the build they describe. The README's "Moving off RocksDB" becomes "The store": the file is created on first start, the earlier release's RocksDB directory is neither read nor imported, and the fleet change that moves this service deletes it after the switch. The CHANGELOG's Unreleased section quotes the decision, the architecture README's NIF module rows (open/1) and image paragraphs say no RocksDB is linked, and the stale RocksDB comments in mcl_graph.app.src, config/sys.config.src, Containerfile, native/build-nif.sh, scripts/ci-gate.sh, lint-and-test.yml and build-push.yml are corrected.
  • The images stay the fleet's plain pair on the forge registry, as on the ported tip: macula-ci-otp builds and macula-pq-runtime runs, each by digest, lint's job container is the builder with the org's read-only pull account (CI_IMAGE_PULL_USER / CI_IMAGE_PULL_TOKEN), the checkout is plain shell, and the NIF cache stays GitHub-only.
  • The three ci-images-*.yml files stay byte-for-byte pinned copies and are not edited here.

The C4 diagrams are unchanged, and that is checked, not assumed. c4_diagrams.py never named RocksDB, and a regeneration with /usr/bin/python3 -I in this tree reproduces assets/c4-context.svg, c4-containers.svg and c4-components.svg byte for byte, so the c4-model compare job sees no drift.

Tests: 131 eunit tests, all passing — the previous 150 less the 19 that the three deleted test files carried. The store's own suite still runs against the real NIF on a real graph.sqlite, including the restart that has to find the schema already there; nothing in the remaining suite is mocked where it used to open a database.

Proof on this tip (3fef4ea8f14d12ff29e07cfa5d975a4ba4818e5e): on msi00, scripts/ci-gate.sh with _build cleared (rm -rf, because podman 6.2 silently drops FRESH=1's tmpfs under a bind mount — mcl-graph#1), exit code 0: rebar3 lint clean, rebar3 eunit 131 tests passed, rebar3 dialyzer clean over 14 files (two modules fewer than before). The cold NIF build took 2m46s, in place of the many minutes the cozorocks compile cost. On the forge, on this exact sha: 2254 c4-model success (its jobs c4-model and c4-model-1, so the pinned copy's SVG compare ran) and 2255 lint-and-test success (job check), both on 3fef4ea.

Review: the removal only, 5113d67..3fef4ea, by Jupiter, at most one round. Nothing is deployed by this change: the fleet image pin and the deletion of /bulk0/mcl-graph/data are Raf's menu, not this PR.

Refs macula-io/macula-ci-images#19

Purpose (work): mcl-graph leaves RocksDB for good — the store is CozoDB on its SQLite engine in `graph.sqlite` and nothing else — so the RocksDB images can be deleted once every service is ported (macula-io/macula-ci-images#19 step 1b, design §2 as amended on 2026-11-23). DECIDED 2026-11-23 (Raf): "we don't use rocksDB anymore", then "Port them off, then delete (Recommended)", and "Yes, build it (Recommended)" for this package; then **"Drop the migration (Recommended)"**, after his question "is there even a 'before the switch'? AFAIK, mcl-graph has never really been used". The design's mcl-graph section is amended on macula-io/macula-ci-images#19 (comment 1003) and in `DESIGN_2026-11-23_off-rocksdb.md`, with the Supervisor's evidence: `/bulk0/mcl-graph/data` holds one 2109-byte sst of the two relation definitions (10 entries, 2026-10-06) and empty WALs since. There is no graph data. **What changes — the removal, from the ported tip `5113d67`** - **Gone: `mcl_graph_migrate` (R3, the one-time import)** with `mcl_graph_migrate_tests`, and **`mcl_graph_reverse_export` (R4, the way back)** with `mcl_graph_reverse_export_tests`, and `mcl_graph_store_migration_tests`. There is nothing to import and nothing to go back to. A boot on a data directory with no `graph.sqlite` gets a fresh store and its schema, whatever else sits beside it; the old RocksDB directory is never opened. - **Gone: the dual-engine build.** `Cargo.toml` asks cozo for `storage-sqlite`, so cozorocks — and with it RocksDB, lz4 and zstd — leaves cozo's dependency graph. `Cargo.lock` is regenerated: 212 lines out, and the three remaining insertions are the dependency lists re-sorted. - **`mcl_graph_nif`**: `open/1` replaces `open/2`; `backup/2`, `restore/2` and `sync_path/1` go with the import that used them, and `open/1` is the whole surface. The stub, the Rust crate, the moduledoc and the NIF's own comments say one engine, one file, created on the first open. - **`mcl_graph_store`**: `init` ensures the data directory and opens `graph.sqlite` in it; CozoDB creates the file. `schema_statements/0` is removed — only the deleted tests used it. - **The docs and the comments follow the build they describe.** The README's "Moving off RocksDB" becomes "The store": the file is created on first start, the earlier release's RocksDB directory is neither read nor imported, and the fleet change that moves this service deletes it after the switch. The CHANGELOG's Unreleased section quotes the decision, the architecture README's NIF module rows (`open/1`) and image paragraphs say no RocksDB is linked, and the stale RocksDB comments in `mcl_graph.app.src`, `config/sys.config.src`, `Containerfile`, `native/build-nif.sh`, `scripts/ci-gate.sh`, `lint-and-test.yml` and `build-push.yml` are corrected. - **The images stay the fleet's plain pair on the forge registry**, as on the ported tip: `macula-ci-otp` builds and `macula-pq-runtime` runs, each by digest, lint's job container is the builder with the org's read-only pull account (`CI_IMAGE_PULL_USER` / `CI_IMAGE_PULL_TOKEN`), the checkout is plain shell, and the NIF cache stays GitHub-only. - **The three `ci-images-*.yml` files stay byte-for-byte pinned copies** and are not edited here. **The C4 diagrams are unchanged, and that is checked, not assumed.** `c4_diagrams.py` never named RocksDB, and a regeneration with `/usr/bin/python3 -I` in this tree reproduces `assets/c4-context.svg`, `c4-containers.svg` and `c4-components.svg` byte for byte, so the c4-model compare job sees no drift. **Tests: 131 eunit tests**, all passing — the previous 150 less the 19 that the three deleted test files carried. The store's own suite still runs against the real NIF on a real `graph.sqlite`, including the restart that has to find the schema already there; nothing in the remaining suite is mocked where it used to open a database. **Proof on this tip** (`3fef4ea8f14d12ff29e07cfa5d975a4ba4818e5e`): on msi00, `scripts/ci-gate.sh` with `_build` cleared (`rm -rf`, because podman 6.2 silently drops `FRESH=1`'s tmpfs under a bind mount — mcl-graph#1), exit code 0: `rebar3 lint` clean, `rebar3 eunit` 131 tests passed, `rebar3 dialyzer` clean over 14 files (two modules fewer than before). The cold NIF build took 2m46s, in place of the many minutes the cozorocks compile cost. On the forge, on this exact sha: **2254 `c4-model` success** (its jobs `c4-model` and `c4-model-1`, so the pinned copy's SVG compare ran) and **2255 `lint-and-test` success** (job `check`), both on `3fef4ea`. **Review**: the removal only, `5113d67..3fef4ea`, by Jupiter, at most one round. Nothing is deployed by this change: the fleet image pin and the deletion of `/bulk0/mcl-graph/data` are Raf's menu, not this PR. Refs macula-io/macula-ci-images#19
The gate found what the WIP commit could not: the old store is not
<data dir>/CURRENT but <data dir>/data/CURRENT (cozo opens the store on the
directory and keeps RocksDB beneath it), so the import never triggered; the
import's backup file was left in the data directory on success and on a
mismatch; mcl_graph_reverse_export nested a fun past the structural lint's
limit; and the store's failed-import test took its own caller down with the
linked exit. Each is fixed. In the CI image on msi00: rebar3 lint clean,
eunit All 147 tests passed, dialyzer run after them.

Docs: the README's Moving off RocksDB section (the one-time import, the way
back and its command), CHANGELOG under Unreleased, the moduledocs, the
Containerfile and sys.config comments, and the C4 diagrams regenerated from
architecture/c4_diagrams.py.

Actions are off on macula-services/mcl-graph (has_actions false), and the
Supervisor's GO to flip them comes with a condition, so the workflows are
ported here: the lint job pulls the forge plain pair by digest with the org's
read-only CI_IMAGE_PULL credentials, checks out in plain shell with no
marketplace action, and keeps its timeout; the NIF cache stays GitHub-only;
build-push gets a timeout. The Containerfile and the service tests follow the
pair; nothing here read either rocksdb image's librocksdb.
Every other failure path already removed graph.sqlite.importing and the
backup the import had read back: a refused backup, a refused restore, a count
mismatch, and the way on. The one path left was the count query on the freshly
restored file coming back an error: the half-made import file was discarded
and the backup beside it stayed in the data directory until the next start
happened to remove it.

The test asks for that failure by name (new_counts), because a real store
cannot be made to show it, and the fake's backup now writes its file the way
cozo's does, so the assertion that no backup is left proves something on every
failure path, not only the new one.
The module table still listed open/1 and the four calls it had before the
engine moved to open/2; backup/2, restore/2 and sync_path/1 are the three the
import and the way back added beside it.
The Containerfile's builder and runtime moved to git.macula.io, and the
publish job on GitHub builds that Containerfile: without a login for that
registry the pull fails before anything is built, so the release path would
have found the port before CI did. The org's read-only pull account names
both, the same two the lint job's container already uses, and the test that
holds the Containerfile's builder to CI's image now pins this login too.

The gate script stays on the ghcr rocksdb image for now and says so: it is
the one a box can pull without that account. It must move to the forge
builder before the rocksdb pair is deleted.
Each of these cases loads the 33 MB NIF before its own work starts, and the
loaded box they ran on put the first of them at 3.3 s against eunit's
five-second default: one slow neighbour and a suite with nothing wrong with it
goes red. The case that was already given a long timeout showed the shape;
these eight follow it, at 60 s.

The assertions are unchanged: the cases a mutant was killed by then are killed
by the same line.
A marker says an import finished here; with graph.sqlite gone, re-importing
the kept RocksDB store would serve the cutover-era graph and drop every write
since, and with no store either the service would start empty. Both now stop
with {marker_without_graph, Marker}. Two tests plant each case.
Saturnus's port check on PR 2, folded in before the Actions flip.

The cache step is gone. Caching the NIF build was a marketplace action behind
an `if: github.server_url == ...`, which reads as free on the forge, but a
forge runner clones every action a workflow names at setup, skipped or not.
The forge has no cache service to spend it on, so the step only bought that
clone: a forge run builds cold in a fresh job with a fresh checkout.

The job runs on `docker`, the label every runner in the fleet carries, as
mcl-stations' ported test workflow does: the forge resolves no hosted
`ubuntu-latest` for a repository of ours. actionlint knows only the hosted
labels, so .github/actionlint.yaml declares this one; without it the check
fails on a runner that is right.

One commit, no new test run: a workflow-only change, and actionlint is 0 over
every file under .github/workflows/.
The first run of this tree on the forge's own runners
All checks were successful
c4 model / c4-model-1 (pull_request) Successful in 2s
c4 model / c4-model (pull_request) Successful in 0s
lint-and-test / check (pull_request) Successful in 11m0s
5113d67325
Actions were off on this repository when the port landed, so this tip has
never run. Turning them on fires nothing by itself: this empty commit exists
only to fire them, and it changes no file -- the tree is the one Jupiter
passed at r=2 and Saturnus re-checked, byte for byte.

Nothing to review here: read the commits below it.
Strip the migration, the way back and the dual-engine build
Some checks failed
c4 model / c4-model-1 (pull_request) Successful in 3s
c4 model / c4-model (pull_request) Successful in 0s
lint-and-test / check (pull_request) Successful in 4m55s
build-and-push / guard-1 (push) Has been skipped
build-and-push / guard (push) Successful in 0s
build-and-push / check (push) Failing after 1s
build-and-push / test (push) Failing after 0s
c4 model / c4-model-1 (push) Successful in 5s
c4 model / c4-model (push) Successful in 0s
lint-and-test / check (push) Successful in 6m3s
build-and-push / build-and-push (push) Has been skipped
build-and-push / attest (push) Failing after 0s
3fef4ea8f1
DECIDED 2026-11-23 "Drop the migration (Recommended)" (Raf), after "is there
even a 'before the switch'? AFAIK, mcl-graph has never really been used".
The store at beam01 holds 10 entries of schema and empty WALs, so nothing is
imported and there is nothing to go back to.

The one-time import (R3) and the reverse export (R4) are gone, with their
modules and tests: mcl_graph_migrate, mcl_graph_reverse_export, and the three
test files that drove them.

mcl-graph is CozoDB on SQLite only. The store opens graph.sqlite directly and
CozoDB creates it on the first open; the NIF stub and the Rust crate are
open/1 on SQLite, with backup, restore and sync_path removed; Cargo.toml asks
cozo for storage-sqlite, so cozorocks, RocksDB, lz4 and zstd leave the
dependency graph (Cargo.lock, 212 lines out).

The docs and the comments follow: the README's "Moving off RocksDB" becomes
"The store", the CHANGELOG's Unreleased section keeps the strip's own story
and quotes the decision, the architecture README's NIF rows say no RocksDB is
linked, and the stale comments in app.src, config, Containerfile,
build-nif.sh, ci-gate.sh and both workflows go with the build they described.
The C4 SVGs are unchanged: c4_diagrams.py never mentioned RocksDB, and a
regeneration reproduces them byte for byte.

Refs macula-io/macula-ci-images#19
pallas changed title from mcl-graph: the store opens SQLite, with a one-time import off RocksDB and a way back to mcl-graph: CozoDB on SQLite only — no RocksDB, no import, no way back 2026-11-23 04:07:00 +00:00
terra manually merged commit 3fef4ea8f1 into main 2026-11-23 04:34:21 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
macula-services/mcl-graph!2
No description provided.