# Changelog

All notable changes to **wkd-tester** are documented here.
Format: [Keep a Changelog](https://keepachangelog.com/).

## [Unreleased]

### Changed

- **RATE-001 — local rate-limit escape hatch**: `BT_RATE_LIMIT` env in
  `config.rs` — `off`/`0` lifts every AbuseGuard budget (per-IP/UA/target/
  global), a number sets the per-IP budget (handy to reproduce a 429 fast).
  Compiled **only into debug builds** (`#[cfg(debug_assertions)]`): release
  binaries get an empty stub, so production can never run unlimited by
  touching an env var. Local Makefile targets (`up`, `up-template`,
  `watch-server`) default it to `off` — override with
  `make up BT_RATE_LIMIT=30`.

### Security

- **RECUR-001 — self-check guard**: `contract::guard_self_target()` rejects a
  target that is *this service's own host* with `400 {"error":"self_target",
  "retry":"never"}` **before** any outbound fetch. Configured by `BT_SELF_HOSTS`
  (comma-separated own hosts; empty = guard inert) with `BT_ALLOW_SELF_CHECK=1`
  as the local opt-out. Sibling `*.btoven.net` hosts stay fetchable — the fleet
  checks each other for dogfooding and public examples (decision 2026-11-15).
- **SSRF-001 (MCP/FEEDBACK §B9)**: `contract::guard_target()` is now wired on
  every outbound route — RFC1918/loopback/link-local/metadata targets are
  rejected with `400 private_target` before the fetch.

### Fixed

- **OOM-003 — rate-limiter ceilings**: `windows` (65 536) and `bans` (16 384)
  get hard caps with batch eviction of the least-recently-active 10%, so a
  distributed flood of UA/target keys can no longer grow the maps until OOM.
  Bans reuse the grouped window material (one IPv6 ban covers a /64).
- **OOM — cache `key_fifo`**: an entry evicted under the write-lock now also
  leaves `key_fifo`, so `sweep()` can no longer stall on an orphaned key.

### Changed

- **Shared theme**: the landing now uses the shared `theme.css` primitives
  (TEMPLATE-001/003); the local styles were removed in favour of them.

## [0.2.1] — 2026-11-14

### Changed

- **User-Agent (UA-001)**: outbound fetches now carry the canonical transparency
  signature `BTOVEN-WKD/1.0 (+https://btoven.net/transparency/wkd)` — format
  `BTOVEN-<Service>/<version> (+<stable URL>)` per the registry at
  btoven.net/transparency — replacing `wkd/<version> (<host>)`. The
  `USER_AGENT_URL` env override is gone: the signature is fixed and registered.

## [0.2.0] — 2026-10-30

### Added

- **`GET /changelog.md`** — serves this file for the version badge menu (route in the
  server + `COPY CHANGELOG.md /opt/CHANGELOG.md` in the image).
- **`GET /health`** (MCP consumer contract B1): `{status, version, commit,
  schema_version, engine, contract_version, polarity}`. `commit` is baked from
  `GIT_COMMIT` (exported by the Makefile, passed as `ARG` by the Dockerfile) and falls
  back to `unknown` when the build had no sha.
- **Response identity (B2/B4)**: every JSON response carries `engine` (`wkd/0.2.0`),
  `schema_version`, `contract_version` and `polarity` (`absence_means: "pass"` over
  `errors`).
- **`llms.txt` contract, privacy and acceptable-use section (B5/B7/B11)**: queries are
  not persisted, real cache TTLs, and the abuse-guard limits (30/h per IP · 300/h per
  user-agent · 60/h per target · 2000/h global).
- **`server/src/contract.rs`**, shared with the eight testers (audit06
  `shared_identical` group, drift 8/8), plus `config::API_META`.

### Changed

- **Error envelope (B3)** — responses from `/api/lookup` now carry `{error, message,
  retry, retry_after_s?, contract_version}` with `retry` ∈ `never | backoff |
  honor-retry-after`; the abuse-guard `429` adds `retry_after_s` + `retry`, keeps
  `retry_after_secs` as a deprecated alias and still sends `Retry-After`.
- Cache-key validation warnings log the length of the value instead of the value itself
  (privacy promise).
- Version **0.1.0 → 0.2.0** across the workspace (server, cli and lib crates).

### Notes

- **Verification pending** (`CONTRACT-002`): this session did not build. Run `cargo
  build && cargo clippy -- -D warnings && cargo test` before shipping.

## [0.1.0] — 2026-04-16

### Notes

- First versioned release of this repository. No changelog existed before `0.2.0`;
  earlier work is visible in `git log`.
