This lesson works through issues 3 and 4 from T11.1: quote agent finished and MCP server secured. You work as in T11.2: every criterion gets a test, every feature its pull request with numbers. One difference is immediately noticeable. For the agent and the server, T7.3 and T8.3 already provide many tests that check exactly the criteria of the issues. The work therefore consists first of finding them and assigning them to the acceptance. Newly written is only what lies between the modules:
- a whole round of the agent through the Kladde's wiring, from the draft through the approval to the single mail,
- a table of rights for the MCP server that knows every tool and forgets none.
What's already there and what's missing
Put the criteria of the two issues next to your tests. With the classes from the lessons, this assignment results:
| Criterion | Test | Origin |
|---|---|---|
| Without an approval, nothing is ever sent. | WithoutAnApprovalNothingIsSent |
ApprovalTests, T7.3 |
| After an approval, exactly once, even on a repeat. | AfterOneApprovalTheQuoteIsSentExactlyOnce |
ApprovalTests, T7.3 |
| A changed draft needs a new approval. | AChangedDraftNeedsANewApproval |
ApprovalTests, T7.3 |
| The approval records who, when and which version. | AQuoteIsDraftedApprovedAndSentExactlyOnce |
new |
Every call counts under quote-agent. |
EveryModelCallOfARoundCountsUnderTheAgent |
new |
| Without a token 401, without a role 403. | the tests of ToolRightsTests |
T8.3 |
Every writing tool needs the write role and confirm: true; every call is in the audit log. |
the tests of ToolRightsTests and OutwardToolTests |
T8.3 |
| Every tool is in the list of rights, no entry names a tool that doesn't exist. | ToolRightsTableTests |
new |
An existing test that proves a criterion is an acceptance test. Don't copy it into a new class; two versions of the same test drift apart as soon as one is changed. Instead, give the existing class the acceptance's trait:
// tests/Kladde.Agents.Tests/ApprovalTests.cs (one new line)
[Trait("Abnahme", "Angebots-Agent")]
public sealed class ApprovalTests : IDisposable
Likewise, ToolRightsTests and OutwardToolTests in tests/Kladde.Mcp.Http.Tests get the line [Trait("Abnahme", "MCP-Server")].
With that, --filter-trait "Abnahme=Angebots-Agent" starts the tests from T7.3 and the new ones together, and the acceptance of every feature is a
single command.