Files
rick 212f19ac19 Add v6-rewrite OpenSpec: proposal, design, specs, and tasks
Complete specification for rewriting Swarmops v5 as using.cash v6:
- Proposal: scope buckets (Working Rewrite / First Beyond Working / Maybe),
  non-goals (governance, geography, memberships permanently cut)
- Design: 18 architectural decisions including preserved patterns
  (Basic/Logic, stored procs, credential split), new patterns (repository
  classes, chain abstraction, rate providers), and operational concerns
  (Galera awareness, continuation transactions, VAT booking, OOD
  denormalization)
- Specs: 17 capability specifications with SHALL/MUST requirements and
  WHEN/THEN scenarios, covering accounting core, AP/AR, crypto treasury,
  exchange rates, organizations, users/auth, documents, comms, dashboard,
  end-of-month, backend worker, event bus, data migration, API layer,
  frontend app, and CI/packaging
- Tasks: 145 implementation tasks grouped by subsystem, ordered by
  dependency (migration gates API/frontend work)

Two rounds of adversarial review incorporated.

Made-with: Cursor
2026-04-08 16:02:58 +02:00

31 lines
1.6 KiB
Markdown

## ADDED Requirements
### Requirement: Outbound email delivery
The system SHALL send outbound emails via direct SMTP connection to a configured mail server. Configuration includes SMTP host, port, and optional credentials.
#### Scenario: Send email
- **WHEN** the system needs to send an email (password reset, notification, etc.)
- **THEN** it connects to the configured SMTP server and delivers the message
#### Scenario: SMTP failure
- **WHEN** the SMTP connection fails
- **THEN** the email is queued for retry and the failure is logged
### Requirement: Mail queue
The system SHALL maintain a persistent mail queue in the database. Emails are enqueued by application code and dequeued by the backend worker for delivery. Failed deliveries are retried with backoff.
#### Scenario: Enqueue email
- **WHEN** application code requests an email be sent
- **THEN** the email is stored in the mail queue with recipient, subject, body, and status "pending"
#### Scenario: Backend worker processes queue
- **WHEN** the backend worker checks the mail queue
- **THEN** it attempts delivery of all pending emails and updates their status (sent or failed with retry count)
### Requirement: Mail templates
The system SHALL support named mail templates with placeholder substitution. Templates are stored in the database per organization. Placeholders use a simple token syntax (e.g., `%UserName%`, `%OrganizationName%`).
#### Scenario: Render template
- **WHEN** an email is composed using a template name and substitution values
- **THEN** the template body is fetched, placeholders are replaced, and the result is enqueued