fix: run 7464's two failures — an unused loop target and a missed call site (4392)
CI and images / lint (push) Successful in 2s
CI and images / extension-version (push) Successful in 2s
CI and images / frontend-build (push) Successful in 22s
CI and images / backend-lint-and-test (push) Successful in 32s
CI and images / integration (push) Successful in 2m37s
CI and images / sign-extension (push) Successful in 3s
CI and images / build-agent (push) Successful in 5s
CI and images / build-web (push) Successful in 1m41s
CI and images / smoke-web (push) Successful in 56s
CI and images / promote (push) Skipped

Both mine, both from the same change.

`identity` is unpacked in the write loop and never read there — the decision
it feeds happens above it, when `conclusive` is built. flake8-bugbear is on
repo-wide and B007 is exactly this. Renamed `_identity`, and `linked +=
status == "linked"` spelled out as the `if` it actually is.

The second is worse, because it was a real assertion silently pointed at the
wrong shape. `match_post` now returns `(proposed, linked)`, and when I
rewrote the call sites I matched on `) == 0` — so the one comparison in the
file that reads `) == 1` kept comparing a tuple to an integer. Found by
walking the module's AST for every comparison against `match_post` and every
use of a name assigned from it, rather than grepping again with the pattern
that had already missed it once.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LVjrnpQjRgHdvq95rASoiR
This commit is contained in:
2026-09-24 08:20:12 -04:00
co-authored by Claude Opus 5
parent b3e4491b0a
commit 941f1c6e07
2 changed files with 4 additions and 3 deletions
@@ -391,9 +391,10 @@ class PostAssociationService:
auto_id = conclusive[0][0].id auto_id = conclusive[0][0].id
linked = 0 linked = 0
for group, score, signals, identity in scored: for group, score, signals, _identity in scored:
status = "linked" if group.id == auto_id else "pending" status = "linked" if group.id == auto_id else "pending"
linked += status == "linked" if status == "linked":
linked += 1
self.session.add(PostAssociation( self.session.add(PostAssociation(
announcement_post_id=announcement.id, announcement_post_id=announcement.id,
payload_post_id=group.id, payload_post_id=group.id,
+1 -1
View File
@@ -306,7 +306,7 @@ async def test_a_dismissed_pair_is_never_proposed_again(db):
svc = PostAssociationService(db) svc = PostAssociationService(db)
assert await svc.match_post( assert await svc.match_post(
teaser.id, threshold=DEFAULT_THRESHOLD, window_hours=WINDOW, teaser.id, threshold=DEFAULT_THRESHOLD, window_hours=WINDOW,
) == 1 ) == (1, 0)
await db.commit() await db.commit()
assoc = (await db.execute(select(PostAssociation))).scalar_one() assoc = (await db.execute(select(PostAssociation))).scalar_one()