feat(admin-costs): conversations on the user page + session profile, diagnoses and trajectory - #1094
Open
philmerrell wants to merge 2 commits into
Open
feat(admin-costs): conversations on the user page + session profile, diagnoses and trajectory#1094philmerrell wants to merge 2 commits into
philmerrell wants to merge 2 commits into
Conversation
…diagnoses and trajectory
The SPA half of the content-free cost drill-down (API in
feature/admin-cost-drilldown-api). Requires that API to be live; until then
the new section shows its error state and the anatomy page is unchanged.
- /admin/users/:userId gains a Conversations section (component owned by the
costs feature, rendered only for admins holding admin.costs): period/sort
controls, per-row model, tools on, context bar against the window, cost
with share of the user's month ("unknown" when unrecorded — never $0),
cache waste, and a severity dot for the diagnoses that fired. Row → anatomy.
- /admin/costs/sessions/:id gains a profile band (messages, model calls +
mix, tool calls, attachments, compactions, peak context of window,
write:read — "not tracked" wherever a counter predates the session), an
expandable Diagnoses list (severity chip, headline, code, suggestion,
evidence, ref), a per-call context trajectory chart with the compaction
threshold always in view, a back-to-user link, and "Copy diagnostic JSON"
(profile + anatomy — content-free by construction, meant to be handed to a
model for a second opinion). The profile loads independently of the
anatomy so one failing does not hide the other.
- Top-users table shows email / tier / quota % now that the API fills them.
Verified in the in-app browser against dev data through a branch server:
93 conversations listed for September's top user, profile + diagnoses +
chart rendered, dark mode via both levers, copy produced a 15.8 KB document
with no denylisted keys, console clean. Full SPA suite green.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
… global The anatomy spec replaced `navigator` with a spread copy to stub the clipboard. A spread drops prototype getters such as `userAgent`, and with the suite running `isolate: false` Angular's forms `DefaultValueAccessor` in a later spec file (agent-form-*.spec.ts under the coverage build's ordering) threw on `navigator.userAgent.toLowerCase()`. Override the `clipboard` property alone and restore it. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The SPA half of the content-free cost drill-down. PR 2 of 3 — requires the API PR (
feature/admin-cost-drilldown-api) to be live; until then the new section shows its error state and the anatomy page is otherwise unchanged./admin/users/:userIdgains a Conversations section, rendered only for admins holdingadmin.costs(it is cost data and its drill-down target isadmin.costs-gated; a users-only delegate sees the page without it rather than a 403 inside it). Period/sort controls; per row: model, tools on, context bar against the window, cost with share of the user's month ("unknown" when unrecorded), cache waste, a severity dot for the diagnoses that fired. Row → anatomy./admin/costs/sessions/:idgains a profile band ("not tracked" wherever a counter predates the session), an expandable Diagnoses list (severity, headline, code, suggestion, evidence, ref), a per-call context trajectory chart with the compaction threshold always in view, a back-to-user link, and Copy diagnostic JSON — profile + anatomy, content-free by construction, meant to be handed to a model for a second opinion. The profile loads independently of the anatomy so one failing does not hide the other.Deploy notes
Verification
npm run test:ci— 2,942 passed (99 in the admin suites, 30 new).🤖 Generated with Claude Code