Skip to content

test(offers,messaging): couverture OfferService & MessageService (#132, #135) - #173

Merged
RebelliousSmile merged 1 commit into
mainfrom
claude/plan-derniere-issue-l94t6x
Jul 26, 2026
Merged

test(offers,messaging): couverture OfferService & MessageService (#132, #135)#173
RebelliousSmile merged 1 commit into
mainfrom
claude/plan-derniere-issue-l94t6x

Conversation

@RebelliousSmile

Copy link
Copy Markdown
Owner

Les épiques #132 (Offer sociale) et #135 (MP fédérés) ont été livrées en code (modèles, services, vues, AP entrant/sortant, UI) mais sans aucun test (tests/offers/ inexistant, tests/messaging/ vide). Cette PR comble ce manque avec une couverture ciblée au niveau service.

tests/offers/test_offer_service.py (#132)

Sur la couture SUMMARY (le carrier EST un Report) :

  • open_offer idempotent (pas de doublon pour (carrier, kind, open))
  • respond : une réponse par (offer, responder), mise à jour du contenu si encore pending
  • accept_response : matérialise un Rapport, décline les réponses sœurs pending, résout l'offre — et re-accepter est idempotent (pas de second Rapport)
  • decline_response
  • expire_for_carrier : expire les offres ouvertes + décline les réponses en attente

tests/messaging/test_message_service.py (#135)

Invariants DEC-E :

  • E1get_or_create_conversation : paire canonique (même row quel que soit l'ordre), idempotente
  • E2send lève NotMutualFollowersError sans follow mutuel (un sens seul ne suffit pas), réussit et met à jour last_message_at quand mutuel
  • E4receive_remote idempotent par ap_id
  • lecture : unread_for / mark_read / unread_count

Vérification

ruff format --check . + ruff check . clean · mypy clean · pytest tests/offers/ tests/messaging/ = 12 passed. Aucun code de production modifié (tests seuls).

🤖 Generated with Claude Code


Generated by Claude Code

…135)

Both apps shipped without tests. Add focused service-level coverage for
the core invariants:

offers (#132): idempotent open_offer, one response per (offer,responder),
accept materializes a Rapport + declines siblings + resolves the offer
(idempotent), decline, and expire_for_carrier.

messaging (#135): canonical/idempotent conversation pair (E1), the
mutual-follow send gate raising NotMutualFollowersError (E2), idempotent
remote receive by ap_id (E4), and the unread read-cursor logic.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YBRFVUtmBW3YSP8Yd2uNpB
@RebelliousSmile
RebelliousSmile merged commit 01fbf4c into main Jul 26, 2026
1 check passed
@RebelliousSmile
RebelliousSmile deleted the claude/plan-derniere-issue-l94t6x branch July 31, 2026 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants