Files
StarPunk/docs/design/v2.10.0/2026-11-03-websub-implementation.md
T
PhilandClaude Opus 5.5 0716984958 docs: Bring all documentation up to date for v2.10.1
- architecture/: overview, technology stack, auth (OIDC + built-in
  IndieAuth), syndication (POSSE) rewritten; new database.md,
  deployment.md and indieweb-protocols.md; legacy stack marked historical
- decisions/: reconstructed ADR-060 and ADR-063; 31 status corrections
  (superseded auth ADRs, proposed -> accepted); INDEX rebuilt
- design/: reconstructed the v1.6.0 documents the webmention code cites;
  reports for 18 v2 releases without a design folder; INDEX rebuilt
- projectplan/: BACKLOG rewritten (shipped items removed, open issues from
  the reviews added); RELEASE.md for v2.0.0-v2.10.1; INDEX
- standards/: development setup (uv, tests, DEV_MODE), testing (CI test
  stage), git and release flow, versioning, coding standards, cookies
- README, CLAUDE.md, .env.example (every setting the code reads, with
  defaults) brought up to date
- 137 broken links repaired (old absolute paths, moved files); stale ADR
  references in code comments corrected (comments only)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 12:40:19 -07:00

61 lines
2.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# v2.10.0: WebSub with a built-in hub (implementation report)
> Reconstructed on 2026-11-03 from the changelog and git history. Commits `720a1e6` (ADR, proposed), `b520b8b`.
## Design
[ADR-071](../../decisions/ADR-071-websub.md), sections 1–11. This report
covers where it was implemented and how it was verified; it does not repeat
the design.
## Changes
- `starpunk/websub.py` (new): topics (`topic_url`, `tag_topic`,
`canonical_topic`, `topic_for_request`), discovery (`add_discovery_headers`
after-request hook for `Link: rel=hub` / `rel=self`, `template_links` for
`<link>`s in HTML, `embed_hub` for Atom/RSS/JSON Feed), change tracking
(`note_changed`, `queue_topics`, `get_content_version` /
`bump_content_version`), subscription requests
(`accept_subscription_request`), signing (`signature`: HMAC-SHA256),
`stats` for the dashboard.
- `starpunk/websub_worker.py` (new): `WebSubWorker`, one per gunicorn
process with a file lock so one process works the queues (webmention
worker pattern): `verify` (challenge GET), `render_topic` (renders inside
the app), `deliver` (signed POST, retries), `prune` (expired leases).
- `starpunk/routes/websub.py` (new): `POST /websub`, 202 on accept,
plain-text 4xx otherwise, per-IP `RateLimiter(30, 60)`.
- `migrations/016_websub.sql`: `websub_subscriptions`, `websub_intents`,
`websub_deliveries` (one per subscription, or per topic for pings to an
external hub), and `site_state.content_version`.
- `starpunk/notes.py`, `starpunk/micropub.py`: create/update/delete call
`websub.note_changed` (via `_websub_changed`), which bumps the content
version (all processes' feed caches go stale at once) and queues
deliveries.
- `starpunk/webmention_ssrf.py`: `safe_post` takes a raw body and reads
only a capped response; used for verification and delivery.
- `starpunk/feeds/rss.py`: self link `/feed.rss` (was `/feed.xml`).
- `starpunk/__init__.py`: discovery hook, worker start; the memory monitor's
`teardown_appcontext` stop removed (it stopped after the first request).
- `starpunk/routes/admin.py`, `templates/admin/dashboard.html`: subscribers
per topic, failing deliveries.
- Config: `WEBSUB_ENABLED`, `WEBSUB_HUB_URL`, `WEBSUB_MAX_SUBSCRIPTIONS`,
`WEBSUB_MAX_PER_HOST`.
## Tests
`tests/test_websub.py` (23 tests: discovery on every topic and format,
external hub, request validation, private callbacks, per-host limit,
verification success/failure, unsubscribe, re-subscribe, signed delivery,
drafts, tag topics incl. removed tags, delete, 410, retries, expiry, fresh
feed after posting).
## Verification
Deployed to production; the websub.rocks publisher test passed against the
live site.
## Notes
An adversarial review after release found worker, time-limit, lease and
spec 5.1 issues; fixed in v2.10.1 (ADR-071 Amendments).