62 lines
2.5 KiB
Gherkin
62 lines
2.5 KiB
Gherkin
Feature: Response envelope handling
|
|
The responder parses the model's JSON envelope and decides what the
|
|
bot says, where, and whether staff is alerted. (SPEC-001)
|
|
|
|
Background:
|
|
Given a responder with history limit 10
|
|
|
|
@ENV-01
|
|
Scenario: Model answer reaches the user
|
|
Given the model answers with answer "Hei! Velkommen." and answer_needed "true"
|
|
When user "alice" sends "Hei bot" in channel "chat"
|
|
Then the response answer contains "Hei! Velkommen."
|
|
And the response is marked as needed
|
|
|
|
@ENV-02
|
|
Scenario: Suppressed answer stays silent
|
|
Given the model answers with answer "irrelevant musing" and answer_needed "false"
|
|
When user "alice" sends "talking to bob" in channel "chat"
|
|
Then the response is not marked as needed
|
|
|
|
@ENV-03
|
|
Scenario: Staff note forces delivery
|
|
Given the model answers with answer "Et oyeblikk!" and staff note "Guest at table 4 needs a waiter"
|
|
When user "guest" sends "Can somebody help us?" in channel "chat"
|
|
Then the response staff note is "Guest at table 4 needs a waiter"
|
|
And the response is marked as needed
|
|
|
|
@ENV-04
|
|
Scenario: Direct messages are always answered
|
|
Given the model answers with answer "Svar." and answer_needed "false"
|
|
When user "alice" sends "hei" directly to the bot
|
|
Then the response is marked as needed
|
|
|
|
@ENV-05
|
|
Scenario: Short-path rules skip the model
|
|
Given a short-path rule for channels "spam.*" and users "bob.*"
|
|
When user "bobby" sends "noise noise" in channel "spam-corner"
|
|
Then the model was not called
|
|
And the response is empty
|
|
And the history contains the message from "bobby"
|
|
|
|
@ENV-07
|
|
Scenario: History is trimmed to the limit
|
|
Given a responder with history limit 4
|
|
And 6 prior history entries in channel "chat"
|
|
And the model answers with answer "ok" and answer_needed "true"
|
|
When user "alice" sends "hei" in channel "chat"
|
|
Then the history length is at most 4
|
|
|
|
@ENV-08
|
|
Scenario: Markdown links are unwrapped
|
|
Given the model answers with answer "Se [menyen](https://fjerkroa.example/meny) her" and answer_needed "true"
|
|
When user "alice" sends "meny?" in channel "chat"
|
|
Then the response answer contains "https://fjerkroa.example/meny"
|
|
And the response answer does not contain "[menyen]"
|
|
|
|
@ENV-09
|
|
Scenario: Missing channel falls back to the message channel
|
|
Given the model answers with answer "ok" and no channel
|
|
When user "alice" sends "hei" in channel "kitchen-talk"
|
|
Then the response channel is "kitchen-talk"
|