release: 1.9.2: Review pass: port-25 milters, DMARC validation, rate-limit fix

Review pass over `1.4.0`…`1.9.1`: port 25 no longer shares the submission milter chain, DMARC reports are validated before they are stored, and the auto rate limit is correct for a non-default level-1 window. Schema migration `0010` (index only). Upgrading is a tag bump.
Added:
  - SQLite migration `0010_send_log_app_login_index.sql` —
  - DMARC aggregate reports are accepted as **zip** as well as gzip or plain XML
  - e2e: `checkPort25ConfigCombinations` regenerates the Postfix configuration
Changed:
  - README hero line and a **Positioning** block in `docs/product.md` record the
Fixed:
  - The setup account's password is hashed at bcrypt cost `12` like every other
  - Login/setup rate limiter: protecting blocked buckets from eviction is now
  - `postqueue -p` output is bounded to 4 MiB (the timeout alone left the size of
  - [schema-migrations.md](docs/schema-migrations.md): the schema section was
  - postqueue reader is now time-bounded: `postqueue -p` runs under a 5-second
  … (11 more in CHANGELOG)
Changed:
  - [roadmap.md](docs/roadmap.md) now carries everything the 2026-08-19 code
  - Extracted `internal/configsafe` — the empty-value and forbidden-character
  - Build, deploy and migration comments no longer cite the archived
  - Dropped the `parseDomainRateLimitForm` / `parseAppRateLimitForm` pass-through
  - Extracted shared helpers: `internal/atomicfile` (atomic temp-write+rename) and
  … (7 more in CHANGELOG)
Removed:
  - Unused legacy asset `docs/assets/icon.png` (superseded by the four brand SVGs
  - Plan documents for already-shipped features: `domain-stats-auto-ratelimit`,

Full detail: CHANGELOG.md (1.9.2).
This commit is contained in:
mix
2026-09-22 15:24:53 +03:00
parent 967d3d95de
commit 7ef7f75246
179 changed files with 11558 additions and 1738 deletions
+39 -2
View File
@@ -154,8 +154,8 @@ func TestRateLimitActive(t *testing.T) {
inactive := []RateLimit{
{},
{Scope: RateLimitScopeDomain, AllowedIPs: []string{"203.0.113.1"}}, // no ceiling
{Scope: RateLimitScopeDomain, MaxMessages: 5}, // no window
{Scope: RateLimitScopeApp, MaxMessages: 5}, // no window
{Scope: RateLimitScopeDomain, MaxMessages: 5}, // no window
{Scope: RateLimitScopeApp, MaxMessages: 5}, // no window
}
for i, rl := range inactive {
if rl.Active() {
@@ -261,3 +261,40 @@ func TestAutoRateLimitZeroTrafficInactive(t *testing.T) {
t.Fatalf("zero traffic auto should be inactive: %+v", rl)
}
}
// The auto ceiling counts messages per level-1 window, so the per-hour average
// must be scaled to that window: half an hour of traffic, not a full hour's.
func TestComputeAutoMaxMessagesScalesToWindow(t *testing.T) {
stats := SendStats{Total: 100, AvgPerHour: 10}
cases := []struct {
name string
windowSeconds int
want int
}{
{"one hour", 3600, 20},
{"half an hour", 1800, 10},
{"two hours", 7200, 40},
{"unset falls back to an hour", 0, 20},
}
for _, tc := range cases {
t.Run(tc.name, func(t *testing.T) {
got := computeAutoMaxMessages(stats, 2.0, 1000, tc.windowSeconds)
if got != tc.want {
t.Fatalf("max = %d, want %d", got, tc.want)
}
})
}
}
func TestComputeAutoMaxMessagesBounds(t *testing.T) {
if got := computeAutoMaxMessages(SendStats{}, 2.0, 1000, 3600); got != 0 {
t.Fatalf("no traffic: max = %d, want 0 (inactive)", got)
}
// A trickle still has to leave room for one message.
if got := computeAutoMaxMessages(SendStats{Total: 1, AvgPerHour: 0.001}, 1.0, 1000, 3600); got != 1 {
t.Fatalf("trickle: max = %d, want 1", got)
}
if got := computeAutoMaxMessages(SendStats{Total: 100, AvgPerHour: 500}, 2.0, 100, 3600); got != 100 {
t.Fatalf("capped: max = %d, want the level-1 ceiling 100", got)
}
}