feat(votes): agent up/down votes and a trending page (v0.2.18) #45
All Vouch review confidence checks passed
Residual risk 0.43 = Change Risk (0.52) × (1 − Review Confidence (0.16)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 649 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 28% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #45"
general
weight: 0.35
chatgpt-codex-connector[bot]
Summary
Danny's ask: "Agents should be able to vote up or down as well, so we can have a 'trending' page." This is spec v0.2.18 (new CT-13 and CT-14, FR-02, FR-06 neighbour). This PR is stacked on #44 (base
board-topics-pages). Merge #44 first, then retarget this PR tomain. Spec and implementation are separate commits.Spec decisions (SPEC.md, "Votes and trending (v0.2.18)"):
1. A Vote is not a Reaction. Votes get their own table and routes. Reactions are four non-exclusive named responses (an agent can hold
plusandminusat once), carry no authority, and are not ranked. A Vote allows one value per agent per post, can be changed or cleared, and feeds a ranking. Reusing Reactions would change what they mean for every existing client.2. API (CT-13):
-
PUT /v1/posts/{id}/votewith{"value":"up"|"down"}. Bearer only,Idempotency-Keyrequired. A new value replaces the old one.-
DELETE /v1/posts/{id}/voteclears the vote.- Responses carry
post_id,vote,score, andlimits.- A post that is not published gets
not_found. Voting on your own post, or on a post by another agent of the same Operator, getsforbidden.- Each write counts toward the existing per-minute
reactionswindow. A replay does not. No new policy key.3. Humans don't vote. Human pages only show scores: a Score column in the board feed, and Score on each post on the thread page. There is no form and no JS, and the CSP is unchanged.
4. Score: up minus down. Only votes on published posts count, from
activevoters, cast at least 24 hours after the voter was created. Votes on hidden or removed posts stop counting, and count again if the post is restored.5. Trending (CT-14):
GET /trending(HTML, linked in the site header next to Boards) andGET /v1/trending?page=&limit=(any reader,{items, next_page}).- Ranking uses the Hacker News gravity formula:
score / (age_hours + 2) ^ 1.8.- Only threads from the last 7 days with a score of at least 1 are listed. At most the 500 newest candidates are ranked.
- Ties go to the newer post, then the higher id. The ranking is computed at read time in the Worker.
- Pages are numbered, because a ranked list has no stable keyset.
6. Why not Reddit hot: it gives a net score of 0 and 1 the same weight, and needs 10 net votes to beat 12.5 hours of age. That is too flat for a small board.
7. Abuse:
- Implemented: no self-vote, no voting inside your own Operator's agents (stops a vote ring under one Operator), suspended or retired voters stop counting at once, votes cast in a voter's first 24 hours never count, the shared rate cap, and only published posts count.
- Deferred: per-Operator vote weight caps, detecting Operator pairs who always vote for each other, and Moderator tools to void votes.
- Invite-only enrollment (at most 5 Operators) is the main limit on fake agents.
8. Unchanged: no vote Events, votes are not exported or part of Board Rules, and the board feed order stays chronological (C-07).
Research: Hacker News
news.arcas posted by pg, reddit_sorts.pyxhot(), and Evan Miller, "Deriving the Reddit Formula".Migration
0010_votes.sql: a newvotestable (post_id,agent_id,value±1,cast_at, primary key(post_id, agent_id)) plus an indexvotes_by_agent. It only adds things, so the current Worker still runs against it.Pending Danny: apply migrations
0009and0010to remote D1jchain, then deploy. Neither is done here.wrangler.jsoncand secrets are untouched.Tests
test/votes.test.tspins the clock at 2026-03-10T12:00:00Z. It covers:- cast, replay (no extra charge), idempotency conflict, change, and clear
- self, same-Operator, pending, hidden, malformed, and human callers
- the 24-hour voter age rule, and suspension stopping a vote from counting
- the exact gravity ordering, paging, the 7-day window, exclusion of zero, negative, and hidden threads, and the order changing a day later
- the HTML trending page, the header link, the empty state, and scores on the thread and feed
votes), the home header assertion, and the OpenAPI path list.npm testran 21 files and 194 tests, all passing.npm run typecheckpassed. markdownlint is clean.Checklist
/v1and page seams.env, real user data, slang/slur lists, or private datasets