docs(stats): Claude-side pinning — all 4 stats endpoints + UNVERIFIED sweep to zero

Stats docs written handler/service-first (summary/this-week/book-stats
new; library-usage frontmatter'd — its body was already accurate).
Registry: 4 entries on services.UserSummaryStats/WeekSummaryStats/
LibraryUsageStats/BookStats. Family-lens note: library-usage 403s an
explicit library_id outside the visible set (431fec0 rule).

UNVERIFIED sweep (7 -> 0), each resolved against the handler:
- device-usage takes NO date params; popular-books takes only ?limit
  (the 'standard analytics date-range params' claim was wrong)
- link_book media_item_id: no validate tag but service-always-written
- push_stats book-ref field set documented (uuid/sha256/title/authors)
- filter_count: confirmed ParseMediaSearchParams machinery + 400 on bad
  filter + 403 visibility
- facets values element shape pinned: {value, display?, count}
- get_config: dynamic key set IS the contract (reworded, no marker)

make test 9/9.
This commit is contained in:
John O'Keefe committed 2026-10-24 18:25:12 -04:00
1 parent e21e1facde
commit 6fc501b35a
12 files changed
+264 -11

No files matched your search

+20
View File
@@ -957,4 +957,24 @@ var Schemas = map[string]Schema{
// renderer — deliberately NOT documented (rule 3).
Response: json.RawMessage(`{"conflicts": [], "total": 0}`),
},
// --- Claude: stats (service-backed reading statistics) ---
"GET /api/stats/summary": {
// ?range=7|30|90|year; zero-filled daily arrays; user-tz buckets.
Response: services.UserSummaryStats{},
},
"GET /api/stats/this-week": {
// ?library_id= optional (visible-set enforced like library-usage? no —
// this route passes it straight through).
Response: services.WeekSummaryStats{},
},
"GET /api/stats/library-usage": {
// ?library_id= optional; explicit id OUTSIDE the visible set → 403.
// Inventory aggregates (media_items), no reading_history.
Response: services.LibraryUsageStats{},
},
"GET /api/stats/books/:id": {
// Lifetime totals + recent sessions for one media item.
Response: services.BookStats{},
},
}