From bd6dc6524ac1414e692efda4ca22d5dc5bdee336 Mon Sep 17 00:00:00 2001 From: Ben Stull Date: Fri, 5 Jun 2026 13:14:52 -0700 Subject: [PATCH] =?UTF-8?q?=C2=A722=20S2:=20@S2=20acceptance=20=E2=80=94?= =?UTF-8?q?=20anonymous=20empty=20public=20collection=20catalog=20(C3.6)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Anonymous reader of an empty public collection gets a 200 empty catalog and no propose action (the propose route rejects anonymous); the Catalog footer's 'Sign in to propose' prompt is the existing anonymous affordance. Co-Authored-By: Claude Opus 4.8 (1M context) --- backend/tests/test_collection_scoped_serve.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/backend/tests/test_collection_scoped_serve.py b/backend/tests/test_collection_scoped_serve.py index cb1ab43..7c4d5d2 100644 --- a/backend/tests/test_collection_scoped_serve.py +++ b/backend/tests/test_collection_scoped_serve.py @@ -139,3 +139,21 @@ def test_scoped_routes_404_for_collection_outside_project(app_with_fake_gitea): with TestClient(app) as client: r = client.get("/api/projects/default/collections/nope/rfcs") assert r.status_code == 404 + + +def test_s2_anonymous_empty_public_collection(app_with_fake_gitea): + """C3.6 (@S2): a public collection with no entries; an anonymous visitor + lands on its catalog → an empty catalog (200, no items), and the propose + action is not available to them (the propose route rejects anonymous).""" + app, _ = app_with_fake_gitea + with TestClient(app) as client: + _add_features_collection() # public, no entries + # Anonymous (no session cookie) reads the empty catalog — 200, []. + r = client.get("/api/projects/default/collections/features/rfcs") + assert r.status_code == 200, r.text + assert r.json()["items"] == [] + # No propose action for an anonymous visitor. + r2 = client.post( + "/api/projects/default/collections/features/rfcs/propose", + json={"title": "X", "slug": "x", "pitch": "p", "tags": []}) + assert r2.status_code == 401