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)))))