sx-gitea Phase 4: issues — content-document bodies + relations graph (TDD, 360/360)

lib/gitea/issues.sx: issues as kv records (zero-padded per-repo
numbering, title/author/state, sorted label+assignee sets, Markdown
body, comment thread). Bodies and comments are content-on-sx documents:
content/from-markdown -> block doc -> content/html for pages, with the
round-trip law asserted in the suite. The issue graph (issue->repo
parent, author origin, assignee member, label link, commenter reply) is
DERIVED into lib/relations facts and rebuilt on fact change — same
pattern as the acl db, so deleting a repo can never dangle edges.

Views: open/closed/by-label/by-assignee; graph queries: repo-issue-nodes,
user-authored, user-assigned, label-issues, issue-participants.

Web: issues list + issue page (rendered HTML body + comments), JSON API:
create (any authenticated reader), comment, close/reopen (author or
write), label/assignee management (write). All read-gated like the rest.

Infra: gitea/route-packs registry — wire/issues append their routes at
load; gitea/app serves all packs. repo-delete! now purges collab/issue/
issue-seq rows too (ghost-state regression tested). Conformance runner
gains per-suite extra modules; the issues suite loads relations +
smalltalk + content (~5s).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-03 13:53:21 +00:00
parent 83a8a2f8db
commit d96529effe
8 changed files with 1423 additions and 33 deletions

View File

@@ -7,7 +7,7 @@
; from the bytes, so a pack can't lie about its contents. SHA-1/packfile
; byte compat for stock git clients stays in lib/git/{export,import}.sx.
;
; Endpoints (added to the web routes by gitea/forge-routes):
; Endpoints (registered on gitea/route-packs):
; GET /:owner/:name/info/refs read-gated ref advertisement
; POST /:owner/:name/git-upload-pack read-gated; wants/haves -> pack
; POST /:owner/:name/git-receive-pack write-gated; commands+pack -> statuses
@@ -19,7 +19,8 @@
; Limits: one object per pkt line => objects over ~64KB need side-band
; chunking (future extension); gitea/pkt-fits? reports this.
;
; Requires: lib/gitea/{repo,access,web}.sx and their stacks.
; Requires: lib/gitea/{repo,access,web}.sx and their stacks, plus
; sx-parse (spec/parser.sx on the OCaml server host).
; ── pkt-line framing ─────────────────────────────────────────────────
@@ -359,7 +360,7 @@
(gitea/apply-cmd! grepo (gitea/cmd-parse c)))
cmds)))))))))))))))
; ── routes: web + wire ───────────────────────────────────────────────
; ── routes ───────────────────────────────────────────────────────────
(define
gitea/wire-routes
@@ -376,13 +377,11 @@
"/:owner/:name/git-receive-pack"
(fn (req) (gitea/w-receive-pack forge req))))))
(define
gitea/forge-routes
(fn (forge) (concat (gitea/routes forge) (gitea/wire-routes forge))))
(set! gitea/route-packs (append gitea/route-packs (list gitea/wire-routes)))
(define
gitea/forge-app
(fn (forge) (dream-make-app (gitea/forge-routes forge))))
; back-compat aliases from before the route-pack registry
(define gitea/forge-routes gitea/all-routes)
(define gitea/forge-app gitea/app)
; ── client ───────────────────────────────────────────────────────────
; A remote is any dream app fn plus repo coordinates and a token — the