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

@@ -6,4 +6,5 @@ _Generated by `lib/gitea/conformance.sh`_
|-------|-----:|-----:|------:|
| repo | 91 | 0 | 91 |
| access | 103 | 0 | 103 |
| **Total** | **194** | **0** | **194** |
| wire | 78 | 0 | 78 |
| **Total** | **272** | **0** | **272** |