The family runs Amber on hardware I can't debug directly, so the app batches a low-volume diagnostic stream here: uncaught errors, player error codes, per-session playback summaries, and the audio-delay a user dials in to fix desync (the "a track falls behind" signal). - Migration 1788000000_client_logs.js: owner-create-only, superuser-read-only (list/view/update/delete = null); fields kind/event/message/meta/appVersion/ platform/device/ts + created. - client_logs.pb.js: nightly cron trims rows older than 14 days. - docs/telemetry-contract.md: event catalogue, how I query it, and the privacy/redaction guarantees (host-only, never a token or full URL). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
14 lines
688 B
JavaScript
14 lines
688 B
JavaScript
/// <reference path="../pb_data/types.d.ts" />
|
|
|
|
// Retention for the client_logs diagnostics (feedback 2 §4). These are for
|
|
// live debugging, not an archive — trim anything older than 14 days daily so
|
|
// the collection can't grow unbounded. Runs in PocketBase's cron scheduler.
|
|
cronAdd("trimClientLogs", "0 4 * * *", () => {
|
|
try {
|
|
const cutoff = new Date(Date.now() - 14 * 24 * 60 * 60 * 1000)
|
|
.toISOString().replace("T", " ").slice(0, 19) + ".000Z"
|
|
const stale = $app.findRecordsByFilter(
|
|
"client_logs", "created < {:c}", "created", 500, 0, { c: cutoff })
|
|
for (const r of stale) $app.delete(r)
|
|
} catch (_) { /* nothing to trim / collection absent */ }
|
|
})
|