~ knotless Search/
↑↓ move↵ open⇧↵ all results

grain.social/grain

photography-focused photo sharing platform

grain.social
1 collaborator
0
2

A Rust workspace beside the Node app, built and tested on the runner

Merged
Merged chadtmiller.com asked to merge into feature/rust from grain.social/grain:rust/workspace

What changes

The workspace. Cargo.toml at the root with two crates under crates/, laid out as knotless's are, and knotless's dev and release profiles:

  • grain: the core library the server, CLI and MCP will share, and the grain binary (only --version so far). It starts with knotless's base32 (as is, with its tests) and drisl, DAG-CBOR records read as atproto JSON, which Jetstream, firehose and STAR reading build on. drisl gains tests here: a record of every kind of value, links, and what no record holds (floats, non-text keys, bad CBOR).
  • grain-serve: an axum server answering atproto's /xrpc/_health with its version, on GRAIN_LISTEN (127.0.0.1:2600 by default). A test starts it on a free port and asks.

CI. .knotless/workflows/rust.yml runs cargo fmt --check, clippy with warnings denied and cargo test --workspace --locked in rust:1.98, the image knotless's checks use, on pushes to main and pulls into main or a feature branch, keeping the build, registry and toolchain between runs.

Justfile. just lint and just t, on rustup run stable cargo.

Why

The first step of phase 1: somewhere for the knotless modules to land, checked on the runner from the first pull. grain-mcp joins when it has a tool to offer rather than as an empty crate.

How it was checked

cargo fmt and cargo generate-lockfile here; nothing compiled locally. Building, clippy and the tests are this pull's rust check, its first run. vp's format check passes over the new files (it reflowed two long lines in Cargo.toml).

Shortcomings

No coverage gate yet: knotless's 100% gate (harness/cov.mjs) comes with the harness, once there is code worth gating. check.yml and test.yml still run the Node side; the three fold together as the move goes on.

🤖 Generated with Claude Code

Approved

This adds a Cargo workspace with two crates. grain holds base32, drisl and a --version binary. grain-serve is an axum server answering /xrpc/_health. It also adds a rust.yml workflow and Justfile recipes. I read the workflow and the server code and found nothing wrong. The server is small and correct, and the workflow runs fmt, clippy with -D warnings and the tests, as the description says.

I did not read all of the diff. It is about 2,200 lines, mostly the lockfile and the ported base32/drisl code, and I skimmed that rather than reading it in full.

The rust check had not run when I looked: it was still queued. Nothing was compiled locally either, so the build, clippy and tests are unverified until it passes. Please don't merge before it is green.

One thing to watch on that first run: the workflow's cache: lists absolute paths (/usr/local/cargo/registry, /usr/local/rustup). The other workflows only cache node_modules, so I couldn't confirm the runner accepts paths outside the workspace. If it doesn't, the run will show it.

Merged as 87ae1f6
Part of a stack of 2
  1. A Rust workspace beside the Node app, built and tested on the runner Landed as 87ae1f6
  2. main