From a59fa1065f3e7886054d55ed48054265df1a2d49 Mon Sep 17 00:00:00 2001 From: jwvanderstam Date: Sun, 15 Nov 2026 17:47:18 +0100 Subject: [PATCH] test(gkb): the #532 fix still finds an unowned document beside a contribution The test proved a contribution is no longer matched as a document without a workspace. It did not prove the queries still match the documents they should: a fix that made `exists(filename, None)` and `stale()` return nothing would have passed it. It now inserts an unowned document of the same filename, and asserts `exists` returns that one and `stale` returns it and the source, but not the contribution. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01KkWPq9YWxtZ6hbDvMft8fh --- tests/integration/test_gkb_contribution.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/integration/test_gkb_contribution.py b/tests/integration/test_gkb_contribution.py index 9118561c..195dcdc2 100644 --- a/tests/integration/test_gkb_contribution.py +++ b/tests/integration/test_gkb_contribution.py @@ -259,5 +259,9 @@ def test_a_contribution_is_not_mistaken_for_a_document_without_a_workspace(datab filename = f"gkb-nows-{uuid.uuid4().hex[:8]}.txt" doc = _document(database, workspaces["a"], filename) global_id = database.contributions.contribute(workspaces["a"], [doc], admin)[0]["global_document_id"] + assert database.documents.exists(filename, None)[0] is False + # Beside it, the documents both queries must still find: one with no workspace, and the source. + unowned = database.documents.insert(filename, "unowned content", workspace_id=None, scope=ALL_WORKSPACES) stale_ids = {d["id"] for d in database.documents.stale(0, scope=ALL_WORKSPACES)} - assert (database.documents.exists(filename, None)[0], global_id in stale_ids) == (False, False) + assert (database.documents.exists(filename, None)[1]["id"], {doc, unowned, global_id} & stale_ids) == ( + unowned, {doc, unowned})