Posteingang: Antwortbezug ohne Klammern, Testadresse im Testbetrieb, sofortige Auswertung
Deploy FeWo mit PipelineManager / deploy (push) Successful in 5m6s
Deploy FeWo mit PipelineManager / deploy (push) Successful in 5m6s
- Antwortbezug (In-Reply-To/References) wird mit und ohne spitze Klammern verglichen – Strato liefert ihn ohne, gespeichert war er mit; Antworten blieben deshalb im Posteingang hängen. - Testbetrieb: Die Testadresse steht zusammen mit der genannten Vorgangsnummer für den Gast dieses Vorgangs (alle Antworten kommen vom Testpostfach). Im Live-Betrieb gilt das nicht. - Eine zugeordnete Nachricht wird sofort ausgewertet (automatisch und nach Zuordnung von Hand), nicht erst im Fünf-Minuten-Lauf; die Meldung nennt, was übernommen wurde. Neu: „Erneut auswerten“. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f4a435c71a
commit
ad63db78f3
6 files changed
+78
-11
No files matched your search
@@ -187,6 +187,21 @@ public function test_the_mailbox_is_kept_as_a_record_and_full_mode_reads_every_m
|
||||
$this->assertNotNull($mailbox->fresh()->last_fetched_at);
|
||||
}
|
||||
|
||||
/** Test operation: every answer comes from the test mailbox, which then stands for the guest of the named case. */
|
||||
public function test_in_test_operation_the_test_address_counts_as_the_guest_of_the_named_case(): void
|
||||
{
|
||||
Settings::tenant()->update(['test_recipient' => 'test@example.org']);
|
||||
$booking = $this->request();
|
||||
|
||||
$message = $this->receive(from: 'test@example.org', subject: 'Re: Ihre Anfrage '.$booking->reference, text: 'Strandweg 1');
|
||||
|
||||
$this->assertSame([InboundMessage::ASSIGNED, $booking->id, 'reference_test_sender'], [$message->status, $message->booking_id, $message->match_reason]);
|
||||
|
||||
Settings::tenant()->update(['operating_mode' => 'live']);
|
||||
$live = $this->receive(from: 'test@example.org', subject: 'Re: Ihre Anfrage '.$booking->reference, text: 'Strandweg 1', id: '<live@x>');
|
||||
$this->assertSame(InboundMessage::NEEDS_REVIEW, $live->status, 'in live operation the test address is nobody special');
|
||||
}
|
||||
|
||||
public function test_the_mailbox_can_be_checked_and_incoming_mails_show_on_the_case(): void
|
||||
{
|
||||
$this->actingAs(User::factory()->create());
|
||||
|
||||
@@ -65,6 +65,7 @@ protected function setUp(): void
|
||||
TenantService::query()->create(['tenant_id' => Settings::tenant()->id, 'service' => TenantServiceKey::AiGuestMail->value, 'is_enabled' => true, 'api_key' => 'test-key',
|
||||
'settings' => ['provider' => 'anthropic', 'small_model' => 'claude-haiku-5-5', 'review_model' => 'claude-opus-5-5']]);
|
||||
app(TenantFeatures::class)->forget();
|
||||
Http::preventStrayRequests();
|
||||
}
|
||||
|
||||
public function test_without_the_service_nothing_is_sent_to_a_provider(): void
|
||||
|
||||
@@ -68,6 +68,7 @@ protected function setUp(): void
|
||||
TenantService::query()->create(['tenant_id' => Settings::tenant()->id, 'service' => TenantServiceKey::AiGuestMail->value, 'is_enabled' => true, 'api_key' => 'sk-or-test',
|
||||
'settings' => ['provider' => 'openrouter', 'small_model' => 'vendor/small-model', 'review_model' => 'vendor/large-model']]);
|
||||
app(TenantFeatures::class)->forget();
|
||||
Http::preventStrayRequests();
|
||||
}
|
||||
|
||||
public function test_from_an_incomplete_website_request_to_the_binding_booking(): void
|
||||
@@ -87,8 +88,14 @@ public function test_from_an_incomplete_website_request_to_the_binding_booking()
|
||||
$question = BookingMessage::query()->where('booking_id', $booking->id)->where('subject', 'like', '%Bitte ergänzen%')->sole();
|
||||
$this->assertSame('test', $question->audience, 'test operation: not delivered to the guest');
|
||||
|
||||
// The provider of the landlord's own AI access (faked; no network).
|
||||
$this->fakeExtraction([
|
||||
['field' => 'guest.street', 'value' => 'Lindenallee 12', 'evidence' => 'Lindenallee 12', 'confidence' => 0.97],
|
||||
['field' => 'guest.postal_code', 'value' => '10115', 'evidence' => '10115 Berlin', 'confidence' => 0.97],
|
||||
['field' => 'guest.city', 'value' => 'Berlin', 'evidence' => '10115 Berlin', 'confidence' => 0.97],
|
||||
]);
|
||||
// 3. The guest answers by e-mail; the inbox reads it, assigns it by the reply reference and stores it once.
|
||||
$reply = new PortalMail('<antwort@gast.example>', 'test@example.org', 'Re: '.$question->subject, "Hallo,\nunsere Anschrift: Lindenallee 12, 10115 Berlin, Deutschland.\nGesa", CarbonImmutable::now(), inReplyTo: $question->message_id);
|
||||
$reply = new PortalMail('<antwort@gast.example>', 'test@example.org', 'Re: '.$question->subject, "Hallo,\nunsere Anschrift: Lindenallee 12, 10115 Berlin, Deutschland.\nGesa", CarbonImmutable::now(), inReplyTo: trim((string) $question->message_id, '<>'));
|
||||
$reader = Mockery::mock(MailboxReader::class);
|
||||
$reader->shouldReceive('fetchAll')->andReturn([$reply]);
|
||||
$this->app->instance(MailboxReader::class, $reader);
|
||||
@@ -96,15 +103,11 @@ public function test_from_an_incomplete_website_request_to_the_binding_booking()
|
||||
$this->artisan('channels:fetch-mail')->assertSuccessful();
|
||||
|
||||
$message = InboundMessage::query()->sole();
|
||||
$this->assertSame([InboundMessage::ASSIGNED, $booking->id, 'reply', true], [$message->status, $message->booking_id, $message->match_reason, $message->test_mode]);
|
||||
// The server delivers the reference without angle brackets; it is assigned anyway, and evaluated at once.
|
||||
$this->assertSame([InboundMessage::PROCESSED, $booking->id, 'reply', true], [$message->status, $message->booking_id, $message->match_reason, $message->test_mode]);
|
||||
$this->assertNull($request->fresh()->next_reminder_at, 'the answer stops the reminder');
|
||||
|
||||
// 4. Extraction (faked provider) → rules → fact intake → the existing process sends the offer.
|
||||
$this->fakeExtraction([
|
||||
['field' => 'guest.street', 'value' => 'Lindenallee 12', 'evidence' => 'Lindenallee 12', 'confidence' => 0.97],
|
||||
['field' => 'guest.postal_code', 'value' => '10115', 'evidence' => '10115 Berlin', 'confidence' => 0.97],
|
||||
['field' => 'guest.city', 'value' => 'Berlin', 'evidence' => '10115 Berlin', 'confidence' => 0.97],
|
||||
]);
|
||||
// 4. The inbox evaluated the reply at once (extraction → rules → fact intake); the five-minute run finds nothing left.
|
||||
$this->artisan('messages:extract')->assertSuccessful();
|
||||
|
||||
$booking->refresh();
|
||||
|
||||
Reference in new issue
Block a user