host: fix the 2 brittle relate-picker tests — robust to pool size (blog 164/164)

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 <noreply@anthropic.com>
This commit is contained in:
2026-07-01 05:12:40 +00:00
parent 07dfad5919
commit 10bc091890

View File

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