fix: a self-contradicting test fixture, and import order (E4 follow-up)
CI / lint (push) Successful in 3s
Build images / sign-extension (push) Successful in 4s
CI / extension-version (push) Successful in 2s
Build images / build-agent (push) Successful in 7s
CI / frontend-build (push) Successful in 21s
CI / backend-lint-and-test (push) Successful in 34s
Build images / build-web (push) Successful in 1m13s
Build images / smoke-web (push) Skipped
Build images / build-ml (push) Successful in 2m15s
Build images / promote (push) Skipped
CI / integration (push) Successful in 2m46s

Two failures on 51e78a3, neither in the shipped logic.

**The integration failure was a TEST bug, not a code bug.**
`test_a_weak_name_needs_the_declaration` set `display_name` to something
deliberately weak but left `_membership`'s DEFAULT vanity, which matched the
artist slug exactly. So the name signal was legitimately 1.0 and the matcher
was right to propose — my assertion of 0 was asserting the wrong scenario.
Both identity fields now have to be weak for the test to mean what it says,
and the arithmetic was checked before pushing: 0.39 without the declaration,
0.74 with it.

Worth keeping: a fixture whose fields disagree with each other will pass or
fail for reasons unrelated to the property under test, and this one was one
default away from silently testing nothing.

**The lint failure was import order** — `artist_membership_service` sorts
before `credential_*` and I inserted it after. Second isort slip this session
from patching an import block with a script rather than reading it back; the
repo has a rule about exactly this (#102).

Everything else passed on that SHA: 1256 tests, the frontend suite, and
migration 0096.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LNXXULQDjVZmbuNa2G9mD9
This commit is contained in:
2026-09-11 08:02:08 -04:00
co-authored by Claude Opus 5
parent 51e78a329b
commit f8614d437d
2 changed files with 11 additions and 3 deletions
+1 -1
View File
@@ -1244,9 +1244,9 @@ def sync_memberships() -> str:
"""
import asyncio
from ..services.artist_membership_service import rescan as membership_rescan
from ..services.credential_crypto import CredentialCrypto
from ..services.credential_service import CredentialService
from ..services.artist_membership_service import rescan as membership_rescan
from ..services.membership_roster import sync_platform
from ..services.patreon_client import PatreonClient
from ._async_session import async_session_factory
+10 -2
View File
@@ -181,13 +181,21 @@ async def test_an_artist_with_no_sources_at_all_is_never_proposed(db):
@pytest.mark.asyncio
async def test_a_weak_name_needs_the_declaration(db):
artist = await _artist_with_discord(db, "Maewix", "maewix")
m = await _membership(db, display_name="Maewix Studios Official")
# BOTH identity fields must be weak, or the test contradicts itself: the
# first draft left the default vanity exactly matching the artist slug, so
# the name signal was legitimately 1.0 and the code was right to propose.
# CI caught it — a test bug, not a code bug.
m = await _membership(
db, display_name="Maewix Studios Official",
details={"campaign": {"vanity": "maewixstudios"}},
url="https://www.patreon.com/maewixstudios",
)
await db.commit()
assert await ArtistMembershipService(db).match_membership(m.id) == 0
db.add(Post(
artist_id=artist.id, source_id=None, external_post_id="p1",
description='<a href="https://www.patreon.com/maewix">my patreon</a>',
description='<a href="https://www.patreon.com/maewixstudios">mine</a>',
post_date=datetime.now(UTC),
))
await db.commit()