Skip to content

Perf viewer clean-up: Kira calls the site's /api/perf/sweep every 5 minutes - #159

Merged
ludovic111 merged 2 commits into
mainfrom
perf-sweep
Nov 12, 2026
Merged

ludovic111 merged 2 commits into
mainfrom
perf-sweep

Conversation

@ludovic111

@ludovic111 ludovic111 commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

The perf viewer on playhorizon.dev (horizon-site#93) keeps Share uploads in an S3 bucket: unshared ones expire after an hour, shared ones after PERF_SHARED_DAYS. The site frees their bytes only when POST /api/perf/sweep is called with Authorization: Bearer $PERF_SWEEP_TOKEN, and the site has no timer of its own.

src/features/perfsweep.js makes that call every 5 minutes, only when PERF_SWEEP_TOKEN is set on Kira (the same value as the site's). Without the variable nothing runs, so this is inert until Share's bucket is configured.

Also fixes a test that started failing on its own today: elections.test.js "the timer closes votes at 24 hours…" took the first open vote, but /elect and /vote in earlier tests start on the real clock, so from 2026-11-12 it picked an election with no ballots. It now runs its own vote at the test's fixed time.

Tests: test/perfsweep.test.js (posts with the token, nothing without one, an HTTP error is reported). npm test: 631 pass, 0 fail.

🤖 Generated with Claude Code

Horizon agent and others added 2 commits November 12, 2026 17:19
…inutes

Only when PERF_SWEEP_TOKEN is set (the same value as the site's). The viewer's Share
uploads expire after an hour unshared, or after PERF_SHARED_DAYS; the sweep frees their
bytes in the bucket.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
It took the first open vote, but /elect and /vote in the tests above start on the real
clock, so which of them was still open depended on the day: since 2026-11-12 it was an
election with no ballots, which never lands in closed, and CI failed on main's tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ludovic111
ludovic111 merged commit b56124b into main Nov 12, 2026
1 check passed
ludovic111 added a commit that referenced this pull request Nov 12, 2026
…160)

bot.js maps every feature's commands; perfsweep (#159) had none, so commands.map
hit undefined.toJSON() on clientReady and Kira crashed since 16:27Z. A test now checks
every feature bot.js loads exports a commands array.

Co-authored-by: Horizon agent <agent@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant