From a9df9f4e994b946f254bb9ff1510f318e38cc92f Mon Sep 17 00:00:00 2001 From: giles Date: Mon, 29 Jun 2026 23:03:37 +0000 Subject: [PATCH] host: relation enumeration via a static slug list (graph scan was fragile on live) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit host/blog-in "relation" "is-a" (a reduce over ALL edges) returned a partial set on the live store (many edges), so only one relation editor rendered. Enumerate the relations from a fixed slug list instead — deterministic; the metadata still lives on the relation-posts (loaded into the cache). rel-kinds maps kind-spec over the list and drops any uncached. Co-Authored-By: Claude Opus 4.8 --- lib/host/blog.sx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/host/blog.sx b/lib/host/blog.sx index 7d6a9607..e9c54e03 100644 --- a/lib/host/blog.sx +++ b/lib/host/blog.sx @@ -102,17 +102,23 @@ ;; rel-kinds / kind-symmetric? then read the cache (pure); the relation-posts stay ;; the durable source of truth. host/blog-load-rel-kinds! re-reads them. (define host/blog--rel-cache (dict)) +;; the relation slugs — a small fixed set. (Enumerating them from the graph via +;; host/blog-in "relation" "is-a" proved fragile on the live store: that reduce over +;; ALL edges returned a partial set. A static list is deterministic; the metadata +;; still lives on the relation-posts. Add a relation here + a seed-rel! call.) +(define host/blog--rel-slugs (fn () (list "related" "is-a" "subtype-of" "tagged"))) (define host/blog-load-rel-kinds! (fn () (for-each (fn (kind) (let ((m (get (host/blog-get kind) :rel))) (when m (dict-set! host/blog--rel-cache kind (merge {:kind kind} m))))) - (host/blog-in "relation" "is-a")))) ;; relations are flat: direct is-a is enough + (host/blog--rel-slugs)))) ;; spec = the cached :rel metadata + :kind; nil for a non-relation (relate validates). (define host/blog--kind-spec (fn (kind) (get host/blog--rel-cache kind))) (define host/blog-rel-kinds - (fn () (map (fn (k) (get host/blog--rel-cache k)) (keys host/blog--rel-cache)))) + (fn () (filter (fn (s) (not (nil? s))) + (map host/blog--kind-spec (host/blog--rel-slugs))))) (define host/blog--kind-symmetric? (fn (kind) (let ((s (host/blog--kind-spec kind))) (and s (get s :symmetric)))))