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 <noreply@anthropic.com>
This commit is contained in:
stumpylog
2026-08-20 11:54:14 -07:00
co-authored by Claude Opus 5
parent 6ab4c3d689
commit 42c4f648a4
@@ -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,