MAS-WP-0010 finished: email slave role, stub outside master, contract flows, SCP-8

- EmailMode slave role: master-issued case ids, events to the master,
  sends only on instruction or autonomous policy, transfers blocked or to
  a primed webhook, timeouts left to the master; principle 10 refusals
  reported back.
- conformance/flows.json (13 flows) + mas_modes.runner; mas test runs the
  mode corpus (172/172).
- SCP-8 / v0.2 section 7.1: !MODE requests a handoff defined by the mode
  contract. docs/reuse-surface.md.
- Deploy image copies mas_modes (ticket service imports its mailer).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Assistant: claude-code
Assistant-Model: opus
Assistant-Process: 5787@bnt-lap001
Assistant-Session: 5db26b82-138b-40cc-9856-4d5eb0f752fd
This commit is contained in:
tegwick 2026-10-19 11:03:16 +02:00
parent e91cd01a02
commit 87be0d1da3
16 changed files with 1396 additions and 17 deletions

View file

@ -4,7 +4,7 @@ type: workplan
title: "Mode reference implementation: contract, email master/slave roles, stubs"
domain: communication
repo: mail-address-semantics
status: active
status: finished
owner: claude
topic_slug: coulomb-social
created: "2026-10-19"
@ -63,7 +63,7 @@ Review the design with the founder before T02.
```task
id: MAS-WP-0010-T02
status: progress
status: done
priority: high
state_hub_task_id: "e0af967d-15e8-50ad-8930-ad569224cddf"
```
@ -132,7 +132,7 @@ Add end-to-end tests against the callback stub for every scenario.
```task
id: MAS-WP-0010-T06
status: todo
status: done
priority: high
state_hub_task_id: "fbef3fea-c0b6-5e79-bdf9-95bbf98c9bc6"
```
@ -154,7 +154,7 @@ Add end-to-end tests: stub master + email slave + callback stub.
```task
id: MAS-WP-0010-T07
status: todo
status: done
priority: medium
state_hub_task_id: "0fcb541f-cab8-5014-aee0-4332fc7e0642"
```
@ -169,7 +169,7 @@ stubs). Update SCOPE.md.
```task
id: MAS-WP-0010-T08
status: todo
status: done
priority: medium
state_hub_task_id: "7d5dca10-184f-5b96-a280-b59dd8d77c60"
```
@ -178,3 +178,28 @@ Write a spec change proposal (SCP-8) and put it into the v0.2 draft:
§7 says `!MODE` requests a handoff whose behavior the mode contract
defines, and points to `mas-modes-v0.1-spec/`. No grammar or statute
change. Add CHANGELOG and CONFORMANCE notes.
## Outcome
- **Contract** (`mas-modes-v0.1-spec/`, draft). Reviewed by the founder on
2026-10-19: `mail.send` is replies only, and the status set is accepted.
It has a message schema, the gateway event schema (T03), the transition
table, 27 message fixtures, a statute and 13 scripted flows. One
addition during implementation: `case.assign` may carry the initial
policy, so a mode requested in the intake mail can be blocked or primed.
- **Code** (`mas_modes/`). `email_mode.EmailMode` covers both roles: the
master role runs over the ticket service through `MasterStore`, and the
slave role over its own SQLite store. `mailer` holds the principle-10
gate (now shared with the ticket service). `stubs/callback.py` has 10
scenarios, and `stubs/master.py` assigns EXT-100, EXT-101, .... There is
also `harness`, and `runner` (`mas test`: 172/172).
- **Tests.** `tests/test_modes_master.py` (17), `test_modes_slave.py`
(14), `test_modes_conformance.py` (12, including real gateway events
validated against the schema).
- **Spec.** SCP-8, plus v0.2 §7.1 "Handoffs" and notes in CHANGELOG and
CONFORMANCE.
- **Docs.** `docs/reuse-surface.md` and the bundle README.
- **Not done.** No second mode stub: callback was enough to exercise the
contract, and the contract text is mode-neutral. The reference email
side has no authentication on its HTTP endpoints; it is for loopback and
tests only, as documented.