host: relation enumeration via a static slug list (graph scan was fragile on live)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 39s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 39s
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 <noreply@anthropic.com>
This commit is contained in:
@@ -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)))))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user