ci: the forge port — docker runner, plain-shell checkout, c4 stand-in at 862d8b32 #4

Manually merged
terra merged 13 commits from ceres/3-forge-ci into main 2026-11-23 20:23:45 +00:00
Member

Purpose (ci-port): this repository's lint and c4 gates run on the forge's own runner, once its Actions are on (macula-services/mcl-rag#3, macula-io/forge-setup#16).

  • lint.yml: runs-on: docker (the forge runner's label); timeout-minutes: 15, derived from the timed run (all twelve steps took 89 s at 40239ad in the same image); and the plain-shell checkout step instead of actions/checkout@v4, a JavaScript action a node-less macula-ci container cannot run. The step is byte-identical to mcl-mail's (macula-io/martha#601).
  • .github/actionlint.yaml: the station's file, telling actionlint the forge's docker label.
  • c4-model.yml: still calls the local stand-in, with no with: (ubuntu-latest is a label the forge serves).
  • ci-images-c4-model.yml: re-cut at macula-ci-images 862d8b32 (adds the service Container-diagram handling and timeout-minutes: 5), byte for byte below the stand-in header.
  • build-push.yml and the other three ci-images stand-ins are untouched.

Proof (no forge run exists: has_actions is false for this repo):

  • actionlint 0 on every workflow. Its run is not vacuous: a workflow naming an unknown label and one with a bad step key both fail, and docker appears in the known-label list, so .github/actionlint.yaml is loaded.
  • tail -n +11 .github/workflows/ci-images-c4-model.yml | diff - <(git -C macula-ci-images show 862d8b32:.github/workflows/c4-model.yml) — identical.
  • the checkout step diffed against mcl-mail's lint.yml — identical.
  • the ported c4_model.sh exits 0 on this tree and 1 on a tree with no diagrams.

Precondition, named and not fixed here: lint.yml pulls git.macula.io/macula-io/macula-ci-otp by digest through vars.CI_IMAGE_PULL_USER / secrets.CI_IMAGE_PULL_TOKEN; those are repo settings only the forge admin (Saturnus) can set. mcl-mail's port avoids this by pulling ghcr anonymously, and its runs are green.

Refs macula-services/mcl-rag#3

Purpose (ci-port): this repository's lint and c4 gates run on the forge's own runner, once its Actions are on (macula-services/mcl-rag#3, macula-io/forge-setup#16). - lint.yml: `runs-on: docker` (the forge runner's label); `timeout-minutes: 15`, derived from the timed run (all twelve steps took 89 s at 40239ad in the same image); and the plain-shell checkout step instead of `actions/checkout@v4`, a JavaScript action a node-less macula-ci container cannot run. The step is byte-identical to mcl-mail's (macula-io/martha#601). - .github/actionlint.yaml: the station's file, telling actionlint the forge's `docker` label. - c4-model.yml: still calls the local stand-in, with no `with:` (ubuntu-latest is a label the forge serves). - ci-images-c4-model.yml: re-cut at macula-ci-images `862d8b32` (adds the service Container-diagram handling and `timeout-minutes: 5`), byte for byte below the stand-in header. - build-push.yml and the other three ci-images stand-ins are untouched. Proof (no forge run exists: `has_actions` is false for this repo): - actionlint 0 on every workflow. Its run is not vacuous: a workflow naming an unknown label and one with a bad step key both fail, and `docker` appears in the known-label list, so `.github/actionlint.yaml` is loaded. - `tail -n +11 .github/workflows/ci-images-c4-model.yml | diff - <(git -C macula-ci-images show 862d8b32:.github/workflows/c4-model.yml)` — identical. - the checkout step diffed against mcl-mail's lint.yml — identical. - the ported c4_model.sh exits 0 on this tree and 1 on a tree with no diagrams. Precondition, named and not fixed here: lint.yml pulls `git.macula.io/macula-io/macula-ci-otp` by digest through `vars.CI_IMAGE_PULL_USER` / `secrets.CI_IMAGE_PULL_TOKEN`; those are repo settings only the forge admin (Saturnus) can set. mcl-mail's port avoids this by pulling ghcr anonymously, and its runs are green. Refs macula-services/mcl-rag#3
Tag A of macula-io/macula-ci-images#19 step 2: behaviour unchanged, plus the
two tools the cutover needs from the OLD release.

rag_barrel_export opens the barrel store exactly as the service does, folds
every document and writes rag-export.jsonl (one line per document with its
vector) plus rag-export.counts.json. rag_barrel_import reads the same format
into a FRESH barrel dir, refusing a non-empty target and a count that differs
from the export's counts file: that is the way back.

rag_export_file is the format both ends share: JSON per line, every binary
base64 (content and raw_bytes are arbitrary bytes, and the document fields are
an Erlang term), the vector as little-endian f32 bytes so equality is a byte
comparison.

scripts/rag-oneshot.sh runs one expression with no node started and the
release's own sys.config; the release's eval pings a running node instead.

Refs macula-io/macula-ci-images#19
macula-io/macula-ci-images#19 step 2, tag B, in progress.

native/mcl_rag_store_nif: rustler 0.38 + rusqlite (bundled SQLite, Apache/MIT).
One rag.sqlite file: docs (kind/source_path/repo_id/corpus_id columns, the rest
as an Erlang term blob), vectors as f32 blobs, a topics table, and a meta
table. Vectors are loaded into one flat in-memory f32 buffer at open and kept
current by put/delete; the exact cosine scan runs in native code over that
buffer on a dirty scheduler (the architect's note, ci-images#19 c1489). Point
writes are dirty-I/O NIFs. 16 Rust tests, clippy -D warnings clean.

rag_store keeps its public contract and the 19 procedures; its inside is now
the NIF. The cutover import runs inside the open: no rag.sqlite and an
rag-export.jsonl beside it -> import into rag.sqlite.importing, counts checked
against rag-export.counts.json, fsync, atomic rename, marker; a mismatch is a
stop (store_open_failed), not a log line.

rag_export_file is the shared JSONL (base64 payloads; the term and the raw
bytes travel losslessly). rag_embed_ollama replaces barrel's ollama provider
on inets/httpc. barrel, barrel_docdb and the rocksdb override are gone from
rebar.config and rebar.lock, as are tag A's barrel one-shots.

NOT DONE YET: the barrel-coupled tests are not ported (rag_store_opening_tests,
rag_store_paging_tests, topic_scoped_search_tests, rag_embedder_tests'
provider name, mcl_rag_release_files_tests, mcl_rag_app_deps_tests); eunit is
168 passing / 6 failing. The image pair is not yet moved to
macula-ci-otp/macula-pq-runtime, and lint.yml still names the rocksdb pair.

Refs macula-io/macula-ci-images#19
The store rewrite left six tests mecking or calling barrel, and the new
code called a `json' module that does not exist (the dependency is jsx),
so the export and the ollama client would have crashed on first use.

- rag_store_opening_tests mocks mcl_rag_store_nif instead of barrel; the
  "supervised by barrel" test becomes "the open opens the store file".
- rag_embedder_tests and the release-files tests name rag_embed_ollama and
  inets; sys.config.src loses the barrel_docdb block.
- topic_scoped_search_tests drives the topics pass on the NIF directly.
- rag_store:open_db/0 validates the embedder provider at the open again,
  as opening barrel did, so an unknown model still stops the store.
- json:encode/decode -> jsx in rag_export_file, rag_store and
  rag_embed_ollama.
- New: rag_export_file_tests (lossless round trip including a non-UTF-8
  binary and a non-ASCII fields term; the counts compare) and
  rag_cutover_import_tests (a counts mismatch stops the store; a boot
  import serves its documents and writes the marker).
macula-ci-images#19 step 2, item 3. The store no longer links librocksdb, so
the rocksdb image pair is not wanted: the Containerfile and lint.yml move to
the fleet's plain forge pair that mcl-graph builds against, each by digest.

- Containerfile: FROM the forge macula-ci-otp builder and macula-pq-runtime
  runtime; the compile of both NIFs is explicit (build-corpus-sync-nif.sh and
  build-store-nif.sh); the rocksdb comments are gone.
- lint.yml: same builder digest with the forge read-only pull credentials, and
  a clippy + cargo test + build step for native/mcl_rag_store_nif beside the
  corpus-sync one.
- rag_reverse_export: the design's R4 way back -- a one-shot that writes the
  SQLite store to rag-reverse.jsonl + rag-reverse.counts.json, which the old
  release's rag_barrel_import reads into a fresh barrel dir. The one-shot
  script and the Containerfile install name it.
- mcl_rag_service_tests pins the new pair by digest (builder == CI, runtime by
  digest, no `-rocksdb' image named); README says the same.

Refs macula-io/macula-ci-images#19
macula-ci-images#19 step 2, item 4. With the store on SQLite, every comment
that still described a barrel store, a rocksdb image pair or a rebuilt HNSW
index was wrong. CHANGELOG gets an Unreleased section for the cutover (the
store, both NIFs built in the image, the import, the way back); README and the
architecture README say one rag.sqlite file; the C4 diagram source and its two
regenerated SVGs follow. Module docs in the write and read desks, rag_sup,
rag_chunk_embedder, rag_embedder, mcl_rag_service and mcl_rag.app.src are
updated to match.

Refs macula-io/macula-ci-images#19
Found while running the cutover on msi00: rag-oneshot.sh used `erlexec`,
which needs BINDIR (only the release's `erl` wrapper sets it), and passed
`-config releases/$VSN/sys`, which does not exist in a release image (relx
ships sys.config.src, substituted by the start script at boot). Both make the
one-shot fail before it runs anything. Use the release's `erl` with its
`start_clean` boot and no -config; rag_reverse_export now reads MCL_DATA_DIR
from the environment (then the app env, then the container default), so it
needs no sys.config. Verified on msi00: the reverse export wrote
rag-reverse.jsonl from a real store file with this path.

Refs macula-io/macula-ci-images#19
macula-services/mcl-rag#2 r=0, R1, R4, R5 and R6, plus the two lint and one
dialyzer gate reds the branch carried.

R1 (blocker): five filters built their map with an atom key (`#{source_path =>
P}') while `loc/1' reads `<<"source_path">>' and friends, so the filter was
undefined and matched every document. One file's corpus refresh
(`forget_chunks_of_source') deleted every chunk in the store, including
deposits; the per-repo sweep, the per-source listing, the per-corpus watermark
listing and the path lookup were unfiltered too. All five now name the column
the way it is stored, and a key the store does not know is refused by name
(`{error, {unknown_filter_key, Key}}') instead of reading as "no filter".

R4: a data dir with neither `rag.sqlite' nor an export but with barrel's
`rag_chunks/' still in it is refused (`{store_missing_beside_barrel, Dir,
Dirs}') rather than opened as an empty corpus; an export newer than the store
beside it is imported over it, which is the second cutover after a way back.

R5: the count check now reads the store. After the rename the file is reopened
and counted with `doc_counts/1', so an id the export carried twice, or a WAL
checkpoint lost at the close, stops the store
(`{reopened_store_counts_mismatch, ...}') instead of passing on the importer's
own tally; a refused file is removed so the next start redoes the import.

R6: `get/1' answers `not_found' for a catalogue id again instead of a chunk with
`undefined' content and the whole record in its fields; `tag_chunk' refuses a
catalogue id rather than rewriting it as a chunk, and the topics retag writes
each document back with the kind it was read with.

Proof: eunit 230 pass (7 new: the filter refusal, the barrel-beside refusal,
the newer export winning, the duplicate id stopped, the catalogue id),
`rebar3 ct` 60 pass across five suites (13 in embed_corpus_SUITE, including
`forget_chunks_of_source_spares_every_other_path', which fails on 7b027636 and
with the R1 fix reverted), `rebar3 lint` 0, `rebar3 dialyzer` 0. The five ct
failures Uranus read at 7b027636 (get_document_verbatim, retire_document,
refresh namespacing, boilerplate, identical text) were all this one filter bug
and are green.
lint.yml runs on the forge runner's docker label, with a 15-minute ceiling
derived from the timed run (all twelve steps took 89 s at 40239ad), and checks
out through the plain-shell step instead of actions/checkout@v4, which is a
JavaScript action this container image has no node to run. The step is
byte-identical to mcl-mail's.

.github/actionlint.yaml tells actionlint the forge's docker label (the
station's file). c4-model.yml keeps calling the local stand-in with no with:,
and the stand-in is re-cut at macula-ci-images 862d8b32, which adds the
service Container-diagram handling and a 5-minute timeout.

build-push.yml and the other three ci-images stand-ins are untouched.

Proof: actionlint 0 on every workflow (an unknown label and a bad step key are
both caught, so the run is not vacuous); the stand-in's body is byte-identical
to 862d8b32's file; the checkout step is byte-identical to mcl-mail's; the
ported c4_model.sh exits 0 on this tree and 1 on a tree with no diagrams.
No forge run exists until the repo's Actions are turned on (mcl-rag#3,
forge-setup#16).
The lint.yml comments say what is true now: mcl-rag is public, and the twelve steps take 83 s at 1ff7905
Some checks failed
c4 model / c4-model (pull_request) Successful in 0s
lint-and-test / check (pull_request) Has been cancelled
c4 model / c4-model-1 (pull_request) Successful in 4s
ab82ccc97a
Two comments only, no step, no label and no image changed: the job's comment called the repository private, and the timeout comment measured 89 s at 40239ad. The repository is public (macula-ci-images#18), and the same twelve steps at 1ff7905 took 83 s on host00 at OTP 28.

Refs macula-services/mcl-rag#3
r=2 of mcl-rag#2: the two data-loss defects Uranus found, and the four
notes beside them.

D1. `column/2' read an empty path, repo or corpus as "no value", so a
filter for one dropped its clause and matched every document in the
store: `retire_document' on a path-less source listed the first ten
thousand chunks of the corpus and took them with it. The filter now
passes an empty value through as an empty value, and the store reads it
as `IS NULL' -- the column an absent path is written to. A value that
is not a binary is refused by name, for the same reason an unknown key
is. `retire_document' prunes a path-less document by the id its chunks
were stamped with, read from the rule in `maybe_embed_document' that
stamps them.

D2. The old store's `-wal' and `-shm' went with the file the import
renamed over it, and SQLite replayed the old frames onto the freshly
imported file: the store then refused to open at all. They are removed
before the rename.

Note 1 (A's side, on branch ceres/19-rag-tag-a): a refused export
renames its files to `.refused' before it exits 1, so the new release
can never import one.

Note 2. The export a successful import served is renamed to `.imported',
so no later touch of it makes it newer than the store and re-imports it
over the live one.

Note 3. The open's topics pass answers a read error instead of crashing
the open with a case_clause.

Note 4. `forget_chunks_of_repo_except' has its behavioural test: it
spares the kept paths and another repo's chunks.

Each new test is pinned by a mutant: the empty column read as no clause,
the sidecars left in place, the export left in place, the topics clause
removed, the stamping rule bypassed, and `Keep' ignored.
Merge 1ff7905 into ceres/3-forge-ci: one tip holds the r=2 store work and the forge port (macula-services/mcl-rag#3)
All checks were successful
c4 model / c4-model-1 (pull_request) Successful in 8s
c4 model / c4-model (pull_request) Successful in 0s
lint-and-test / check (pull_request) Successful in 9m14s
90b8aa7248
PR 2's branch still carries the GitHub-shaped lint.yml, so the dispatch on 1ff7905 (run 2675) went red at actions/checkout with "node: not found" in ci-otp. The plain-shell port lives on this branch; merged here, one push runs the ported lint.yml over the r=2 code, and its run is the proof for both PRs.
A delete by an empty column value is refused; prune reads a path-less document by its id
Some checks failed
lint-and-test / check (pull_request) Failing after 1s
c4 model / c4-model-1 (pull_request) Successful in 2s
c4 model / c4-model (pull_request) Successful in 0s
dbbf41b764
forget_chunks_of_source(<<>>) and forget_chunks_of_repo_except(<<>>, _)
read the empty value as IS NULL after r=2's D1 fix, so an empty watermark
path or repo id took every path-less chunk or every deposit. Both now
refuse. Prune listed a path-less document's chunks by <<>> instead of the
id they are stamped with: it now uses maybe_embed_document:source_path_or_id/2.

Refs macula-services/mcl-rag#2
Merge remote-tracking branch 'origin/ceres/19-rag-cutover' into ceres/3-forge-ci
All checks were successful
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 8m12s
538d0fd609
terra manually merged commit 8796bcbf8d into main 2026-11-23 20:23:45 +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-rag!4
No description provided.