Repository navigation
Price Claude 5.5/5.2, revive cost backfill, rename users to actors (schema v11) - #162
Conversation
…ll-cost Since 2026-11-07 production has stored cost_usd unset for every span from claude-opus-5-5, claude-fable-5-2 and claude-haiku-5-5: the table did not know them, so the dashboard showed $0 for a week of traffic. Adds Opus 5.5, Sonnet 5.5, Haiku 5.5, Fable/Mythos 5.2 and 5.1, and moves Sonnet 5 to the $2/$10 rate Anthropic still publishes. Revives the cost backfill from the closed PR #67 (FLO-551/552) as reviewed: --backfill-cost is a dry run, --backfill-cost-apply writes spans only. The README procedure is rewritten for the current deploy: the dry run restores the newest snapshot instead of copying a live file, and both one-offs bypass the entrypoint so they do not start a second tunnel connector. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The entity a token belongs to was never only a person: production holds people (flop), Paperclip agents (Daedalus, Clio, ...) and hosts (rpi5). It is now an actor everywhere below the UI. Storage (schema v11): table users -> actors, spans.user_id and daily_usage.user_id -> actor_id, idx_spans_user_id -> idx_spans_actor_id. The rename runs in Go before schema.sql (migrateUsersToActors): a rename cannot be written idempotently in SQL, and schema.sql's CREATE TABLE IF NOT EXISTS actors / ADD COLUMN IF NOT EXISTS actor_id would otherwise create empty twins beside the populated originals. It checks the catalog per step, drops the spans secondary indexes first (DuckDB refuses to ALTER an indexed table; schema.sql recreates them), commits as one transaction, and refuses to start if both users and actors exist. Tested against a database built from the frozen v10 schema.sql (testdata/schema_v10.sql). Export format v2 names the column actor_id at the same offset; the importer still reads v1 files' user_id. Pre-v11 snapshots restore unchanged and are migrated by the next open. API: /api/v1/actors, ?actor_id=, mode=actor_only|actor_and_history, actors_count in /overview. The old /users route, ?user_id= and user_* delete modes are accepted as aliases. Response field names change. BREAKING CHANGE: JSON fields users_count and user_id are now actors_count and actor_id; export manifests are format_version 2. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Pages, routes, components and the actor filter follow the API rename: /actors and /actors/:id, ?actor_id=, actors_count on the Overview KPI. The old /users and /users/:id URLs redirect so bookmarks keep working. The Setup step now says what an actor is - a person, an AI agent or a host - instead of asking the reader to add themselves as a user. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…he docs ADR-0027 records the rename and how the schema moves: why it runs in Go before schema.sql, what stays compatible, and that rolling back across v11 needs a pre-v11 snapshot. The auth guide becomes actors-and-auth.md; the API reference, export format (v2), snapshot, recovery (index names for v11 and older files), agent-identity and page docs follow. The README screenshot is renamed to dashboard-actors.png but still shows the old "Users" heading until the screenshots are re-shot. CHANGELOG covers the pricing fix, the backfill and the rename. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Caution Review failedThe pull request is closed. Walkthrough
Merge Risk:
|
Why
Production showed $0 cost since 2026-11-07, and the Users list mixes one person, one host and fifteen Paperclip agents under the name "user". This PR fixes the first and renames the second.
(Agents going silent on 2026-11-07 is a separate cause, outside this repo: Paperclip v2026.1106 strips each agent's
OTEL_*env, including its cotel token, unless company observability is configured. That will be handled on the Paperclip side.)What
1. Pricing (
e3ffa95)pricing.Known()separates an unpriced model from a priced span that costs zero.2. Cost backfill (
e3ffa95)--backfill-costis a dry run,--backfill-cost-applywrites. Both touchspansonly.--entrypointso they don't start a second tunnel connector.3. Users → actors, down to the schema (
1bf04ff,e1fb0e1,b2d3412, ADR-0027)users→actors,spans.user_id/daily_usage.user_id→actor_id,idx_spans_user_id→idx_spans_actor_id.migrateUsersToActorsruns in Go beforeschema.sql. A rename can't be idempotent in SQL, andCREATE TABLE IF NOT EXISTS actorswould otherwise create an empty twin. The function:spansindexes, whichschema.sqlthen recreates;/api/v1/actors,?actor_id=,actors_count,mode=actor_only|actor_and_history. The old route, param and modes still work as aliases. Response field names change (breaking for consumers that readusers_count/user_id).format_version2 (actor_id). The importer still reads v1./actors, and/users[/:id]redirects there. The Setup step now explains what an actor is.Verification
go vet ./...,go test ./...(underTZ=UTC, as CI runs),npm run build,vitepress build(no dead links).New tests:
schema.sql(data, tokens, soft-deletes, indexes, idempotence, refusal when both tables exist);Real data, read-only: today's 11:39Z prod snapshot restored locally and opened with this build. Results:
userstable left;The copy was deleted afterwards.
Backfill dry run on that copy:
+$921.18across 12 802 spans:claude-opus-5-5claude-fable-5-2claude-opus-5-5[1m]claude-haiku-5-5claude-sonnet-5[1m]Ran the dashboard locally against seeded data: the Actors list, the actor page, the Overview KPI and the
/usersredirects all render correctly.Rollout notes
docs/assets/dashboard-actors.pngis renamed but still shows the old "Users" heading until the screenshots are re-shot.TestRollupAndPurge_BoundaryDayNotSplitandTestHistory_TenMinuteGranularityfail onmainas well. They pass underTZ=UTC, which is what CI uses.🤖 Generated with Claude Code
Summary by CodeRabbit