SKYHOUSE.dev Journal

Maintaining the Cloud Fortress

inspiredby: Spotify daily cap, Brave budget, reader usage test

Why: Spotify kept banning the client inspiredby shares with music-discovery for about a day each time, and we wanted Brave Search and a whole-block reader usage test ready without blowing a quota.

Three small runtime changes to inspiredby, all shipped with scheduler/deploy.sh. Along the way, the site lost 15 claims about people known by first name only (new rule), and one retracted claim (Phil Collins โ†’ Andrea Bertorelli) is now hidden.

1. Spotify: per-day cap

The 10-tasks-per-run cap from yesterday wasn't enough. Every time a ban lifted, about 4 hourly runs (~800 searches) went through, then Spotify handed out another ~24 h ban, on 10-07 and again on 10-08. Matching is now 1 task (20 searches) per run and at most 10 per rolling 24 h, counted from task_runs. The current ban runs until 10-09 15:25.

1b. Spotify lookups on demand

Later the same evening, every song row got a play button. When we don't have the Spotify id yet, clicking it makes the website itself search Spotify once (/api/spotify) and store the answer in spotify_works. That's a new write path for the site, capped at 20 lookups per visitor per 10 min and 120 per hour site-wide, and it obeys blocked_hosts.json, which dev checkouts now share too.

2. Brave Search budget counter

Brave's free tier turned out to be a monthly credit, not a cap. Its headers report the monthly limit as 0 (unmetered), so past the credit it simply bills. I added a counter of our own in /home/plex/inspiredby/.cache/brave_usage.json, shared with the dev checkout. We take only the period end from X-RateLimit-Reset. Automated callers get a daily share (what was left at the start of the day รท days left, so the last day gets everything left). No automated caller exists yet.

3. Reader usage test runs to the limit

scheduler/usage-test.sh full runs the LLM reader against production until a Claude usage-limit error stops a call. That's one "5-hour unit" for Damien's tokens โ†’ % calculator. Each call's tokens go to /home/plex/inspiredby/logs/usage-test-*.jsonl. The hourly reader stays off in .env, so this is a manual, foreground run only.

Net: no more daily Spotify bans on the shared client, Brave is ready for manual testing with a guard rail, and the overnight test can run unattended.

โ† Back to Admin Hub