rit/README.md

80 lines
5.1 KiB
Markdown
Raw Permalink Normal View History

# rit — rust git
feat(gitea): adopt go-gitea/gitea as Railyard's code hosting (apps/gitea) Replaces the from-scratch "Rithub + Rit" build (Dec 21/28 roadmap milestone) with the official gitea/gitea image (MIT) + Postgres, per plans/OSS-ADOPTION-2026-10-15.md's Railyard row 1. Closes the named gap (packages, LFS, wikis, Actions CI) in one compose file instead of a multi-week Rust build. - apps/gitea/docker-compose.yml: gitea/gitea:1.23 + postgres:17, app.ini entirely via GITEA__<SECTION>__<KEY> env (no app.ini committed). Documents three gotchas found proving this locally: the Docker image's CustomPath is /data/gitea itself (not /data/gitea/custom); root-level keys like APP_NAME need the GITEA____KEY (empty section) form; START_SSH_SERVER=true fights the base image's passthrough OpenSSH for :22 and crash-loops. - apps/gitea/custom/: Rithub branding overlay (logo, favicon, brand CSS, header/footer template injection with MIT attribution to Gitea) — pure overlay, no upstream template edited. - apps/gitea/integrations/railyard/: Rago/Mint billing bridge adapted from apps/rithub-forge's (uncommitted, untouched) Forgejo experiment — it already accepted Gitea's X-Gitea-* webhook headers as a fallback, now promoted to primary. 16 new unit tests, all passing. - apps/gitea/deploy/RUNBOOK.md: first production deploy on railyard-box (Oracle A1 ARM64) — Cloudflare Tunnel for HTTPS, SSH on :2222 via the VCN security list, gitea dump/restore backups, rollback. Not executed. - apps/gitea/README.md: full inventory of what existed (apps/rit, apps/rithub — Rust, kept) vs. what Gitea covers vs. what's deployed, plus the local proof log (HTTPS push, SSH push, LFS, npm package registry, wiki — all verified working against the official arm64 image on this machine). - apps/rit/README.md, apps/rithub/README.md: pointer notes to this decision. Neither directory is deleted or modified beyond the note (owner rule). Local proof only — compose stack torn down after screenshots, nothing deployed, nothing pushed to origin. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 03:11:39 +03:00
> **2026-10-15 note:** Railyard's production code-hosting decision for the
> Dec 21/28 roadmap milestone ("Rithub + Rit") is **`apps/gitea`**
> (go-gitea/gitea, MIT) — see `apps/gitea/README.md`'s inventory table for the
> full reasoning. This code is **kept, not deleted** (owner rule), and remains
> available if `rithub`'s Rago/Mint-native billing model is worth finishing
> independently later. It is not currently the dependency of a deployed forge.
A **library-first** Rust implementation of Git's local object/authoring model.
rit owns its safety-critical loose-object, index, tree, commit, and ref-transaction
paths while adopting audited open-source crates for expensive commodity layers.
It is byte-for-byte compatible with real Git where claimed (interop-tested against `git` 2.50).
- Object model: loose blobs/trees/commits/tags (read + write), git-exact SHA-1, canonical framing.
- ODB (zlib, atomic no-clobber writes, SHA-1 verification on read), refs
(HEAD/loose/packed/symbolic plus atomic compare-and-swap updates).
- Checksum-verifying Git index v2/v3 reader, atomic `index.lock` mutation,
recursive ignore-aware `add`, tracked deletion staging, and symlink/path-safe status.
- Canonical recursive `write-tree`, Git commit objects, and atomic branch
compare-and-swap updates.
- Transactional `checkout-tree` materialization with whole-operation collision
preflight, symlink/path confinement, atomic file replacement, and matching
index synchronization. `restore` explicitly replaces selected tracked paths
from the current index without moving `HEAD` or rewriting the index.
- Strict binary pkt-line framing (including protocol-v2 delimiter/response-end
controls), receive-pack command/capability parsing, and report-status encoding.
- Raw and thin Git pack import through gitoxide with checksum/index/delta
verification, target-ODB base lookup, and a two-phase scratch/quarantine
boundary. Decoded objects then pass declared-OID, byte/object/graph bounds,
strict connectivity/fsck, tree/type validation, fast-forward enforcement,
immutable object publication, and one atomic ref CAS. Expected-old deletion
is supported for loose refs and refuses packed backing values. Failed receives
never move a ref; disconnected objects are not published.
- `rit` CLI: `hash-object`, `cat-file`, `ls-tree`, `log`, `status`, `add`,
`write-tree`, `commit`, `checkout-tree`, `restore`, plus a stateful
stdin/stdout `receive-pack` process server for local/SSH adapters and an
argument-safe `upload-pack` bridge to the installed open-source Git backend.
- Real-git interop proves our OIDs match `git hash-object`, `git fsck` accepts
objects we write, and real Git can read/write-tree from an index authored by
rit. Checkout/restore interop also covers modified/untracked collision refusal
and symlink-parent escape attempts.
- Full and genuinely thin packs generated by stock Git can be staged through
receive quarantine into a bare target and pass `git fsck --strict` after
promotion. Corrupt/truncated packs and thin packs with missing bases publish
neither objects nor refs.
- Stock `git push --receive-pack='<rit> receive-pack'` creates and fast-forwards
a bare repository through the process server and deletes loose refs. A client
`--force` does not bypass the server's non-fast-forward policy; deleting a
packed ref fails without exposing or changing its old value.
- **Native upload-pack** (`rit::upload_pack`): protocol-v0 ref advertisement,
want/have negotiation, and rit-generated packfiles. This is what `rit
serve-http` and the rithub forge serve to stock `git clone`/`git fetch` over
smart HTTP and SSH. (The older `rit upload-pack` stdin/stdout subcommand is a
compatibility bridge to an installed Git and is only used for local process
transports.)
- **Client transport** (`rit::remote`): `rit clone`, `rit remote add|remove|list`,
`rit fetch`, `rit pull` (fast-forward only), and `rit push [--force]` against
any rithub / smart-HTTP URL or a local repository path. Fetched packs pass
through the same quarantined, fsck'd receive transaction as server pushes.
HTTP(S) uses the system `curl`; credentials come from the URL or
`RIT_USERNAME` + `RIT_TOKEN` (a rithub personal access token) and are passed
to curl on stdin, never on the command line.
The collaboration **forge** built on this core lives in [`../rithub`](../rithub) (the GitHub equivalent).
Open-source foundations: packed-object reads and received pack/index/delta
verification use gitoxide; ignore patterns use globset. rit does not pretend
these costly primitives were written from scratch.
The protocol boundary follows Git's official
[`gitprotocol-common`](https://git-scm.com/docs/gitprotocol-common),
[`gitprotocol-v2`](https://git-scm.com/docs/gitprotocol-v2), and
[`gitprotocol-pack`](https://git-scm.com/docs/gitprotocol-pack) specifications.
Pkt-line, raw/thin pack ingestion, decoded receive safety, the receive-pack
process contract, native upload-pack, and the clone/fetch/push client are
Rit-native. Still deferred: protocol v2, side-band progress, shallow clones,
packed-refs rewrite/deletion, interrupted-ingest recovery, and SHA-256
repositories.