feat(admin-costs): per-session cost-anatomy drill-down page#700
Merged
Conversation
Consumes GET /admin/costs/sessions/{id}/calls (backend PR #697):
- SessionCostAnatomy / SessionCallRow / PrefixFingerprints models + CacheStatus union
- AdminCostHttpService.getSessionCostAnatomy with URL-encoded session id
- New /admin/costs/sessions/:id route (lazy, component input binding)
- Drill-down page: summary rollups (total cost, cache efficiency incl. null,
avoidable misses, wasted USD, cache read/write tokens), chronological calls
table with color-coded cacheStatus badges, and prefix-fingerprint diffing
that flags which hash (tools/system/history) flipped vs the previous
fingerprinted call — the cache-buster diagnosis on miss_avoidable rows.
Expandable rows show full hashes + messageCount; 404 renders a
no-cost-rows empty state.
- Session-id lookup form on the Cost Analytics dashboard as the entry point
- Vitest specs for the diff util, HTTP method, and page states
Co-Authored-By: Claude Fable 5 <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
SPA follow-up #2 from backend PR #697 — the admin page consuming
GET /admin/costs/sessions/{session_id}/calls. Frontend-only; the backend contract is already live.SessionCostAnatomy,SessionCallRow,PrefixFingerprints, and theCacheStatusunion inadmin-cost.models.ts(exported via the existing models barrel).AdminCostHttpService.getSessionCostAnatomy(sessionId)(URL-encodes the id)./admin/costs/sessions/:id(lazyloadComponent, route param via component input binding). No sidebar entry — drill-down only, mirroring/admin/users/:userId.The page
—when null), avoidable-miss count (red when > 0), wasted USD, cache read/write token totals.cacheStatusbadge (hit=green, first_write=blue, miss_ttl_expired=yellow, miss_avoidable=red, uncached=gray, null=—), cache gap, wasted USD.prefixFingerprintsare compared against the nearest previous fingerprinted call; a flipped hash (Tools / System / History) is highlighted red in the truncated 8-char chips — on amiss_avoidablerow, that flipped hash names the cache-buster. Rows with null fingerprints (predating the feature) are skipped as baselines. Expandable rows show full hashes,messageCount,messageId, and the raw timestamp.resource().Follows the newer admin idiom (skills pages):
resource()-backed loading, rounded-2xl containers/badges,text-sm/6/text-xs/5, blue-600 primary actions, focus-visible outlines, dark mode.Testing
ng test: 41 specs pass across the costs feature, including new specs for the fingerprint-diff util (baseline skipping, partial hashes), the HTTP method (URL + encoding), and page states (load, 404 vs other errors, expansion, formatters, badge mapping).ng buildpasses (pre-existing bundle-budget warning only).Manual test script
miss_avoidablerow, confirm exactly the flipped fingerprint chip is highlighted red and matches the changed hash in the expanded detail.🤖 Generated with Claude Code