3 Commits
Author SHA1 Message Date
mattandClaude Sonnet 5 0766c09fb3 Weekly summary task (phase 3, step 5)
CI / validate-monitoring (push) Successful in 10s
CI / notify (push) Successful in 6s
CI / lint (push) Successful in 16s
CI / federation-interop (push) Successful in 1m2s
CI / test (push) Successful in 2m40s
CI / images (push) Skipped
CI / assets (push) Skipped
CI / python-package (push) Skipped
protocol/schedule.py (pure): target_week(now_utc, tz) resolves to
exactly one Monday-Sunday week — the most recent one whose Monday
09:00-local posting gate has passed — computed via wall-clock
arithmetic in the user's own zone so it's correct across a DST change
(a week can be 6h23/7h01 of real time, never silently 7 flat days).
Because it's a pure function of "now", a worker that was down for
weeks naturally catches up with one post, not a backlog. Also
resolve_timezone()/is_valid_timezone() for a settings field that can
otherwise crash a task or silently do nothing forever.

protocol/content.py (pure): the small HTML subset shared by every post
kind (p, strong, em, ol, li), with escaping split from formatting so a
hostile artist/track name can't inject markup.

publishing/weekly.py: build_content() (the template) and
check_and_post()/check_all() (the federation.weekly periodic task,
every 15 minutes). An empty week is simply never posted, and — since
the target week only ever advances — never reconsidered either, with
no separate marker needed. has_post() lets the common "already posted
this week" pass skip the stats queries entirely.

Core: accounts.get_user(id) (federation needs it and can't import the
User model directly); sharing.EDITABLE and update() gain
timezone/post_weekly_summary/post_milestones, with the same
now-not-later validation visibility already had.

Tested: the DST week and gate boundaries against real computed
reference dates (not guessed ones — one guess was wrong and the test
caught it before it shipped), hostile/emoji/RTL names in the template,
and the full task against a real database (empty vs non-empty weeks,
posting twice, disabled settings, a worker down for weeks, a bad
stored timezone not stopping other users).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-26 12:02:02 +01:00
mattandClaude Opus 5.5 89f8589424 OpenAPI: document the Last.fm API and commit the exported spec
CI / lint (push) Successful in 10s
CI / test (push) Successful in 30s
CI / notify (push) Successful in 5s
- /2.0/ and /api/auth/ are described from the Last.fm method registry:
  method enum, per-method parameter tables, auth requirements, notes,
  request schemas and XML example responses
- Readable tags (Auth, Apps, Sessions, Tokens, Stats, Last.fm)
- docs/openapi.json is exported with `flask openapi write`; tests fail
  if it drifts from the code, if any route is undocumented, or if a UI
  route is missing its bearer-auth security declaration

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-25 14:13:47 +01:00
mattandClaude Opus 5.5 e026e56ee3 UI REST API: accounts, bearer auth, API apps, sessions, OpenAPI docs
CI / lint (push) Successful in 14s
CI / test (push) Successful in 28s
CI / notify (push) Successful in 5s
- flask-smorest API under /api/v1 with a uniform JSON error shape;
  spec at /api/openapi.json, Swagger UI at /api/docs, ReDoc at /api/redoc
- Register/login/logout/me with hashed, expiring bearer tokens,
  documented as an OpenAPI bearer security scheme
- API application and client-session management endpoints
- CORS restricted to the configured UI origin(s)
- Flask no longer serves static files: it is API-only
- Login and registration metrics

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 13:59:59 +01:00