From 42c4f648a4725b55ef06a0afacd7f7e6b1be73e9 Mon Sep 17 00:00:00 2001 From: stumpylog <797416+stumpylog@users.noreply.github.com> Date: Thu, 20 Aug 2026 11:54:14 -0700 Subject: [PATCH] test(search): delete the alias tests that cannot fail TestFieldAliases in test_documented_syntax.py pinned type:/path: against a single indexed document with no decoy, so neither test could tell alias resolution from the demotion that happens without it. Stripping `aliases` from every FieldSpec and clearing the registry cache left both green: - type:invoice demotes to unfielded text, and document_type is a default search field, so the token still matched the typed document. - path:archive demotes and matched via the title: the fixture title was "Pathed", and with SEARCH_LANGUAGE=en that stems to "path". test_acceptance.py::TestFieldAliases covers the same syntax at the same result level with content decoys chosen to make demotion visible, and dies on that mutation. Deleted rather than given decoys of their own, so the property has one home instead of two. Under the alias-strip mutation the suite now fails 4 tests: both test_acceptance.py::TestFieldAliases cases and both test_registry.py resolution cases. Co-Authored-By: Claude Opus 5 --- .../tests/search/test_documented_syntax.py | 37 ------------------- 1 file changed, 37 deletions(-) diff --git a/src/documents/tests/search/test_documented_syntax.py b/src/documents/tests/search/test_documented_syntax.py index d9a4d5530..36963cce9 100644 --- a/src/documents/tests/search/test_documented_syntax.py +++ b/src/documents/tests/search/test_documented_syntax.py @@ -23,9 +23,7 @@ import pytest import time_machine from documents.models import Document -from documents.models import DocumentType from documents.models import Note -from documents.models import StoragePath from documents.models import Tag if TYPE_CHECKING: @@ -112,41 +110,6 @@ class TestPhraseSearch: assert _matched_ids(backend, '"brown quick fox"') == set() -class TestFieldAliases: - def test_type_is_an_alias_for_document_type( - self, - backend: TantivyBackend, - ) -> None: - doc_type = DocumentType.objects.create(name="invoice") - doc = _index( - backend, - title="Typed", - content="body", - checksum="doc-syntax-typed", - document_type=doc_type, - ) - assert _matched_ids(backend, "type:invoice") == {doc.pk} - assert _matched_ids(backend, "document_type:invoice") == {doc.pk} - - def test_path_is_an_alias_for_storage_path( - self, - backend: TantivyBackend, - ) -> None: - storage_path = StoragePath.objects.create( - name="archive", - path="archive/{{ title }}", - ) - doc = _index( - backend, - title="Pathed", - content="body", - checksum="doc-syntax-pathed", - storage_path=storage_path, - ) - assert _matched_ids(backend, "path:archive") == {doc.pk} - assert _matched_ids(backend, "storage_path:archive") == {doc.pk} - - class TestTagCommaList: def test_comma_list_requires_every_listed_tag( self,