test(offers,messaging): couverture OfferService & MessageService (#132, #135) - #173
Merged
Merged
Conversation
…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
This was referenced Jul 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_offeridempotent (pas de doublon pour(carrier, kind, open))respond: une réponse par(offer, responder), mise à jour du contenu si encorependingaccept_response: matérialise unRapport, décline les réponses sœurspending, résout l'offre — et re-accepter est idempotent (pas de second Rapport)decline_responseexpire_for_carrier: expire les offres ouvertes + décline les réponses en attentetests/messaging/test_message_service.py(#135)Invariants DEC-E :
get_or_create_conversation: paire canonique (même row quel que soit l'ordre), idempotentesendlèveNotMutualFollowersErrorsans follow mutuel (un sens seul ne suffit pas), réussit et met à jourlast_message_atquand mutuelreceive_remoteidempotent parap_idunread_for/mark_read/unread_countVérification
ruff format --check .+ruff check .clean ·mypyclean ·pytest tests/offers/ tests/messaging/= 12 passed. Aucun code de production modifié (tests seuls).🤖 Generated with Claude Code
Generated by Claude Code