sx-gitea Phase 3: wire — smart-HTTP protocol over native CIDs (TDD, 272/272)

lib/gitea/wire.sx: git-style pkt-line framing (byte-compatible hex4
lengths + flush sections); object closure walker (commits/trees/blobs/
tags) with missing-object detection; wants/haves pack negotiation.
Objects travel as '<cid> <serialized-sx>' pkt lines — receivers re-derive
the CID from the bytes, so packs are tamper-evident by construction.

Server endpoints: GET info/refs (read-gated advertisement incl. '@ HEAD'
symref line), POST git-upload-pack (read), POST git-receive-pack (write;
401/403/404 like the rest of the API) with per-ref command application:
create/update/delete via ref-CAS, fast-forward enforcement on heads/*,
closure-completeness check, stale detection, heads|tags-only.

Client: gitea/remote over any dream app fn — ls-remote, clone! (sets
HEAD + default-branch, cleans up on unreachable remote), mirror fetch!,
push!/push-delete! with local pack computation. Suite syncs two
in-memory forges end to end: clone, incremental fetch, push, non-ff
rejection + recovery, branch create/delete, tag push, private-repo
credentialed round trip.

sx-parse comes from spec/parser.sx on the OCaml server host — added to
the conformance load order. Also merged loops/git (git-wire export/
import adapters, 267/267) for future stock-git interop.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-03 13:35:40 +00:00
parent 336a61ae66
commit 83a8a2f8db
5 changed files with 1054 additions and 4 deletions

View File

@@ -23,6 +23,7 @@ VERBOSE="${1:-}"
SUITES=(
"repo|gitea-repo-pass|gitea-repo-fail|gitea-repo-fails"
"access|gitea-access-pass|gitea-access-fail|gitea-access-fails"
"wire|gitea-wire-pass|gitea-wire-fail|gitea-wire-fails"
)
OUT_JSON="lib/gitea/scoreboard.json"
@@ -32,6 +33,7 @@ OUT_MD="lib/gitea/scoreboard.md"
# (types/router/middleware/error/html/json/api), then the gitea modules.
MODULES=(
"spec/stdlib.sx"
"spec/parser.sx"
"lib/r7rs.sx"
"lib/persist/event.sx"
"lib/persist/backend.sx"
@@ -69,6 +71,7 @@ MODULES=(
"lib/gitea/repo.sx"
"lib/gitea/access.sx"
"lib/gitea/web.sx"
"lib/gitea/wire.sx"
)
run_suite() {