From 10bc091890c0cb4a7e4f59e1d742531018244bc1 Mon Sep 17 00:00:00 2001 From: giles Date: Wed, 1 Jul 2026 05:12:40 +0000 Subject: [PATCH] =?UTF-8?q?host:=20fix=20the=202=20brittle=20relate-picker?= =?UTF-8?q?=20tests=20=E2=80=94=20robust=20to=20pool=20size=20(blog=20164/?= =?UTF-8?q?164)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Both tests pre-dated the metamodel growth (types/cards/relations are now posts), so the `related` candidate pool — which by design offers EVERY post (a relation with no declaration is unrestricted; plans/relations-as-posts.md) — grew past one 20-item page, and the tests asserted single-page behaviour: - "omits the load-more sentinel on a short last page" assumed alpha-post's pool < 20; - "offers all posts" checked P Doc (pdoc, itself a type-def) was on page 1. Both now test the actual behaviour without depending on absolute counts: the sentinel test pages past the end (offset=100000 → empty page → no sentinel), and the unrestricted-pool test filters (?q=doc → finds the pdoc type-def regardless of pagination — confirming `related` is unrestricted, unlike `tagged`). Behaviour unchanged; the design ("related offers all") stands. blog suite now 164/164. Co-Authored-By: Claude Opus 4.8 --- lib/host/tests/blog.sx | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/host/tests/blog.sx b/lib/host/tests/blog.sx index fec9036a..ddbba892 100644 --- a/lib/host/tests/blog.sx +++ b/lib/host/tests/blog.sx @@ -258,8 +258,11 @@ (contains? html "q=my%20q") (contains? html "exponential:1000:30000"))) ;; retries a dropped fetch (list true true true true true true)) -(host-bl-test "relate-options omits the load-more sentinel on a short last page" - (contains? (dream-resp-body (host-bl-app (host-bl-req "/alpha-post/relate-options"))) "rp-more") +;; a page that isn't full carries NO load-more sentinel. Past the end of the pool the last +;; page is empty (0 rows < limit) — deterministic regardless of how many posts the metamodel +;; has seeded (the `related` pool is every post, which grows as types/cards are added). +(host-bl-test "relate-options omits the load-more sentinel when the page isn't full" + (contains? (dream-resp-body (host-bl-app (host-bl-req "/alpha-post/relate-options?offset=100000"))) "rp-more") false) ;; -- relate / unrelate keep BOTH lists in sync by re-rendering the kind's editor. @@ -545,8 +548,11 @@ (let ((body (dream-resp-body (host-bl-app (host-bl-req "/particle/relate-options?kind=tagged"))))) (list (contains? body ">OCaml<") (contains? body ">P Article<"))) (list true false)) -(host-bl-test "related picker still offers all posts (kind defaults to related)" - (contains? (dream-resp-body (host-bl-app (host-bl-req "/particle/relate-options"))) ">P Doc<") +;; `related` (no declaration) is UNRESTRICTED — it offers every post, including type-defs +;; like pdoc ("P Doc"), unlike `tagged` which offers only tags. Found via a filter so the +;; assertion is robust to pagination (the pool is >1 page once the metamodel is seeded). +(host-bl-test "related picker offers any post, incl a type-def (kind defaults to related)" + (contains? (dream-resp-body (host-bl-app (host-bl-req "/particle/relate-options?q=doc"))) ">P Doc<") true) (host-bl-test "is-a-tag toggle marks a post a tag via /relate kind=is-a" (begin