feat: admin rebuild/purge and the AUP + terms endpoints #138

Merged
manlycucumber merged 1 commit from feature/27-admin-purge-aup into develop 2026-07-03 06:18:46 +00:00
manlycucumber commented 2026-07-03 06:17:20 +00:00 (Migrated from github.com)

Rounds out Api v0.1 (epic #27) with the published policies and the cache-invalidation admin actions — all behind seams that stay inert without infrastructure. This is the last v0.1 code PR.

What's here

  • GET /v1/aup, GET /v1/terms (#30) — the acceptable-use policy and terms of use, served as versioned data (Legal\Policies). Public and cacheable.
  • Edge\EdgeCache (#29) — the CDN-purge seam, with NullEdge (no-op default) and CloudflareEdge (purge_everything via the API, from INTROIBO_CF_ZONE/_TOKEN).
  • POST /v1/admin/purge (#29) + POST /v1/admin/rebuild (#28) — admin-only actions behind Admin\AdminGate (a shared token via X-Admin-Token or bearer). Rebuild reports the current data version and purges so a new build is served at once; the static tier is regenerated out of band with bin/generate-static.php. The admin routes are only registered when INTROIBO_ADMIN_TOKEN is set — no token, no admin surface.

Verification

  • composer check green: phpcs, PHPStan [OK], PHPUnit 95 tests / 331 assertions.
  • Real server: /v1/aup + /v1/terms serve versioned policy data; POST /v1/admin/purge is 401 without the token and 200 (edge purged) with it; /v1/admin/rebuild reports the data version.

Scope notes

Live Cloudflare purge and the admin token are maintainer-provisioned; the purge path is exercised behind the EdgeCache seam with a recording double. With this, Api v0.1 is code-complete — the calendar service, static tier, caching, metering, and admin/policy surface are all in place for the R2 / 3mi.org release, with MySQL + Cloudflare + DreamHost deploy as the remaining infra steps.

Refs #27 #28 #29 #30

Rounds out Api v0.1 (epic #27) with the published policies and the cache-invalidation admin actions — all behind seams that stay inert without infrastructure. **This is the last v0.1 code PR.** ## What's here - **`GET /v1/aup`, `GET /v1/terms`** (#30) — the acceptable-use policy and terms of use, served as versioned data (`Legal\Policies`). Public and cacheable. - **`Edge\EdgeCache`** (#29) — the CDN-purge seam, with `NullEdge` (no-op default) and `CloudflareEdge` (`purge_everything` via the API, from `INTROIBO_CF_ZONE`/`_TOKEN`). - **`POST /v1/admin/purge`** (#29) + **`POST /v1/admin/rebuild`** (#28) — admin-only actions behind `Admin\AdminGate` (a shared token via `X-Admin-Token` or bearer). Rebuild reports the current data version and purges so a new build is served at once; the static tier is regenerated out of band with `bin/generate-static.php`. **The admin routes are only registered when `INTROIBO_ADMIN_TOKEN` is set** — no token, no admin surface. ## Verification - `composer check` green: phpcs, PHPStan `[OK]`, **PHPUnit 95 tests / 331 assertions**. - Real server: `/v1/aup` + `/v1/terms` serve versioned policy data; `POST /v1/admin/purge` is **401** without the token and **200** (edge purged) with it; `/v1/admin/rebuild` reports the data version. ## Scope notes Live Cloudflare purge and the admin token are maintainer-provisioned; the purge path is exercised behind the `EdgeCache` seam with a recording double. With this, **Api v0.1 is code-complete** — the calendar service, static tier, caching, metering, and admin/policy surface are all in place for the R2 / 3mi.org release, with MySQL + Cloudflare + DreamHost deploy as the remaining infra steps. Refs #27 #28 #29 #30
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Directorium/Api!138
No description provided.